Skip to content
StackDecode
AI & ML Atlas
Machine LearningNeural NetworksoptimiserInteractive simulation

Gradient Descent

Minimises a loss by repeatedly stepping against its gradient.

The idea

The gradient points uphill, so stepping the opposite way lowers the loss. The learning rate sets the step size: too small is slow, too large overshoots and may diverge. On a stretched valley it zig-zags, which momentum and adaptive methods address.

θ ← θ − η·∇L(θ)

Watch it run

This is a real computation, not a drawing. Pause, step, change the settings, or try new random data.

  • current weights
  • minimum
  • last update

Start somewhere on the bowl. Rings are lines of equal loss; the minimum is at the centre.

step:
0
loss:
3.4617
1/53

Loss landscape seen from above: a long narrow valley. Final loss 0.0005.

Step by step

  1. 1Initialise the parameters.
  2. 2Compute the gradient of the loss using all training data.
  3. 3Move the parameters a small step against the gradient.
  4. 4Repeat until the loss stops decreasing.

Where it is used

The basis of training almost every model.

Watch out for

Learning-rate choice, plateaus, saddle points and ill-conditioned valleys.

Related