← Measures

Perplexity

How surprised a language model is by real text. Lower means the model saw the next word coming. Says nothing about whether its own words are any good.

At a glance

Full name Perplexity
What it measures How well a language model predicts a held-out stretch of text, one token at a time
Formula The exponential of the average negative log-probability the model assigns to each token
Typical range 1 upward, no fixed ceiling. Lower is better
Used for Comparing language models during training and pretraining research
Best used for Tracking training progress, and comparing models that share the same tokenizer
Pair with Task-specific benchmarks and human evaluation, since low perplexity does not mean good or truthful output

Perplexity is the oldest and most fundamental metric in language modelling, predating the transformer by decades, back to statistical language models built for speech recognition. It asks one narrow question: how surprised was the model by what actually came next in real text? It is not a measure of how good the model’s own writing is, a distinction that trips up a lot of people meeting it for the first time.

What it is and how it’s computed

For each token in a test passage, the model assigns a probability to the token that actually appears next, given everything before it. Average the log of those probabilities across the passage, negate it, and exponentiate the result. The output can be read as an effective branching factor: a perplexity of 20 means the model is, on average, as uncertain about the next token as if it were choosing uniformly among 20 equally likely options. A perplexity of 1 would mean the model predicted every single token with total certainty.

A worked example

When GPT-2 was released in 2019, it achieved a perplexity of around 37 on the WikiText-103 benchmark without ever training directly on that dataset, a result that was considered striking at the time for a model transferring zero-shot to new text. Later models trained with more data and larger parameter counts pushed perplexity on similar benchmarks far lower. The number by itself means little without a point of comparison; what makes it useful is tracking it over the course of training, watching it fall as the model improves, and comparing it against other models evaluated under the same conditions.

Where it matters

Perplexity is the standard metric during pretraining: it is cheap to compute on any text without needing human labels, it correlates reasonably well with downstream task performance in large models, and watching it on a held-out validation set is the simplest way to tell whether a model is still learning or has started to overfit. It remains the first number researchers report when announcing a new base language model.

Strengths

It needs no labelled data at all, just raw text, which makes it essentially free to compute at scale. It gives a continuous signal during training, long before a model is good enough to evaluate on any downstream task. And it has decades of precedent, so results are broadly comparable across a long lineage of research.

Limitations, and the things that go wrong

Perplexity is tied to the tokenizer a model uses, and two models with different vocabularies are not directly comparable on this number, a frequent source of confusion when people compare perplexity figures across model families without checking this. It also measures nothing about the usefulness, factual accuracy, safety or helpfulness of what the model eventually generates: a model can have excellent perplexity on fluent, grammatical text while still hallucinating facts, refusing reasonable requests, or producing harmful content, because none of those failures show up as mispredicted next tokens on in-distribution text. And perplexity is measured against a fixed test set, so a model can look artificially good if that set overlaps with its training data.

When I would use it, and what to pair it with

I treat perplexity as a training-time instrument, not an evaluation of a finished product. It is the right tool for watching whether pretraining is working and for comparing base models that share a tokenizer. Once a model is meant to actually talk to people, perplexity needs to be set aside in favour of task benchmarks, human preference evaluation, and the safety and factuality checks that perplexity cannot see at all.