Vanishing gradient problem
The vanishing gradient problem is the tendency of training signals to shrink as they pass back through many layers of a neural network, so early layers barely learn; it long made deep networks hard to train.
Neural networks learn by backpropagation. After each prediction, the error is passed backwards through the network, and every layer works out how to adjust its weights. On the way back, the signal is multiplied by a factor at each layer. If those factors are mostly smaller than one, the signal shrinks exponentially with depth, and the earliest layers receive almost nothing to learn from. Training slows to a crawl or stalls. If the factors are mostly larger than one, the signal grows instead, which is the exploding gradient problem.
A simple example shows the scale. The logistic sigmoid, a common activation function in early networks, has a slope of at most 0.25. Multiply ten such factors together and the signal can be about a millionth of its starting size. Recurrent networks, which process sequences one step at a time, suffer the same way across time steps, so they struggled to connect information far apart in a sentence.
Sepp Hochreiter identified the problem formally in his 1991 diploma thesis, and Yoshua Bengio, Patrice Simard and Paolo Frasconi showed in 1994 why learning long-range dependencies with gradient descent is hard. In 2010 Xavier Glorot and Bengio showed that the sigmoid was unsuited to deep networks with random starting weights and proposed a better way to set those weights.
Several fixes followed and are now standard. The LSTM, introduced by Hochreiter and Jürgen Schmidhuber in 1997, gave recurrent networks a path that preserves the signal over many steps. Activation functions such as ReLU, which do not flatten out for positive inputs, shrink the signal less. Normalisation layers keep values in a healthy range, and gradient clipping caps exploding signals. Residual connections, introduced by Kaiming He and colleagues in 2015, add each layer's input directly to its output, giving the signal a shortcut. Their ResNet reached 152 layers, about eight times deeper than earlier VGG networks, and won the 2015 ImageNet classification contest.
The problem explains why modern models look the way they do. The original Transformer paper puts a residual connection around every sub-layer, followed by layer normalisation. Today's large language models keep the residual connections, though most now normalise before each sub-layer instead of after. When a model is described as hundreds of layers deep, these techniques are what make that depth trainable.
During backpropagation the error signal is multiplied by a factor at each layer. When those factors are below one, as with saturating activation functions such as the sigmoid, the product shrinks exponentially, so the earliest layers get almost no signal and barely learn. Both come from multiplying many factors through deep networks. Vanishing gradients shrink towards zero, so learning stalls. Exploding gradients grow very large, so training becomes unstable and weights can jump to useless values. Common fixes include ReLU-style activation functions, careful weight initialisation, normalisation layers, residual connections and, for recurrent networks, gated designs such as the LSTM. Modern architectures combine several of these by default. Transformers are built to avoid it. Each sub-layer is wrapped in a residual connection with layer normalisation, which gives gradients a direct path through the network. That design is a large part of why very deep language models can be trained at all.Common questions
What causes vanishing gradients?
What is the difference between vanishing and exploding gradients?
How do you fix the vanishing gradient problem?
Do transformers have vanishing gradients?
Search for "vanishing gradient problem explained", "residual connections ResNet" or "LSTM vanishing gradient". Good sources include deep learning textbooks, university course notes, and the original papers on arXiv and in machine learning conference proceedings. Interactive tutorials that plot gradient size layer by layer make the effect easy to see.Finding more
Working out what this means for your business?
Aileron Shift builds the systems behind this site: AI newsrooms that research, write and publish on their own, marketing automation and WordPress hosting for companies that need to move faster than their competitors.