# Loss function

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

Also called: loss, cost function, objective function, error function, training loss

A formula that scores how wrong a model's output is compared with the right answer. Training tries to make this number as small as possible.

**For example:** For [next-token prediction](https://ecosystem.samcarlton.com/next-token-prediction), the loss is high when the model gave the real next word a low likelihood.

## Connects to (5)

- [Gradient descent](https://ecosystem.samcarlton.com/gradient-descent): The method used to train neural networks: measure how wrong the model is, work out which direction to nudge each weight to be less wrong…
- [Training](https://ecosystem.samcarlton.com/training): Teaching an AI model by showing it a very large number of examples before anyone uses it.
- [Overfitting](https://ecosystem.samcarlton.com/overfitting): When a model learns its training examples too closely, including their quirks, and then performs poorly on new data.
- [Ground truth](https://ecosystem.samcarlton.com/ground-truth): The verified, correct answers or facts that an AI system's output is checked against.
- [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…

Map view: https://ecosystem.samcarlton.com/loss-function
