3.2.8 · D1Training Deep Networks

Foundations — Batch normalization

2,642 words12 min readBack to topic

Before you can read the parent note Batch normalization, you need to own every symbol it throws at you. This page builds each one from absolute zero: plain words → a picture → why the topic needs it.


0. The scene: what is "an activation flowing through a network"?

A neural network is a stack of layers. Each layer takes some numbers, multiplies and adds them, then passes the results up. A single number arriving at one spot in one layer is called an activation.

If you are hazy on how numbers move layer-to-layer, revisit Backpropagation and Training Deep Networks — this page assumes only that "a layer produces numbers".

Figure — Batch normalization

Look at figure s01: one column of the network is highlighted. The little dots are activations. BN operates on one such dot's value, collected across many examples. That collection is our next symbol.


1. The mini-batch: , , and the subscript

We rarely feed the network one example at a time. We feed a small group of examples together — a mini-batch — because the average behaviour of a group is smoother and computers process groups efficiently.

Why the topic needs it: BN's whole trick is to look at one fixed position across the whole batch and standardize those readings together. Without the idea of "a batch of values from one position", there is nothing to compute statistics over.


2. Summation: the symbol

To find the average of the pile we must add all the values up. The Greek capital sigma is shorthand for "add these up".

Why we need it: every statistic below (mean, variance) is secretly one big sum. The symbol saves us from writing "" forever.


3. The mean — the center of the pile

Why BN needs it: to center the pile at zero, you first have to know where its center currently is. That center is , and Step 1 of BN subtracts it.

Figure — Batch normalization

4. Deviation and variance — the spread of the pile

Knowing the center isn't enough; we also need to know how spread out the values are.

We can't just average the deviations — the positive and negative ones cancel to zero (that's what "center" means). So we square each deviation first (squaring makes everything positive and punishes far-away points more), then average.

Recall Aside — why BN divides by

, not This is a design choice, not an error. In statistics class you often divide by (an "unbiased" estimate of a population variance from a sample). BN deliberately divides by (the biased estimator) because it is simpler, matches the mean's , and any scale difference is absorbed by the learnable anyway. Both parent examples use .

Why BN needs it: to make the spread equal to one unit, you must know the current spread. That is , and Step 3 divides by it.


5. Normalization and the guard

Now combine center and spread. "Standardize" means: subtract the center, divide by the spread.

Figure — Batch normalization

Figure s03 shows the transformation: the shape of the pile is unchanged, but it slides to sit over and squeezes/stretches to width . That reshaping is the entire point of BN's first three steps.


6. The learnable dials and

Forcing every pile to mean-0/variance-1 might be too rigid — some layers work better with inputs shifted or stretched elsewhere. So BN adds two adjustable knobs the network learns on its own.

Why the topic needs them: without , BN would trap every layer at a single distribution shape. These dials restore full freedom while keeping the training benefits.


7. Running averages: , ,

At test time you may get one example — you can't compute a batch mean from a single number. So during training BN quietly keeps a slowly-updated memory of typical statistics.

Why the topic needs it: these frozen make BN deterministic at test — same output no matter what else is in the batch. This is the train-vs-test distinction the parent stresses.


8. The gradient symbol

BN must be trainable, so we need to know how a change in each quantity changes the loss.

For BN the two key ones are simple because : Full mechanics live in Backpropagation.


How these feed the topic

activation x

mini-batch B of size m

sum over i

mean mu_B

variance sigma2_B

normalized x-hat

epsilon guard

scale gamma and shift beta

Batch Normalization output y

running averages for test time

partial derivatives

Related normalizers that reuse this same vocabulary but pool differently: Layer Normalization and Group Normalization. The problems BN attacks are covered in Vanishing and Exploding Gradients, Weight Initialization, and Optimization and Conditioning of the Loss Surface; its mild regularizing overlap with Dropout is discussed in the parent.


Equipment checklist

Test yourself — reveal only after you've answered aloud.

What does the activation symbol represent?
One scalar number at one spot in the network for one example.
In , what does the index run over?
Over the examples in the batch, at one fixed neuron/position — not over neurons.
What are and ?
The mini-batch (a small set of examples) and its size (how many examples).
In a convolutional layer, over what does BN compute its mean and variance?
Over all pixels of a feature map across all examples: values, with one per channel.
What does mean?
Add up through ; a compact "total these".
What is as a picture?
The balance/pivot point of the values on a number line — their average.
Why do we square deviations before averaging for ?
Positive and negative deviations would cancel; squaring makes them all positive and measures true spread.
What is the difference between and ?
Variance vs its square root, the standard deviation (spread in original units).
What does the hat in signal, and what is its exact variance?
The standardized version of ; its variance is , i.e. , exactly only as .
Why is there?
A tiny positive cushion so we never divide by zero when the batch has zero spread.
What do and do, and what are their initial values?
rescales, shifts; both learnable, initialized to so BN starts as pure normalization.
Write the running-variance update rule.
.
What is an "affine map"?
A multiply-then-add, — the fixed transform BN becomes at inference.
Why keep , and how are they initialized?
At test there is no batch, so BN uses these stored stats; they start at and are updated each training step.
Write the full inference-time BN formula.
.
What does measure?
How much the loss changes when is nudged — the slope gradient descent uses.