Why Adam Beats SGD on Transformers
Competing explanations: heavy-tailed noise, heterogeneous curvature and sign descent.
Train a ResNet with well-tuned SGD and momentum and it does about as well as Adam. Train a transformer language model the same way and it falls far behind. Nobody disputes the gap, but its cause is contested. This lesson lays out the leading explanations as competing hypotheses, each with the experiment that supports it and the one that cuts against it, and asks what evidence could settle the question.
What you’ll learn
- Describe the empirical gap between SGD and Adam on transformers, and the controls (tuning, batch size, compute) needed to measure it fairly.
- State the heavy-tailed-noise hypothesis, derive why clipping tames heavy tails, and explain the full-batch experiments that challenge it.
- Derive Adam's sign-descent limit and its signal-to-noise damping, and explain how coordinate-wise updates exploit heterogeneous curvature, heavy-tailed class imbalance and geometry.
- Compare the hypotheses, recognize where they overlap, and design experiments that could distinguish them.
The gap and the suspects
The gap is robust. In convolutional image classification, SGD with momentum matches Adam when both are tuned. In transformer language models, SGD trains markedly slower even with momentum, warmup and a tuned learning rate. Zhao, Morwani, Brandfonbrener, Vyas & Kakade (2025) compared Adam, Adafactor, Lion, Sophia and signum on language-model pretraining over a wide range of hyperparameters: all performed comparably, both at their best and in their stability to the learning rate, except SGD.
Measuring the gap fairly takes care. A more general optimizer must get a tuning budget comparable to the simpler one (Choi et al., 2019), runs must be compared at equal compute, and, as we will see, the batch size changes the answer. Four hypotheses lead the field:
| Hypothesis | Mechanism | Main support | Main challenge |
|---|---|---|---|
| Heavy-tailed noise | rare, huge stochastic gradients force SGD's step to be small; clipping and adaptive scaling are robust to them | Zhang et al. (2020): BERT's gradient noise is heavy-tailed, ResNet-50's on ImageNet is not; clipping helps | the gap persists, and grows, as the batch approaches the full dataset (Kunstner et al., 2023) |
| Sign descent and geometry | Adam behaves like sign descent with momentum, which suits losses that are smooth in the geometry | full-batch Adam tracks sign descent with momentum (Kunstner et al., 2023); rotating the parameters hurts Adam, not SGD (Xie, Mohamadi & Li, 2024) | says how Adam wins, not why transformer losses have this geometry |
| Block heterogeneity | Hessian spectra differ wildly between parameter blocks, so no single learning rate suits them all | Zhang et al. (2024): SGD matches Adam when heterogeneity is absent, also on quadratics | a correlational measure; which blocks matter is still being mapped |
| Heavy-tailed class imbalance | rare tokens get tiny gradients, so gradient descent learns them slowly; sign-like updates do not care | Kunstner et al. (2024): reproduced in CNNs with imbalanced classes and in linear models | explains the output side best; whether it accounts for the whole gap is open |
Hypothesis 1: heavy-tailed noise
Zhang, Karimireddy, Veit, Kim, Reddi, Kumar & Sra (2020) measured the norms of stochastic gradient noise. For ResNet-50 on ImageNet they were well concentrated; for BERT they were heavy-tailed, with an empirical variance that did not settle even over very many samples. Heavy tails came from both the attention architecture and the text data: an attention model produced them even on synthetic Gaussian inputs. They modeled this as noise whose -th moment is bounded for some , so the variance may be infinite. On with such noise, SGD with any fixed step sizes has : a single huge, wrong gradient can throw it arbitrarily far.
Clip a scalar noisy gradient at level : if , else . If then ; if the clipped square is . Either way:
The price is a bias, paid only on the rare large values. For , :
Balancing the two as training proceeds gives Zhang et al.'s rate for clipped SGD on smooth nonconvex losses, with a matching lower bound. At it is the familiar of SGD with finite variance; heavier tails make it slower.
Adam's normalization acts like a soft, per-coordinate clip: one outlier inflates along with , so the step stays near . Zhang et al. proposed adaptive coordinate-wise clipping (ACClip), which did well on BERT. A related argument does not need noise at all. Along real training trajectories, curvature grows with the gradient norm, roughly , and under this relaxed smoothness clipped or normalized gradient descent converges arbitrarily faster than gradient descent with a fixed step (Zhang, He, Sra & Jadbabaie, 2020).
The challenge. If noise were the cause, removing it should close the gap. Kunstner, Chen, Lavington & Schmidt (2023) increased the batch size all the way to the full dataset on transformer tasks. The noise vanished, but the gap did not: Adam improved with larger batches much more than SGD did, so its advantage grew, and in the full-batch regime Adam behaved much like sign descent with momentum. Noise may still matter at small batch sizes, but it cannot be the main reason.
Which experiment most directly tests whether gradient noise is the main reason Adam beats SGD on a transformer?
- Measure the tail index of the gradient noise at a small batch size
- Compare tuned SGD and Adam as the batch size grows to the full dataset
- Show that gradient clipping speeds up SGD
- Train a ResNet with both optimizers
Show the answer
B. Compare tuned SGD and Adam as the batch size grows to the full dataset
Growing the batch removes the noise while keeping everything else fixed. If the gap survives at full batch, as Kunstner et al. (2023) found, the cause must lie in the deterministic geometry of the problem. The other experiments are consistent with the noise hypothesis but cannot rule out the alternatives.
Hypothesis 2: Adam is mostly sign descent
Switch off both averages and : with , and , and Adam becomes sign descent. Keeping the momentum but taking the sign gives signum, the momentum version of signSGD (Bernstein, Wang, Azizzadenesheli & Anandkumar, 2018).
With averaging, suppose a coordinate's gradient has mean and standard deviation , so and . Adam's step is the sign of the mean, damped by the relative variance (Balles & Hennig, 2018):
Sign descent is steepest descent for the norm: among steps with , the one that lowers a linear model of the loss the most is , lowering it by . Gradient descent is steepest descent for . Beyond Adam: Lion, Muon & Steepest Descent develops this view.
For one coordinate, the gradient's mean equals its standard deviation (). In steady state, about what fraction of the full step does Adam take along that coordinate?
Show the answer
0.71
. At a signal-to-noise ratio of the factor is , and as the signal vanishes Adam's step shrinks toward zero while the sign alone would keep stepping by : this damping is how Adam anneals itself near a minimum.
Why would sign-like steps suit transformers? Suppose the loss is smooth with respect to the norm, . A sign step then guarantees a decrease of , and can be up to times when the gradient is spread over many coordinates. Xie, Mohamadi & Li (2024) found that the smoothness of GPT-2 and ResNet losses is much more favorable than the usual analysis suggests, and that changing this geometry makes Adam much worse while SGD is provably unaffected.
Rotate the parameters by a fixed orthogonal matrix : and . The chain rule rotates the gradient the same way:
So gradient descent in the new coordinates traces exactly the rotated path, , with an identical loss curve. Coordinate-wise methods do not commute with rotations, because the sign (or the division by ) acts on each axis separately:
If rotating a transformer's parameterization erases Adam's advantage while leaving SGD unchanged, the advantage comes from structure aligned with the coordinates, which is what the remaining two hypotheses propose.
Hypotheses 3 and 4: heterogeneity and imbalance
Block heterogeneity. Zhang, Chen, Ding, Li, Sun & Luo (2024) computed Hessian spectra block by block. In transformers the spectra of different parameter blocks (attention projections, MLP weights, embeddings, normalization gains) differ dramatically; in CNNs the blocks look alike. Across transformers, CNNs, MLPs and quadratic problems, SGD lagged Adam when heterogeneity was present and matched it when it was absent. The mechanism is ill-conditioning that is aligned with the blocks:
Take the output layer, with logits for each class (each token of the vocabulary ) and the cross-entropy loss. The gradient for class 's weights is
Early in training predictions are nearly uniform, . The term that pulls class toward its own examples is then proportional to the class frequency :
Gradient descent therefore moves at a rate proportional to , and class needs time proportional to . Token frequencies are heavy-tailed, roughly when tokens are ranked by frequency, so the rare tail of the vocabulary is learned orders of magnitude more slowly. A sign or Adam step normalizes each coordinate, making progress nearly independent of .
Kunstner, Yadav, Milligan, Schmidt & Bietti (2024) showed that this effect is a key factor in the gap: with gradient descent, the loss on infrequent words falls more slowly than on frequent ones, while Adam and sign-based methods are much less sensitive. The effect reproduces across architectures and data types, in language transformers, in vision CNNs trained on heavy-tailed imbalanced classes, and in linear models, where in continuous time gradient descent provably converges slowly on low-frequency classes and sign descent does not.
Key takeaways
- SGD trails Adam on transformers but not on CNNs; Adam, Adafactor, Lion, Sophia and signum perform comparably on language models, SGD does not. Fair comparisons need equal tuning, equal compute and attention to the batch size.
- Transformer gradient noise is heavy-tailed, and clipping (bias , second moment ) restores convergence at rate . But the gap persists and grows at full batch, so noise is not the main cause.
- Adam with its averages switched off is sign descent, steepest descent for ; with averages it is a sign step damped by . Coordinate-wise methods exploit -favorable, axis-aligned structure and, unlike gradient descent, are not invariant to rotations of parameter space.
- Hessian spectra differ wildly between transformer blocks, and heavy-tailed token frequencies make gradient descent learn rare tokens in time ; per-block or per-coordinate scaling removes both. The explanations overlap, and none is settled as of the mid-2020s.
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
Kunstner et al. (2023) trained transformers with batch sizes growing up to the full dataset. What did they find?
- The gap between Adam and SGD closed at full batch, confirming that noise causes it
- SGD overtook Adam at large batch sizes
- Adam's advantage persisted and grew, and full-batch Adam behaved much like sign descent with momentum
- Both optimizers failed to train at full batch
Show the answer
C. Adam's advantage persisted and grew, and full-batch Adam behaved much like sign descent with momentum
Adam benefited from larger batches far more than SGD did, so noise cannot be the main factor. The sign-descent behavior points instead to the deterministic geometry of the loss.
You re-express a network's loss in coordinates rotated by a fixed orthogonal matrix , and train in the new coordinates from the correspondingly rotated initialization. Whose loss curve is guaranteed to be unchanged?
- Gradient descent's, because its update rotates along with the coordinates
- Adam's, because its normalization makes it invariant to how parameters are expressed
- Sign descent's, because the sign of a vector does not depend on its coordinates
- None of them: rotations change the loss landscape
Show the answer
A. Gradient descent's, because its update rotates along with the coordinates
, so gradient descent's iterates are exactly . Adam and sign descent act coordinate by coordinate, and , so their trajectories, and their performance, can change. That asymmetry is what makes the rotation test informative.
Why does gradient descent learn rare tokens slowly under heavy-tailed class imbalance?
- Rare tokens have larger gradients, which force a smaller learning rate
- The rare tokens' loss is not differentiable
- The gradient pulling a class's output weights toward its examples is proportional to its frequency , so rare classes move slowly; sign-like updates are insensitive to that scale
- Rare tokens are always mislabeled
Show the answer
C. The gradient pulling a class's output weights toward its examples is proportional to its frequency , so rare classes move slowly; sign-like updates are insensitive to that scale
Early in training , so the useful pull scales with and the time to learn class with . Normalizing per coordinate, as Adam and sign descent do, removes the dependence.
Further reading
- J. Zhang, S. P. Karimireddy, A. Veit, S. Kim, S. J. Reddi, S. Kumar & S. Sra, "Why are adaptive methods good for attention models?," NeurIPS (2020).
- F. Kunstner, J. Chen, J. W. Lavington & M. Schmidt, "Noise is not the main factor behind the gap between SGD and Adam on transformers, but sign descent might be," ICLR (2023).
- Y. Zhang, C. Chen, T. Ding, Z. Li, R. Sun & Z.-Q. Luo, "Why transformers need Adam: A Hessian perspective," NeurIPS (2024).
- F. Kunstner, R. Yadav, A. Milligan, M. Schmidt & A. Bietti, "Heavy-tailed class imbalance and why Adam outperforms gradient descent on language models," NeurIPS (2024).
- R. Zhao, D. Morwani, D. Brandfonbrener, N. Vyas & S. Kakade, "Deconstructing what makes a good optimizer for autoregressive language models," ICLR (2025).