Weight Initialization › Vanishing and Exploding Activations
Language AI HandbookAll chapters Weight Initialization › Vanishing and Exploding ActivationsOne section · Sections in this chapter4 / 19 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
Suppose we fix the symmetry problem by using random initialization. We draw weights from a standard normal distribution . At first this seems reasonable, but a deep network reveals a severe problem.
In a layer with inputs, each pre-activation sums weighted inputs. If each weight has variance 1 and each input has variance 1, then the pre-activation has variance . Its standard deviation is . For a layer with 256 inputs, every layer amplifies the signal by a factor of .
After 10 layers, the signal has grown by a factor of . This is exploding activations: values become astronomically large, causing numerical overflow or saturating activation functions.
The opposite problem occurs with too-small initialization. If weights are drawn from , each layer reduces the signal by a factor of roughly . For 256 inputs this is . After 10 layers, the signal shrinks to . This is vanishing activations: the network loses the ability to distinguish inputs, and gradients vanish with the activations.
Both failure modes prevent learning. The goal is to find an initialization scale that keeps activations in a reasonable range throughout the network, regardless of depth.
The gradient side of the picture is equally important and often more immediately damaging to training. When activations vanish, the gradients that flow backward during backpropagation vanish with them. This happens because the gradient of the loss with respect to a weight in an early layer requires multiplying many terms together through the chain rule, and if any activation is near zero, its contribution to the gradient chain is near zero. This is the vanishing gradient problem, and it is what made networks with more than a few layers so notoriously difficult to train before principled initialization and techniques like batch normalization were introduced.
When activations explode, the gradients can explode too, driving weight updates to extreme values and destabilizing the optimization. In practice, activation saturation with sigmoid or tanh is another failure mode: once activations reach the flat regions of these functions, their derivatives are essentially zero, and gradients stop flowing regardless of whether the pre-activations have exploded or not.
import numpy as np
np.random.seed(42)
def forward_pass(x, weights, activation="tanh"):
"""Propagate input through multiple layers and return all activations."""
activations = [x]
for W in weights:
x = x @ W
if activation == "tanh":
x = np.tanh(x)
elif activation == "relu":
x = np.maximum(0, x)
activations.append(x)
return activations
# Simulate a 10-layer network with different initialization scales
n_layers = 10
layer_size = 256
batch_size = 100
scales = [0.01, 0.1, 1.0, 2.0]Effect of initialization scale on activations (tanh network): ------------------------------------------------------------ Scale 0.01: Final layer std = 0.000000 Scale 0.10: Final layer std = 0.633119 Scale 1.00: Final layer std = 0.973512 Scale 2.00: Final layer std = 0.988212
The output reveals the two failure modes. Scale 0.01 produces nearly zero activations after just 10 layers. Scale 2.0 saturates tanh immediately, because activations hit the saturation zone where gradients are nearly zero. Scales 0.1 and 1.0 are better, but neither is precisely calibrated.


The violin plots make the failure modes visible. Small initialization compresses all activations toward zero layer by layer. Large initialization immediately saturates them into two spikes near . We need a principled way to find the scale that keeps activations in the useful middle range.