Why Pre-LayerNorm Transformers Train More Stably Than Post-LayerNorm
Last updated: November 29, 2026
Quick Overview
The original transformer applied layer normalization after each residual addition, while most modern large language models apply it before each sublayer. Explain why the pre-LN placement trains more stably at depth, what it costs, and what other techniques keep very deep models stable.
OpenAI
November 29, 20260
0
0 solved
The original transformer applied layer normalization after each residual addition, while most modern large language models apply it before each sublayer. Explain why the pre-LN placement trains more stably at depth, what it costs, and what other techniques keep very deep models stable.
Training runs at OpenAI's scale are expensive enough that a divergence is a major loss, so interviewers probe whether candidates understand the gradient dynamics behind architecture choices rather than reciting them. Expect follow-ups on warmup, initialization, and loss spikes.
What the Interviewer Expects
- Writes both formulations correctly
- Explains the identity path for gradients in pre-LN
- Connects post-LN to the need for learning rate warmup
- Notes the representation growth trade-off in pre-LN
- Mentions RMSNorm, scaled initialization, and other stabilizers
Key Topics to Cover
How to Approach This
- Understand the bias-variance trade-off. High training accuracy but low test accuracy signals overfitting.
- Choose evaluation metrics carefully based on the problem. Accuracy alone is often insufficient.
- Feature engineering is often more impactful than model selection.
- Know when to use tree-based models (tabular data) vs neural networks (unstructured data).
- Handle class imbalance with SMOTE, class weights, or appropriate loss functions.
Possible Follow-up Questions
- Why do loss spikes still happen in pre-LN models, and how do you recover from one?
- What does a final layer norm before the output head do?
- How does RMSNorm differ from LayerNorm and why is it cheaper?
- How would you detect early that a run is heading toward divergence?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Explore ML Interview PrepSample Answer
Clarify
Post-LN: . Pre-LN: , with a final LN before the output projection....
Approach
Look at the gradient of the loss with respect to an early layer. In pre-LN, unrolling gives , so $\frac{\partial x_L}{\partial x_l} = I + \sum_{k \ge l} \fr...