Deep dives · 2026-11-26 · Advanced · By bombong
Perplexity: the number that measures a language model's 'confusion', and its pitfalls
Perplexity is a metric that sums up, in a single number, how 'surprised' a language model is on average when it reads real text. Because it is easy to compute, it is widely used for training loss and quality evaluation. Recent studies, however, are showing one case after another where perplexity fails to properly capture accuracy, quantization damage, and input-length effects.
Contents
- Why we started measuring 'confusion'
- Core idea: how many options is the model choosing between at each step
- How it is computed
- How its uses expanded
- Limitations and debates: low perplexity does not mean a good model
- Where things are heading
- Practical guidelines: when to trust it and when to doubt it
- Further study
- Perplexity is computed from the probability the model assigned to each token that actually appeared. The lower it is, the less confused the model was.
- Because it can be computed from text alone, with no answer labels, its uses have expanded to training loss, data selection, reinforcement learning weights, and interpretability analysis.
- Confidence is not the same as accuracy. There is now a proof that some sequences can be wrong even when perplexity is low, and that choosing models by perplexity alone may not pick the more accurate model.
- The same model gets different perplexity values when the input length, evaluation method, attention temperature, or tokenizer changes. So to compare the numbers, these conditions have to be matched first.
- In quantization evaluation, average perplexity may stay the same or even improve while hiding damage to internal features or the 'silencing' of tokens in non-Latin scripts such as Korean.
Why we started measuring 'confusion'
The most direct way to check whether a language model is well built is to have it solve real tasks and compare its answers with the correct ones. But this requires building an evaluation set with answer labels for every task, and running it thousands of times during training is expensive. What was needed was a quality signal that could be checked right away during training and did not depend on the task.
A language model is, in the end, a machine that assigns probabilities to 'what the next token (piece of text) will be'. So you can show it text that people actually wrote and see how much probability the model gave to the actual next token in that text. The answer is the text itself, so no separate labels are needed. Perplexity is this average 'surprise' the model feels when reading real text, turned into a single number.
The perplexity critique study paper notes that perplexity has become widely established both as a loss function (the value minimized during training) and as an easy-to-compute model quality metric. The metric spread this widely thanks to two advantages: it needs no labels and it is cheap to compute. Yet the same study begins to examine mathematically the limits that come from that very simplicity. This note covers both what perplexity measures and what it does not.
Core idea: how many options is the model choosing between at each step
Perplexity is easiest to read as 'how many options, on average, the model hesitated between for each token'. A perplexity of 10 means the model was as confused as if it were choosing each time among 10 plausible candidates with equal probability. A perplexity of 1 means it was confident and correct every time, and for a model that spreads probability evenly across the entire vocabulary, perplexity grows to the size of the vocabulary.
It can be compared to a multiple-choice exam. A strong student eliminates most of the wrong answers among five options and only deliberates between one or two. A weaker student guesses among all five. Perplexity measures not how many questions the student got right, but how much confidence they put on the correct option. That makes it more informative than accuracy, which only looks at the single answer, but it also creates a weakness: it blends confidence and correctness into one.
It helps to remember what this design trades away. Perplexity measures 'whether the model assigns probabilities similar to real text', not directly 'whether it produces useful answers'. The two generally move together, but not always. Most of the limitations discussed later come from this gap.
How it is computed
The computation has five steps. First, the text to be evaluated is split into tokens by a tokenizer. Next, the model looks at the preceding tokens, produces a probability distribution over the next token, and only the probability it assigned to the token that actually appeared is extracted. Taking the log of this probability and flipping its sign gives the 'surprise' the model felt at that token. When the probability is close to 1, surprise is close to 0, and the smaller the probability, the greater the surprise. The average surprise over all tokens is what is commonly called the cross-entropy loss, and exponentiating it to convert back into units of 'number of options' gives perplexity.
Several practical properties follow from this definition. First, because the average is taken per token, values cannot be directly compared between models with different tokenizers. The same text is split into a different number of tokens. Second, perplexity is the same quantity as training loss seen on a different scale, so 'reducing training loss lowers perplexity' is effectively a single statement. The GSPO reinterpretation study paper also used this relationship. It showed that the length-normalized importance weight used in the reinforcement learning algorithm GSPO equals the ratio of perplexities between the old and current policies, and can also be written as the exponential of the change in cross-entropy.
Third, how long text is split and fed in also changes the result. The input-length study paper compared feeding the whole text at once and accumulating (direct accumulation) with computing over a fixed-size window that slides along (fixed window sliding). It systematically measured how, even for the same model, perplexity varies depending on which method is used and how long the input is, and how latency, memory, and evaluation cost change along with it.
How its uses expanded
Perplexity started out as a score for measuring the quality of a single language model. The studies in this material show its uses expanding in three broad directions. The first is data selection. The perplexity-based data scaling law study paper started from the problem that in continual pre-training, which continues pre-training to fit a specific domain, simply adding more data yields rapidly diminishing returns. It treated the perplexity a pre-trained model shows on domain data as a proxy for 'how much the model does not yet know', fitted scaling laws for each perplexity range, and selected the most useful subsets of data. It reported better performance on medical and general-domain benchmarks.
The second is as a tool for interpreting training algorithms. The GSPO reinterpretation paper mentioned earlier offered an information-theoretic interpretation that GSPO weights policy gradient updates by perplexity ratios. From this perspective, it also explains why GSPO's geometric mean reduces variance in the log domain and why it is stable in training MoE (mixture of experts) models. Experiments on math reasoning tasks confirmed this equality and the variance predictions.
The third is as an interpretability tool for looking inside models. The token-level perplexity study paper built minimal sentence pairs that differ in only one or two key tokens and compared their perplexity distributions. Existing feature attribution methods give unstable results, whereas this method has the advantage that hypotheses can be formed and tested right away. In the experiments, linguistically important tokens did influence model behavior but did not fully explain the changes in perplexity. This means the model relies on other heuristics besides the expected linguistic rules. The code comprehension study paper went a step further and asked whether perplexity can serve as a signal of human 'confusion'.
Limitations and debates: low perplexity does not mean a good model
The most fundamental challenge came from the perplexity critique study paper. Using results on the continuity of transformers, the authors proved that if a compact decoder-only transformer predicts some sequence accurately and confidently, then there must also exist another sequence on which perplexity is very low but the model fails to get the right answer. Analyzing combinations that yield the same perplexity, they also showed that selecting models by perplexity does not always pick the more accurate model. For a new model to be selected, its accuracy must rise as much as its confidence does. This means a model that has only become more confident can win on the score.
The second debate concerns compression evaluation. The SAE feature damage study paper tested the practice of approving a quantized model as long as its perplexity is similar. Using sparse autoencoder (SAE) features, which are used for interpretation, as a fixed measuring standard, it found that on Gemma-2-2B, INT7 quantization actually improved perplexity while damaging 18.7% of active features. In sliding-window evaluation, INT6 also improved perplexity, yet only 51.3% of active features survived. Identical outward behavior does not guarantee identical internal representations.
The third is a mismatch with human judgment. In the code comprehension study paper, simple aggregates of token perplexity such as the mean, median, and maximum did not reliably correlate with human-judged code comprehensibility. There were three causes. The perplexity distribution is heavily skewed, and spikes arise not only from meaningful structure but also from identifiers, literals, delimiters, and tokenization artifacts. Human labels themselves also showed weak agreement. And distributions differ greatly across models and tokenizers. The input-length study paper likewise reported that length-induced bias does not disappear in either full-precision or quantized models.
Damage perplexity missed
Where things are heading
Rather than abandoning perplexity, recent research is moving toward 'don't look at a single average; match the conditions'. The attention temperature study paper pointed out that when evaluating on contexts longer than the training length, how miscalibrated the baseline model is determines the outcome. A baseline trained at 8k length with a standard training recipe was miscalibrated by 8–15% at 30k length, which made a block-sparse attention model look 7% better. Calibrating a single temperature per model and length made this advantage disappear. The authors recommend reporting length-extension results at calibrated temperatures.
On the quantization side, the silent token study paper raised a new question: how many tokens can the model no longer produce at all after quantization? A token that cannot rank first under any hidden representation is never output in greedy decoding. In models with large vocabularies, such silencing already appeared at 8 bits, and in a 1B-parameter model, up to several hundred tokens that could originally be output went silent. In multilingual vocabularies, even though Latin-script tokens make up the majority, the silenced tokens were overwhelmingly concentrated in non-Latin scripts such as Korean, Chinese, Thai, Arabic, and Hebrew. The authors stress that these losses do not show up in standard average metrics.
The third trend is bundling perplexity as one signal among many. The generative AI confidence study paper used a calibrator to compute how typical the tokens produced by a student model are relative to the distribution of an expert model. It added existing token confidence, entropy, and perplexity statistics to build 15 response-level metrics and classified whether answers were correct. In program generation, math problems, and medical question answering, the two kinds of signals complemented each other, and the authors reported that they can be used to build hallucination detectors.
Practical guidelines: when to trust it and when to doubt it
Perplexity works well for relative comparisons under identical conditions. It is most reliable when tracking learning curves or comparing checkpoints with the same tokenizer, the same evaluation data, the same context length, and the same computation method (accumulation or sliding window). It also naturally fits uses like data selection, which ask 'how unfamiliar is this text to the model'.
The situations that call for doubt are also clear: directly comparing values between models with different tokenizers, choosing a model to deploy based on perplexity alone, or approving a model after quantization or pruning based on perplexity alone. When comparing performance on contexts longer than the training length, do not take differences obtained without attention temperature calibration at face value. For a Korean-language service, as the silent token study paper shows, it is worth separately checking for Korean token losses that get buried in the average.
A common mistake is reading 'perplexity went down, so the answers are more accurate'. Perplexity measures confidence and correctness together. So you should also look at actual task accuracy, metrics broken down by language and token type, and, if needed, comparisons of internal features. Another mistake is averaging token-level perplexity and using it as a document- or code-level quality score. As the code comprehension study paper showed, the distribution is skewed, so simple aggregates easily go wrong.
Checks before comparing perplexity
Match conditions
- Same tokenizer?
- Same evaluation data and context length?
- Same method, accumulation or sliding window?
- Temperature calibrated for long-context comparisons?
Metrics to check alongside
- Checked actual task accuracy as well?
- Checked token losses per language separately?
- Compared internal features after quantization?
- Avoided using a simple average of token values as a document score?
Further study
Once you have the concept, the first paper to read is the perplexity critique study paper. It shows why perplexity is incomplete as a model selection criterion through proof rather than empirical observation, so it serves as a reference point for reading later work. Next, reading the input-length study paper and the attention temperature study paper gives a sense of how much the evaluation protocol can sway the numbers.
If you work on quantization or compression, read the SAE feature damage study paper and the silent token study paper together. Both look at the same problem, 'something can disappear even when average perplexity stays the same', from different sides: internal features and the output vocabulary. If you are curious about uses in training and data, we recommend the data scaling law study paper and the GSPO reinterpretation paper; for interpretability, the token-level perplexity study paper and the code comprehension study paper.
Related terms
Loss function Tokenizer Token Quantization Benchmark Interpretability Hallucination Context window
References
Foundational papers
- Perplexity Cannot Always Tell Right from Wrong (2026)
- Rethinking Perplexity: Revealing the Impact of Input Length on Perplexity Evaluation in LLMs (2026)
- Perplexity Can Miss SAE Feature Damage Under Quantization (2026)
- Perplexity-Aware Data Scaling Law: Perplexity Landscapes Predict Performance for Continual Pre-training (2025)
- Rethinking GSPO: The Perplexity-Entropy Equivalence (2025)
- Is my model perplexed for the right reason? Contrasting LLMs' Benchmark Behavior with Token-Level Perplexity (2026)
- Can Perplexity Serve as a Cognitive Signal for Code Understandability? (2026)
Recent research
Written by AI from the listed references and reviewed. Please check the original sources for details.