Core
Residuals, pre-norm vs post-norm
Qwen3.8-27B carries one 5120-dimensional residual stream through 64 heterogeneous layers, with pre-norm RMSNorm calibrating what each sublayer reads.
Updated
01 · Concept
Concept
Here is a problem the next lesson will make vivid: Qwen3.8-27B stacks 64 layers, and they are not even all the same kind of layer — most mix tokens one way, a minority another way, and every one of them ends in the wide gated FFN you just met. How do sixty-four heterogeneous processing stages cooperate without any stage destroying what earlier stages built, and without gradients dying on the way back down? The answer is the architecture’s quietest and most load-bearing decision: a single continuous residual stream, 5120 numbers wide per token, that no layer ever replaces — layers only add to it.
For a transformation , the core pattern is
The identity term gives information a direct route through the stack. A layer can learn a small useful correction instead of rebuilding the representation from scratch. During backpropagation, gradients also get an additive route that does not multiply through every sublayer’s Jacobian. This does not abolish exploding or vanishing gradients, but it makes optimizing genuinely deep stacks tractable — and 64 layers is genuinely deep.
Each layer writes twice. After its mixing sublayer, the stream holds its previous features plus a communication update; after the FFN, it holds that result plus a nonlinear position-wise update. The residual stream is therefore not any single component’s output. It is a shared workspace in which many overlapping features are superposed, and the fact that both a Gated DeltaNet layer and a full-attention layer can write to the same workspace — using the same interface, an added 5120-wide update — is exactly what lets Qwen mix layer types freely.
Normalization controls what each sublayer reads from that workspace. Classic LayerNorm computes a mean and variance across a token’s feature dimension, subtracts, divides, and applies a learned scale and shift. Qwen3.8-27B, like most modern decoders, uses RMSNorm: divide the vector by and apply a learned scale — no mean subtraction, no shift. In Qwen the epsilon is : small enough to be invisible for healthy activations, present inside the square root so a near-zero vector never divides by zero.
Where the normalization sits is the classic fork. The original Transformer used post-norm:
renormalizing the combined state after every addition. Walk the naive reasoning first, because it feels right: “normalize the final sum — surely the cleanest signal comes from calibrating the result.” But trace the gradient. In post-norm, the identity path itself passes through the normalization, so every backward step multiplies through a norm’s Jacobian; with 64 layers, that is 128 sublayer normalizations standing between the loss and the embedding. Deep post-norm stacks historically demanded careful warmup and were prone to divergence. The correction is pre-norm:
which is what Qwen3.8-27B does. Each sublayer receives a calibrated copy, but the main path remains a bare chain of additions — the light table never gets repainted. Concretely, one Qwen layer computes and then , and the model repeats that contract 64 times before a final RMSNorm prepares the state for the output head.
Pre-norm has its own dynamics. Because the stream is never rescaled on the main path, its magnitude tends to grow as updates accumulate through depth; the per-sublayer RMSNorm hides that growth from each reader, and the final norm hides it from the head. Initialization, learning-rate schedule, precision, and optimizer all interact with these choices — pre-norm is an empirically friendlier default for very deep stacks, not a theorem about accuracy.
The phrase “residual stream” also disciplines interpretation. Because features are superposed in one vector space, a mixing layer’s output may be cancelled by a later update, carried unchanged for thirty layers, or transformed downstream. Looking at one sublayer’s output in isolation misses both the state already present in and the later operations that consume the sum.
A practical debugging habit: record three norms per sublayer — the stream , the update , and the sum. An update that dwarfs the stream can destabilize training; one that is always negligible may be a dead branch. These are diagnostics, not thresholds; expected scale depends on depth and architecture.
The enduring picture is collaborative editing at industrial depth. Qwen3.8-27B’s stream preserves the current document across 64 specialists of two different trades. RMSNorm hands each specialist a calibrated copy at a cost of one scale vector per sublayer, epsilon guarding the division. Pre-norm placement keeps the master document continuous, which is precisely why the stack can be this deep — and this heterogeneous — without collapsing.
02 · Analogy
Analogy
A long restoration project keeps the original photograph on a central light table. Sixty-four specialists — some retouchers, some archivists with different tools — each receive a calibrated copy, propose a bounded correction, and add it back rather than repainting from scratch. Pre-norm calibrates what enters each specialist while leaving the central table continuous. Post-norm adds the correction first and recalibrates the combined image afterward.
03 · Teach it back
Teach it back
Write the conceptual equations for pre-norm and post-norm, explain how RMSNorm differs from LayerNorm, and say why one continuous residual stream lets Qwen3.8-27B stack 64 layers of two different kinds.
Compare with a model answer
Pre-norm computes x' = x + F(RMSNorm(x)); post-norm computes x' = Norm(x + F(x)). RMSNorm computes x / sqrt(mean(x²) + epsilon), applies a learned scale, and does not subtract the mean as LayerNorm does; epsilon is 1e-6 in Qwen3.8-27B. The additive identity path lets information and gradients travel through the stack without every layer reconstructing the representation, which is why 64 layers — whether their mixer is attention or Gated DeltaNet — can all read from and write to the same 5120-dimensional stream. Each sublayer only has to honor the interface: read a normalized copy, return an update of matching shape.
04 · Check your understanding
Check your understanding
Complete the teach-back and answer the quiz correctly to finish this lesson.
◎ · Evidence marker
Sources
- Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun (2015). Deep Residual Learning for Image Recognition.
- Ruibin Xiong et al. (2020). On Layer Normalization in the Transformer Architecture.
- Qwen Team (2026). Qwen3.8-27B Model Card.
- Hugging Face and Qwen Team (2026). Qwen3.5/Qwen3.8 reference implementation.