Why is an additional final LayerNorm needed at the output of a pre-norm Transformer stack?
Last updated
In pre-norm (
x + F(LN(x))), LayerNorm sits only on the branch. The residual stream is a raw sum whose scale grows with depth.A final LayerNorm restores a stable scale before the output head, keeping logits bounded and weight tying sensible (e.g. GPT-2's
ln_f, LLaMA's finalRMSNorm).Post-norm doesn't need it because every block already ends with a normalization.