Quant Memo
Advanced

RMSNorm and Scale-Only Normalization

Layer normalization both recenters and rescales a layer's activations; RMSNorm drops the recentering step entirely and rescales only by the root-mean-square, doing nearly as well at a fraction of the compute — which is why most modern large language models use it instead.

Prerequisites: Batch Normalization

Layer normalization takes each example's vector of activations and standardizes it: subtract the mean (recenter to 0) and divide by the standard deviation (rescale to unit spread), then let two learned parameters stretch and shift it back to whatever scale training actually needs. That works well, but computing a mean, then a variance around that mean, then dividing, is three passes of arithmetic over every activation, on every layer, of every token — a real cost at the scale of a modern language model. RMSNorm asks: how much of that is actually necessary?

The analogy: adjusting volume without re-centering pitch

Imagine adjusting the loudness of a recording. There are two separate things you could do: shift every sample up or down by a constant (changing where "silence" sits — recentering), and scale every sample by a factor (changing how loud the loudest parts are — rescaling). If a recording is already reasonably centered around zero and the only real problem is that its volume drifts unpredictably, you don't need the recentering step at all — a single volume knob does the job at half the effort. RMSNorm is betting that most of layer normalization's benefit for deep transformers comes from controlling scale, and that recentering was buying comparatively little.

The formulas, side by side

LayerNorm, for an activation vector x=(x1,,xn)x = (x_1, \dots, x_n) with mean μ\mu and standard deviation σ\sigma:

LN(xi)=γxiμσ+β\text{LN}(x_i) = \gamma \cdot \frac{x_i - \mu}{\sigma} + \beta

In words: subtract the mean, divide by the standard deviation, then apply a learned scale γ\gamma and shift β\beta.

RMSNorm skips the mean subtraction and divides only by the root-mean-square:

RMS(x)=1ni=1nxi2,RMSNorm(xi)=γxiRMS(x)\text{RMS}(x) = \sqrt{\frac{1}{n}\sum_{i=1}^n x_i^2}, \qquad \text{RMSNorm}(x_i) = \gamma \cdot \frac{x_i}{\text{RMS}(x)}

In words: measure the typical magnitude of the vector by averaging its squared entries and taking the square root (never subtracting a mean first), divide every entry by that number, and apply a single learned scale γ\gamma — there is no learned shift β\beta and no recentering step at all.

Worked example 1: RMSNorm by hand

Take x=(3,1,4,2)x = (3, -1, 4, 2). Sum of squares: 9+1+16+4=309 + 1 + 16 + 4 = 30. Mean of squares: 30/4=7.530/4 = 7.5. RMS =7.5=2.739= \sqrt{7.5} = 2.739. Divide each entry: (3/2.739, 1/2.739, 4/2.739, 2/2.739)=(1.095, 0.365, 1.461, 0.730)(3/2.739,\ -1/2.739,\ 4/2.739,\ 2/2.739) = (1.095,\ -0.365,\ 1.461,\ 0.730). With γ=1\gamma=1, that's the RMSNorm output — no mean was ever computed or subtracted.

Worked example 2: comparing to LayerNorm on the same vector

Same x=(3,1,4,2)x = (3, -1, 4, 2). Mean μ=2\mu = 2. Variance =14[(1)2+(3)2+(2)2+(0)2]=3.5= \frac{1}{4}[(1)^2+(-3)^2+(2)^2+(0)^2] = 3.5, so σ=1.871\sigma = 1.871. LayerNorm output (with γ=1,β=0\gamma=1,\beta=0): (0.534, 1.604, 1.069, 0)(0.534,\ -1.604,\ 1.069,\ 0). The outputs differ meaningfully from RMSNorm's (1.095,0.365,1.461,0.730)(1.095, -0.365, 1.461, 0.730) — LayerNorm shifted everything relative to the mean of 2 first, RMSNorm never did. Both still succeed at the main goal: neither output has entries that have grown or shrunk to an extreme scale, which is what keeps a deep stack of these layers numerically stable.

LayerNorm output RMSNorm output
The two normalizations produce different output vectors from the same input — LayerNorm's mean-subtraction step changes the relative pattern, not just the scale, of the result.
LayerNorm 1. subtract mean μ 2. divide by std σ 3. scale γ and shift β 3 passes over activations RMSNorm 1. divide by RMS(x) 2. scale γ only no mean, no β, fewer passes
RMSNorm removes the mean-centering step and the learned shift entirely, keeping only a magnitude rescale — cheaper per layer, and used across most modern large language models (LLaMA, PaLM, and others).

RMSNorm rescales an activation vector by its root-mean-square, 1nxi2\sqrt{\frac{1}{n}\sum x_i^2}, and applies a single learned scale — no mean subtraction, no learned shift — trading LayerNorm's extra recentering step for cheaper computation at a similar level of training stability.

What this means in practice

RMSNorm is the default normalization in most contemporary transformer architectures because it removes roughly a third of the arithmetic (no mean, no β\beta parameter) while empirically matching LayerNorm's training stability on large models; it's the reason a quant reading a modern LLM's architecture diagram sees "RMSNorm" rather than "LayerNorm" at nearly every block. The saved computation is genuinely material at the scale of billions of parameters and trillions of training tokens, even though the difference in behavior on any single small vector, as above, looks modest.

The common confusion is assuming RMSNorm is simply "LayerNorm without the learned shift β\beta" and nothing else changes. The bigger difference is upstream: RMSNorm never computes or subtracts a mean at all, so activations that happen to be systematically biased away from zero stay biased after RMSNorm, whereas LayerNorm would have corrected that. RMSNorm works well in practice because transformer activations tend not to have large systematic offsets to begin with — not because recentering is unimportant in general.

Related concepts

Practice in interviews

Further reading

  • Zhang & Sennrich, Root Mean Square Layer Normalization (2019)
ShareTwitterLinkedIn