What it does
Layer normalization looks at the feature vector of a single example (or a single token) and subtracts its mean and divides by its standard deviation. A learned per-feature gain γ and bias β then restore whatever scale the next layer needs. Unlike batch normalization it does not depend on other examples in the batch, so it behaves the same in training and in use, and works for sequences of any length. Transformers place one around every attention and feed-forward block. Older exporters spell it out as ReduceMean, Sub, Pow, ReduceMean, Add, Sqrt, Div, Mul, Add. RMSNorm skips the mean subtraction.
Formula
μ = (1/D) Σi xi, σ2 = (1/D) Σi (xi − μ)2yi = γi · (xi − μ) / √(σ2 + ε) + βiShapes and parameters
- Shapes
- Any shape [..., D] in, the same shape out; γ and β are [D].
- Parameters
- 2 × D: a gain and a bias per feature. With D = 768: 1,536.
- Used for
- Every transformer block (BERT, ViT, CLIP, Marian), the mixers of TinyTimeMixer, and many audio models.
In WeightSpace
A few catalog transformers expose single LayerNorm parameters as their editable values: the final gain of a question-answering model, and final LayerNorm biases of a retrieval model and an image–text model. Edits stay within ±8 of the shipped value and shift one feature of every token.
Where it appears
- Segment an object by clickingSlimSAM339.7M params
- Read a phrase aloudKokoro 82M3181M params
- Find a caption that fits a photoTinyCLIP ViT-8M/162923M params
- Change how a voice speakstiny-voca274.5M params
- Estimate depth from a photoDepth Anything V2 Small2525M params
- Name the emotion in a sentenceALBERT Base v2 Emotion2512M params
- Transcribe a short English recordingWav2Vec2 Base 960h2594M params
- Forecast a time seriesGranite TinyTimeMixer R216805K params
- Classify text with your labelsXtremeDistil zero-shot1313M params
- Find an answer in a passageDistilBERT SQuAD1365M params
- Find the most relevant answerall-MiniLM-L6-v21223M params
- Translate a Chinese sentenceHelsinki-NLP OPUS-MT12111M params
- Ask a question about a tableGoogle TAPAS Tiny54.5M params
- Rerank search resultsMS MARCO TinyBERT-L254.4M params
- Restore punctuation in a transcriptEdge-Punct-Casing37.4M params
- Fill a gap in ChineseBERT Base Chinese2102M params
- Find beats and downbeatsBeat This! Small13.2M params