Pre-norm versus post-norm: which placement makes deep stacks stable?
Pre-norm puts LayerNorm inside the residual branch so the residual path is never normalized. Gradients flow cleanly back, deep stacks train without warmup, and every modern decoder LLM uses it.
Imagine a long telephone game played across 80 people. Post-norm is like having each person whisper to the next but a referee retunes the volume after every pair speaks. The retuning makes early whispers fade away because every retune slightly attenuates what came before. Pre-norm is like setting the volume once before each person speaks but leaving the original whisper untouched in a backchannel. The backchannel carries the original message clean across all 80 people; the retuning only affects what each person says into the channel. The second setup lets messages survive long chains, which is exactly what gradients need to do in deep networks.
Detailed answer & concept explanation~7 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
Compare the formulas, explain the gradient-flow argument for pre-norm's residual identity path, walk the historical transition from Vaswani 2017 to GPT-2 to modern LLMs, address the variance-growth concern and the final-LayerNorm fix, and close with DeepNorm and RMSNorm as related variants.
| Property | Post-norm | Pre-norm |
|---|---|---|
| Formula | x_out = LN(x_in + f(x_in)) | x_out = x_in + f(LN(x_in)) |
| Residual path through LN? | Yes (every layer) | No (identity path) |
| Gradient stability at depth | Poor without warmup | Stable with standard init |
| Used by GPT-1, BERT, Vaswani 2017 | Yes | No |
| Used by GPT-2+, Llama, Mistral, modern LLMs | No | Yes |
| Needs final LN before LM head | No | Yes (variance grows) |
Real products, models, and research that use this idea.
- GPT-2 (2019) switched from post-norm (used in GPT-1 following Vaswani) to pre-norm and dramatically reduced warmup requirements.
- GPT-3/4/5 series all use pre-norm; Llama 1/2/3/4 Maverick all use pre-norm with RMSNorm.
- Mistral, Mixtral, Qwen 3.5, DeepSeek V4, Gemma 4, and Claude Opus 4.7 all use pre-norm with RMSNorm.
- DeepNorm (Wang et al. 2022) is a notable academic effort to stabilize post-norm at extreme depth (1000+ layers) via initialization, but it has not displaced pre-norm in mainstream production.
- BERT uses post-norm but is only 12-24 layers deep, where the difference is less pronounced.
What an interviewer would ask next. Try answering before peeking at the approach.
QWhy does pre-norm's residual-stream variance grow unboundedly with depth, and what fixes it?
QHow does DeepNorm (Wang et al. 2022) make post-norm work at extreme depth?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Believing the original Vaswani layout (post-norm) is what modern LLMs use. GPT-2 already switched to pre-norm in 2019 and every frontier LLM since has followed.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.