Before you move a control in the demo, say what you expect to change.
Foundation reference
Adam & Adaptive Gradient Methods
Adam updates each parameter using running averages of its gradient and squared gradient. The published GPT-3 and Llama training recipes use Adam or AdamW (Brown et al., 2020; Touvron et al., 2023).
Study guide
Where to start
How does dividing each coordinate by √v̂ₜ change which solution an overparameterized network reaches, and why does Adam sometimes generalize worse than SGD (Wilson et al., 2017)?
How to study this pagePredict · Check · Generalize · Continue
Compare what the demo shows with the key equation and with the papers cited below.
Identify the part of the idea that survives a change of notation or model, so you can recognize it in another paper or system.
The newer notebook covers the same concept and has an interactive demo.
Why It Matters for Modern Models
- Adam updates each parameter using running averages of its gradient and squared gradient. The published GPT-3 and Llama training recipes use Adam or AdamW (Brown et al., 2020; Touvron et al., 2023).
- Not every large model uses them; PaLM, for example, was trained with Adafactor (Chowdhery et al., 2023).
- Adam-family optimizers are also the usual choice for fine-tuning, RLHF and diffusion-model training, where gradient scales differ widely from one parameter to another.
Questions to Think About
- How do bias correction and exponential averaging behave when the objective keeps changing, as in curriculum training or RLHF?
Interactive Demos
Core Math
If you prefer intuition first, try the demos above, then come back for the math.
For gradient :
Here is an exponential moving average of the gradient and an exponential moving average of its elementwise square (an uncentred second-moment estimate); dividing by and corrects the bias from initializing both at zero.
Reddi et al. (2018) gave a simple convex problem on which Adam fails to converge to the optimum, and proposed the AMSGrad variant.