Gradient descent

Engine preview · How a network learns · 02 / 04 · Beginner · 21 min

The cost function, the gradient as the direction of steepest ascent, and learning as repeatedly stepping the other way.

Before thisDerivativesWhat is a neural network?

This lesson is part of a preview roadmap.

The engine around it is real — progress, notes and bookmarks all work — but the video has not been through the sourcing and review protocol a shipped lesson goes through. See the roadmap for what that means.

3Blue1Brown · 21 min

Gradient descent

The player loads from youtube-nocookie.com when you press play. Nothing reaches YouTube before that.

Taught by 3Blue1BrownReport a problem with this video

What you'll learn

  • Training is minimising a cost function over the weights, not over the input data.
  • The gradient points in the direction of steepest increase, so learning steps along its negative.
  • The step size is a choice with consequences — too large overshoots, too small never arrives.

From a fixed network to a learning one

The previous node left a network full of arbitrary numbers. This one adds the only two things needed to improve them: a number that says how wrong the network currently is, and a rule for which way to nudge every weight to make that number smaller.

What to watch for

The cost surface is drawn in two dimensions because that is what fits on a screen; the real one has as many dimensions as the network has parameters. The intuition that survives the jump is local and modest — you cannot see the landscape, you can only feel which way is downhill from where you stand.

Where this sits

Gradient descent says step along the negative gradient. It does not say how to compute that gradient for a network with millions of weights. That is backpropagation, and it is the next node.

Check yourself

  1. 01What exactly are the variables being optimised?

    The weights and biases. The training examples are fixed; the cost is a function of the parameters alone.

  2. 02Why does anyone settle for a local minimum?

    Because in very high dimensions the local minima that gradient descent actually reaches tend to be good enough, and finding a global one is not tractable.

Go deeper

The maths underneath

Notes

Private to you

Esc
↑↓ navigate↵ open? shortcuts

Keyboard shortcuts

Press Esc to close

Anywhere

⌘K
Search and commands
/
Search
?
This sheet
Esc
Close

Reading a lesson

J
Next lesson
K
Previous lesson
B
Bookmark