Normalization  · October 2019

Root Mean Square Layer Normalization

intro

training-stability

Drop the mean-centering step of LayerNorm — keep almost all of the stability benefit at meaningfully less compute.

§ 1 · Premise

What LayerNorm actually costs

For each token in a forward pass through one Pre-Norm transformer block, LayerNorm is invoked twice: once before the attention sub-layer and once before the FFN. For a 70B-class model with 80 layers and a hidden dimension of d=8192d = 8192, that is 160 LayerNorm calls per token, each performing two full reductions across the feature axis (one for the mean, one for the centered variance), a subtraction, a division, and an affine transform with two learnable vectors γ,βRd\boldsymbol{\gamma}, \boldsymbol{\beta} \in \mathbb{R}^d.

In raw terms per call: two reductions of dd summands, two dd-vector parameter reads (16 KB each in fp16, 32 KB in fp32), and an output write. The reductions are the bottleneck — on a GPU, the SM stalls until the partial sums are all-reduced across the warp, and that latency sits on the critical path of every token of every layer.

The parameter line is also non-trivial. LayerNorm contributes 2dL2dL parameters across LL layers per block (one γ\boldsymbol{\gamma} and one β\boldsymbol{\beta} per call, times two calls per block). For Llama-2 70B (d=8192d = 8192, L=80L = 80), that is about 2.6 M parameters spread across hundreds of tiny tensors — small as a fraction of total weights, but each is a separate kernel launch under naive execution.

The question Zhang and Sennrich asked in 2019 is sharper than “is LayerNorm slow?” It is: of the two statistics LayerNorm estimates — the mean μ\mu (re-centering) and the standard deviation σ\sigma (re-scaling) — which one is actually load-bearing for training stability? Their answer, defended both analytically and empirically in the paper, is that the re-centering term is dispensable. RMSNorm drops the mean and the bias, keeps the RMS-based re-scaling and the gain, and recovers comparable quality at strictly less compute.

§ 2 · Derivation

From LayerNorm to RMSNorm

Start from LayerNorm. For a vector xRd\mathbf{x} \in \mathbb{R}^d of summed inputs at one token position (each xix_i is a single neuron’s pre-activation in the layer being normalized), LayerNorm computes

LN(x)i  =  xiμσγi  +  βi,μ  =  1dj=1dxj,σ  =  1dj=1d(xjμ)2  +  ε.\mathrm{LN}(\mathbf{x})_i \;=\; \frac{x_i - \mu}{\sigma}\,\gamma_i \;+\; \beta_i, \qquad \mu \;=\; \frac{1}{d}\sum_{j=1}^{d} x_j, \qquad \sigma \;=\; \sqrt{\frac{1}{d}\sum_{j=1}^{d}(x_j - \mu)^2 \;+\; \varepsilon}.

Symbols: dd is the hidden width (e.g. 4096, 8192); xiRx_i \in \mathbb{R} is one neuron’s pre-activation; μR\mu \in \mathbb{R} is the sample mean of x\mathbf{x}; σR\sigma \in \mathbb{R} is the sample standard deviation (with ε105\varepsilon \sim 10^{-5} to guard the square root); γ,βRd\boldsymbol{\gamma}, \boldsymbol{\beta} \in \mathbb{R}^d are learned per-feature gain and bias. The full operator therefore needs 2d2d parameters and two reductions (xj\sum x_j and (xjμ)2\sum(x_j-\mu)^2) over the feature axis.

Section 3 of Zhang and Sennrich classifies what LayerNorm’s normalization actually buys, by asking which transformations of the layer input x\mathbf{x} or of the upstream weight matrix leave the output unchanged. The four cases are: re-centering of weights, re-scaling of weights, re-centering of inputs, re-scaling of inputs. LayerNorm is invariant to all four; the question is whether the input re-centering invariance — the one that requires computing μ\mu — actually matters.

