Gradient Clipping › Visualizing Gradient Norms During Training

Michael BrenndoerferUpdated April 24, 20253 min read
Language AI HandbookAll chapters
Part 10 of 67Neural Network Foundations
Chapter 73Gradient Clipping › Visualizing Gradient Norms During Training
Reading section 6 of 14 · Visualizing Gradient Norms During Training · 3 minSection 6 of 14 · 3 min

Book contents

Section 6 of 14 · 3 min read

Gradient Clipping › Visualizing Gradient Norms During TrainingOne section · Sections in this chapter6 / 14 ↓
Reading tools Definitions & inline links

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

Plotting gradient norms over training reveals patterns that inform threshold selection. Let's train a model and visualize the gradient dynamics over hundreds of steps to understand what "normal" looks like and what problematic patterns to watch for.

The gradient norm trace is one of the most informative diagnostic plots available for neural network training. Unlike the loss curve, which can decrease smoothly even when the network is on the edge of instability, the gradient norm trace reveals the moment-to-moment health of optimization. A stable training run shows gradient norms fluctuating within a band, neither systematically growing nor shrinking dramatically. Occasional spikes are normal and expected; a sustained upward trend suggests instability.

Out[19]:
Visualization
Line plot showing gradient norm values across training steps with most values between 0-2 and occasional spikes reaching 4-5, with a red threshold line at 2.0.
Gradient norms during a simulated training run without clipping applied. Most values stay in the 0.5-1.5 range, but occasional spikes reach 3-5x the typical value, representing the outlier gradient events that clipping targets. The red dashed line at 2.0 illustrates a conservative threshold that would intercept spike events while leaving routine gradient flow undisturbed.

The gradient norm plot reveals the training dynamics. Early in training, gradients tend to be larger and more variable as the model makes large initial adjustments. As the model converges, gradients stabilize and shrink. The occasional spikes are the dangerous outliers that gradient clipping targets, and the threshold at 2.0 correctly identifies them as the minority of steps where intervention is needed.

In practice, you would generate this plot from real training data rather than a simulation, and you would use it to set your clipping threshold before finalizing your training configuration. A good workflow is to run a short exploratory training session without clipping, plot the gradient norm trace, identify the 90th or 95th percentile, and use that as your threshold. This data-driven approach is more reliable than using a default value like 1.0 without verification.