Case & CodeA FIELD GUIDE TO AI
Start learning
Advanced

Loss function

In plain words

The score training uses to measure how wrong a model's guess was. Training tries to make this number smaller.

The fuller definition

A loss function measures how far a model's output is from a training objective. An optimizer uses this signal to guide parameter updates.

The training loop, simplified
  1. ExamplesInputs paired with the expected output.
  2. PredictionThe model produces an output.
  3. LossHow far off it was, as a number.
  4. UpdateParameters nudged to reduce the loss; repeat.

Training ends at the knowledge cutoff. Whatever the examples contained, including their gaps and biases, is what the model learned.

A concrete example

Predicting a low probability for the target token produces a training penalty under a next-token objective.

The distinction that matters

A lower training loss does not alone prove better performance on your real workload.

Related terms

Where it is taught

How models learn from examples

Source and further reading

Hugging Face · LLM course

The definition and example are written for this library. The link gives background, official documentation or legal authority as labelled. Legal scope depends on the jurisdiction and current text; product features depend on release and settings.

Lessons, terms, practical guides and sources ESC