← All lessons
015

Gradient Descent

In the linear regression lesson you moved the sliders by hand to shrink the error. Gradient descent is how the model does that itself: at its current position it computes the slope of the loss — which way is downhill — and takes a step that way. Repeat, and the loss rolls down to a minimum.

The curve is the loss for every possible weight value; the ball is the current weight. Press Take a step and watch it move downhill. Then raise the learning rate: small steps crawl, moderate steps converge fast, and very large steps overshoot the valley and bounce from side to side — the classic training failure.

weight value →

loss: 135.2

Check yourself

Why can a learning rate that is too large make the loss go up instead of down?

Go deeper (free): 3Blue1Brown — Gradient descent

Next: Loss Functions