Cross-entropy loss is the number that language models are trained to push down. At every step of training, the model reads some text and predicts what token comes next. Cross-entropy loss measures how surprised the model was by the real answer. A low value means it gave the right token a high probability. A high value means it was confidently wrong, or had no idea.
How it works
For each position in the text, the model outputs a probability for every token in its vocabulary. Cross-entropy takes the probability assigned to the token that actually came next and turns it into a penalty: the lower that probability, the bigger the penalty.
Suppose the text is "The capital of France is" and the next word is "Paris". If the model gave "Paris" 90 percent, the penalty is small. If it gave "Paris" 1 percent, the penalty is large. Average that penalty across billions of tokens and you have the loss.
It uses a logarithm, which is why a model that is confidently wrong is punished far more than one that is merely unsure. That pressure is what pushes a model toward calibrated, useful predictions.
How it is used
Training uses gradient descent to adjust the model's parameters so this loss goes down. It is the standard loss function for pretraining a large language model.
Researchers also measure it on a held-out dataset, text the model never trained on. That number shows whether the model has learned general patterns or merely memorized its training data, a problem called overfitting.
Relationship to perplexity
Perplexity is cross-entropy loss, exponentiated. They carry the same information in different units. Perplexity reads as "the model is as uncertain as if it were choosing among this many equally likely tokens," which is easier to picture. Labs often track the loss directly because it moves smoothly.
Scaling laws describe how this loss tends to fall in a predictable way as you add compute, data and parameters.
What it does not tell you
Lower loss means better next-token prediction. It does not by itself tell you a model is more truthful, safer or better at your task. Two models with similar loss can behave differently, and loss figures are only comparable when measured on the same data with the same tokenizer. For that reason, evals on real tasks are still needed.
Why you might see it
Training reports, research papers and model cards sometimes quote loss curves to show progress. If you fine-tune a model, the loss on your validation set is the first number to watch.