Batch Normalization › Worked Example: Batch Norm By Hand
Language AI HandbookAll chapters Batch Normalization › Worked Example: Batch Norm By HandOne section · Sections in this chapter12 / 17 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
Let's trace through a single batch normalization step with a concrete mini-batch. Suppose we have a batch of 4 samples with activations for one feature dimension:
Step 1: Compute the batch mean.
Step 2: Compute the batch variance.
Step 3: Normalize. Using :
Notice that the normalized values sum to zero and have unit variance: , and . The normalization has precisely achieved its goal.
Step 4: Scale and shift. With initial parameters and (the default initialization):
Initially, the transformation is pure normalization. As training proceeds, and will shift away from these initial values to match the learned optimal distribution. If the downstream layer works best when inputs are scaled by 2 and shifted by 0.5, gradient descent will move and over the course of training.
What happens in the next training step? If a different batch is drawn with slightly different values, say mean 2.7 instead of 2.5, the normalized values will be different. Sample will be normalized to instead of . This is the stochastic noise of batch normalization. Over many batches, the network learns representations that are robust to this variability.
The figure below shows the effect of batch normalization on activation distributions.


