A small gradient is not automatically a fault: near a stationary point, it may be appropriate. The concern here is attenuation or amplification along the computational path between the loss and earlier computations.
Twenty multiplications, very different outcomes
Take a deliberately linear scalar chain with twenty steps, each multiplying its input by a fixed number . Let the loss be the final output itself, so its derivative with respect to that output is one. The chain rule gives
With , the derivative is . With , it is approximately . Every local derivative is finite and nonzero; multiplication alone creates the extreme scale difference. With , the derivative remains one.
These are synthetic sensitivities, not trained forecasting results. Real networks have changing derivatives, multiple paths and parameter-gradient contributions that can add or cancel. The toy isolates a mechanism, rather than claiming that depth always causes it.
The vector version depends on direction
For a layer , let be its Jacobian matrix and use column gradients . The backward recursion is
Match the intervention to the failure
- Initialisation and activation choice: aim to start with usable forward and backward scales. The appropriate variance depends on the activation and layer widths; an initialisation argument does not guarantee stability throughout training.
- Residual connections: a compatible block has Jacobian . This supplies an identity contribution, as analysed by He et al., §2. It does not guarantee a nonzero total derivative: the scalar choice makes the block constant and its derivative zero. See residual network for shortcut and activation-order details.
- Gradient clipping: bounds the supplied gradient according to a chosen rule, helping contain large excursions. It cannot recover a contribution already erased by the derivative chain. Clipping also does not by itself bound every adaptive optimiser’s complete parameter update; see gradient clipping.
Inspect gradient norms by layer or temporal distance, activation distributions, and actual parameter-update sizes. A single overall norm can hide weak early-layer signals. Loss spikes warrant checking finite inputs, loss scaling and learning rate as well as gradient propagation; a flat loss alone does not identify vanishing gradients.
Check the mechanism
A scalar path has successive local derivatives , and , with incoming loss derivative one. Must its gradient explode because two factors exceed one?
Sources
- Pascanu, Mikolov and Bengio (2013), On the difficulty of training recurrent neural networks, §§1.1–2.1 and 3.2. Temporal contributions, Jacobian products and norm clipping.
- Glorot and Bengio (2010), Understanding the difficulty of training deep feedforward neural networks, §§3–4. Activation saturation and initialisation analysis.
- He, Zhang, Ren and Sun (2016), Identity Mappings in Deep Residual Networks, §§2 and 4. Identity paths and activation ordering.