Learn AI · Level 2 · How AI works · step 5 of 16 · word 4 of 5

What is a loss function in machine learning?

A loss function is the score that tells a model how wrong its guesses are. Training means adjusting the model, step by step, to push that score down.

Added 28 Oct 2026

In plain English

A model can’t improve unless it knows how badly it’s doing. The loss function turns every mistake into a number: big mistakes, big loss. Gradient descent then nudges the model’s parameters in whatever direction makes the loss smaller, millions of times over.

An example

A language model’s loss is about the next word. Shown “The cat sat on the”, it gives every possible next word a chance. If it gave “mat” only a small chance, the loss is high. Training raises the chance of the right word.

Watch out

A model gets good at exactly what the loss measures, and nothing else. If the score rewards the wrong thing, the model learns the wrong thing very well. More in how a machine learning model is built.

Learn AI path · Level 2 · How AI works · step 5 of 16

Next wordPrecision and recall →See all of level 2

← All terms