Initialization & Signal Propagation
Keeping activations and gradients alive through depth.
Before a deep network learns anything, its random initial weights decide whether a signal entering the first layer reaches the last one, and whether a gradient can travel back. Get the scale slightly wrong and both shrink or grow exponentially with depth. This lesson derives the classic initializations from variance propagation, develops the mean-field theory of order, chaos and the edge between them, shows why the whole spectrum of the Jacobian matters, and explains how residual scaling, Fixup and gated recurrent cells keep very deep computations trainable.
What you’ll learn
- Derive Glorot and He initialization from the forward and backward propagation of variance, including ReLU's factor .
- Compute the fixed point of the length map and the slope that separates ordered from chaotic networks, and connect to vanishing and exploding gradients and to trainable depth.
- Explain dynamical isometry: why Gaussian weights give a Jacobian spectrum whose variance grows linearly with depth, why orthogonal weights do not, and why ReLU networks cannot reach isometry.
- Derive the variance growth of residual networks and Fixup's scaling , and bound gradients through time in recurrent networks.
Variance propagation
Take a fully connected layer at initialization, with independent zero-mean weights of variance , biases of variance , and weights independent of the incoming activations. Track the variance of a pre-activation forward, and of an error signal backward.
Forward. A sum of independent zero-mean terms has variance equal to the sum of their second moments. Note the second moment , not the variance: ReLU outputs do not have mean zero.
ReLU. For symmetric about 0, ReLU keeps exactly half of the second moment: . With , the variance is preserved through any number of layers exactly when , that is (He, Zhang, Ren & Sun, 2015). For near the origin, and the same argument gives .
Backward. sums terms. Treating the backward weights as independent of the forward signal (the standard mean-field approximation):
For ReLU, , so the backward pass wants . Glorot & Bengio (2010), working with tanh-like units near their linear regime, compromised between and ; He et al. observed that either condition alone suffices, because the other side's product of width ratios telescopes to a constant such as instead of shrinking exponentially.
A 50-layer ReLU network is initialized with (appropriate for tanh, not ReLU) and no biases. By what factor does the pre-activation variance shrink from the first layer to the last? Give of the factor.
Show the answer
-15
With the recursion is : 49 halvings separate layer 1 from layer 50, a factor , about . The signal reaching the output is drowned out by rounding errors, and by the backward formula the gradient shrinks the same way. With the factor would be exactly 1.
| Scheme | Designed for | Source | |
|---|---|---|---|
| LeCun | tanh-like units near the origin | LeCun, Bottou, Orr & Müller (1998) | |
| Glorot (Xavier) | tanh, sigmoid, linear; balances forward and backward | Glorot & Bengio (2010) | |
| He (Kaiming) | (or ) | ReLU | He, Zhang, Ren & Sun (2015) |
| Orthogonal | , | any; exact norm preservation in linear networks | Saxe, McClelland & Ganguli (2014) |
Order, chaos and the edge
Poole, Lahiri, Raghu, Sohl-Dickstein & Ganguli (2016) and Schoenholz, Gilmer, Ganguli & Sohl-Dickstein (2017) followed two inputs through a wide random network, tracking each one's length and their correlation . In the wide limit, both evolve by deterministic maps. Write for an average over a standard Gaussian .
Length. The forward variance recursion, iterated, converges to a fixed point for bounded activations:
Correlation. At the fixed length, the pre-activations of the two inputs are jointly Gaussian with correlation ; write and :
is always a fixed point: identical inputs stay identical. Its stability is the slope of the correlation map there, which differentiates to
Ordered phase (): nearby inputs converge, with depth scale , so deep layers can no longer tell inputs apart. Chaotic phase (): nearby inputs decorrelate toward a fixed point , and tiny input changes produce large output changes. At the edge of chaos, , the depth scale diverges.
The same number governs gradients. In the backward recursion with equal widths, is exactly . So the ordered phase is the vanishing-gradient phase and the chaotic phase the exploding one (Schoenholz et al., 2017):
| 0 | 0.05 | 0.1 | 0.2 | 0.3 | 0.5 | |
|---|---|---|---|---|---|---|
| critical () | 1 | 1.12 | 1.19 | 1.30 | 1.40 | 1.55 |
| fixed point there | 0 | 0.15 | 0.27 | 0.51 | 0.76 | 1.32 |
The practical claim of Schoenholz et al. is that random networks are trainable precisely when information can travel through them: the depth scales bound how deep a network can be trained for given , and arbitrarily deep networks train only close to criticality. They also showed that dropout destroys the critical point, which limits trainable depth.
Dynamical isometry: the whole spectrum
pins the mean squared singular value of the input–output Jacobian at 1, but gradient-based learning also cares about the spread. If some singular values are huge and others tiny, gradient steps are badly conditioned even though the average is fine. Dynamical isometry asks for all singular values of to concentrate near 1 (Saxe, McClelland & Ganguli, 2014; Pennington, Schoenholz & Ganguli, 2017).
Take a linear network () with independent Gaussian weight matrices of variance , the critical scale. Each layer preserves the expected squared norm, so the mean squared singular value of is 1 at every depth:
As , the squared singular values of a product of such matrices follow the Fuss–Catalan distribution, whose moments are . The second moment is , so the variance grows linearly with depth (and the largest squared singular value grows like ):
With orthogonal matrices (), is a product of orthogonal matrices, hence orthogonal: every singular value is exactly 1 at every depth. Saxe et al. (2014) showed that deep linear networks initialized this way learn in a time that does not grow with depth, unlike scaled Gaussian initializations.
A very wide 100-layer linear network has independent Gaussian weights at the critical scale. What is the variance of the squared singular values of its input–output Jacobian?
Show the answer
100
, while the mean stays exactly 1: a spectrum so spread out that the largest squared singular values are hundreds of times the typical ones. The same network with orthogonal weights has variance 0. A quick simulation with gives about 1, 2, 5 and 10.6 for , close to the wide-limit values.
With nonlinearities, each also shapes the spectrum. Using free probability, Pennington, Schoenholz & Ganguli (2017) computed the full singular-value distribution of and found that ReLU networks are incapable of dynamical isometry: about half of each is zero, which spreads the spectrum whatever the weight scale. Sigmoidal networks can reach isometry, but only with orthogonal weights, at criticality and with small so that most units operate near their linear regime; such networks trained orders of magnitude faster than ones that were not isometric. Xiao, Bahri, Sohl-Dickstein, Schoenholz & Pennington (2018) extended the conditions to convolutions with orthogonal kernels and trained plain convolutional networks with 10,000 layers.
Residual networks and Fixup
A residual block computes , so its Jacobian is , and gradients always have the identity path. The forward pass, however, has its own problem. At initialization, with zero-mean weights in , the cross term vanishes in expectation:
If every branch is He-initialized so that , the squared norm doubles at every block: growth over blocks. Scaling each branch by gives ; with this is , bounded at any depth. Normalization does something similar implicitly: De & Smith (2020) showed that at initialization batch normalization downscales each residual branch relative to the skip connection by a factor on the order of the square root of the depth, so deep normalized residual networks start out close to the identity.
Let each of the residual branches be layers with ReLU between them, , and scale the branch's weights by relative to He initialization. The gradient with respect to one layer's weights carries the other layers' scales, a factor , and a step of size changes the branch's output by that weight change times another :
Fixup ("fixed update") asks that one SGD step change the network's output by in total, independent of depth. With branches each contributing :
The full recipe: (1) initialize the classification layer and the last layer of each residual branch to zero; (2) initialize every other layer with a standard method such as He, and scale the weight layers inside residual branches by ; (3) add a scalar multiplier (starting at 1) to every branch and scalar biases (starting at 0) before each convolution, linear and activation layer. The authors found rule 2 essential, and with it trained residual networks of 10,000 layers, without normalization, as stably as with it.
A residual network without normalization has 50 residual branches of 2 layers each. By what factor does Fixup scale the weight layers inside the branches?
- 1: Fixup only zeroes the last layer
Show the answer
C.
With , the exponent is , so . Deeper branches need less scaling per layer, because the scales of their layers multiply: would give .
Depth in time: recurrent networks
A recurrent network is a network as deep as its sequence is long, with the same weights at every layer. A loss at time reaches the state at time through a product of Jacobians.
Differentiate the recursion step by step:
Let ( for tanh, for the sigmoid) and be the largest singular value. Submultiplicativity of the spectral norm gives a geometric bound:
So is sufficient for long-range gradient contributions to vanish exponentially; conversely is necessary, but not sufficient, for them to explode. Since the gradient for sums contributions from all pairs , the short-range terms dominate and long-range dependencies are learned slowly or not at all: the diagnosis of Hochreiter (1991) and Bengio, Simard & Frasconi (1994).
Explosions are handled by gradient clipping, , which Pascanu et al. proposed together with this analysis. Vanishing needs a change of architecture. The LSTM (Hochreiter & Schmidhuber, 1997), in its now-standard form with a forget gate, carries a cell state updated additively, ; along that path the Jacobian is , so when the forget gates stay near 1 the error flows back nearly undiminished over many steps. Orthogonal or unitary recurrent matrices attack the same product directly, and residual connections play the same role across depth.
Key takeaways
- Variance propagation, forward and backward, gives He (, for ReLU's factor ) and Glorot () initialization.
- In wide random networks, separates order (, vanishing gradients, depth scale ) from chaos (, exploding gradients); trainable depth diverges only at the edge of chaos.
- Dynamical isometry needs the whole Jacobian spectrum near 1: critical Gaussian linear networks have , orthogonal ones are exactly isometric, and ReLU networks cannot be isometric at all.
- Residual branches add variance, growth if unscaled; scaling by , normalization, or Fixup's with zero-initialized last layers keeps very deep residual networks trainable.
- Through time, : clipping tames explosions, and additive gated memory (LSTM) keeps gradients alive.
Check yourself
In the interactive lesson these are scored with your confidence, and what you miss comes back for review.
Why does He initialization use for ReLU layers, twice the value used for tanh?
- Because ReLU outputs are twice as large as tanh outputs
- Because ReLU discards the negative half of a symmetric pre-activation, so its second moment is , and the factor 2 makes up for the loss
- Because ReLU networks have twice as many parameters
- Because the backward pass needs twice the variance of the forward pass
Show the answer
B. Because ReLU discards the negative half of a symmetric pre-activation, so its second moment is , and the factor 2 makes up for the loss
The forward recursion is . For ReLU the second moment is half of , so keeps constant; for tanh near the origin and suffices.
In the mean-field theory of a deep tanh network, . What does that imply?
- Nearby inputs become more and more similar with depth, and gradients vanish
- The network is exactly at the edge of chaos
- Nearby inputs decorrelate with depth, and mean squared gradients grow from layer to layer
- Nothing about gradients: concerns only the forward pass
Show the answer
C. Nearby inputs decorrelate with depth, and mean squared gradients grow from layer to layer
is the derivative of the correlation map at its fixed point ; above 1 that fixed point repels, so small input differences are amplified (chaos). The same multiplies per layer going backward, so gradients explode.
Which initialization gives a deep linear network an input–output Jacobian whose singular values are all exactly 1?
- Orthogonal weight matrices
- Gaussian weights with variance
- Gaussian weights with variance
- All weights equal to
Show the answer
A. Orthogonal weight matrices
A product of orthogonal matrices is orthogonal, so every singular value is 1 at every depth. Critical Gaussian weights get the mean squared singular value right but leave a spread with variance ; variance doubles the squared norm at every layer.
A tanh recurrent network has a recurrent matrix with largest singular value 1.5. Must its gradients explode over long sequences?
- Yes: grows without bound
- Yes, unless gradient clipping is used
- No: they always vanish, because tanh saturates
- No: is necessary for explosion but not sufficient; the activation slopes and the directions involved can still make the product shrink
Show the answer
D. No: is necessary for explosion but not sufficient; the activation slopes and the directions involved can still make the product shrink
The bound is only an upper bound. Saturated units have small , and the error signal need not align with the top singular direction, so the actual product can shrink even when . Explosion requires , but that is not enough to cause it.
Further reading
- X. Glorot & Y. Bengio, "Understanding the difficulty of training deep feedforward neural networks," Proceedings of the 13th International Conference on Artificial Intelligence and Statistics, PMLR 9, 249–256 (2010).
- K. He, X. Zhang, S. Ren & J. Sun, "Delving deep into rectifiers: surpassing human-level performance on ImageNet classification," IEEE International Conference on Computer Vision (ICCV) (2015).
- S. S. Schoenholz, J. Gilmer, S. Ganguli & J. Sohl-Dickstein, "Deep information propagation," International Conference on Learning Representations (ICLR) (2017).
- J. Pennington, S. S. Schoenholz & S. Ganguli, "Resurrecting the sigmoid in deep learning through dynamical isometry: theory and practice," Advances in Neural Information Processing Systems 30 (2017).
- H. Zhang, Y. N. Dauphin & T. Ma, "Fixup initialization: residual learning without normalization," International Conference on Learning Representations (ICLR) (2019).