What is a vanishing gradient?
A vanishing gradient occurs when, during backpropagation, the error signal shrinks exponentially towards zero as it travels back through layers or time steps. Early layers barely learn and recurrent networks cannot link events far apart in time.
Unlike an exploding gradient, whose norm grows sharply during training, a vanishing gradient falls towards zero. Both stem from products of Jacobian matrices, which can shrink to zero or explode to infinity.
- Topic
- Machine learning, models and training
- Also known as
- Vanishing gradient problem
- Origin
- 1994 IEEE Transactions on Neural Networks paper; long-term dependencies in recurrent networks
How a vanishing gradient works
- The chain rule multiplies layer derivatives; repeated factors below one shrink the signal exponentially.
- Saturating activations such as the sigmoid push derivatives towards zero, especially in the top hidden layer.
- Normalised initialisation and normalisation layers let networks with tens of layers start converging.
- ReLU activations, Long Short-Term Memory units and residual connections give gradients an uninterrupted path.
Commonly confused terms
| Term | How it differs |
|---|---|
| Exploding gradient | An exploding gradient is a sharp rise in the norm of the backpropagated gradient during training that destabilises updates; it is usually tamed with gradient clipping. With a vanishing gradient the gradient approaches zero and early layers fail to learn. |
Why a vanishing gradient matters for on-premises AI
A 1994 journal paper analysed the problem for recurrent networks; a 2010 study noted that deep multilayer networks had not been trained successfully before 2006. LSTM, ReLU, normalised initialisation and residual networks of up to 152 layers in 2015 largely eased it. Transformer language models also wrap each sub-layer in a residual connection followed by layer normalisation.
An energy company's recurrent fault prediction model reacts only to the last few hours of substation sensor data and misses a warming pattern from weeks earlier. The team tracks gradient norms, swaps simple units for LSTM units and revalidates the model on past faults with long-range patterns.
Common questions
How is a vanishing gradient noticed?
Gradient norms for early layers or the distant past stay near zero, the loss stalls for long periods and the model fails to learn long-range dependencies.
Does gradient clipping fix vanishing gradients?
No. Gradient clipping targets exploding gradients. Vanishing gradients are addressed with architectural changes, suitable initialisation, normalisation or regularisation terms that preserve gradient magnitude.
Related terms
- Exploding gradient
- Backpropagation
- Long short-term memory (LSTM)
- Residual connection
- Activation function
Sources
- Understanding the difficulty of training deep feedforward neural networks, AISTATS, 2010
- Deep Sparse Rectifier Neural Networks, AISTATS, 2011
- On the difficulty of training Recurrent Neural Networks, arXiv, 2012
- Deep Residual Learning for Image Recognition, arXiv, 2015
In the glossary: Glossary, R to Z