liveBook · Manning

Vanishing gradient problem

As explained in Inside Deep Learning: Math, Algorithms, Models

A training instability in which gradients become too small for effective learning updates.

The vanishing gradient problem occurs when the gradient with respect to a network’s parameters becomes so small that weight updates make almost no progress. Formally, when ||∇ΘfΘ(x)|| approaches zero, learning effectively stops, even if the learning rate is large. section 6.1.1

Saturating activations are a common cause. For large positive inputs, tanh and sigmoid flatten near 1; for large negative inputs, they flatten near −1 and 0. Their derivatives consequently approach zero, so saturated neurons transmit little learning signal backward. section 6.1.1

Use these distinctions when diagnosing or reducing the problem:

  • Distinguish vanishing gradients from exploding gradients: tiny gradients require excessive optimization steps, while huge gradients cause overly large updates. section 5.1.2
  • Inspect gradient histograms when learning stalls; saturation is common but is not the only possible cause. section 6.1.1
  • Try ReLU instead of tanh or sigmoid when saturation is not intentional; ReLU commonly converges more accurately in fewer epochs. section 6.1.2
  • Use leaky ReLU when inactive ReLU units are costly: its negative side retains a small slope controlled by α. section 6.1.2

Activation derivatives as a quick check

For tanh, use tanh′(x) = 1 − tanh(x)²; for sigmoid, use σ′(x) = σ(x)(1 − σ(x)). Plot these derivatives over an input range such as −5 to 5: values near zero identify saturated regions. ReLU instead has derivative 1 for positive inputs and 0 for nonpositive inputs; leaky ReLU replaces the zero branch with α.

Figure 5.2 A toy example showing three scenarios for gradient descent. Each is a contour plot of a 2D optimization going from red (high values, bad) to dark green (low values, good). The ideal case is at the top left, where each gradient heads exactly toward the solution. The top right shows noisy gradients that cause the descent to head in not quite the correct direction, requiring more steps. The bottom left shows exploding gradients, where we begin to take steps that are far too large and head away from the solution. The bottom right shows vanishing gradients, where the gradient becomes so small that we have to take an excessive number of steps to get to the solution.

Compare ideal, noisy, exploding, and vanishing optimization paths in a contour plot; the vanishing case requires excessive steps because each gradient is too small. section 5.1.2

How Inside Deep Learning: Math, Algorithms, Models covers it

How deep it goes
Explains parameter-gradient updates, activation saturation, derivative plots, and ReLU variants, but does not enumerate every cause.
Examples
Uses contour plots, tanh and sigmoid derivative plots, gradient histograms, and ReLU or leaky-ReLU code.
What it assumes
Assumes gradients, parameters, loss functions, and gradient descent; teaches saturation and derivative behavior explicitly.
What you can do after
Diagnose vanishing gradients with derivative plots or gradient histograms and reduce them by selecting ReLU-family activations.
How it connects
Connects gradient descent, learning rates, momentum, activation functions, ReLU, leaky ReLU, and GAN training.

Also explained in

Compare how 14 books explain vanishing gradient problem →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Inside Deep Learning: Math, Algorithms, Models. The section links point to the parts of the book it draws on.