Part IX — Deep Learning Regularization, Normalization & Training Dynamics · Chapter 3

Batch normalization

Hook

Chapter 8 needed exactly the right weight scale to keep a deep network stable. What if a layer could just fix its own scale, no matter what came before it?

Intuition
scale = 0.05 — with batch norm, layer 6 RMS = 1.000

Same broken scale from Chapter 8 — the faint line still vanishes exactly as before. The bold line is the same network with one thing added after every layer: batch normalization. It barely moves.

Formalize

Batch normalization re-centers and rescales a layer's output across a batch of examples, at every layer, regardless of what produced it:

h^j=hjμjσj2+ϵ\hat h_j = \frac{h_j - \mu_j}{\sqrt{\sigma_j^2 + \epsilon}}
  • h^j\hat h_j — neuron jj's output after normalization, mean 00 and variance 11 by construction.
  • hjh_j — neuron jj's raw output, before normalization.
  • μj\mu_j — the mean of neuron jj's output, measured across the current batch.
  • σj2\sigma_j^2 — the variance of neuron jj's output, measured across the current batch.
  • ϵ\epsilon — a tiny constant that keeps the division from blowing up when the variance is near zero.
  1. Mean 0, variance 1 — by construction

    μj\mu_j and σj2\sigma_j^2 are simply the mean and variance of neuron jj's output, measured across the current batch. Plug them in and every neuron comes out with mean 00 and variance 11 — by construction, not by hoping the weight scale happened to be right.

Play
without BN: 9.77e-1 — with BN: 1.000

Drag the scale anywhere — tiny, huge, exactly ideal. The faint line swings across nine orders of magnitude. The bold one barely leaves 11. Batch norm doesn't care what scale produced the input; it forces the output to a fixed scale every time.

Worked example
  1. Without batch norm, at scale 0.05

    Six layers shrink the RMS (short for Root Mean Square) activation from about 11 down to under 10510^{-5} — dead, exactly as in Chapter 8.

  2. With batch norm, at every scale tried

    Insert batch normalization after each layer instead, and every single layer's RMS activation comes out within about 0.5%0.5\% of exactly 11 — from 0.050.05 all the way to 1.01.0.

  3. Compare the spread

    The five-scale spread in final-layer RMS with batch norm is under 0.050.05, compared to nine orders of magnitude without it.

Checkpoint

Pick a scale that would badly break the network without batch norm — then confirm the batch-normalized version stays healthy anyway.

without BN: 9.77e-1 — with BN: 1.000
Move the scale slider to try it
Summary
h^j=hjμjσj2+ϵ\hat h_j = \frac{h_j - \mu_j}{\sqrt{\sigma_j^2 + \epsilon}}

Batch norm doesn't fix a bad weight scale — it makes the weight scale stop mattering, by re-establishing a healthy activation distribution at every layer regardless of what arrived there. That's also why training got noticeably more forgiving of learning rate and initialization choices once batch norm became standard. The next chapter looks at a completely different kind of fix — one aimed not at unstable activations, but at a network that's learned its training data a little too well.