Layer normalization stabilizes training by normalizing activations within each layer to have zero mean and unit variance, then applying learned scale and shift. Where you place it in the block matters more than you'd think.
Two placements
Post-LN (original Transformer, 2017): normalize after the residual connection.
Trains poorly without learning-rate warmup. Gradient signals at depth tend to explode or vanish unless carefully tuned. Most papers from 2017-2019 use Post-LN; modern models avoid it.
Pre-LN (modern standard): normalize before the sublayer.
The residual stream remains un-normalized; gradients can flow back through the skip connection without ever being pushed through layer norms. Training is much more stable. GPT-2, GPT-3, BERT-base, every modern Llama, Mistral, and Claude variant uses Pre-LN.
RMSNorm
Modern Llama and Mistral use RMSNorm instead of LayerNorm. Same shape, but skips the mean-centering step — it normalizes by the root mean square of the activations rather than (activation − mean) / std. Slightly faster, slightly fewer parameters, empirically just as stable.