Why does pre-norm train more stably than post-norm in deep transformers?
Last updated
Pre-norm (
x + F(LN(x))) keeps the residual path a pure identity, so gradients flow cleanly through any depth and training often needs little warmup.Post-norm (
LN(x + F(x))) puts LayerNorm on the residual path, distorting gradients layer after layer. At initialization gradients near the output are large, so it needs warmup and often diverges when deep.Trade-off: pre-norm's residual stream grows with depth so later layers contribute less, while successful post-norm can reach slightly better quality. Hybrids like DeepNorm aim for both.