Gradient Descent

20 min read

In the last lesson you found the best line with one NumPy call. Gradient descent is how a computer finds the best numbers by itself, step by step. Almost every AI model, from a small line to a large language model, learns this way.

New words

Loss
One number that says how wrong the model is. Smaller is better.
Gradient
The slope of the loss. It shows which way is uphill.
Learning rate
The size of each step. It is a number you choose.
Epoch
One full pass over all the training data.
Batch
The group of examples used to make one step.
Local minimum
A low point that is not the lowest point of all.

What you will learn

  1. How can a computer find the best line?
  2. What is the update rule?
  3. How do you get the slope for a line?
  4. How does the training loop work?
  5. What is a good learning rate?
  6. How do you see that the model is learning?
  7. Batch, stochastic and mini-batch
  8. Try it: walk down the valley
  9. Common mistakes
  10. Explain it to a friend
  11. Key takeaways

10 quiz questions at the end.

Start this lesson

The full lesson, with interactive demos and the quiz, opens after you sign in with Google. It is free.

All lessons · Back to the roadmap