Part IX — Deep Learning Regularization, Normalization & Training Dynamics · Chapter 5

RMSNorm

Hook

LayerNorm computes a mean and a variance every single forward pass. What if the mean-centering step was never buying you much in the first place?

Intuition

Same six activations as the last chapter — mean 0.50.5, not 00. LayerNorm would force the output's mean back to 00. RMSNorm doesn't: it never subtracts a mean at all, so whatever bias was in the input mean survives into the output, just rescaled.

Formalize

RMSNorm divides by the root-mean-square of the vector — no mean subtraction anywhere in the formula:

h^i=hiRMS(h)g,RMS(h)=1nj=1nhj2+ϵ\hat h_i = \frac{h_i}{\text{RMS}(h)} \cdot g, \qquad \text{RMS}(h) = \sqrt{\frac{1}{n}\sum_{j=1}^n h_j^2 + \epsilon}
  • hih_i — channel ii's raw value.
  • RMS(hh) — the root-mean-square of the whole vector: the square root of its average squared value.
  • gg — a learned (here, shared-scalar) gain applied after normalizing.
  • ϵ\epsilon — a tiny constant keeping the division well-defined near zero.
  1. LayerNorm: subtract the mean, then divide by the standard deviation

    h^i=(hiμ)/σ\hat h_i = (h_i-\mu)/\sigma — two statistics computed from the data, one subtraction, one division.

  2. RMSNorm: skip the subtraction entirely

    h^i=hi/RMS(h)\hat h_i = h_i/\text{RMS}(h) — one statistic, one division. Whatever mean the input had is still there, just divided down along with everything else.

Play

Drag the gain. Every one of the six channels scales up or down by exactly the same factor — RMSNorm never treats any channel differently based on where the group's center happens to sit, because it never computed a center.

Worked example
  1. RMS of the six activations

    Squaring each of [2,1,0.5,3,2.5,1][2,-1,0.5,3,-2.5,1] and summing: 22+(1)2+0.52+32+(2.5)2+12=4+1+0.25+9+6.25+1=21.52^2+(-1)^2+0.5^2+3^2+(-2.5)^2+1^2 = 4+1+0.25+9+6.25+1 = 21.5. Mean-of-squares =21.5/63.583=21.5/6\approx3.583, so RMS=3.5831.893\text{RMS}=\sqrt{3.583}\approx1.893.

  2. RMSNorm's output mean isn't 0

    Dividing every value by 1.8931.893 divides the mean by 1.8931.893 too: 0.5/1.8930.2640.5/1.893\approx0.264. LayerNorm on the identical input forces that same quantity to exactly 00 by construction.

  3. One fewer statistic, one fewer reduction

    RMSNorm needs only hj2\sum h_j^2, not both hj\sum h_j and (hjμ)2\sum(h_j-\mu)^2 — cheaper to compute, and in practice competitive with LayerNorm's accuracy on large transformer models, which is why models like LLaMA and T5 use it instead.

Checkpoint

Tune the gain until channel c4 (raw value 3) normalizes to about 2.

Move the gain slider to try it
Summary
h^i=hiRMS(h)g\hat h_i = \frac{h_i}{\text{RMS}(h)} \cdot g

RMSNorm keeps normalization's core benefit — controlling the scale of activations layer after layer — while dropping the assumption that re-centering to mean zero was doing meaningful work. One fewer statistic to compute, one fewer place for a bug to hide, and empirically little accuracy lost. The next few chapters turn from activation stability to a different training concern: keeping the model from simply memorizing its training data.