Gradient Descent Visualizer

Almost every machine learning model learns the same way: roll downhill on an error landscape, one step at a time. Pick a landscape, set the step size, and watch it converge, overshoot, get stuck, or blow up. No math background needed.

100% in your browser. Works offline once loaded.
Height is the model's error. Lower is better. The deepest point is the best possible model.
Where training begins. You can also click the landscape to drop the ball anywhere.
The size of each step. The single most important dial in training.
Lets the ball keep some speed from previous steps, like a heavy ball instead of a light one.
0
Steps
Current loss
The ball is the model. The arrow shows which way is downhill from where it stands. Click anywhere on the curve to start there.
Press Play, or Step through one move at a time.
Loss over steps: the training curve. This is the exact chart ML engineers stare at all day.
Learning rate

About the Gradient Descent Visualizer

Strip away the jargon and almost all machine learning training is one idea: measure how wrong the model is, figure out which small change makes it less wrong, take a step that way, repeat a few million times. That procedure is called gradient descent, and the best way to understand it is to watch it move. Here the model is a ball, the error is a landscape, and every control that matters in real training is a slider.

Four experiments worth trying

Why the learning rate matters so much

Every step moves the ball by the slope at its feet multiplied by the learning rate. Too small, and training crawls: thousands of tiny steps, each one safe and slow. Too large, and each step overshoots the target, so the ball zigzags or explodes. There is no single correct value; it depends on the landscape, which is why practitioners try several and watch the loss curve. The plateau landscape shows the other failure: where the ground is nearly flat, the slope is nearly zero, so steps shrink to almost nothing even though the ball is far from the bottom.

From this toy to real models

A real neural network does not have one dial to tune; it has millions or billions, so the landscape is a surface in millions of dimensions that nobody can draw. But the algorithm walking it is this one, and the failure modes you just watched are the ones that show up at any scale: learning rates that oscillate, plateaus that stall progress, and local dips that catch the unwary. When someone says a model "didn't converge" or "the loss blew up," you have now seen exactly what they mean.

Common questions

What is gradient descent in simple terms?

It is how models learn: measure which direction reduces the error, take a small step that way, repeat. This tool draws it literally as a ball rolling downhill on an error landscape, one step per tick, with the loss curve recording the journey.

What does the learning rate actually do?

It is the step size. Too small and training crawls; too large and the ball overshoots the valley, oscillates, or flies off entirely. Drag the slider from 0.01 to 4 and watch each failure mode happen instead of reading about it.

What is momentum and why do optimizers use it?

Momentum lets the ball accumulate speed in a consistent direction, which smooths oscillation and, crucially, carries it out of small local dips that plain gradient descent gets trapped in. Get stuck in the valleys landscape, add momentum, and watch the escape.

What is a local minimum?

A dip that is lower than everywhere nearby but not the lowest point overall. Plain descent stops there because every local direction goes up. The tool detects when you have converged to a local dip versus the global valley and says so.

Why does my model training diverge?

Almost always a learning rate too large for the landscape: each step overshoots so badly the error grows instead of shrinking. Set the rate to maximum here and watch the exact behavior your training logs were describing.

Related tools