The paper’s argument for “no” runs through the gradient. Writing a=(xμ1)/σ\mathbf{a} = (\mathbf{x}-\mu\mathbf{1})/\sigma for the normalized activation, the Jacobian of LN\mathrm{LN} with respect to x\mathbf{x} has the structure

LN(x)ixj  =  γiσ(δij    1d    1daiaj),\frac{\partial \mathrm{LN}(\mathbf{x})_i}{\partial x_j} \;=\; \frac{\gamma_i}{\sigma}\,\Big(\,\delta_{ij} \;-\; \tfrac{1}{d} \;-\; \tfrac{1}{d}\,a_i\,a_j\,\Big),

a sum of three terms: an identity term, a mean-removal term 1/d-1/d from differentiating through μ\mu, and a variance-removal term aiaj/d-a_i a_j / d from differentiating through σ\sigma. The re-scaling backward path is the aiaj/da_i a_j / d term; the re-centering backward path is the constant 1/d1/d term. Zhang and Sennrich’s argument is that the constant subtraction-of-the-mean contribution is the strictly weaker of the two — the variance correction already projects the gradient onto the tangent space of the sphere of constant norm, and the mean correction is then a rank-1 correction whose practical effect on training dynamics is small. (The argument is heuristic in the paper; the experiments in § 4 are what carry the claim.)

Removing it gives RMSNorm:

RMSNorm(x)i  =  xiRMS(x)γi,RMS(x)  =  1dj=1dxj2  +  ε.\mathrm{RMSNorm}(\mathbf{x})_i \;=\; \frac{x_i}{\mathrm{RMS}(\mathbf{x})}\,\gamma_i, \qquad \mathrm{RMS}(\mathbf{x}) \;=\; \sqrt{\frac{1}{d}\sum_{j=1}^{d} x_j^{2} \;+\; \varepsilon}.

Three things have happened:

  1. The mean μ\mu is gone. The first reduction xj\sum x_j disappears; only the second-moment reduction xj2\sum x_j^2 remains.
  2. The subtraction xiμx_i - \mu is gone. There is one fewer pointwise op per element.
  3. The additive bias β\boldsymbol{\beta} is gone. Per-call parameter count is dd, not 2d2d.

What is preserved is the invariance the paper argues is the load-bearing one: re-scaling of the input. For any scalar α>0\alpha > 0, RMSNorm(αx)=RMSNorm(x)\mathrm{RMSNorm}(\alpha \mathbf{x}) = \mathrm{RMSNorm}(\mathbf{x}) (up to the ε\varepsilon guard). This follows directly from RMS(αx)=αRMS(x)\mathrm{RMS}(\alpha \mathbf{x}) = \alpha\,\mathrm{RMS}(\mathbf{x}). Re-centering invariance is deliberately given up.

Geometrically, RMSNorm(x)=dγx/x2\mathrm{RMSNorm}(\mathbf{x}) = \sqrt{d}\,\boldsymbol{\gamma} \odot \mathbf{x}/\|\mathbf{x}\|_2 (with ε=0\varepsilon = 0): the normalization is a projection of the activation onto the sphere of radius d\sqrt{d}, followed by a per-coordinate gain. LayerNorm first translates x\mathbf{x} so its centroid is at the origin and then performs the same projection. RMSNorm skips the translation and trusts that downstream weights can absorb the offset.

Numerical stability. The placement of ε\varepsilon matters in low precision. Computing the sum xj2\sum x_j^2 in fp16 overflows once any xi240|x_i| \gtrsim 240, so production kernels (reference implementation) accumulate the square in fp32 even when x\mathbf{x} is stored in fp16/bf16. The ε\varepsilon guard then sits inside the square root, so the worst-case division is xi/εx_i / \sqrt{\varepsilon}; typical values ε{105,106}\varepsilon \in \{10^{-5}, 10^{-6}\} keep that bounded for reasonable inputs. Llama-class configs commonly use 10510^{-5} or 10610^{-6} — see, for example, the Llama 3 release notes (rms_norm_eps).

