EasyDeepLearn

How should learning rate scale with batch size?

medium

Answer

  • Linear rule (Goyal et al., 2017): LR  =  baseLR    (batch  /  basebatch)\mathrm{LR}\; = \;\mathrm{base}_{\mathrm{LR}}\; \cdot \;(\mathrm{batch}\; / \;\mathrm{base}_{\mathrm{batch}}).
  • Works up to ~8k batch in vision with sufficient warmup.
  • Sqrt rule: LR ∝ sqrt(batch) — more conservative, sometimes better for Adam / transformers.
  • Very large batches (>32k) need layer-wise scaling (LARS, LAMB).
  • Always combine with warmup: large batches need longer warmup to avoid divergence.
Check yourself — multiple choice
  • LR is independent of batch size
  • Linear rule LR ∝ batch (with warmup); sqrt for Adam; LARS/LAMB above 32k batch
  • LR should shrink with batch size
  • Batch size only affects loss

Linear LR-batch scaling + warmup up to ~8k; sqrt for Adam; LARS/LAMB for extreme scales.

#batch-size#learning-rate#distributed

Practise Deep Learning

214 interview questions in this topic.

Related questions