The story: a detail that decides success or failure
Here's a question that seems absurdly trivial: where do you put the normalization in a Transformer layer?
Two options:
- Normalize after the residual connection
- Normalize before the residual connection
Seems unimportant, right? Wrong. This architectural detail decides whether:
- Your model trains correctly or crashes miserably
- You can stack a dozen layers or a hundred
- You spend the first few thousand training steps cautiously warming the model up, or barely any
It's ridiculous that such a small detail makes such a big difference. But that's the reality of deep learning: sometimes, moving a single operation one step over changes everything. And this one might be the most impactful of all.
Two notions are needed to follow along, and both are explained in the feed-forward and residual connections lesson: layer normalization (which brings activations back to a reasonable scale) and the residual connection (also called a skip connection, which adds a block's input directly to its output). One more term will keep coming up: the learning rate, the size of the step taken in the direction the gradient points, at every weight update. Too small and you never get anywhere; too large and you leap over the solution and training goes off the rails.

Post-norm: the unstable version (original Transformer, 2017)
This is the architecture from the "Attention Is All You Need" paper. Normalization comes after the residual connection:
Term by term: input is the vector arriving at the block, Transformation the sub-layer (attention or feed-forward), the + the residual connection, and LayerNorm the normalization. Read in that order: the input goes through the sub-layer, the original input is added back, and only then is the result normalized. The normalization therefore acts on the sum of the two signals.
The major problems
1. Training instability
The direct path (the residual connection, the "+") lets raw values through without any control. No normalization on this path. Result: the magnitudes of activations can grow layer after layer in an uncontrolled way. Imagine a staircase where each step is a bit higher than the previous one, after 80 steps, you're on Everest.
Mathematically, when you compute gradients during backpropagation, these growing values end up in the partial derivatives. Gradients explode in deep layers, making optimization chaotic.
2. A long and delicate warm-up
To work around this instability, training has to start with a tiny learning rate and raise it very gradually over thousands of iterations. This is called warm-up. Without it, the model diverges within the first few iterations: gradients are too violent and the weights go haywire.
And it's tricky: the shape of that ramp (how many steps? what curve?) becomes yet another setting to find, and getting it wrong costs you an entire training run. Under post-norm, that setting is not optional.
3. Scaling hits a wall
The more layers you stack (6 -> 12 -> 24 -> 80), the worse the problem gets. Each additional layer amplifies the instability. A 24-layer BERT does train under post-norm, but at the price of a carefully tuned warm-up and a lot of patience. A 100-layer model with bare post-norm? Practically impossible to train reliably.
This is a real blocker for the era of large models. If you can't stack more layers, you can't increase the model's capacity. And increasing capacity is exactly what enabled the breakthroughs of GPT-3 and its successors.
The direct path has no normalization. The magnitude of the values gets multiplied layer after layer, and a multiplication repeated eighty times has no reason to stay in a sensible range: it blows up or collapses, depending on whether the per-layer factor sits a little above or a little below 1. The gradients follow the same fate. This is as much a problem of computer arithmetic as of learning: past a certain point the numbers are no longer representable, and the computation returns infinity or zero.
Pre-norm: the stable version (modern standard)
The idea is simple: move the normalization before the transformation:
The same terms in a different order: the input is normalized first, then goes through the sub-layer, and the result is added to the original input. The normalization no longer sits on the addition path, but in the side branch.
The difference seems minimal, but the impact is fundamental. Let's see why.
Why it's stable
The secret is in the residual path. With pre-norm, the "+" directly adds the input and the transformed output. That path short-circuits everything: neither normalization nor transformation sits on it. It's a pure highway for values and, most importantly, for gradients.
Mathematically, the derivative of an addition is 1. The gradient therefore passes intact through each layer via the residual connection. Whether you have 10 layers or 100 layers, the gradient arrives at the first layer with practically the same magnitude as at the last. No explosion, no vanishing.
To get the intuition: imagine a 100-story building. With post-norm, to go up or down, you have to pass through each floor and its filter (the normalization). With pre-norm, you have an express elevator that goes directly from the ground floor to the 100th floor, that's the residual connection, free of any obstacle. Gradients take this elevator.
Practical consequences
- A much shorter and much less critical warm-up: it does not disappear (LLaMA, for instance, still spends 2,000 steps ramping up) but it drops from survival condition to mere precaution
- A higher learning rate is tolerated: the model takes noticeably bigger steps without diverging
- Stacking layers becomes safe again: depth is no longer the variable that makes training fail
- Fewer settings to find: one critical hyperparameter less to calibrate through expensive trial and error
Used by:
- GPT-2, GPT-3 (the first large models to adopt pre-norm)
- LLaMA, Mistral, Qwen (all modern LLMs, Large Language Models)
- Flan-T5 and nearly all LLMs from 2023+
You will often read that pre-norm "removes the need for warm-up". That is too strong. Recent large models keep a short one: the LLaMA paper reports 2,000 warm-up steps. What pre-norm changes is the nature of the problem: under deep post-norm, a badly tuned ramp makes training diverge; under pre-norm, it costs a little time at worst.
The compromise: stability versus performance
Here's the paradox: at moderate depth, and if you can get it to train at all, post-norm reaches slightly better scores.
That is what the literature on normalization placement in the Transformer reports, on translation tasks where models stay fairly shallow. The gap is small and protocol-dependent, so we quote no figure for it. The intuition offered for the advantage follows.
The intuition behind this advantage: with post-norm, normalization acts on the sum of the input and the transformation. It therefore sees the interaction between both signals and can calibrate them together. With pre-norm, normalization acts on the input before the transformation, so it never sees the combined result.
But: this advantage is completely crushed by the stability problems. You simply can't train large models with post-norm. So yes, post-norm is theoretically better, but only if you manage to train it. Which you can't do at scale.
Pre-norm? A very slight deficit on paper, but far deeper models that can actually be trained. And a large model with a marginally worse architecture easily beats a small "optimal" one. It's an easy choice.
Why this matters for you
Understanding this detail allows you to:
- Debug unstable training: if your model diverges, check if you're using post-norm by mistake
- Read research papers: many architectural variants play with normalization placement
- Understand modern LLM choices: when you read "LLaMA uses Pre-RMSNorm" (RMSNorm being Root Mean Square Normalization, the stripped-down variant of layer normalization) you know exactly what that means and why
- Remember a broader lesson: in deep learning, seemingly insignificant details can have gigantic consequences
Concrete comparison
| Aspect | Post-norm | Pre-norm |
|---|---|---|
| Stability at depth | Fragile | Very stable |
| Warm-up | Indispensable, needs careful tuning | Short, not sensitive |
| Raw performance at moderate depth | Very slightly ahead | Reference |
| Depth that is actually practical | A few dozen layers | A hundred and beyond |
| Tolerable learning rate | Low | Clearly higher |
| Used by | BERT, original T5 | GPT-2/3/4, LLaMA, Mistral |
| Number of critical settings | High | Low |
Recent research: the best of both worlds?
The community hasn't given up on recovering post-norm's advantages without its downsides. A few interesting approaches:
- DeepNorm (Microsoft, 2022): multiplies the residual branch by a scale factor computed to offset the instability. The paper claims the training of a 1,000-layer post-norm Transformer.
- Sandwich-norm: normalizes both before AND after the transformation. More expensive but combines the advantages.
- Adaptive norm placement: some researchers experiment with dynamic placement depending on the layer depth.
These approaches remain marginal. In practice, pre-norm + RMSNorm remains the dominant and proven combination.
Conclusion: the competition is over
Pre-norm has won, and unanimously: all modern models use it without exception.
Post-norm is a historical artifact. BERT and the original T5 used it because it was 2018-2019 and we didn't know better. The "Attention Is All You Need" paper proposed post-norm, and everyone followed without questioning. It took GPT-2 switching to pre-norm for the community to realize the difference.
Now the standard recipe is clear: pre-norm + RMSNorm. If you're designing a Transformer today, that's the default choice.
1. What makes pre-norm so much more stable than post-norm?
2. Does pre-norm eliminate the need for learning-rate warm-up?
3. At moderate depth, which variant reaches the better scores when training succeeds?
4. Why is a 100-layer post-norm Transformer practically untrainable?