Loss Function
The number a model tries to shrink. A loss function scores how far a model's predictions are from the truth, and training works to make that number as small as possible.
- Term
- Loss function
- Is
- A measure of a model's prediction error
- Also called
- Cost or objective function
- Role
- The quantity training minimizes
Parts of speech & senses
- A loss function is the measure of how wrong a machine-learning model's predictions are — a single number the training process works to minimize as it fits the model to the data. "They chose a loss function that penalizes big errors."
What a loss function is
A loss function is the mathematical measure of how far a machine-learning model's predictions are from the correct answers — it takes the model's output and the true value and returns a single number, the loss, that is larger when the model is more wrong and smaller when it is closer to right. Training a model is, at heart, the process of adjusting the model's internal parameters to make this number as small as possible across the training data, typically by methods that nudge the parameters in the direction that reduces the loss. The loss function is therefore the objective the whole training process is aimed at: it defines what "good" means for the model. Different tasks use different loss functions — for example, one that squares the error for predicting continuous quantities, or one that penalizes confident wrong answers for classification — and the choice shapes what the model learns to do well.
The loss function matters because it encodes the goal of the model in a form the training algorithm can optimize. Whatever behavior you reward or punish through the loss is what the model will chase, so the choice of loss function directly determines what the trained model prioritizes. A loss that heavily penalizes large errors produces a model that avoids big misses even at the cost of many small ones; a loss suited to classification pushes the model toward confident, correct labels. Because training minimizes the loss, a poorly chosen loss function optimizes for the wrong thing, and the model can score well on its loss yet behave badly on what you actually care about. Choosing a loss function that reflects the real objective is one of the most consequential decisions in setting up a model.
Loss function versus cost function and evaluation metric
The loss function is closely related to the terms cost function and objective function, and the distinctions are worth knowing even though the words are often used loosely. Many practitioners use "loss function" for the error on a single example and "cost function" for the average loss over the whole training set — the total quantity actually minimized — while "objective function" is the general term for whatever is being optimized (often the cost, sometimes with added regularization terms). In everyday use the three are frequently treated as synonyms, and that is usually harmless, but the underlying idea is consistent: there is a number, built from the model's errors, that training works to reduce. The point of all three names is the same target — a scalar measure of wrongness that optimization drives down.
The more important distinction is between a loss function and an evaluation metric, because confusing them is a real trap. The loss function is what the model is trained to minimize — it must be suited to optimization (often smooth and differentiable) so the training algorithm can work with it. An evaluation metric is what you use to judge the model's performance in terms you care about, such as accuracy, precision, recall, or a business outcome, and it need not be something a training algorithm can directly minimize. The two often differ on purpose: a classification model might be trained on a smooth loss like cross-entropy while being evaluated on accuracy, because accuracy itself is awkward to optimize directly. Keeping the loss function (the training objective) separate from the evaluation metric (the judgment of success) prevents the mistake of assuming a low loss automatically means the model is good at the thing that matters.
Choosing a loss function well
Choosing a loss function well means picking the measure of error that reflects the model's real objective — one that penalizes the kinds of mistakes you most want to avoid and rewards the behavior you actually want. It means matching the loss to the task (a squared-error style loss for continuous predictions, a cross-entropy style loss for classification, and specialized losses for other problems), and being mindful of how the loss treats outliers and different error types, since that shapes the model's behavior. It means keeping the loss function, which training minimizes, distinct from the evaluation metric, which measures success, and checking the model on both — because a low loss is only useful if it corresponds to good performance on the metric you care about. The loss function is where you tell the model what to value, so choosing it deliberately is choosing what the model will become.
The failures are choosing a loss function that does not match the real objective, so training optimizes for the wrong thing; confusing the loss function with the evaluation metric and assuming a low loss means a good model; ignoring how the loss handles outliers or class imbalance, which can quietly distort what the model learns; and treating the loss as a fixed technicality rather than a design choice that encodes the goal. The discipline is to select the loss function as a deliberate statement of what the model should minimize, aligned with the task and the errors that matter, evaluated separately from the metric of success — because the model will faithfully chase whatever the loss rewards, for better or worse.
Synonyms & antonyms
Synonyms
Antonyms
Origin & history
Loss function — the measure of a machine-learning model's prediction error that training minimizes — encodes the model's objective and is distinct from the evaluation metric used to judge success.
Etymology: source.
Usage trends
Search interest for this term over the last five years:
Common questions
- What is a loss function?
- The measure of how wrong a machine-learning model's predictions are — a single number, larger when the model is more wrong, that training works to minimize by adjusting the model's parameters. It defines what good means for the model.
- What is the difference between a loss function and a cost function?
- They are often used interchangeably. When distinguished, loss is the error on a single example and cost is the average loss over the whole training set — the total quantity minimized. Both name the number training drives down.
- How is a loss function different from an evaluation metric?
- The loss function is what the model is trained to minimize and must suit optimization. An evaluation metric, like accuracy, judges performance in terms you care about. They often differ on purpose, so a low loss does not automatically mean a good model.
Resources & people to follow
- referenceRGM analysis — definitions, senses, and usage verified per term
Curated, non-competitor resources verified per term.
Related training
Disciplines
Areas of marketing where loss function is a core concern: