Skip to content
Cosvexa – Cosvexa home

Research · Landmark papers

Batch normalization (2015)

Batch normalization is a layer that normalizes each feature to zero mean and unit variance using the statistics of the current mini-batch, then applies a learned scale and shift. Introduced by Sergey Ioffe and Christian Szegedy of Google in 2015, it let deep networks train with much higher learning rates and far fewer steps, and it became a standard part of convolutional networks such as ResNet.

Cosvexa team · Published

Scattered streams of light at uneven heights pass through a thin glowing ring and leave it aligned into an even, centred band, which then fans out again at a chosen width.

Key points

  • For each feature, BatchNorm subtracts the mini-batch mean, divides by the mini-batch standard deviation, then multiplies by a learned γ and adds a learned β.
  • At inference it uses fixed population statistics collected during training, so the output no longer depends on other examples.
  • The authors reported matching Inception's ImageNet accuracy with 14 times fewer training steps, and a 4.9% top-5 validation error with an ensemble.
  • The paper's explanation, reducing “internal covariate shift”, was later challenged; a smoother optimization landscape is a leading alternative.
  • BatchNorm struggles with small batches and sequence models, so transformers use layer normalization or RMSNorm instead.

What batch normalization is

Training a deep network means adjusting millions of weights at once. Every update to an early layer changes the values that later layers receive, so each layer is learning from inputs whose scale and centre keep moving. Before 2015 this made deep networks touchy: learning rates had to be small, initialization had to be careful, and saturating activations such as the sigmoid were very hard to train.

Batch normalization (BatchNorm, BN) adds a normalization step inside the network. For each feature, it looks at the values that feature takes across the examples in the current mini-batch, shifts them to mean zero and scales them to variance one, then lets the network re-scale and re-shift the result with two learned parameters. It was introduced in “Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift” by Sergey Ioffe and Christian Szegedy of Google, posted to arXiv in February 2015 and published at ICML 2015.

The problem: internal covariate shift

Ioffe and Szegedy named the problem they wanted to solve internal covariate shift: the change in the distribution of each layer's inputs during training, caused by changes in the parameters of the layers before it. It was already known that networks train faster when their inputs are whitened (zero mean, unit variance, decorrelated). Their idea was to apply a cheap version of that to the inputs of every layer, not just the first, and to make the normalization part of the model so that gradients flow through it.

Full whitening of every layer would be expensive, so the method makes two simplifications. It normalizes each feature independently instead of decorrelating features, and it estimates means and variances from each mini-batch instead of the whole dataset.

How batch normalization works

  1. 1

    Compute mini-batch statistics

    For one feature and a mini-batch of m examples, compute the mean μ and variance σ² of that feature's values.

  2. 2

    Normalize

    Replace each value x by (x − μ) / √(σ² + ε), where ε is a small constant for numerical stability. The result has roughly mean 0 and variance 1 within the batch.

  3. 3

    Scale and shift

    Output y = γ · x̂ + β, where γ and β are learned per feature. If the network needs the original values, it can learn γ = σ and β = μ, so normalization never removes capacity.

  4. 4

    Backpropagate through the statistics

    Gradients flow through μ and σ as well, because they are computed from the batch. This is what makes BN part of the model rather than a fixed preprocessing step.

  5. 5

    Switch to population statistics for inference

    After training, the mean and variance are fixed to averages collected over training mini-batches (in practice, usually running averages). BN then becomes a fixed linear transform that can be folded into the preceding layer.

A concrete example

Suppose one feature takes the values 2, 4, 6 and 8 across a mini-batch of four images. The mean is 5 and the variance is (9 + 1 + 1 + 9) / 4 = 5, so the standard deviation is about 2.24. Normalizing gives about −1.34, −0.45, 0.45 and 1.34. If the learned parameters are γ = 2 and β = 1, the layer outputs about −1.68, 0.11, 1.89 and 3.68. If the next training step brings a batch whose values are all ten times larger, the normalized values come out the same, so the next layer sees a stable range.

BatchNorm forward pass for a fully connected layer (training mode)
import numpy as np

def batchnorm_train(x, gamma, beta, eps=1e-5):
    # x has shape (batch, features)
    mu = x.mean(axis=0)
    var = x.var(axis=0)
    x_hat = (x - mu) / np.sqrt(var + eps)
    return gamma * x_hat + beta, mu, var  # mu and var also feed the running averages used at inference

In convolutional networks, BN normalizes each channel using all values of that channel across the batch and across spatial positions, with one γ and β per channel. The paper inserts BN right before the nonlinearity, after the linear or convolutional layer, and notes that the layer's bias becomes redundant because the mean subtraction cancels it.

What the paper reported

The main experiments used the Inception network on ImageNet classification. Simply adding BN helped, but the authors got most of the benefit by also changing the training setup: a higher learning rate, no dropout, a five times smaller L2 weight penalty, faster learning-rate decay, no local response normalization, more thorough shuffling and fewer photometric distortions.

