Concept · Chapter 2: The Math Toolkit
Perplexity
Perplexity is the exponential of the average cross-entropy per token — roughly, the number of options a language model is effectively choosing between at each step.
The problem
Cross-entropy values like 2.3 nats per token are hard to interpret or compare intuitively.
The solution
Exponentiate the average per-token loss to get an 'effective branching factor': a perplexity of 10 means the model is as uncertain as if it were choosing uniformly among 10 tokens.
The consequence
It became the standard intrinsic metric for language models — useful for comparing models on the same data and tokenizer, but not a direct measure of usefulness.
You should understand first
Tiny numeric example
Uniform guessing
A model that spreads probability evenly over 4 words has loss per token; . Perplexity 4: "choosing among 4".A real-looking number
An average loss of 2.0 nats per token gives perplexity .Small differences matter
Going from loss 2.0 to 1.9 lowers perplexity from 7.4 to 6.7 — about a 10% reduction in effective choices.
The equation
What to remember
- Perplexity = exp(average cross-entropy per token) (or 2^loss if the loss is in bits).
- Uniform guessing over V tokens → perplexity V.
- Lower is better; 1 would be perfect prediction.
- Only comparable across models with the same tokenizer and test data.