DL0007 Batch Norm

Why use batch normalization in deep learning training?

Answer

Batch normalization stabilizes and accelerates training by normalizing each layer’s inputs across the mini-batch: subtract the batch mean and divide by the batch standard deviation. After normalization, a learnable scale \gamma and shift \beta let the network recover the identity transformation if needed. BN is applied after the linear transform (e.g., the convolution) and before the activation (e.g., ReLU).

(1) Stabilizes Learning: Reduces internal covariate shift, making training less sensitive to initialization and hyperparameter choices.
(2) Enables Higher Learning Rates: Larger learning rates can be used without instability, leading to faster convergence.
(3) Improves Generalization: Normalizing per mini-batch introduces noise into activations, preventing over-reliance on specific batches and acting as a mild regularizer.

Batch normalization pipeline transforming a mini-batch through batch statistics, normalization, and learnable scale and shift to produce the output.

Figure 1: Each feature channel is normalized using its mini-batch statistics, then rescaled by learnable \gamma and \beta.

Mathematical Formulation:
BN(x_i) = \gamma \left( \frac{x_i - \mu_B}{\sqrt{\sigma_B^2 + \epsilon}} \right) + \beta

Where:

  • x_i is an individual feature value in the batch.
  • \mu_B and \sigma_B^2 are the mean and variance of that feature across the current mini-batch.
  • \epsilon is a small constant (e.g., 10^{-5}) added for numerical stability.
  • \gamma and \beta are learnable scaling and shifting parameters.
Comparison of batch normalization during training using per-batch statistics versus inference using frozen running averages.

Figure 2: Training computes per-batch statistics and updates running averages; inference uses the frozen running averages, producing deterministic outputs.

Placement in a CNN Block: BN sits between the linear transform and the non-linearity: Conv2D → BatchNorm → ReLU.

Standard CNN block pipeline showing BatchNorm positioned between the Conv2D linear transform and the ReLU activation.

Figure 3: In a standard CNN block, BatchNorm normalizes the convolution output before the activation function.


Login to view more content


Log in to track your progress

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *