What it is
Gradient descent is the basic engine of how neural networks learn. A model starts with parameters set to nearly random values. It makes predictions, and a score called the loss measures how wrong they are. Gradient descent then changes every parameter by a small amount in the direction that lowers the loss. Repeat that millions of times and the model gets good at its task.
Picture a hiker in thick fog trying to reach the bottom of a valley. She cannot see the valley, but she can feel which way the ground slopes under her feet. So she takes a step downhill, checks the slope again and repeats. The slope is the gradient, and walking down it is the descent.
How it works in practice
- Forward pass. The model reads a batch of training examples and makes predictions.
- Loss. A formula compares predictions with the right answers and produces one number for the error.
- Gradient. An algorithm called backpropagation works out how much each parameter contributed to the error, which tells you which way to nudge it.
- Update. Each parameter moves a small step against the gradient. The size of the step is the learning rate.
In practice, training uses variants such as stochastic gradient descent, which computes the gradient on small random batches instead of all the data, and optimizers such as Adam, which adapt the step size for each parameter. The core loop is the same.
Why it matters to you
Almost everything expensive about AI traces back to this loop. Pretraining runs it across enormous amounts of text. Fine-tuning runs it again on a smaller set of examples, and methods like LoRA run it on only a small set of added weights to cut the cost. The step size and the quality of the training data decide whether the model learns well, learns slowly or fails to learn.
It also explains a common limit. Gradient descent finds a good setting of the parameters, not necessarily the best one, and it only learns patterns present in the data it is shown.
Inference does not use it. When you chat with a model, the parameters stay fixed, and inference only runs the trained network forward. Researchers are also exploring ways to change a model's weights without this loop, but gradient descent remains the standard method.
See reinforcement learning, which also uses gradient steps but gets its score from rewards, and transformer for the network design most often trained this way.