Normalization and initialization
Why signal and gradient scale multiply at every layer, Glorot and He initializations, BatchNorm and related layers, residual connections, and a thirty-layer experiment.
From regularization to scale
The topic Losses and regularization trained a three-layer net and asked how to keep it from fitting its training set too well. A network of thirty layers has the opposite problem first: at the default initialization it does not fit its training set at all. Signal and gradient are each multiplied by a factor every layer; over thirty layers any factor other than one grows or shrinks geometrically. This topic derives initializations that set that factor to one, shows what normalization layers compute, and explains how a residual connection carries signal and gradient through depth.
Notation. Pre-activation , activation ; fan-in , fan-out ; weight variance ; adjoint . For normalization: batch size , mean , variance , standardized , learned .
Scale at every layer
For independent zero-mean weights,
and backward with . For ReLU and symmetric , . Over layers both products are raised to power .
On 50 width-256 ReLU layers: unscaled overflows by layer 25; and PyTorch's default crush the signal; only keeps both forward and backward scales usable. A thirty-layer digit net at default init stays at loss for all of training.
Glorot and He
Glorot (symmetric activations near linear): compromise .
He (ReLU): fan-in mode . The backward product then telescopes to , independent of depth. For a layer, Glorot std , He .
PyTorch's nn.Linear default is uniform with variance — He's form with gain squared , six times too small for a plain ReLU stack; it relies on normalization layers to restore scale.
What init cannot fix. After a He-initialized ReLU layer the correlation of two inputs follows the arc-cosine kernel; from orthogonal inputs it climbs to by layer 50. Every example maps toward the same direction — rank collapse. Init sets scale at step 0; it does not keep examples apart during depth.
Batch normalization
Batch normalization standardizes each feature over the batch:
Training uses batch statistics and updates running averages; evaluation (model.eval()) uses the averages. Gradients through the batch statistics sum to 0 and are orthogonal to ; each example's gradient depends on the others.
Small batches hurt: with standardized values are always . Running averages lag after large weight changes. Explanations of why BN helps (internal covariate shift, scale invariance, identity bias in ResNets, noise) are still debated; the practical facts are larger stable learning rates and faster training of deep convnets.
Other normalization axes
Every norm computes ; they differ only in the set :
| layer | |
|---|---|
| BatchNorm | one channel, all examples and positions |
| LayerNorm | one example, all channels (in a Transformer: one token's features) |
| InstanceNorm | one example, one channel |
| GroupNorm | one example, a group of channels ( typical) |
Only BatchNorm's set crosses examples, so only it depends on batch size and has two modes. LayerNorm alone does not undo rank collapse in a plain stack — it restores per-example scale without comparing examples. Residual architectures are what make LayerNorm work in Transformers.
Residual connections
A residual block has Jacobian : an identity path for the gradient. At init, variances add: .
For a branch that returns the input's mean square, over blocks from mean square 1: plain residual ; pre-norm ; scaled . The identity path also slows correlation growth between examples.
Thirty layers on digits
Thirty hidden layers of width 64 on digits, Adam, 12 epochs (means over seeds):
| configuration | cosine at init | val accuracy |
|---|---|---|
| plain, default init | 1.000 | 0.102 |
| plain, He | 0.993 | 0.834 |
| plain, batch norm | 0.335 | 0.556 |
| plain, layer norm | 0.995 | 0.100 |
| residual, default | 0.850 | 0.966 |
| residual, pre-norm LN | 0.758 | 0.961 |
Default stacks learn nothing; He restores gradient but not separation; BN separates examples but can explode gradients without residuals; LayerNorm alone fails like the default; residuals train to validation accuracy.
Signals now keep their scale. Whether training then goes fast and ends somewhere good is up to the optimizer and its schedule. The next topic, Optimizing deep networks, closes the Training module with SGD+momentum, Adam, warm-up, clipping and the curves you watch.
Check your understanding
The same questions as in Pulse. Answers are shared between modes.
Go deeper — optional
Code and labs do not count toward the main percentage or the certificate.
- BatchNorm reduction axesoptional
NumPy: mean/variance over (N,H,W) per channel; verify standardization. Self-check in the notebook.
~15 min · easier on a computer · Normalization and initialization read.
Self-check in the notebook — not part of mastery or the certificate.
Answers are saved on the server and tied to this browser until you sign in.