Back to LLMs Mind Map
中文·English
LLMsID: preln-rmsnorm

Pre-LN & RMSNorm

归一化 Pre-LN/RMSNorm
🎯Core Definition
LayerNorm standardizes the last dimension: LN(x)=xmeanvarγ+βLN(x) = \frac{x - mean}{\sqrt{var}} \cdot \gamma + \beta; Pre-LN places normalization before the residual sublayer (x+SubLayer(LN(x))x + SubLayer(LN(x))) while Post-LN applies it after the residual addition; RMSNorm drops the mean and scales by root-mean-square only: RMSNorm(x)=xmean(x2)γRMSNorm(x) = \frac{x}{\sqrt{mean(x^2)}} \cdot \gamma.
💡Use Cases
mainstream models (LLaMA, Mistral, Qwen) uniformly use Pre-LN + RMSNorm; classic interview questions are "why Pre-LN trains deep models stably" and "why RMSNorm can drop the mean".
Key Problems Solved
in Post-LN the residual signal is progressively attenuated by normalization, making deep training unstable and requiring delicate warmup and gradient clipping; Pre-LN lets gradients flow back through the near-identity residual path, stabilizing depth; RMSNorm removes the mean computation (saving about 1/3 of normalization FLOPs) and experiments show re-centering is essentially unnecessary for Transformers.
🎯5 High-Frequency Exam Points
1
Structural difference between Pre-LN and Post-LN? Why is Pre-LN more stable for deep models?
2
RMSNorm formula? Difference from LayerNorm, and why dropping the mean works?
3
Downsides of Pre-LN (residual drift; late-training accuracy vs Post-LN, warmup switching)?
4
Why does the position of normalization relative to the residual matter? Why must the γ\gamma scale be kept?
5
What problem does DeepNorm solve (stable training of 1000-layer Post-LN models)?
Updated 2026-08-12
🎯
Test Your Knowledge: Practice Questions for "Pre-LN & RMSNorm"
Single choice pitfall questions with instant feedback and mistake tracking.
🚀 Start Card Practice
Previous CardFFN & SwiGLUNext CardFlashAttention

🔗 More LLMs Knowledge Cards

Agent & Tool CallingAlignment Tax & Preference DataScaled Dot-Product AttentionAttention Variants MHA/MQA/GQA