# Gradient descent

Concept · [Building with AI](https://ecosystem.samcarlton.com/ai)

Also called: SGD, stochastic gradient descent, optimizer, optimization

The method used to train [neural networks](https://ecosystem.samcarlton.com/neural-network): measure how wrong the model is, work out which direction to nudge each weight to be less wrong, take a small step and repeat millions of times.

**For example:** Like walking downhill in fog by always stepping where the ground slopes down, gradient descent moves [the weights](https://ecosystem.samcarlton.com/weights) toward lower error.

## Connects to (4)

- [Loss function](https://ecosystem.samcarlton.com/loss-function): A formula that scores how wrong a model's output is compared with the right answer.
- [Backpropagation](https://ecosystem.samcarlton.com/backpropagation): The calculation that works out how much each weight in a neural network contributed to an error, layer by layer from the output back, so…
- [Training](https://ecosystem.samcarlton.com/training): Teaching an AI model by showing it a very large number of examples before anyone uses it.
- [Weights](https://ecosystem.samcarlton.com/weights): The numbers inside a model that it learned during training.

Map view: https://ecosystem.samcarlton.com/gradient-descent
