# Loss Function

> A score of how wrong a model is. Training tries to make it small.

**Field:** Artificial Intelligence  
**Category:** Machine Learning  
**Also known as:** Cost Function, Objective Function, Loss

## Think of it like

Think of it like a score of how far your throw landed from the target.

## Definition

A loss function is a formula that measures how wrong a model's answers are. It compares each guess with the right answer and gives back one number, called the loss. A high loss means the model is far off, and a low loss means it is close. Training tries to make this number as small as it can. Different jobs use different loss functions, such as one for numbers and another for groups.

## Example

Emma's model guesses a house costs €300,000. It really sold for €340,000. The loss function turns that €40,000 miss into one number that training can shrink.

## Why it matters

It tells training what good means. If the loss measures the wrong thing, the model gets good at the wrong thing.

## Common mistake

Trusting a low training loss. The loss on data the model has never seen is the one that counts.

## Three principles

- **Measures wrongness.** Each guess against its answer.
- **One number.** Called the loss.
- **Training shrinks it.** Lower means better.

## Related terms

- [Gradient Descent](https://learn.benibix.com/term/ai/gradient-descent)
- [Backpropagation](https://learn.benibix.com/term/ai/backpropagation)
- [Training (AI)](https://learn.benibix.com/term/ai/training)
- [Overfitting](https://learn.benibix.com/term/ai/overfitting)

## Taught in

- [Gradient Descent and Backprop](https://learn.benibix.com/learn/ai-machine-learning/gradient-descent-and-backprop): Machine Learning, 14/18

![A U-shaped curve of loss. A ball takes small steps down the slope to the bottom. On a second curve, steps that are too big jump from side to side past the bottom.](https://learn.benibix.com/diagrams/nn-gradient-descent.svg)

---

Source: https://learn.benibix.com/term/ai/loss-function
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
