Interactive Lab · Training Deep Networks
Push a batch of numbers through a deep network and something quietly goes wrong: each layer rescales the activations a little, and over many layers those little changes compound. Soon the numbers are either exploding into the thousands or collapsing to zero, and a network whose activations look like that can't learn. Batch normalization is a dead-simple fix: after each layer, re-center and re-scale the batch to mean 0, std 1. Flip it on and watch every layer snap back to health.
▶ The playground, watch the activations flow through depth
After each layer, subtract the batch mean and divide by the batch std, forcing that layer's activations back to a clean mean-0, std-1 distribution before they flow on. Click to toggle.
Normalization (BatchNorm/LayerNorm) is what keeps deep networks trainable, it stops activations from exploding or vanishing across layers. LayerNorm sits in every transformer block. When training is unstable or the loss goes NaN, normalization is one of the first things to check.
The code that's actually running
With BatchNorm off, slide the weight scale from 3.0 down to 0.6. At the top, the bars rocket off the chart (activations in the hundreds); at the bottom, they shrink to nothing (dead units). There's only a razor-thin "just right" setting in between, which is exactly why deep nets were so fiddly to initialize. Now turn BatchNorm on and sweep the same slider: the bars barely move. BatchNorm makes the network robust to the init, you can be sloppy about weights and use a bigger learning rate, and it still trains. That robustness, more than any single trick, is why it made very deep networks practical.
The takeaway