Prompts Forms Resume Reports ★ Saved ★ Saved★ + Submit a tool
Core concepts

Batch Normalization (BatchNorm)

About 3558 characters Updated Nov 30, 2026 34 views AI wiki

Batch normalization is a technique that standardizes activation values between layers of a neural network using mini-batch statistics and then introduces learnable scaling and shifting. It eases the training difficulty caused by internal covariate shift and lets deeper networks train stably with larger learning rates. Since its proposal it has become an almost standard component of convolutional and fully connected networks, and it is also a classic case for understanding the difference between training and inference modes.

Core Principles

The procedure is: for activations within a batch, compute the mean and variance for each channel along the batch dimension, standardize the activations to zero mean and unit variance, and then apply an affine transform with two learnable parameters, gamma and beta. Note that the last step is crucial: it lets the network recover the original distribution, so in theory no expressive power is lost, and the optimization problem is merely reconditioned.

Why does it work? On one hand, standardization makes the input distribution of each layer more stable, the gradient is no longer dominated by features with overly large scales, and layers can update more independently; on the other hand, batch statistics introduce noise that acts as mild regularization, which is why Dropout can sometimes be reduced or removed once batch normalization is added. It makes the loss surface smoother, permits larger learning rates, and lowers sensitivity to initialization.

At inference there is no batch to speak of, nor should the model depend on which batch the current sample falls into: here the moving-average mean and variance accumulated during training are used, which are estimates over the full data. If the mapping is simply ignored, the training and inference distributions become inconsistent and the output drifts sharply; this is the most error-prone spot in implementation and porting.

Key Points

Mathematically, during training the mean and variance are computed over the N values of a channel in one batch, the square root of the variance with a small constant epsilon is used as the denominator to avoid division by zero, and then the standardization and affine transform follow. Backpropagation must differentiate through the mean and variance, because they are functions of the samples in the batch and gradients propagate across samples; this is the essential difference between batch normalization and ordinary per-sample operations.

Placement is usually after the convolution layer and before the activation function, as in the original paper, though some work argues for placing it after the activation. When the batch size is small the statistic estimates are noisy and performance drops noticeably; here group normalization or layer normalization can substitute, since they do not depend on the batch dimension and suit object detection, segmentation, and sequence models.

Common techniques: run a batch of data through before inference to make sure the moving statistics are updated; when fine-tuning, freeze the statistics while keeping training mode, which can markedly reduce performance degradation on small data; and plot the distribution of batch normalization statistics to help judge whether the model is training normally.

Common Misconceptions

First, treating batch normalization in training mode and inference mode as the same thing, so metrics collapse after deployment. Second, ignoring the momentum hyperparameter, so statistics update too slowly and inference uses stale estimates. Third, forcing batch normalization into scenarios with a batch size of one. Fourth, wrongly believing batch normalization only prevents overfitting, when its main role is to stabilize and accelerate optimization. Fifth, improperly synchronizing statistics across cards in distributed training.

Application Scenarios

Training deep convolutional networks, image-classification backbones, generators of generative adversarial networks, fine-tuning in transfer learning, speech-recognition models, embedding networks of large-scale recommender systems, and online services that need batched inference acceleration.