---
title: "Explain batch normalisation: what it computes at training versus inference time, and why it helps. Why do transformers…"
url: https://gurkanozkan.ai/learn/questions/research-batch-norm-vs-layer-norm-023/
markdown: https://gurkanozkan.ai/learn/questions/research-batch-norm-vs-layer-norm-023.md
kind: question
role: Research
stage: Technical
difficulty: Medium
json: https://gurkanozkan.ai/api/learn/questions/research-batch-norm-vs-layer-norm-023.json
robots: noindex
---

# Explain batch normalisation: what it computes at training versus inference time, and why it helps. Why do transformers use layer norm or RMSNorm instead, and does pre-norm vs post-norm placement matter?

Research · Technical · Medium

## Answer

*Model answer, written in a candidate's voice*

### In short

- Per-feature normalisation over the batch with learnable gamma/beta; inference uses running mean/variance.
- Helps optimisation and higher learning rates; covariate-shift story is disputed.
- Batch-dependent and fragile with small batches or variable sequence lengths, so transformers normalise per token.
- RMSNorm drops mean-centring and is cheaper.
- Pre-norm stabilises deep stacks; post-norm needs careful warmup.

### In full

Batch normalisation normalises each feature using statistics computed over the current batch, then applies learnable scale gamma and shift beta; at inference it uses running mean and variance accumulated during training rather than the current batch. It generally smooths optimisation and permits higher learning rates, though the classic internal-covariate-shift explanation is disputed and the benefit is broader than that story. Because the statistics depend on the batch, it is sensitive to batch size and is awkward with small batches or variable-length sequences, which is why transformers typically normalise per token across features instead. LayerNorm subtracts the mean and divides by the standard deviation within a token; RMSNorm skips the mean-centring and just divides by the root mean square, making it cheaper while often performing similarly. Placement matters: pre-norm puts the normalisation before each sublayer so the residual stream stays unnormalised and deep stacks train more stably, whereas post-norm normalises after the sublayer and can work well but usually needs careful warmup and tuning.

*Checked against sources by an independent AI reviewer.*

## What a strong answer covers

- Per-feature normalisation over the batch, with learnable γ and β; running statistics used at inference.
- Allows higher learning rates and smoother optimisation; the covariate-shift explanation is disputed.
- Depends on batch size and breaks with small batches or variable sequence lengths, so transformers normalise per token (LayerNorm).
- RMSNorm drops mean-centring and is cheaper.
- Pre-norm stabilises deep stacks; post-norm needs careful warmup.

## Common mistakes

- Forgetting the train/eval-mode difference.
- Stating the internal-covariate-shift story as settled.

## Topic guides

- [Deep learning fundamentals](https://gurkanozkan.ai/learn/topics/deep-learning.md)
- [Transformers, attention and scaling](https://gurkanozkan.ai/learn/topics/transformers.md)
---

*Study material compiled with AI: drafted by a local model (Inkling 2 Mini) from public sources, then checked against those sources by independent AI reviewers (Claude) in November 2026. Not reviewed line by line by a person.*
