Good
That is exactly what batch normalization does. For each pre-activation, it
normalises the values across the mini-batch to mean
Fix one pre-activation feature and look at its values across a mini-batch of
Step 1 — the batch mean. Average the feature over the batch; this is the centre we will subtract off:
Step 2 — the batch variance. The mean squared deviation from that centre, measuring the spread we will divide out:
Step 3 — normalise. Shift by the mean and divide by the standard deviation.
The small constant
By construction the
Step 4 — scale and shift, learnably. Forcing mean
Crucially the network can undo the normalisation if that is what minimises the loss:
setting
One subtlety: at training time
and at inference those fixed running statistics replace the batch statistics. The transform then becomes a plain, deterministic affine map — no batch required.
It's tempting to assume a trained network behaves identically no matter when you call it — batch normalization is the classic counter-example. During training each pass normalises using that mini-batch's own mean and variance, which change from batch to batch. At inference you often feed the model a single example — there is no "batch" to measure a mean or variance from, so the layer must fall back on the fixed running averages it accumulated while training. Forget to flip that switch — a classic bug is leaving a framework's batch-norm layer in "training mode" during evaluation or deployment — and the model quietly computes something different from what it was tested on: predictions on a single input can drift, or even depend eerily on whichever other examples happen to share its batch. Always confirm your framework has switched to inference/eval mode before shipping a model.
The original 2015 paper (Ioffe & Szegedy) explained batch norm through internal covariate shift: as earlier layers update, the distribution of inputs to later layers keeps shifting, so each layer is forever chasing a moving target. Pinning every layer's inputs to a fixed mean and variance, the story went, stops the shift and lets layers learn in peace.
It is a tidy intuition — but later work (Santurkar et al., 2018) cast doubt on it: you can
inject covariate shift back in and batch norm still helps. The modern
reinterpretation is geometric: batch norm smooths the loss landscape,
making the gradients more predictable and Lipschitz-bounded. A smoother
The faint bell is a messy raw feature — off-centre and too wide. Batch norm
first standardises it to the clean unit bell (mean