4.2.9 · D5Tokenization & Language Modeling
Question bank — Perplexity as a metric
Notation this page uses (defined before we probe it)
Before the traps, we pin down every symbol so nothing is used before it is earned.
Everything below assumes these definitions.
True or false — justify
A perplexity of 1 means a perfect model.
True — perplexity 1 requires every real token to get probability , so and the model is never surprised; it "knew" each next token exactly.
Perplexity can be less than 1.
False — since , each surprisal , so and ; 1 is the hard floor.
Lower cross-entropy always means lower perplexity.
True — is monotonically increasing in (for base ), so they move in the same direction; less average surprise means fewer effective choices.
Perplexity is measured in bits.
False — cross-entropy has units (bits when , nats when ), but perplexity is a dimensionless count: the effective number of equally-likely tokens.
A model with perplexity 50 on English is choosing among exactly 50 words at every step.
False — 50 is the effective (geometric-mean) branching factor across the whole text, not a literal count at any single position; some steps are far more or less certain.
If you double the length of the test text, perplexity roughly doubles.
False — perplexity is a per-token geometric mean, so it is designed to be length-independent; doubling leaves it roughly unchanged if the text is statistically similar.
Two models on the same data: the one with lower per-token negative log-likelihood has lower perplexity.
True — perplexity is a monotonic (exponential) function of the mean NLL, which is exactly , so lower mean NLL always yields lower PPL; they rank models identically.
Switching from to changes the numeric value of perplexity.
False — as long as you exponentiate with the matching base, ; the base cancels and perplexity is base-independent.
A larger vocabulary always gives a model higher perplexity.
False — a bigger vocabulary only raises the ceiling ( for a uniform model over tokens); a good model can still be very confident and have low perplexity regardless of .
Spot the error
"I computed mean -loss = 2.0, so perplexity = ."
Error: base mismatch — the loss is in nats (), so you must exponentiate with , giving , not .
"Model A has PPL 30 with word tokens; Model B has PPL 12 with sub-word tokens; B is clearly better."
Error: the tokenizations differ, so and the per-token distribution differ; per-token perplexities are not comparable across tokenizers — use bits-per-byte instead. See Bits-Per-Character (BPC).
"Entropy and perplexity are opposites, so a confident (low-entropy) model has high perplexity."
Error: they are not opposites — increases with , so low entropy gives low perplexity, same direction.
"To get sequence perplexity I add the per-token probabilities and take a root."
Error: probabilities are multiplied (chain rule ), then you take the -th root of the reciprocal; addition would be meaningless here.
"The model gave probability 0 to one rare word, but the other 999 words were great, so PPL is still fine."
Error: one makes , so the sum, , and thus PPL all blow up to — a single impossible-but-real token destroys the score.
"Perplexity 1.0 on my training set proves my model is excellent."
Error: perplexity near 1 on training data usually signals memorization/overfitting; the metric is only meaningful on held-out data the model has not seen.
"Since PPL = exp(loss) and loss ≥ 0, perplexity ranges from 0 to ∞."
Error: because , perplexity ranges from 1 (at ) to , never from 0; is the minimum.
Why questions
Why do we take the geometric mean of rather than the arithmetic mean?
Because sequence probability is a product ; the geometric mean is the natural per-factor summary of a product, and its log is exactly , the arithmetic mean of the log-probabilities. See Cross-Entropy Loss.
Why does the exponent carry a negative sign in ?
The negative flips "probability" (bigger = better) into a cost (bigger = worse), so perplexity behaves like a loss you want to minimize.
Why does a uniform model over tokens have perplexity exactly ?
Each gives surprisal , so and ; it literally recovers the vocabulary size — the worst-case branching factor.
Why is perplexity only a proxy for text quality, not quality itself?
It measures probability calibration on real text, rewarding the safe/frequent next token; a model can score low PPL yet produce dull, repetitive prose because "likely" is not the same as "good."
Why must probabilities come from a proper distribution (e.g. softmax) for perplexity to be valid?
Perplexity assumes each is a normalized probability summing to 1 over the vocabulary; unnormalized scores would make and the geometric mean meaningless.
Why does minimizing the language-modeling loss automatically minimize perplexity?
The training loss is the average negative log-likelihood, which equals , and perplexity is just ; lowering one monotonically lowers the other.
Why can't perplexity ever be negative?
It is an exponential with , and exponentials of real numbers are always positive; moreover forces .
Edge cases
What is the perplexity if the model assigns probability 1 to every actual next token?
Exactly 1 — every surprisal is , so and ; the perfect, never-surprised model.
What is the perplexity if the model assigns probability 0 to any actual token?
— that token's surprisal dominates the sum, which is exactly why we smooth or clamp probabilities away from zero.
For a single-token sequence (), what does perplexity reduce to?
Just — the geometric mean of one number is that number, so perplexity is the reciprocal of the model's probability for that one token.
What perplexity does a completely random guesser over a 50,000-token vocabulary achieve?
50,000 — a uniform model gives ; this is the ceiling that any trained model must beat to show it learned anything.
If a model is worse than uniform (assigns below-average probability to real tokens), can its perplexity exceed ?
Yes — perplexity is only bounded below by 1, not above by ; a systematically miscalibrated model that favors wrong tokens can have .
What happens to perplexity as the test text approaches infinite length (from the same source)?
It converges toward , where is the true per-token cross-entropy between the model and the language — the metric stabilizes rather than drifting with . See Entropy and Information Content.
Connections
- 4.2.09 Perplexity as a metric — the parent concept this bank probes; reuse its definition of when you reason through each trap.
- Cross-Entropy Loss — perplexity is with the cross-entropy, so this page's traps are all disguised statements about that loss.
- Entropy and Information Content — supplies the surprisal that makes "why " and the edge case work.
- Language Modeling Objective — minimizing its average NLL is minimizing , hence perplexity; explains the "same direction" traps.
- Tokenization — sets and the per-token distribution, which is why cross-tokenizer comparison of PPL fails.
- Bits-Per-Character (BPC) — the tokenizer-independent fix invoked whenever tokenizations differ.
- Softmax and Probability Distributions — guarantees each is a normalized probability, the precondition for perplexity to be defined at all.