A loss function is a mathematical measure of how far a model's output is from the desired or correct result during training.
Training uses the loss value to guide optimization and update model weights.