How does the product of layer Jacobians explain vanishing and exploding gradients in a deep feed-forward network, and why are sigmoid networks especially prone to vanishing gradients?
Deep learning, Optimisation of deep networks
Level L3 Intermediate. Length Medium. Nature Th+Mat Both.
What's being asked
Whether you can write the backward pass as a product of Jacobians and bound its norm.
Key idea
Let layer compute and , with activation . Its Jacobian (the matrix of partial derivatives) is , and . Using the spectral norm (the largest singular value), . A product of factors shrinks or grows geometrically.
Steps
- Write the layer map and its Jacobian: .
- Apply the chain rule, writing for the loss: .
- Bound the norm by the product of the factor norms. If each factor is below 1, the gradient vanishes geometrically in . If the largest singular values are consistently above 1, it explodes.
- Sigmoid: . With the bound is ; for that is about . So the early layers barely learn.
- List remedies and what each fixes: ReLU (, so no shrinking factor); Xavier or He initialisation, to keep the factors near 1; batch or layer normalisation; residual connections (, where is the residual branch, so the identity carries the gradient); and gradient clipping for exploding gradients.
Common mistakes
- Writing a sum of terms instead of a product of Jacobians.
- Saying vanishing gradients mean the loss is zero or the model has converged.
- Claiming ReLU removes the problem entirely. Weight norms and dead units still matter.
- Treating it as an RNN-only issue. An RNN gives the same product, with a shared .
How long your answer should be
About 3 minutes; one product formula and one bound.
Last checked on 4 December 2026.
Read this
Previous in Deep learning: For a two-layer network , , trained with cross-entropy on one example with true class , what are the gradients of the loss with respect to in matrix form, and do their shapes check out?
Next in Deep learning: What is the batch normalisation forward pass for one feature? For a mini-batch of activations with , and , what are the outputs? What changes at inference time, and why do transformers use layer normalisation instead?