Glossary · Normalization

RMSNorm

Also: root mean square normalizationLayerNormpre-normrms_norm_eps

Read it at the depth you need: one sentence · a paragraph · the math · in the models here

1In one sentence

Divide a vector by its root mean square and multiply by a learned gain: LayerNorm without the mean subtraction or the bias, and what nearly every LLM uses.

2In a paragraph

Normalization layers rescale each token's vector so its values stay in a steady range as it passes through dozens of blocks. LayerNorm subtracts the mean, divides by the standard deviation, then applies a learned scale and shift. RMSNorm drops the mean and the shift and divides by the root mean square alone. It is cheaper and works as well, so almost every model since LLaMA uses it, placed before attention and before the FFN in each block (pre-norm).

3The math, shapes and parameters

RMSNorm(x) = x / √( (1/d) Σ xi2 + ε ) ⊙ g

LayerNorm(x) = (x − μ) / √(σ2 + ε) ⊙ g + b

RMSNorm has d parameters (the gain g); LayerNorm has 2d. A pre-norm block has two, plus one at the end of the stack, so norms are a tiny share of any model: for a 7B model, about 0.0035%. ε (rms_norm_eps, 10−5 or 10−6) keeps the division safe. Gemma stores its gain as an offset from 1, so it computes x/RMS ⊙ (1 + g).

Term by term on Notation Decoder, the sister site: RMSNorm, decoded · LayerNorm, decoded

4In the 96 models on this site

95 of the 96 models here use RMSNorm; Phi-3.5 MoE uses LayerNorm with a bias. Gemma 3 and Gemma 2 put four norms in each block (before and after attention and the FFN). OLMo 2 normalizes after each sublayer instead of before.

Introduced in Zhang and Sennrich, “Root Mean Square Layer Normalization” (2019).

Related

QK-norm · Transformer block · every term