Training Stability: Initialization, Normalization & Gradient Problems
You'll learn to
- -Understand why random weight initialization matters, and what goes wrong with a bad choice
- -Understand vanishing and exploding gradients as a direct consequence of repeated multiplication across layers
- -Understand batch normalization as a second, complementary fix for the same underlying problem
Backpropagation explained how a gradient gets computed. This chapter is about what can go wrong with that process once a network gets deep, and the two standard fixes every practitioner reaches for. This is genuinely practical territory. Get initialization or normalization wrong and a network that should train perfectly well simply does not.
Why Not Just Start With All Zeros?
It seems natural to initialize every weight to zero, but that choice quietly breaks training before it even starts. If every weight in a layer starts identical, every neuron in that layer computes the exact same output and receives the exact same gradient during backpropagation. They stay identical forever, no matter how long you train. This is called the symmetry problem, and it is why weights always start as small random numbers instead of a fixed value.
Vanishing Gradients: Shrinking on the Way Back
Recall from the backpropagation chapter that a hidden layer's error signal is the output error multiplied by a weight and an activation derivative, layer after layer. Stack ten or twenty layers, and that gradient gets multiplied by roughly the same small factor ten or twenty times in a row. A factor just below 1, repeated enough times, shrinks toward zero fast. By the time the signal reaches the earliest layers, there may be almost nothing left to learn from. Those layers barely update at all, even while later layers train just fine.
Exploding Gradients: The Opposite Failure
The same multiplication can run the other way. A factor just above 1, repeated across many layers, grows exponentially instead of shrinking. The gradient can blow up to enormous values, causing wild, unstable weight updates that can wreck a training run in a single bad step.
Try all three below and watch the same ten-layer network behave in completely different ways depending on nothing but how it was set up.
Gradient Magnitude, Layer by Layer
Backpropagation multiplies the gradient once per layer on its way back to the input. A small repeated shrink (or growth) compounds fast.
layer (10 = output side, 1 = input side) · bar height is log-scaled
Weights scaled to the layer size. The gradient survives the trip.
Gradient at layer 1 (input side): 8.34e-1 (started at 1.00 at the output)
Weight Initialization: Scaling the Starting Point on Purpose
The fix is to choose the initial random weights carefully, scaled to the size of each layer, so the signal neither shrinks nor grows much as it passes through. Two standard schemes handle this, and they are genuinely named after the papers that introduced them.
Batch Normalization: Fixing It Mid-Network Too
Good initialization only guarantees a stable start. As training proceeds and weights change, the distribution of values flowing into each layer can still drift. Batch normalization addresses this directly, at every layer, throughout training, not just at the start. For each mini-batch, it rescales that layer's inputs to have a mean of 0 and a standard deviation of 1, then lets the network learn a small correction on top if needed.
In practice, you specify the initialization scheme and add batch norm layers with one line each. PyTorch's nn.init.kaiming_normal_ implements He initialization by name (Kaiming is He's given name), and nn.BatchNorm1d or nn.BatchNorm2d adds a batch normalization layer wherever you place it. Both are one-line calls built on exactly the formulas above.
Interview Signal is part of Pro
See a real weak answer next to a real strong one for this exact topic.
Quiz is part of Pro
Test what you just read with a short quiz, and bank the XP.