Batch norm
Batch-level normalization that rescales activations using statistics pooled across examples, common in convolutional networks but uncommon inside modern transformers.
Batch norm steadies features by using the minibatch's shared mean and variance, which works best when examples line up cleanly but becomes awkward when token streams, batch sizes, or decoding steps vary from one pass to the next.
At a glance
Released
February 2015
Authors
Sergey Ioffe, Christian Szegedy
Optimizes
- Training Stability
What It Is
Batch normalization computes feature statistics across the minibatch, rescales each feature with those shared numbers, then applies learned scale and shift. One example is partly normalized using information from its batch neighbors rather than only from its own hidden state.Why It Exists
Batch norm mainly targets training stability in settings where many examples share the same feature layout. It can reduce internal scale drift and make optimization easier when minibatches are large enough to give reliable statistics.How It Works
For each feature or channel, batch norm measures the minibatch mean and variance, recenters the values, rescales them by the stabilized spread, then applies learned gain and bias. During inference it uses running estimates collected during training rather than the live minibatch.Input activationsBatch mean and varianceNormalize each channelLearned scale and shiftOutput activationsInput activations to Batch mean and varianceBatch mean and variance to Normalize each channelNormalize each channel to Learned scale and shiftLearned scale and shift to Output activations
Math Or Compute Schema
The formula below summarizes one normalized feature channel. The important distinction is the subscript B: the mean and variance come from the batch, not from one token or one hidden vector alone.- Feature values for one channel before normalization.
- Mean of that feature over the current minibatch.
- Variance of that feature over the current minibatch.
- Small constant for numerical stability.
- Learned per-feature scale.
- Learned per-feature shift.
Compared To Nearby Modules
Batch norm shares statistics across examples. Layer norm and RMSNorm stay inside one token or hidden vector, while group norm stays inside one example but uses smaller channel groups. That difference is why batch norm fits image minibatches better than autoregressive transformer decoding.| Comparison dimension | Batch Norm | Layer Norm | Group Norm |
|---|---|---|---|
| Statistics scope | One feature or channel across the minibatch | All features inside one token or hidden vector | Small channel groups inside one example |
| Depends on batch neighbors | Yes; each example uses shared batch statistics | No; each token is normalized on its own | No; groups stay inside one example |
| Common use | Convolutional and vision models with stable batches | Transformer blocks and sequence models | Vision models when batch norm is awkward at small batch sizes |