Skip to content
DARC
■ Change #1 · wiki.edited

Adam, AdamW and the optimizer zoo: Normalize Markdown to canonical form

by DARC wiki2026-10-22 20:30:54 UTCOpen the page →
explainer.student
− **What an optimizer does.** Training a neural network means finding weights that make a loss (an error score) small. Gradient descent does this by computing the derivative of the loss with respect to every weight and stepping each weight a little against it: $w \leftarrow w - \eta\, g$, where $g$ is the derivative (the *gradient* entry for that weight) and the *learning rate* $\eta$ sets the step size. The derivative is estimated from a small random batch of examples, so it is noisy.
+ **What an optimizer does.** Training a neural network means finding weights that make a loss (an error score) small. Gradient descent does this by computing the derivative of the loss with respect to every weight and stepping each weight a little against it: $w \leftarrow w - \eta\, g$, where $g$ is the derivative (the _gradient_ entry for that weight) and the _learning rate_ $\eta$ sets the step size. The derivative is estimated from a small random batch of examples, so it is noisy.
**What goes wrong.** One $\eta$ for billions of weights is a poor fit. Some weights get large, consistent gradients and need small steps; others get tiny or rare gradients and barely move. Think of rolling a ball down a long narrow valley: a step large enough to make progress along the gentle floor makes the ball bounce between the steep walls.
**Adam.** Adam keeps two running averages for every weight. An exponential moving average updates a running value as $m \leftarrow \beta m + (1-\beta) g$ with $\beta$ near 1, so recent values count most and old ones fade. Adam keeps $m$, the average of the gradient (its direction, smoothed over steps), and $v$, the average of the squared gradient (its typical size). The update is roughly
− $$w \leftarrow w - \eta\,\frac{m}{\sqrt{v} + \epsilon}.$$
+ $w \leftarrow w - \eta\,\frac{m}{\sqrt{v} + \epsilon}.$
Dividing by $\sqrt{v}$ makes the step about the same size for every weight whatever the scale of its gradient, while noisy gradients that keep changing sign average out in $m$; $\epsilon$ is a tiny number that prevents division by zero. In the valley picture, the steep direction is damped and the gentle direction gets a full step.
**AdamW.** Weight decay shrinks every weight slightly each step to stop weights growing without need. In plain Adam, adding that shrinkage to the gradient means it also gets divided by $\sqrt{v}$, which weakens it unevenly. AdamW applies the decay separately, $w \leftarrow w - \eta\lambda w$, so the decay rate $\lambda$ means what it says. AdamW with a warm-up and a decaying learning rate is the default for language models; its cost is two extra numbers ($m$ and $v$) stored per weight.
**Successors.** Shampoo and Muon treat each weight matrix as a matrix rather than a list of numbers; Muon makes the update's directions balanced (orthogonalized) using a few cheap matrix iterations. Lion keeps only the sign of a momentum term and one stored number per weight. Schedule-free methods remove the need to choose in advance when the learning rate decays.
**Why the comparison is hard.** New optimizers are often compared against a poorly tuned AdamW. Benchmarks such as AlgoPerf fix the tasks, hardware and tuning budget; in its first competition Distributed Shampoo won with tuning and Schedule-Free AdamW won without it. A large careful study reported that the speed-up of matrix-based optimizers over well-tuned AdamW shrinks from about 1.4 times at 0.1 billion parameters to about 1.1 times at 1.2 billion, so whether any optimizer clearly beats AdamW at large scale is open.
hash b4473ee6c66db77d6b6d171971cd8444e69877a6aa8d9887ccedac8309d7713a
previous (first change)