Per-call accounting versus LayerNorm, holding dd fixed:

QuantityLayerNormRMSNormΔ
Reductions over the feature axis21−1
Pointwise subtractions10−1
Learnable parameters2d2dddd-d
Bytes of param state, fp164d4d2d2d2d-2d

For a Llama-2 70B-scale model (d=8192d = 8192, L=80L = 80, two norms per block, plus a final norm), the parameter-count delta is (2 ⁣ ⁣80+1)d=1,318,912(2\!\cdot\!80 + 1)\cdot d = 1{,}318{,}912 scalars removed — under 0.002% of total weights, but a meaningful constant-factor saving in the small-tensor traffic that dominates kernel-launch overhead on the norm path.

§ 3 · Reference implementation

A sketch of the forward pass

def rms_norm(x, gamma, eps=1e-6):
    # x: [..., d]  the activation being normalized
    # gamma: [d]   learnable per-feature gain
    # No mean, no bias. One reduction along the last axis.
    sq_mean = x.pow(2).mean(dim=-1, keepdim=True)   # [..., 1]
    inv_rms = (sq_mean + eps).rsqrt()               # [..., 1]
    return x * inv_rms * gamma                      # [..., d]

# Compare: LayerNorm needs both reductions and an extra parameter.
def layer_norm(x, gamma, beta, eps=1e-6):
    mu  = x.mean(dim=-1, keepdim=True)              # [..., 1]   first reduction
    var = (x - mu).pow(2).mean(dim=-1, keepdim=True) # [..., 1]  second reduction
    return (x - mu) * (var + eps).rsqrt() * gamma + beta

The sketch is not a kernel: a production version fuses the reduction, the rescaling, and the gain into a single pass, and accumulates sq_mean in fp32 when x is in bf16/fp16.

LayerNorm centers then divides by std; RMSNorm just divides by RMS. Adding a constant bias to the input shifts RMSNorm's output but not LayerNorm's.Input vector x (8 dims)x-1.400.301.10-0.600.90-0.201.70-0.80LayerNorm: (x − μ) / σLN-1.540.180.98-0.730.78-0.331.59-0.93RMSNorm: x / RMS(x)RMS-1.400.301.10-0.600.90-0.201.70-0.80
Drag the bias slider. LayerNorm's output is unchanged — the mean-subtraction step removes any constant. RMSNorm's output shifts visibly because it only divides by RMS. μ = 0.13, σ = 0.99, RMS = 1.00.

§ 4 · Empirical evidence

What the experiments show

The introducing paper benchmarks RMSNorm versus LayerNorm across six tasks: Transformer-based WMT14 En→De translation, RNNSearch En→De, character- and word-level language modeling on enwik8/Wikitext-103, image-caption retrieval on Order-Embeddings, BiDAF question answering on SQuAD, and CIFAR-10 image classification. The headline claim from the abstract — comparable quality, 7–64% wall-clock speedup — is decomposed across these workloads in the paper’s tables. The high end of that range (~64%) comes from the small RNNSearch model where the LayerNorm cost is a larger fraction of step time; the low end (~7–10%) comes from the Transformer where attention dominates. Quality numbers (BLEU, BPC, accuracy) are within noise across all six.

A partial variant pRMSNorm, in which only the first p%p\,\% of features are used to estimate the RMS, is also tested. At p=6.25%p = 6.25\%, quality is preserved on the same suite — evidence that the useful signal in the normalization statistic is not a fine-grained property of the activation distribution. Production stacks have not picked up pRMSNorm, presumably because the speedup beyond standard fused RMSNorm is small and the partial-feature pattern is unfriendly to a fused single-pass kernel.

Three observations from the 2023–2026 production record carry the claim into modern scale:

