3.2.8 · D3Training Deep Networks

Worked examples — Batch normalization

2,290 words10 min readBack to topic

Every symbol we use is already earned in the parent note, but we restate each the moment it appears so you can read this page from line one.


The scenario matrix

Below is every class of situation BN can produce. Each row is a "cell". The worked examples that follow are labelled with the cell(s) they cover, so you can see the whole territory is filled.

# Case class What makes it tricky Covered by
A Ordinary batch (varied values) baseline; get the mechanics right Ex 1
B Negative & mixed-sign inputs mean can be negative; deviations flip sign Ex 2
C Constant / degenerate batch () division by zero → saves us Ex 3
D Single-element batch () variance always; BN erases everything Ex 3 (limit)
E Large-magnitude / drifting batch shows why BN exists (saturation) Ex 4 (figure)
F Learnable recover identity the "BN is pointless?" objection, answered numerically Ex 5
G Inference on one example (running stats) no batch — use Ex 6
H Backprop numbers () gradients must actually be computable Ex 7
I Word problem (bias is redundant) real design decision: drop the bias Ex 8
J Exam twist (multi-feature batch, per-feature stats) BN normalizes each feature separately Ex 9

Two symbols we lean on constantly:

  • = number of examples in the mini-batch (one scalar activation each).
  • (the batch mean, the center), (the batch variance, the spread). We divide by , not — BN uses the biased estimator.

Ex 1 — Cell A: the ordinary batch


Ex 2 — Cell B: negative and mixed-sign inputs


Ex 3 — Cells C & D: constant batch and single element (degenerate)


Ex 4 — Cell E: why BN exists (saturation of a drifting batch)


Ex 5 — Cell F: can recover identity (answering the objection)


Ex 6 — Cell G: inference on a single example


Ex 7 — Cell H: backprop numbers through and


Ex 8 — Cell I: word problem (the bias is redundant)


Ex 9 — Cell J: exam twist (per-feature normalization)


Recall Which cell breaks BN, and what replaces it?

Small-batch / single-example degeneracy (Cells C, D) makes noisy or zero. ::: Use Layer Normalization or Group Normalization, which normalize across features within one example, so they don't depend on batch size.

See also: Weight Initialization, Dropout, and the parent Batch normalization · Training Deep Networks.