Skip to main content
GanitML

Gradient descent

Find the bottom of a loss by walking downhill. The gradient says which way, the learning rate says how far, and a model learns a line.

FreeAbout 15 min

Step 1 of 8

Rolling downhill

A model learns by making a number called its loss smaller. The loss measures how wrong the model's answers are, and it depends on the model's settings. Picture it as a landscape: the settings are where you stand, the loss is the height, and learning means walking down to the lowest point.

Start with the simplest landscape there is, the curve f(x)=x2f(x) = x^2, whose lowest point is at x=0x = 0. Press Step a few times, then try the three presets.

The small learning rate creeps down, the medium one overshoots the bottom and zig-zags in, and the large one overshoots further every time until the ball flies off. By the end of this lesson you'll be able to predict all three.