Why Does Batch Normalization Work?
Reproducing Santurkar et al. live in the browser with TensorFlow.js — testing why BatchNorm accelerates training, why internal covariate shift isn’t the reason, and how it smooths the optimization landscape.
Beyond the conventional story
Batch Normalization is a simple yet extremely effective technique that makes learning with neural networks faster and more stable. Despite its widespread adoption, the theoretical justification of BatchNorm has been vague and shaky. The belief propagating through the ML community is that BatchNorm improves optimization by reducing internal covariate shift (ICS). As we shall see, ICS has little to no effect on optimization.
This post examines the explanations of why BatchNorm works, mainly agreeing with the conclusions from How Does Batch Normalization Help Optimization? (No, It Is Not About Internal Covariate Shift) [1]. It joins the effort to make reproducibility and open source commonplace in ML by reproducing the results from [1] live in your browser using TensorFlow.js. To see the results you will train the models from scratch, made as easy as clicking a button. Parameter initialization is random, so you will observe slightly different trajectories every time you train. The original source code lives in this GitHub repo.
Batch Normalization, step by step
Batch Normalization is applied during training on hidden layers. It is similar to feature scaling applied to the input data, except we do not divide by the range. The idea is to track layer activations along each dimension and then subtract the mini-batch mean and divide by the standard deviation for each batch. The interactive visualization below walks through both steps.
Subtract the mean
Subtracting the batch mean shifts the cloud directly onto the origin (0, 0). Watch the axes and crosshair move.
Normalize the variance
Dividing by the standard deviation rescales every axis to unit variance ( prevents division by zero).
One important detail is that Batch Normalization includes learnable parameters. After centering and normalizing, the layer applies an affine transformation:
Here and are learned parameters and is the output of the BatchNorm layer. If normalization is unhelpful for a given layer, the network can learn the identity mapping and undo it. BatchNorm also behaves differently at test time: rather than computing batch statistics on the fly, it uses the running mean and variance accumulated during training via an exponential moving average.
Does Batch Normalization work?
Before examining why BatchNorm works, let’s convince ourselves that it really works as well as advertised. We will train a convolutional neural network with and without BatchNorm at both a low and a high learning rate. The two architectures are shown below: on the left is a regular CNN, and on the right is the exact same network with BatchNorm inserted after each convolutional block.
We train a digit classifier on the classic MNIST dataset. Click Train in browser below to run all four trainings live on your device (MNIST downloads once and stays cached for the remaining experiments).
Trains 4 fresh networks from scratch on MNIST (LR 0.1 and LR 0.5) and streams held-out test loss & accuracy every 2 steps.
Once training completes, you should see BatchNorm outperforming the baseline at both learning rates. It is common for the standard CNN without BatchNorm to stall or diverge at the higher learning rate, whereas with BatchNorm it simply trains faster.
Internal covariate shift and the error surface
According to the original BatchNorm paper [3], the technique works because it remedies Internal Covariate Shift (ICS) — the change in the distribution of hidden-layer inputs as earlier weights update during training. Concretely, the mean shifts, the variance changes, and the distribution shape drifts. Intuitively this sounds compelling: if the first layer’s activations start roughly Gaussian around one center and then drift and skew as training proceeds, the second layer must continuously adapt. Yet as Santurkar et al. [1] demonstrate, ICS has little to do with optimization performance, and BatchNorm does not even reliably reduce it.
Even before BatchNorm became mainstream, Geoffrey Hinton showed how shifting and scaling inputs reshapes the error surface. As he explained in his Neural Networks Course (Lecture 6.2 — A bag of tricks for mini-batch gradient descent), centering data around zero and normalizing scale gives each dimension similar curvature, turning an elongated, high-curvature elliptical ravine into a far more spherical basin.

Empirical work by D. Jiwoong et al. [2] (figure above) observed clean, unimodal transitions with Batch Normalization, whereas without BatchNorm they reported wide, bumpy surfaces that are not necessarily unimodal. They also found that without BatchNorm, optimization depends heavily on weight initialization — BatchNorm makes the network much less sensitive to its starting state.
Lipschitzness and a smoother optimization landscape
The authors of [1] provide both empirical evidence and theoretical proof that the primary mechanism is geometric rather than distributional:
BatchNorm helps optimization by making the loss landscape significantly smoother — improving the Lipschitzness of both the loss and its gradients — rather than by reducing internal covariate shift.
Formally, a function is -Lipschitz if , and Lipschitzness of its gradients is captured by -smoothness: is -smooth if for inputs . They further show that BatchNorm is not unique in this regard: their , , and activation normalizations yield similar smoothing benefits even when they introduce higher ICS. Fundamental research like this matters not only for understanding, but for cultivating an ML culture built on first principles.
Let’s test the ICS claim directly. We will train three models at the same learning rate (): a Regular CNN, a CNN + BatchNorm, and a CNN + BatchNorm + Noise model where random noise from a non-zero-mean, non-unit-variance distribution is injected immediately after each BatchNorm layer at every step. That noise creates severe, chaotic covariate shift — yet the model still outperforms the regular CNN.
Trains Regular CNN, CNN + BatchNorm, and CNN + BatchNorm + Noise (LR 0.15), tracking train loss/accuracy alongside Layer 2 activation moment shifts.
After training, you should see BatchNorm with or without noise outperforming the regular CNN. Meanwhile, in the bottom two charts, the activation moments (mean and variance) of the noisy BatchNorm model fluctuate wildly from step to step. Even when we intentionally inject massive ICS, the network trains better — directly supporting the authors’ conclusion.
Finally, let’s train Regular CNN vs. CNN + BatchNorm one last time to measure landscape smoothness directly. The left chart tracks how sharply the loss jumps between consecutive steps, and the right chart tracks local “effective” -smoothness measured while stepping in the direction of the gradient. Because deep networks are non-linear, global -smoothness does not hold everywhere, so we probe local effective -smoothness around each iterate. Lower, steadier values indicate a smoother, more predictable gradient field.
Measures how smoothly the loss and activation gradients evolve along the gradient direction across a ∈ [0.05, 0.35]. Lower and steadier curves indicate a smoother landscape.
The local effective -smoothness above is computed by choosing a range of step sizes and, at every training step , evaluating:
where is the gradient of the loss with respect to , the output activations of the first convolution / BatchNorm block.
Papers cited
- [1]Shibani Santurkar, Dimitris Tsipras, Andrew Ilyas, and Aleksander Madry. How Does Batch Normalization Help Optimization? (No, It Is Not About Internal Covariate Shift). arXiv:1805.11604, June 2018.
- [2]Daniel Jiwoong Im, Michael Tao, and Kristin Branson. An Empirical Analysis of Deep Network Loss Surfaces. arXiv:1612.04010, December 2016.
- [3]Sergey Ioffe and Christian Szegedy. Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift. arXiv:1502.03167, March 2015.