Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Adam’s direction, LARS’s step size
Adam decides which way each parameter should move, adjusting for each one’s gradient history. LARS decides how far each layer should move, as a fraction of that layer’s size. LAMB does both: it takes Adam’s direction for a layer and then scales the whole layer’s step so the layer changes by a set percentage. The goal is to keep training stable when the learning rate is pushed very high to make use of enormous batches.
Pre-training large language and vision models on many accelerators needs huge batches to be efficient, and huge batches need large, stable learning rates. LAMB made BERT pre-training with 64k batches possible, cutting wall-clock time dramatically. Knowing what it fixes, and what Adam already handles, helps decide whether it is worth adopting.
- 1. LAMB combines…
- 2. LAMB was designed for…
- 3. LAMB made BERT pre-training take about…
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.By hand
- Adam direction: u = m̂/(√v̂ + ε), plus decoupled weight decay: r = u + λw.
- Trust ratio: ‖w‖/‖r‖ per layer, often clipped.
- Update: w ← w − γ·(‖w‖/‖r‖)·r.
- Example: w = (3, 4), r = (0, 1), γ = 0.1: the trust ratio is 5, so w becomes (3, 3.5), a 10% change of its norm.
- Relative change: ‖Δw‖/‖w‖ = γ for every layer, by construction.
- Compare plain Adam: each coordinate moves about γ, so the layer moves about γ√n in total. Relative to a layer of norm ‖w‖ that is γ√n/‖w‖: 0.1 for ‖w‖ = 1 and 0.01 for ‖w‖ = 10 (n = 100, γ = 0.01).
- Learning-rate scaling: You et al. scaled the rate with the square root of the batch size: 10⁻⁴ × √(65536/256) = 1.6 × 10⁻³.
- 1. LAMB's relative change per step is…
- 2. Plain Adam's relative change for a small-norm layer is…
- 3. LAMB's paper scaled the learning rate with…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.LAMB in code
Exercise 1.
- A LAMB update changed a layer by exactly 1% of its norm (γ = 0.01), whether the weights were scaled by 1000 or the Adam direction by 50.
- A plain Adam step of about γ per coordinate changed a small-norm layer by 36.5% of its norm and a large-norm one by 0.36%, a hundredfold difference.
Practice.
- Use the same β’s as Adam, decoupled weight decay (λ ≈ 0.01), a long warm-up, and polynomial or linear decay.
- Exclude biases and LayerNorm parameters from the trust ratio, applying plain Adam to them.
- LAMB’s learning rate means “fraction of each layer’s norm per step”, so its range differs from Adam’s (often around 10⁻³–10⁻²). Do not reuse Adam’s value.
- Many implementations clip the trust ratio (for example to 10) to avoid extreme steps for layers whose Adam direction is tiny.
# apex.optimizers.FusedLAMB / timm.optim.Lamb(params, lr=2e-3, weight_decay=0.01)- 1. LAMB's learning rate means…
- 2. Trust ratios are often clipped to avoid…
- 3. LayerNorm parameters in LAMB usually…
Level 3: Advanced
★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.Theory
What each normalisation fixes.
- Adam’s per-coordinate normalisation equalises gradient scales: each coordinate moves about γ per step, whatever its gradient’s size.
- LARS’s trust ratio equalises relative change: each layer moves by γη of its norm.
- LAMB applies both. It equalises gradient scale within a layer and relative change across layers.
With plain Adam, a layer with small weights (embeddings, or layers after normalisation) gets a large relative change, and a layer with large weights a small one. At the very large learning rates of large-batch training, the former can blow up.
Convergence. You et al. (2020) gave convergence rates for LARS and LAMB in non-convex settings. They showed the layer-wise normalisation can improve the dependence on per-layer smoothness constants, compared with a global rate.
When it matters. The benefit appears when the learning rate is large enough that some layers’ relative changes become unstable. That is the large-batch regime. At moderate batch sizes and learning rates, Adam or AdamW with warm-up is often as good (Nado et al., 2021). Exercise 2 is such a moderate setting.
- 1. Adam's normalisation equalises…
- 2. LAMB's advantage appears mainly at…
- 3. With plain Adam, small-norm layers experience…
Level 4: Expert
★★★★★ Expert⏱ 25 minResearchers: original papers and open problems.Does LAMB help on a small problem?
History.
- Y. You, I. Gitman and B. Ginsburg (2017) introduced LARS.
- Y. You et al. (2020) introduced LAMB and pre-trained BERT in 76 minutes with batch size 64k.
- Large-batch training of transformers and vision transformers has used LAMB.
- Z. Nado et al. (2021) showed carefully tuned Adam and Nesterov can match LAMB in many settings.
Exercise 2. The heterogeneous-layer network of E3-14: spiral inputs scaled by 30, so the first layer’s weights are small and its gradients large. It is trained full-batch for 250 steps with Adam and with LAMB over learning-rate grids.
| method | η | steps to loss < 0.1 | final loss |
|---|---|---|---|
| Adam | 0.003 | 95 | 0.008 |
| Adam | 0.01 | 38 | 0.001 |
| Adam | 0.03 | 19 | 0.0002 |
| Adam | 0.1 | 47 | 0.0002 |
| LAMB | 0.003 | — | 0.211 |
| LAMB | 0.01 | 102 | 0.000 |
| LAMB | 0.02 | 58 | 0.039 |
| LAMB | 0.03 | 42 | 0.243 |
| LAMB | 0.1 | 20 | 1.333 |
A second seed gave the same picture: Adam’s best was 21 steps; LAMB’s best stable run took 97.
- Adam already coped with the layer heterogeneity. Its per-coordinate normalisation removed the gradient-scale problem that crippled plain SGD in E3-14, and it reached the target in 19 steps.
- LAMB was slower or unstable here. Its learning rate sets each layer’s relative change per step: 0.01 (1% per step) was stable but slow, while 0.03 and above reached the target quickly and then overshot.
- This does not contradict LAMB’s published results. Its advantage is in the very-large-batch, very-large-learning-rate regime of pre-training huge models, which this small problem does not reach.
- Lesson: choose LAMB for that regime; at ordinary scales, tuned Adam or AdamW is a strong baseline.
LAMB in AI, robotics and aerospace
- Foundation-model pre-training on large clusters (language, vision, multimodal) uses LAMB to reach very large batches.
- Fleet-scale training of shared models from many vehicles’ data benefits when batch sizes must be large for throughput.
- At smaller scales, prefer tuned AdamW: exercise 2 shows LAMB is not automatically better.
References
- Y. You, J. Li, S. Reddi, J. Hseu, S. Kumar, S. Bhojanapalli, X. Song, J. Demmel, K. Keutzer, C.-J. Hsieh (2020). “Large batch optimization for deep learning: training BERT in 76 minutes.” Proc. ICLR.
- Y. You, I. Gitman, B. Ginsburg (2017). “Large batch training of convolutional networks.” arXiv:1708.03888.
- Z. Nado, J. Gilmer, C. Shallue, R. Anil, G. Dahl (2021). “A large batch optimizer reality check: traditional, generic optimizers suffice across batch sizes.” arXiv:2102.06356.