A useful counterpoint to the “always use RMSNorm” framing: nothing in the derivation rules out LayerNorm working too. Zhang and Sennrich’s claim is that the mean subtraction is unnecessary, not that it is harmful. At inference, the difference is a single reduction per call; at training, it is one extra term in the backward pass. The case for RMSNorm is the cumulative constant factor across hundreds of layer-norm calls per token across a trillion-token run, not a fundamental capability gap.

Adopted by

  • Llama 1 65B · Meta — First production open-weights model to adopt RMSNorm + Pre-Norm at scale.  [source]
  • Llama 2 70B · Meta — RMSNorm throughout, Pre-Norm placement; established the open-weights consensus.  [source]
  • Llama 3.1 70B · Meta — RMSNorm throughout, Pre-Norm placement.  [source]
  • DeepSeek V3 · DeepSeek-AI — RMSNorm, Pre-Norm, across all 61 layers.  [source]
  • Gemma 3 27B · Google DeepMind — RMSNorm, applied as both Pre-Norm and Post-Norm per block.  [source]
  • OLMo 2 13B · Allen Institute for AI (AI2) — RMSNorm with reordered Post-Norm-style placement.  [source]
  • OLMo 3 32B · Allen Institute for AI (AI2) — RMSNorm (rms_norm_eps 1e-6) across the 64-layer dense flagship; reordered Post-Norm placement inherited from OLMo 2.  [source]
  • Qwen3 235B-A22B · Alibaba (Qwen Team) — Pre-Norm RMSNorm across the 94-layer MoE flagship.  [source]
  • Qwen3 32B · Alibaba (Qwen Team) — Pre-Norm RMSNorm across the 64-layer dense flagship.  [source]
  • Qwen3 30B-A3B · Alibaba (Qwen Team) — Pre-Norm RMSNorm across the small MoE.  [source]
  • Hunyuan-Large 389B · Tencent — Pre-Norm RMSNorm across the 64-layer MoE.  [source]
  • GLM-4.5 · Zhipu AI — RMSNorm with rms_norm_eps 1e-5 in the released config; 92 transformer layers.  [source]
  • MiniMax-M1 · MiniMax — Pre-Norm RMSNorm inherited from the MiniMax-Text-01 base architecture.  [source]
  • Kimi Linear 48B-A3B · Moonshot AI — RMSNorm (rms_norm_eps 1e-5) across the 27-layer hybrid KDA + MLA stack.  [source]
  • Qwen3-Next 80B-A3B · Alibaba (Qwen Team) — Zero-centered, weight-decayed RMSNorm — a stability tweak over standard RMSNorm; weight decay applied to the gain parameter.  [source]

Lineage

Cite

BibTeX entry for the original paper
@article{arxiv1910_07467,
  title  = {Root Mean Square Layer Normalization},
  author = {Biao Zhang and Rico Sennrich},
  year   = {2019},
  eprint = {1910.07467},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/1910.07467}
}

Or cite the paper directly: arXiv:1910.07467.

Export

BibTeX
@article{arxiv_1910_07467,
  title         = {Root Mean Square Layer Normalization},
  author        = {Biao Zhang and Rico Sennrich},
  year          = {2019},
  eprint        = {1910.07467},
  archivePrefix = {arXiv},
  url           = {https://arxiv.org/abs/1910.07467}
}
CSL JSON
{
  "id": "arxiv_1910_07467",
  "type": "article-journal",
  "title": "Root Mean Square Layer Normalization",
  "author": [
    {
      "literal": "Biao Zhang and Rico Sennrich"
    }
  ],
  "issued": {
    "date-parts": [
      [
        2019
      ]
    ]
  },
  "URL": "https://arxiv.org/abs/1910.07467",
  "number": "1910.07467",
  "source": "arXiv"
}
RIS
TY  - JOUR
TI  - Root Mean Square Layer Normalization
AU  - Biao Zhang and Rico Sennrich
PY  - 2019
JO  - arXiv
AN  - arXiv:1910.07467
UR  - https://arxiv.org/abs/1910.07467
ER  -