Adam Optimisation
Momentum plus per-parameter adaptive step sizes: the default optimiser.
The idea
Adam tracks an exponential moving average of the gradient (the first moment, like momentum) and of its square (the second moment). It divides the first by the square root of the second, so parameters with consistently large gradients take smaller steps and rare ones take larger steps. Bias correction fixes the early averages.
θ ← θ − η · m̂ / (√v̂ + ε)
Watch it run
This is a real computation, not a drawing. Pause, step, change the settings, or try new random data.
- current weights
- minimum
- last update
Start somewhere on the bowl. Rings are lines of equal loss; the minimum is at the centre.
- step:
- 0
- loss:
- 3.4617
Loss landscape seen from above: a long narrow valley. Final loss 0.0037.
Step by step
- 1Compute the gradient g.
- 2Update m = β₁m + (1 − β₁)g and v = β₂v + (1 − β₂)g².
- 3Bias-correct: m̂ = m/(1 − β₁ᵗ), v̂ = v/(1 − β₂ᵗ).
- 4Update θ ← θ − η·m̂ / (√v̂ + ε).
Where it is used
The default choice for training deep networks and transformers.
Watch out for
Can generalise slightly worse than tuned SGD with momentum on some vision tasks.