Batch Normalization in a Deep Classifier, Worked by Hand
Batch normalization rescales each activation over a mini-batch to mean zero and variance one, then lets the network learn its own scale and shift. Ioffe and Szegedy introduced it because the distribution of each layer's inputs keeps changing as the earlier layers train, which forces low learning rates and careful initialization. They call this internal covariate shift.
Algorithm 1 in the paper takes the values of one activation over a mini-batch and computes four lines: the mini-batch mean, the mini-batch variance, the normalized value (x − mean) / sqrt(variance + ε), and the output γ times that value plus β. Here ε is a small constant for numerical stability, and γ and β are learned.
Try it by hand. Take the batch {1, 2, 3, 6}. The mean is 3. The variance is (4 + 1 + 0 + 9) / 4 = 3.5. With ε = 0.001 and γ = 1, β = 0, the outputs are −1.07, −0.53, 0.00 and 1.60. They sum to zero, and their variance is 3.5 / 3.501, about 1. The paper notes that the output for one example depends on the others in its batch.
What did it buy? Applied to an Inception image classifier, the paper's BN-x5 variant needed 14 times fewer training steps to reach 72.2% accuracy. An ensemble reached 4.9% top-5 validation error.