Context. Very large transformers showed failures never seen at small scale: attention logits that grow until the softmax collapses (ViT-22B) and output logits that drift away from the log-probabilities they represent (PaLM). Wortsman et al. reproduce both in models of a few million parameters at high enough learning rates, and the large-scale fixes work there too. Large-scale instabilities are high-learning-rate instabilities whose threshold moves down as the model grows, so a sweep of final loss against learning rate across small sizes is a cheap proxy, and an intervention that flattens that curve is one that will matter at scale. The speedrun trains a small model at very high learning rates, which is exactly this regime, and several of its changes are these fixes.
Setting: LR sensitivity as the proxy. Pre-norm transformers on C4 from 2.4M to 1.2B non-embedding parameters (plus a few 4.8B runs), trained with AdamW, are summarized by the average excess of final loss over the best learning rate across three decades, with diverged runs capped at the initial loss . Everything is empirical, in one training setup.
Attention logits blow up first, and QK-norm stops them. Without a fix, the learning rate at which runs diverge falls with size, and the maximum attention logit climbs by orders of magnitude before the loss blows up. The growth is in the norms of queries and keys, while their cosine similarity does not rise; the authors' explanation is that attention logits are the only quantity quadratic in the parameter scale, , so they are the first to grow large as the weights grow. Forcing a 10M model's logits to a fixed scale of makes it worse than a bigram model, so the saturated softmax is the cause. Every run whose maximum logit at step 2000 exceeded diverged, and a fit of that maximum against log size predicted the 4.8B divergence at LR 0.01 before that model was trained. Normalizing queries and keys per head before the dot product removes the failure, and a 1.2B model then trains at LR 0.3. The paper uses LayerNorm with learned gains; the speedrun uses a parameter-free RMS form, under which every query and key has norm and Cauchy-Schwarz bounds each logit by the scale times .
Output logits drift unless something holds near zero. The cross-entropy is invariant to adding a constant to every output logit, so the mean logit lies along a flat direction and nothing pulls it back. Without weight decay, at high learning rates and every size tested, the logits drift strongly negative late in training and the loss degrades. PaLM's z-loss adds a penalty that pulls back toward zero, and removes the instability; weight decay also removes it for the larger models. A logit softcap blocks the same drift by bounding the logits (my connection; the paper does not test caps).
Gradients shrink until AdamW's dominates the denominator. The gradient RMS falls with model size and learning rate, and at 4.8B and LR 0.3 it reaches about , AdamW's default . In , once the update shrinks well below its intended scale and the layer stops learning, and the measured update RMS drops when the gradient RMS crosses . Lowering to improves the 4.8B loss; raising it to makes the run diverge. The proposed mechanism is output-norm growth: the residual stream's RMS grows with depth and learning rate, and the final layernorm divides the gradient it passes back by that RMS.
How standard hyperparameter choices change LR sensitivity. With qk-layernorm and z-loss in place, other interventions barely move the range of stable learning rates but change the loss inside it. Longer warmup lowers LR sensitivity, most for the larger models; weight decay applied independently of the learning rate lowers it relative to the PyTorch default, where a learning-rate sweep also sweeps the decay; and depth raises it faster than width. Param keeps the best learning rate fixed across width but neither lowers sensitivity nor improves loss, and it does not remove the need for qk-layernorm. More steps or a larger batch leave sensitivity unchanged.
Which of these fixes the speedrun adopted. QK-norm came in at record 5, alongside other changes. Because it fixes the query and key norms, the logit scale (the softmax temperature) becomes a hyperparameter, and record 20 set it to 0.12 instead of (about 3 s; with that caps logits near 15 instead of 11). For the output logits the speedrun uses a cap: at record 9, cap 15 at record 18 (about 10 s, 1490 to 1390 steps), now an asymmetric ; these gains are steps saved, so the cap does more than prevent divergence, which is outside this paper. Adam's went from to at record 20 (about 10 steps), by the same mechanism for a different cause: with a zero-initialized head, the gradients reaching the Adam-trained embeddings start near zero, below . Muon normalizes whole matrices and has no per-coordinate in this role.
Limits. The paper studies only slow divergences (fast loss spikes are out of scope), in one codebase with one data set and optimizer; LR sensitivity does not reflect the overall loss level and meaningless for interventions that change what the learning rate means; and the mechanisms (quadratic dependence, output-norm growth) are hypotheses supported by measurements.
Terms
- LR sensitivity
- over three decades of learning rate
- attention-logit growth
- grows with norms; past about the softmax collapses and training fails
- qk-layernorm
- normalize queries and keys per head before the dot product; logits bounded by scale
- output-logit divergence
- output logits drift along the flat shift direction of the cross-entropy, late in training
- z-loss / softcap
- keeps the normalizer near 1; a cap bounds the logits and blocks the same drift (my connection)
- AdamW problem
- gradient RMS shrinks to about at scale, so shrinks
- independent weight decay
- : decay not scaled by the peak learning rate
- logit-max prediction
- quadratic fit in log size forecast the 4.8B divergence at LR 0.01
- speedrun fixes
- QK-norm (record 5), scale 0.12 (20), softcap (9, 18), Adam (20)
Quiz
- Why does the paper study instabilities by sweeping the learning rate in small models instead of training large ones?Without the fixes, the learning rate at which runs diverge decreases with size. Pushing a small model to a high learning rate reaches the same failure mode cheaply, and the large-scale fixes work there too.
- With parameter-free RMS normalization of queries and keys in a head of dimension , what limits the attention logits?After RMS normalization every query and key has the same norm, so the logit is at most the scale times . That fixes the softmax temperature, which is why the speedrun then tunes the scale by hand.
- What did Param change in the paper's learning-rate sweeps?Param is built so the optimum transfers across width, and it does. The shape of the curve around the optimum, and the attention-logit failure at high learning rates, are unchanged.
Sources
- Mitchell Wortsman et al. Small-scale proxies for large-scale Transformer training instabilities. ICLR, 2024.
- Keller Jordan et al. modded-nanogpt. GitHub repository, 2024.