What is perplexity in language models? Cross-entropy loss explained with the OpenAI and Anthropic numbers
Perplexity is the exponential of a language model's cross-entropy loss. This guide explains what it measures, how to read the figures labs now publish, and where it misleads.
· 6 min read
Written by AI from the sources linked below. How we use AI
On this page
In short
Perplexity is a number that says how surprised a language model is by real text. It is the exponential of the model's average cross-entropy loss: a perplexity of 2.1 means the model is, on average, about as uncertain as if it were choosing between roughly two equally likely next tokens. Lower is better, and because labs train models by minimising this loss, it is the most basic yardstick of how good a pretrained model is. It cannot be compared between models that use different tokenizers or test data, and it does not measure everything that makes a model useful.
Why this is in the news
This week two labs put the measure at the centre of a safety debate. On 22 November 2026 OpenAI's chief scientist Jakub Pachocki argued for perplexity as a shared metric and published OpenAI's internal numbers, and on 4 December Anthropic's Jared Kaplan replied with Anthropic's own curve. We covered the exchange in our report on Anthropic's pretraining loss curve. This guide explains the measure itself, so the numbers in those posts make sense.
Step 1: what a language model predicts
A causal (also called autoregressive) language model reads a sequence of tokens, which are pieces of words or characters, and at each position produces a probability for every possible next token. Training pushes up the probability the model gave to the token that actually came next in the training text.
If the text is "the cat sat on the" and the real next token is " mat", a model that gave " mat" a probability of 0.5 did better than one that gave it 0.01. The model is rewarded for putting probability on what really happens.
Step 2: cross-entropy loss
The standard way to score that is the negative log of the probability the model gave the correct token. Probability 1 gives a loss of 0 (no surprise). Smaller probabilities give larger losses. Average that over every token in a text and you have the cross-entropy loss.
Written out, as in the Hugging Face documentation on perplexity: perplexity is the exponentiated average negative log-likelihood of a sequence, and equivalently the exponentiation of the cross-entropy between the data and the model's predictions.
A small worked example, using natural logarithms (the usual convention in machine learning code):
- A model that spreads probability evenly over four possible next tokens gives each probability 0.25. The loss per token is ln(4), about 1.386, and the perplexity is e raised to 1.386, which is exactly 4.
- A model that puts 0.9 on the right token each time has a loss of about 0.105 and a perplexity of about 1.11.
So perplexity has a friendly reading: it is the effective number of equally likely choices the model is torn between at each step. A perfect predictor would have a perplexity of 1 (a loss of 0). A model with perplexity 1.97 is about as unsure as picking between two equally likely tokens.
Step 3: log-perplexity, and what the lab numbers mean
Pachocki's essay notes that in practice OpenAI generally tracks the log of perplexity, which is the same thing as cross-entropy loss. That is the number to read in his plot: "log-perplexity of about 0.99" for GPT-3.5, about 0.91 for GPT-4, and below 0.8 for recent models, with the model that started producing results on open mathematics problems at about 0.76. He expects the next window of new capabilities around 0.68 to 0.7.
The essay does not state the base of the logarithm. If it is the natural logarithm, which is the common choice for training loss, the conversions are:
| Log-perplexity (loss) | Perplexity (e to the power of the loss) | Bits per token (loss divided by ln 2) |
|---|---|---|
| 0.99 | 2.69 | 1.43 |
| 0.91 | 2.48 | 1.31 |
| 0.76 | 2.14 | 1.10 |
| 0.70 | 2.01 | 1.01 |
| 0.68 | 1.97 | 0.98 |
This is our arithmetic on figures from the OpenAI essay, under the natural-log assumption, so treat the right-hand columns as an illustration of scale. The point is how small the gaps look: moving from 0.91 to 0.76 changes the effective number of choices from about 2.5 to about 2.1, yet OpenAI says it coincided with a jump from capable reasoning to mathematical results the team described as surreal.
| log-perplexity | |
|---|---|
| GPT-3.5 | 0.99 |
| GPT-4 | 0.91 |
| Model at 0.76 | 0.76 |
Source: OpenAI, Perplexity and Intelligence (Jakub Pachocki)
Step 4: why labs care about it
It is smooth and cheap to measure. Most capability benchmarks are pass or fail on specific tasks, saturate over time and need to be replaced. Loss on a held-out dataset can be measured on any pretrained model at any stage of training, which is why it is used to steer research and forecast how strong a model will be after pretraining.
It follows a pattern. The 2020 paper "Scaling Laws for Neural Language Models" by Kaplan and colleagues found that cross-entropy loss scales as a power law with model size, dataset size and training compute, with trends spanning more than seven orders of magnitude. That regularity is why loss became the standard yardstick for planning large training runs.
It might warn of surprises. Pachocki's argument is that new capabilities have emerged as loss has fallen, so loss could flag capabilities nobody is testing for yet.
Step 5: where perplexity misleads
The two posts this week, and the Hugging Face documentation, point to the same cautions.
- Tokenizer and dataset matter. The Hugging Face guide says the tokenization procedure has a direct impact on a model's perplexity and must be considered when comparing models. Pachocki notes that different developers use different evaluation datasets and data mixtures, and that OpenAI reports loss on its own internal codebase. Kaplan makes the same point: Anthropic's axis runs on a different scale, so only the shapes of curves compare, not heights.
- It only covers pretraining. Pachocki lists chain-of-thought reasoning, which does not reduce perplexity yet drastically increases capability. Kaplan adds that large-scale reinforcement learning (RL) brought big capability gains with almost no change in loss.
- It is not an upper bound. Kaplan says a low loss shows a model is at least that good at predicting text, but a high loss does not prove a weak model, since training schedules, objectives or evaluation formatting can make it look worse.
- There is an unknown floor. Pachocki notes that nobody knows the inherent entropy of the data, so it is hard to say how much a given improvement matters.
- It is not defined for every model. The Hugging Face documentation says perplexity applies to classical (autoregressive) models and is not well defined for masked models like BERT. Kaplan adds that text diffusion models may not be directly comparable to autoregressive ones.
Kaplan's example of the second point uses the Anthropic ECI, an internal version of the Epoch Capabilities Index: Claude 3.5, 3.6 and 3.7 Sonnet had near-identical pretraining loss, but scores of 130, 133 and 140.
Step 6: how to compute it yourself
For an open model you can measure perplexity on your own text. With the Hugging Face Transformers library, the documentation's approach is to use a sliding window with overlap, because evaluating disjoint chunks gives a poor approximation and typically a higher (worse) perplexity: each chunk's early tokens have little context to condition on. The library page walks through the procedure for GPT-2, whose largest version had a fixed context of 1,024 tokens.
Two practical rules follow from this guide:
- Compare models only on the same text and with the same tokenizer, or convert to a tokenizer-independent unit such as bits per character, which the Hugging Face page points to for readers who want the link to compression.
- Report the dataset and the log base. A bare "loss 0.8" is meaningless without them.
What to remember
- Perplexity = exp(cross-entropy loss). The loss is the average negative log of the probability the model gave the right next token.
- Lower is better, and a perplexity of N means being about as unsure as a choice between N equally likely tokens.
- Numbers from different labs, tokenizers or test sets cannot be compared directly.
- It captures pretraining quality, not the full range of capabilities added by reinforcement learning or reasoning, which is the heart of the current debate between OpenAI and Anthropic.
Sources
- OpenAI: Perplexity and Intelligence (Jakub Pachocki, 22 November 2026)
- Anthropic: Measuring model capabilities for pacing the frontier (Jared Kaplan)
- Hugging Face Transformers documentation: Perplexity of fixed-length models
- arXiv:2001.08361, Scaling Laws for Neural Language Models (Kaplan et al., 2020)
Written by
The official account of the people who run audiotale.net: announcements, conversation starters and the newsroom's drafts. Posts written with AI say so. Every other account here is a real person.
Read next
Olmicro: Ai2 releases five open 275M-2.7B hybrid models, Apache 2.0, 64K context
Ai2's new small base models ship with data, code and 1,707 checkpoints, and cut long-context memory to about a fifth of an all-attention model.
audiotale.net team8 min read
How to compare LLM prices: cost per task, not price per million tokens
A step by step guide to counting tokens, thinking, caching and batch discounts so you can compare AI models by what a finished job really costs.
audiotale.net team7 min read
How to run an open-weight LLM locally: GGUF, quantization, Ollama and llama.cpp
A step-by-step guide to running an open-weight model on your own computer: what GGUF is, how quantization sets memory needs, and the Ollama and llama.cpp commands.
audiotale.net team6 min read