ModelResult as reported by the authors
Inception (baseline)Reached 72.2% validation accuracy after about 31 million training steps
BN-Baseline (Inception plus BN only)Reached 72.2% in about 13.3 million steps, less than half the baseline
BN-x5 (learning rate 5× higher, other changes)Reached 72.2% in about 2.1 million steps, 14 times fewer than Inception
BN-x30 (learning rate 30× higher)Trained slower at first but reached 74.8% after about 6 million steps
BN-x5-SigmoidReached 69.8% with sigmoid activations; without BN, sigmoid Inception never exceeded 1/1000 accuracy
Ensemble of 6 BN networks4.9% top-5 validation error and 4.82% test error, which the authors described as exceeding the estimated accuracy of human raters

The paper also noted that BN acts as a regularizer: because each example's normalized value depends on the other examples in its mini-batch, the network sees slightly different values every time, a kind of noise. The authors reported that this removed the need for dropout in their modified Inception.

Why it matters

  • It made deep convolutional networks easy to train. Higher learning rates, less fragile initialization and fewer steps changed what was practical. ResNet, later in 2015, applied BN right after every convolution, and that pairing defined image models for years.
  • It changed default recipes. The paper's own recipe dropped local response normalization and dropout. ResNet likewise trained without dropout, citing the BN paper's practice, and relying on BN instead of dropout became common in image models.
  • It started a family of normalization layers. Layer normalization, instance normalization, group normalization and RMSNorm all follow the same pattern of normalize, then learn a scale and shift, but compute the statistics over different dimensions.
MethodStatistics computed overTypical use
Batch normalization (2015)The mini-batch (and spatial positions), per feature or channelConvolutional networks for vision
Layer normalization (Ba, Kiros and Hinton, 2016)All features of a single exampleRecurrent networks and transformers
Group normalization (Wu and He, 2018)Groups of channels within a single exampleVision tasks with small batches, such as detection
RMSNorm (Zhang and Sennrich, 2019)Root mean square of a single example's features, without mean subtractionMany recent large language models

Limits and common misconceptions

  • The original explanation is disputed. Santurkar, Tsipras, Ilyas and Madry (NeurIPS 2018) argued that the stability of layer input distributions has little to do with BN's success. They found that BN makes the optimization landscape significantly smoother, so gradients are more predictive and larger steps are safe. The paper's results stand; its proposed reason is now widely questioned, though the exact mechanism is still debated.
  • It depends on the batch. Statistics from a few examples are noisy. Wu and He (2018) reported that BN's error rises quickly as the batch gets smaller, which matters for detection, segmentation and video, where memory limits batch size.
  • Training and inference behave differently. BN uses batch statistics in training and stored averages at inference. Forgetting to switch modes, or running averages that do not match the deployment data, are common sources of bugs and degraded accuracy.
  • It is awkward for sequences. In recurrent models and transformers, sequence lengths vary and examples should not depend on each other. Layer normalization, which normalizes within one example and computes the same thing at training and test time, was proposed partly for this reason. The original transformer uses it, and the transformer architecture has kept per-example normalization ever since.
  • It is not a replacement for a good optimizer or a good architecture. BN makes training more forgiving, but learning-rate schedules, initialization and optimizers such as Adam still matter.

Where it is going

Batch normalization remains common in convolutional vision models, but most of the field's largest models now use per-example normalization: layer normalization in many transformers and RMSNorm, which drops the mean subtraction for speed, in many recent language models. Research continues on where to place normalization (before or after the residual addition), on normalizing queries and keys inside attention for stability, and on training very deep networks with no normalization layers at all.

The lasting idea from Ioffe and Szegedy is that controlling the scale of activations inside the network, with a learnable escape hatch, makes optimization far easier. Almost every modern architecture includes some version of it, even when the batch itself no longer plays a part.

Frequently asked questions

What does batch normalization do?

It normalizes each feature inside a network to zero mean and unit variance using the current mini-batch, then applies a learned scale and shift. This keeps activations in a stable range, which allows higher learning rates and faster training. At inference, fixed averages collected during training replace the batch statistics.

Why does batch normalization work?

The original paper said it reduces internal covariate shift, the drift in each layer's input distribution during training. Later work by Santurkar and colleagues (2018) argued that this is not the main reason and that BN instead makes the loss landscape smoother, so gradients are more reliable. The exact mechanism is still discussed.

What is the difference between batch normalization and layer normalization?

Batch normalization computes statistics for each feature across the examples in a mini-batch. Layer normalization computes them across all features of a single example, so it does not depend on batch size and works the same at training and test time. Transformers use layer normalization or its variant RMSNorm.

Should batch normalization go before or after the activation?

The original paper placed it right after the linear or convolutional layer and before the nonlinearity, and ResNet followed that order. Other placements are used in practice and can work similarly; the best choice depends on the architecture and is usually settled empirically.

Why does batch normalization behave differently at test time?

During training it uses statistics from the current mini-batch, which would make a prediction depend on the other examples in the batch. At test time it uses fixed mean and variance values averaged during training, so each prediction depends only on its own input. Libraries switch between the two with a training or evaluation mode.

References

  1. Ioffe and Szegedy (2015). Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift
  2. Santurkar et al. (2018). How Does Batch Normalization Help Optimization?
  3. Ba, Kiros and Hinton (2016). Layer Normalization
  4. Wu and He (2018). Group Normalization
  5. Zhang and Sennrich (2019). Root Mean Square Layer Normalization

More in this section

Start free: 50 Cosvexa-1 questions a day

Every major model in one workspace; on the Free plan Cosvexa-1 answers 50 questions a day. No card needed to start.