liveBook · Manning

Gradient clipping

As explained in Machine Learning System Design

Gradient clipping is a training technique that bounds gradient values or their norm before parameter updates.

Gradient clipping bounds gradient values or their norm before parameter updates, helping stabilize training when loss explodes or trends toward NaN. section 9.1.3

When loss becomes unstable, pair clipping with these checks:

  • Reduce the learning rate to limit bouncing through parameter space. section 9.1.3
  • Check for implementation failures such as division by zero, invalid logarithms, NaNs in data, or missing preprocessing. section 9.1.3
  • Use a small batch to test whether the model can overfit a limited sample before adding complexity. section 9.1.3
Figure 9.4 A model was converging until something went wrong.
figure

The figure illustrates a model whose loss was converging before an instability appeared. section 9.1.3

How Machine Learning System Design covers it

How deep it goes
Defines clipping as an exploding-gradient remedy but stops short of implementation details or parameter choices.
Examples
Uses exploding or NaN loss as the diagnostic case, alongside oscillation and small-batch overfitting checks.
What you can do after
Diagnose/debug with it by recognizing exploding-gradient symptoms and comparing clipping with learning-rate or initialization changes.
How it connects
Connects gradient clipping to learning rate, weight initialization, preprocessing, and loss-curve interpretation.

Also explained in

Compare how 2 books explain gradient clipping →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Machine Learning System Design. The section links point to the parts of the book it draws on.