How machines learn

Gradient descent

Gradient descent is the step-by-step method used to train models: it repeatedly adjusts the model's numbers in the direction that most reduces its error.

Picture standing on a hillside in thick fog, trying to reach the valley floor. You cannot see the bottom, but you can feel which way the ground slopes under your feet. So you take a small step downhill, feel again, and repeat. Gradient descent is a model doing this with its error instead of altitude.

The 'gradient' is the slope: for every weight in the model, it says whether nudging that weight up or down would lower the error, and by how much. The model moves every weight a small step in the helpful direction. The step size is called the learning rate. Too big and you overshoot; too small and training takes forever.

Real models have billions of weights, so the 'hill' has billions of dimensions, but the idea is the same. Backpropagation is the technique that computes the slope efficiently. Nearly every neural network you have heard of was trained with some version of gradient descent.

Example

Training a model to predict how long a bike ride takes, gradient descent notices that raising the weight on 'distance' shrinks the error, so it nudges that weight up a little each round.

Topic: Deep learning fundamentals →