core-ai
Glossary ↗Perplexity (Metric)
Perplexity measures how well a language model predicts a sample of text: it is the exponential of the average negative log-likelihood per token, intuitively the number of choices the model is "hesitating between" at each step. A perplexity of 1 means perfect prediction; 20 means the model is, on average, as uncertain as a uniform pick among 20 tokens. Lower is better. It has been the workhorse metric of language modeling since the n-gram era and still tracks pretraining progress and quantization damage well — a compressed model whose perplexity barely moves has likely survived intact. Its limits matter, though: perplexity scores are only comparable across models sharing a tokenizer, and low perplexity does not guarantee instruction-following, factuality, or usefulness, which is why chat-era evaluation leans on benchmarks and human or LLM-judged comparisons instead. Not to be confused with Perplexity AI, the answer-engine product. Where perplexity genuinely earns its place is inside the training and research loop rather than on a product dashboard: tracking loss curves during pretraining, comparing checkpoints, and — most usefully for builders — checking whether a compression step did damage. Quantize a model and measure perplexity before and after on held-out text from your domain; if it barely moves, the compression probably preserved the model's language modelling ability, and if it jumps, you have a cheap early warning before running any expensive task-level evaluation. Two constraints determine when the number means anything. First, perplexity is not comparable across models that use different tokenizers or vocabularies, because the metric is defined per token and different tokenizers segment the same text into different numbers of tokens — a model whose tokenizer splits your language more finely will show a different perplexity for identical text without being better or worse at anything. This bites hardest on non-English text, where tokenization efficiency varies widely between vendors. Second, low perplexity does not reliably predict downstream behaviour: a model can be excellent at next-token prediction and still fail at following multi-step instructions, resisting a jailbreak, or staying factual, because none of those properties are what the metric measures. Post-training changes such as instruction tuning and preference optimization can even move perplexity in one direction while moving usefulness in the other. Treat it as a health check on the language model underneath, not as a ranking of assistants — and never as a substitute for evaluating the actual task you are shipping.
Related terms