noun
A loss function is a mathematical formula that quantifies the difference between a model’s predictions and the actual correct values. It acts as a ‘report card’ for AI models, telling them how far off they are from the right answer.
In machine learning, the model adjusts its internal parameters to minimize this loss. For example, if a language model predicts the wrong word, the loss function calculates how ‘wrong’ that prediction was, guiding the model to improve over time.
For developers, the choice of loss function is critical—it determines what the model prioritizes. A poorly chosen loss function can lead to biased or inaccurate results. For instance, in image generation, using a loss function that prioritizes sharp edges might produce blurry images if the edges are overemphasized.
When training an AI to recognize cats, the loss function penalizes the model for misclassifying a dog as a cat, nudging it toward better accuracy.
In other languages
See also: gradient descent · Overfitting