Drop the ball — where it lands was decided before it moved
This curve is a loss landscape: left-right is one model parameter, height is how wrong the model is. Gradient descent is dumb and local — it only ever rolls downhill from wherever it starts. Click anywhere on the canvas to drop the ball and watch. There are two valleys; only one is the good one.
Every ball follows the exact same rule: x ← x − lr·slope(x). No ball ever climbs. The only difference between winners and losers is the starting point.
The step-size dial — creep, converge, explode
The learning rate is how far the ball moves per step. It is the single most-tuned number in deep learning, and it has three regimes. Drag the slider and press play — same valley, three completely different fates. The loss trace on the right is live.
The explosion is real math, not theatre: on this parabola any lr above 1.0 makes each step land farther from the bottom than the last.
The ravine — why plain gradient descent zigzags
Real landscapes aren't round bowls — they're ravines: cliff-steep in one direction, almost flat in another. The gradient points across the ravine, not along it, so the ball ping-pongs between the walls while barely crawling toward the exit. Crank the steepness, then switch on momentum and watch the same ball average out its own zigzag.
Contours are the true landscape; the gold trail is every step the optimizer actually took. Steps-to-converge is measured, not scripted.
Noise is a feature — let SGD shake the ball loose
Full-batch gradient descent computes the exact slope — and exactness is a trap: the ball settles into the first pit it finds, even a nasty narrow one. Stochastic gradient descent estimates the slope from a small random batch, so every step carries noise. Drag the batch-size slider down and watch the noise kick the ball out of the sharp pit and over into the wide valley.
Smaller batch = larger gradient noise here, matching the 1/√batch scaling of real SGD noise. Escape or capture is decided by the actual simulation each run.
Sharp vs flat — the earthquake test
Two balls, both at the bottom of their valley: one in a sharp pit (lower training loss!), one in a flat basin. Now the earthquake: test data never matches training data exactly, which shifts the whole landscape sideways. Drag the shift slider and watch who survives. The sharp ball's loss rockets; the flat ball barely notices.
Dashed curve = training landscape, solid = shifted test landscape. Both losses are read off the actual curves at the balls' positions.