Zenaique

Complete the RMSNorm formula

Fill in blank·Easy·4.0 · 0·~1 min·Asked atBaiduVoyage Ai·Relevant atMetaMistral AI
Attempt it
RMSNorm(x) = * x / sqrt(mean(x^2) + )
TL;DR

RMSNorm(x) = gamma * x / sqrt(mean(x^2) + eps). One learnable scale `gamma` per feature, and a small `eps` (typically 1e-5 or 1e-6) under the square root for numerical stability.

Memory aid
Sign in to see the mnemonic that makes this stick.
Easy to grasp

Imagine each token in the model has a list of 4096 numbers. Some lists are bigger overall, some smaller. RMSNorm just measures the typical size of those numbers (the root mean square) and divides everything by that, so every list ends up at roughly the same overall scale. Then it lets the model learn one knob per position to fine-tune the final scale. That is the whole operation. The two missing pieces of the puzzle are the knob name (gamma) and the tiny safety constant under the square root (epsilon) that stops the division from blowing up when the input is all zeros.

Concept explanation~2 min read

Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.

RMSNorm is one of the simplest swaps in the 2017-to-2026 transformer transition: drop the mean subtraction and the bias from LayerNorm, keep the scale. Faster, smaller, no quality loss. This question is asking whether you have the formula on muscle memory; if you do, the rest of the LayerNorm versus RMSNorm discussion falls out naturally.

Building the formula from the name

The name is the formula. Root Mean Square. Square each element of x, take the mean over the feature axis, take the square root. That gives you the RMS magnitude of x. Divide x by that magnitude to rescale it to unit RMS. Then multiply by a learnable per-feature scale gamma.

The one extra piece is the numerical-stability constant eps, added inside the square root: sqrt(mean(x^2) + eps). Without it, if x is exactly the zero vector, you would divide by zero. With it, the denominator is floored at sqrt(eps), which keeps the operation stable.

No other terms. No mean subtraction. No bias. The formula is just gamma * x / sqrt(mean(x^2) + eps).

Why this is faster than LayerNorm
What gamma and eps actually control
The bigger picture: why the omissions are safe
Sign in to unlock the full deep dive.

Situations where this technique stops working.

Sign in to see when this approach fails.

2–4 min · Everything important, quickly.

Sign in to see the quick scan of the deep dive.
AspectLayerNormRMSNorm
Normalizing quantity`(x - mean(x)) / sqrt(var(x) + eps)``x / sqrt(mean(x^2) + eps)`
Mean subtractionYesNo
Learnable params per feature2 (gamma, beta)1 (gamma)
Reductions over feature axis2 (mean, then variance)1 (mean of x^2)
Typical eps`1e-5``1e-5` or `1e-6`
Compute costBaselineRoughly 30-50% faster

Real products, models, and research that use this idea.

  • Llama 3.1 8B and 70B both use RMSNorm with eps `1e-5` in every block (two per block, plus a final RMSNorm before the unembedding head).
  • Mistral Large and Mixtral 8x22B use RMSNorm with eps `1e-5`.
Sign in to see more production examples.

What an interviewer would ask next. Try answering before peeking at the approach.

QWhy is gamma per-feature (shape `(d_model,)`) rather than a single scalar?
A

Different features in the residual stream serve different roles and have different natural scales. A per-feature gamma lets the model recover those distinct scales after normalization; a scalar gamma would force every feature to share one post-norm magnitude.

2 more follow-ups an interviewer would ask next. Sign in to reveal them.

Red flags & common mistakes

The phrases that signal junior thinking. Click to expand.

Most common mistake

Adding a learnable bias term. RMSNorm deliberately omits the bias that LayerNorm has; only one learnable parameter per feature.

Sign in to see all red flags and common mistakes.

60 second bullets to scan on the way to the call.

  • Write the full RMSNorm formula and identify what each symbol represents

  • Explain why mean subtraction is dropped relative to LayerNorm

Sign in to unlock the revision sheet.

Primary sources. Browse if you want the original framing.

Similar questions

Same topic, related formats. Practice these next.

4 curated
Next question
Explain scaled dot product attention.
Short answer·Medium