μ\mu

μ — the mean

Read "mu". It is the mean (the ordinary average) of a set of numbers: add them up and divide by how many there are.

In LayerNorm, μ=1d∑ixi\mu = \frac{1}{d}\sum_i x_i is the average of the dd numbers in one token's vector, not an average across the tokens in a batch. Subtracting it shifts that token's values so they average to zero.

RMSNorm skips this subtraction, on the argument that it costs compute without helping much.

Example

x=[1,2,6]  ⟹  μ=1+2+63=3\mathbf{x} = [1, 2, 6] \;\Longrightarrow\; \mu = \tfrac{1+2+6}{3} = 3

Subtracting the mean gives [-2, -1, 3], which averages to zero.

Where the course uses it

Related terms