Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Every knob gets its own speed
Imagine tuning a machine with two knobs. One is ultra-sensitive, so a hair’s turn changes everything. The other barely does anything unless you crank it. Turning both by the same amount is either reckless for the first or useless for the second. Better: watch how strongly each knob has been reacting and adjust each one’s step accordingly.
Adaptive optimizers do exactly this for every parameter of a model. Adam, the most popular, also keeps a running average of the direction (momentum).
Adam and AdamW are the default optimizers for transformers, perception networks and most deep RL agents. They make training robust to poorly scaled parameters and need little tuning. Knowing their quirks (bias correction, ε, weight-decay coupling, warmup) prevents silent failures.
- 1. Adaptive methods give each parameter…
- 2. A parameter whose gradients are always huge gets…
- 3. Adam combines RMS scaling with…
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.Three algorithms (per coordinate, element-wise)
- AdaGrad (Duchi, Hazan and Singer, 2011): and . Rare features keep big steps. The steps only ever shrink.
- RMSProp (Hinton, 2012): . An exponential moving average forgets old gradients.
- Adam (Kingma and Ba, 2015):
Defaults: , , .
Each Adam step moves a coordinate by roughly times a ratio between −1 and 1. The step size is about in parameter units, whatever the gradient’s magnitude.
- 1. AdaGrad's effective step…
- 2. RMSProp replaces AdaGrad's sum by…
- 3. Adam's first step moves each coordinate by about…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 45 minUndergraduate students and practising engineers.Why bias correction?
and start at 0, so early averages are biased toward 0. With a constant gradient , . Dividing by recovers . For the correction matters for the first few thousand steps.
Invariance and its limits
Rescaling a coordinate, , scales its gradient by . Adam’s ratio is unchanged (as ), so Adam is invariant to diagonal rescaling. That’s why it tolerates badly scaled networks. It is not invariant to rotations, unlike Newton’s method. It’s a diagonal preconditioner (A6.3-6).
Known issues and fixes
- Non-convergence: Adam can fail on simple convex problems. AMSGrad keeps (Reddi, Kale and Kumar, 2018).
- Warmup: early estimates are noisy, so a learning-rate warmup helps (Liu et al., 2020, RAdam).
- Generalization: adaptive methods can generalize worse than SGD + momentum on some vision tasks (Wilson et al., 2017).
- Weight decay: adding to the gradient (L2) gets rescaled by . AdamW applies separately, giving the same decay rate to every weight (Loshchilov and Hutter, 2019). It’s now the standard for transformers.
- 1. Adam is invariant to…
- 2. AMSGrad fixes Adam's non-convergence by…
- 3. AdamW differs from Adam + L2 because its decay is…
Level 3: Advanced
★★★★☆ Advanced⏱ 40 minGraduate level, with full derivations and proofs.Deriving bias correction
Unrolling, . If is stationary, then . Dividing by gives an unbiased estimate. The same holds for and . ∎
Diagonal-rescaling invariance
Let with diagonal. Gradients in are , so and . The step in is , which is the same normalized step in every coordinate. Mapped back, iterates in differ only by the coordinate scaling of the step size. Convergence speed in terms of normalized progress is unchanged. ∎
Why L2 inside Adam isn’t weight decay
With L2, the update is . Weights with a large gradient history (large ) are regularized less, and weights with small gradients more. Adam + L2 converges toward the minimizer of the L2-penalized objective (ridge), which crushes low-variance features. AdamW’s decay is the same fraction for every weight per step, independent of gradient statistics.
Exercise 3.1: RMSProp step size under a constant gradient
With , , so the step is . It has fixed length . RMSProp behaves like sign descent with step .
- 1. With constant gradient g, Adam's m_t equals…
- 2. Under a constant gradient, RMSProp steps…
- 3. Adam + L2 regularizes weights with large gradient history…
Level 4: Expert
★★★★★ Expert⏱ 35 minResearchers: original papers and open problems.Weight decay done right
Two features feed a regression: wheel current (variance 100) and IMU tilt (variance 0.01), with true weights 1 and 10. With decay 0.05:
- Adam + L2 converges to the ridge solution, shrinking the tilt weight from 10 to about 1.7. Ridge punishes low-variance features hardest.
- AdamW shrinks both weights only slightly (tilt ≈ 9.1), because its decay doesn’t interact with the gradient scale.
Which behaviour you want depends on the goal, but they are not the same algorithm. Confusing them was a common bug before 2019.
Adaptive methods in AI, robotics and aerospace
- Transformers and LLMs are trained with AdamW plus warmup and cosine decay (A6.3-7).
- Deep RL for robotics (PPO, SAC) uses Adam almost universally (Schulman et al., 2017; Haarnoja et al., 2018).
- Neural fields and scene representations for mapping (NeRF, Gaussian splatting) use Adam with per-parameter-group learning rates.
- Sparse features: AdaGrad remains popular for embeddings and online advertising-scale models (McMahan et al., 2013).
References
- J. Duchi, E. Hazan, Y. Singer (2011). “Adaptive subgradient methods for online learning and stochastic optimization.” JMLR, 12.
- T. Tieleman, G. Hinton (2012). “Lecture 6.5 — RMSProp.” COURSERA: Neural Networks for Machine Learning.
- D. Kingma, J. Ba (2015). “Adam: a method for stochastic optimization.” ICLR.
- S. Reddi, S. Kale, S. Kumar (2018). “On the convergence of Adam and beyond.” ICLR.
- I. Loshchilov, F. Hutter (2019). “Decoupled weight decay regularization.” ICLR.
- L. Liu et al. (2020). “On the variance of the adaptive learning rate and beyond.” ICLR (RAdam).
- A. Wilson, R. Roelofs, M. Stern, N. Srebro, B. Recht (2017). “The marginal value of adaptive gradient methods in machine learning.” NeurIPS.
- J. Schulman et al. (2017). “Proximal policy optimization algorithms.” arXiv:1707.06347.
- T. Haarnoja et al. (2018). “Soft actor-critic: off-policy maximum entropy deep reinforcement learning with a stochastic actor.” ICML.
- H. B. McMahan et al. (2013). “Ad click prediction: a view from the trenches.” KDD.