Perplexity › The Evaluation Problem

Michael BrenndoerferMarch 26, 20252 min read
Language AI HandbookAll chapters
Part 2 of 67Classical Text Representations
Chapter 10Perplexity › The Evaluation Problem
Reading section 2 of 17 · The Evaluation Problem · 2 minSection 2 of 17 · 2 min

Book contents

Section 2 of 17 · 2 min read

Perplexity › The Evaluation ProblemOne section · Sections in this chapter2 / 17 ↓
Reading tools Definitions & inline links

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

Consider two language models trained on the same corpus. Model A assigns P("the cat sat on the mat")=0.001P(\text{"the cat sat on the mat"}) = 0.001. Model B assigns P("the cat sat on the mat")=0.0001P(\text{"the cat sat on the mat"}) = 0.0001. Which model is better?

At first glance, Model A seems superior because it assigns higher probability to a grammatical sentence. But this comparison is misleading. Model A might assign high probability to everything, including nonsense like "mat the on sat cat the." Model B might be more discriminating, reserving high probability for truly likely sequences while assigning near-zero probability to ungrammatical or incoherent text.

We need a metric that rewards models for assigning high probability to actual language while penalizing them for wasting probability mass on unlikely sequences. Perplexity does exactly this by measuring how well a model predicts held-out test data.

Held-Out Evaluation

The practice of evaluating a model on data it wasn't trained on. This tests whether the model learned generalizable patterns rather than memorizing the training data. The held-out data is called the test set or evaluation set.

The held-out evaluation principle is fundamental. A model can always achieve better probability on its own training data simply by memorizing it. The real question is whether the patterns the model learned from training data generalize to new text it has never seen. Perplexity on a held-out test set answers this question directly.

Think of it like testing a student. A student who memorized answers to practice problems but doesn't understand the underlying concepts will do well on those same practice problems and poorly on a final exam with new questions. Perplexity on held-out data is the final exam: it distinguishes learning from memorization.