03 · C · Block
The pre-norm Transformer block
Residual highways, RMSNorm, and the two sublayers that every modern decoder stacks.
Pre-norm residual block
Modern decoder LLMs stack identical pre-norm blocks. Each block writes a residual delta into the stream, twice: once from attention, once from the MLP.
- layer index, 1 … n
- residual stream after layer ℓ, T×d
- stream after the attention residual
Why it mattersResiduals are the highway that lets gradients travel through dozens of layers (He et al., 2016). The skip has Jacobian I, so there is always a path that does not vanish.
RMSNorm
RMSNorm scales a vector by its root-mean-square and a learned gain (Zhang and Sennrich, 2019). It does not subtract the mean and has no bias. Llama-style models use it.
- one residual-stream vector
- small constant, e.g. 10^{-6}
- learned scale
- elementwise multiply
Why it mattersNorms keep residual-stream scale stable so attention scores and MLP activations do not explode as depth grows.
LayerNorm
LayerNorm also subtracts the mean and usually has a bias. GPT-2 uses it. The extra projection orthogonal to is the only structural difference.
- mean of u
- variance of u
- learned bias