Skip to content
Lesson 2 of 3+60 XP

Gradient descent: how networks learn

Lecture by 3Blue1Brown

Learning means minimizing a cost function. This lecture defines the cost, explains the gradient as the direction of steepest increase, and shows how stepping downhill again and again tunes thousands of weights at once.

Key concepts

Tap a card to reveal its meaning.

Reviewed 0 of 5

Study notes

Highlight any sentence to ask Sage about it.

Measuring how wrong the network is

To train a network you first need a way to score it. For one training image, compare the 10 output activations with what they should be (1 for the correct digit, 0 for the rest), square the differences and add them up. Averaging this cost over thousands of training examples gives one number that sums up how badly the network performs.

Rolling downhill

The cost is a function of all of the network's weights and biases, about 13,000 inputs. Picture it as a landscape. To improve the network you want to move downhill. The gradient points in the direction of steepest ascent, so stepping along the negative gradient decreases the cost fastest.

Each component of the gradient also tells you how sensitive the cost is to that particular weight. Large components mark the weights where a change makes the biggest difference.

Repeat many times

Gradient descent computes the gradient, takes a small step, and repeats. Over many steps the network settles into a local minimum of the cost. The lecture's simple network classifies about 96 percent of new images correctly, and small changes to its structure push that to around 98 percent.

What did it actually learn?

Look at the weights of the first hidden layer and they do not resemble the neat edge detectors you might hope for. The network found a solution that works, but not necessarily one that matches our intuition, a reminder that good performance is not the same as understanding.

Lesson quiz

Ready to prove it?

3 questions. Get 2 right to complete the lesson.

  • +60 XP for passing
  • +20 XP per correct answer
  • +25 XP for a perfect score

You can take the quiz without an account, but your XP is only saved once you create an account.

Up next · Lesson 3

Backpropagation, intuitively

Backpropagation is how the gradient gets computed. Starting at the output, it works out how each weight, bias and earlier activation should change to reduce the cost for one example, then averages those wishes across many examples.

Lorequest

Watch great lectures, prove what you learned and level up as you go, with Sage, an AI tutor that reads along with you.

© 2026 Lorequest. All rights reserved.

Video lectures are embedded from YouTube and belong to their creators.