Post-Norm and Pre-Norm Differ by Two Lines of Code
Implementation
Our diagnostic MiniBlock uses identical weights for both placements, switching only whether norm1 and norm2 wrap the residual sum or the branch inputs:
Because an untrained L-block stack is a deterministic random function, we can measure how both placements propagate signal variance, inter-token diversity, and gradients at initialization (t = 0).
Why Post-Norm Squeezes Tokens Together Across Depth
Mechanism of Token Collapse
- Decompose each token vector \mathbf{x}_i = \boldsymbol{\mu} + \boldsymbol{\delta}_i into the sequence mean \boldsymbol{\mu} = \frac{1}{n}\sum_j \mathbf{x}_j and token-specific deviation \boldsymbol{\delta}_i.
- Random attention reinforces \boldsymbol{\mu}: Uniform initial weights add \mathbf{W}_o\mathbf{W}_v\boldsymbol{\mu} to every token while deviations \boldsymbol{\delta}_i cancel.
- Post-norm rescales downward: Dividing every token by the same factor restores the stream’s length but shrinks \boldsymbol{\delta}_i relative to \boldsymbol{\mu} at every layer (
LayerNorm centers channels, not tokens).
RMSNorm: Dropping Mean-Centering for Speed
Normalization Form
Zhang & Sennrich (2019) showed that LayerNorm’s stability comes from bounding root-mean-square magnitude rather than centering the channel mean \mu = \frac{1}{d}\sum_j x_j:
\mathrm{RMSNorm}(\mathbf{x}) = \frac{\mathbf{x}}{\mathrm{RMS}(\mathbf{x})} \odot \boldsymbol{\gamma}, \qquad \mathrm{RMS}(\mathbf{x}) = \sqrt{\frac{1}{d}\sum_{j=1}^{d} x_j^2 + \epsilon}
ours vs. nn.RMSNorm: max deviation 0.0e+00
x: RMSNorm 0.28 0.57 0.85 1.70 | LayerNorm -1.07 -0.53 0.00 1.60
3x: RMSNorm 0.28 0.57 0.85 1.70 | LayerNorm -1.07 -0.53 0.00 1.60
x + 10: RMSNorm 0.84 0.91 0.99 1.22 | LayerNorm -1.07 -0.53 0.00 1.60
Scale vs. shift invariance: Both norms are invariant to positive rescaling (\mathbf{x} \mapsto 3\mathbf{x}), whereas adding a constant shift (\mathbf{x} \mapsto \mathbf{x} + 10) alters RMSNorm but leaves LayerNorm unchanged. Dropping \mu and \boldsymbol{\beta} saves one reduction pass over HBM per token.
Both FFN Variants in One Parameter-Matched Class
FeedForward Implementation
Our FeedForward module switches cleanly between a 4d GELU MLP and an \frac{8}{3}d SwiGLU network at the exact same 8d^2 parameter and FLOP budget:
At d = 256, act='gelu' uses 2 \times 256 \times 1024 = 524{,}288 parameters, while act='swiglu' uses 3 \times 256 \times 683 = 524{,}544 parameters (8.004\,d^2 due to rounding \frac{8}{3}\cdot 256 = 682.67 \to 683).