Moving LayerNorm inside the residual branch lets a Transformer train from step zero at full learning rate without a warmup schedule, delivering 40% faster convergence on BERT-Base pretraining (500k vs 700k updates, or 29% fewer steps, to reach 1.69 validation loss). In ICML 2020, Xiong et al. use mean-field theory to prove why the original Post-LN Transformer blows up without warmup: normalizing between residual blocks pins every layer’s hidden norm to sqrt(d), forcing gradients near the output layer to stay large regardless of depth L while starving earlier layers.
- Post-LN fails with Adam and SGD alike: Without warmup on IWSLT14 De-En (
lr_max = 1e-3), Post-LN with Adam collapses from roughly 34 BLEU (T_warmup = 4,000) to 8.45 BLEU (and 2.77 BLEU withT_warmup = 500); vanilla SGD also stalls near zero BLEU, disproving claims that warmup only fixes early Adam variance. - Depth-shrinking gradients in Pre-LN: Mean-field Theorem 1 bounds the last FFN layer’s Frobenius gradient norm at initialization as
O(d * sqrt(ln d))for Post-LN (independent of depthL, measured around1.6across 6 to 14 layers), versusO(d * sqrt(ln d / L))for Pre-LN, while keeping expected gradient scales uniform across layers. - 40% faster BERT convergence without warmup: Pre-LN BERT-Base (
12layers,3.4Bwords) starts directly atlr = 3e-4with linear decay and hits1.69validation loss in 500k steps, versus 700k steps for Post-LN (10kwarmup at1e-4;3e-4diverged), a 40% speedup (29% fewer updates). - Architecture dominates the optimizer: On IWSLT14 De-En, RAdam rescues Post-LN without warmup, yet gives almost zero difference over standard Adam once you switch to Pre-LN.
Why Post-LN needs warmup at initialization
A LayerNorm layer projects its input v onto a hypersphere of radius sqrt(d), so its Jacobian norm shrinks inversely with input magnitude: ||J_LN(x)||_2 = O(sqrt(d) / ||x||_2) (Lemma 3). That single fact drives the entire difference between Post-LN and Pre-LN at step zero.
In Post-LN, placing LayerNorm after every residual addition resets the hidden-state squared norm to (3/2) d at every block (Lemma 2), regardless of network depth L. During backpropagation, the output layer’s gradients pass through only that final fixed-scale LayerNorm, leaving their norm at O(d * sqrt(ln d)) (empirically ~1.6 across 6-6 through 14-14 models), while earlier layers suffer exponential attenuation of roughly (2/3)^((L-l)/2). Hitting those large top-layer gradients with a full learning rate on step one destabilizes updates immediately. Warmup works around this by creeping along at tiny step sizes until the top layers’ gradients shrink; indeed, once warmup finishes in Post-LN, measured gradient norms drop sharply (Figure 3a–b). Fixing a tiny constant learning rate (1e-4) without warmup avoids divergence on IWSLT14, but crawls to 4.3 validation loss after 27 epochs.
Pre-LN keeps the residual highway clean and adds a single Final LayerNorm before the softmax head. Because each sublayer adds variance O(d) onto an unnormalized skip stream, the hidden-state squared norm grows linearly with depth between (1 + l/2) d and (1 + 3l/2) d. When gradients flow back through Final LayerNorm, its 1 / ||x_{L+1}||_2 Jacobian divides them by sqrt(L), pulling the output-layer gradient down to O(d * sqrt(ln d / L)) and keeping gradient norms nearly flat from layer 1 to layer L.
Key findings across translation and BERT
Removing warmup with Pre-LN did not merely survive; it accelerated training across all three benchmarks tested. On IWSLT14 De-En (6-6 Transformer), Pre-LN without warmup (lr = 5e-4, decayed by 0.1 at epoch 8) reached Post-LN’s epoch-15 validation loss and BLEU (~34) by epoch 9, and tuned Pre-LN (lr = 7.5e-4, batch 8,192) reached 35.5 test BLEU with zero warmup. On WMT14 En-De (4.5M sentence pairs on 16 P40 GPUs), Pre-LN trained stably from 7e-4 and 1.5e-3 with inverse square-root decay starting at epoch 6 and beat warmed-up Post-LN in convergence speed.
On 12-layer BERT-Base pretraining (3.4B words across English Wikipedia and BookCorpus on 32 P40 GPUs), Post-LN diverged at lr = 3e-4 and had to stay at 1e-4 with 10k warmup steps, reaching 1.69 validation loss at 700k updates. Pre-LN ran cleanly from 3e-4 with linear decay and no warmup, hitting 1.69 at 500k updates (saving 200k steps, 20x larger than the skipped 10k warmup) and reaching higher MRPC and RTE accuracies sooner (where downstream BERT fine-tuning variance was evaluated across 6 seeds).
Caveats and builder takeaway
The mean-field proof assumes single-head attention, zero-initialized Q and K projections, square d x d weights, Xavier initialization, and ReLU FFNs, though multi-seed empirical checks on real 6-6 through 14-14 models confirmed both the (0.1, 0.125) concentration bound and the 1 / sqrt(L) gradient trend. More importantly, the paper proves faster optimization and warmup removal rather than higher final accuracy ceilings: subsequent LLM research showed that Pre-LN’s growing residual variance can make deep layers contribute less late in training, and giant models still retain short warmups for batch-size ramps, FP16/BF16 stability, and optimizer second-moment smoothing.
For modern Transformer stacks, Pre-LN (today usually paired with RMSNorm) is the clear default: it eliminates the brittle T_warmup hyperparameter sensitivity, unlocks higher initial learning rates, and turns early divergence debugging into a straightforward check on residual wiring and layer-wise gradient norms.


