Show that the cross-entropy of a model on text from the true distribution equals , so perplexity can never go below . Why can the perplexities of two models with different tokenisers not be compared directly, and how do you convert to bits per character? For a model with perplexity per token and characters per token, what is the bits per character?
Sequence models and transformers, Evaluation
Level L3 Intermediate. Length Long. Nature Th+Mat Both.
What's being asked
Whether you can derive the decomposition, link perplexity to entropy, and normalise across tokenisers.
Key idea
because . Perplexity is (with logs in base ).
Steps
- Add and subtract : .
- (Gibbs' inequality), with equality only when . So the cross-entropy is minimised by the true distribution, and the minimum value is the entropy of the source.
- Perplexity . A perfect model still has perplexity above if the text has real uncertainty. is the effective branching factor.
- Per-token perplexity depends on the unit. A tokeniser with larger tokens predicts fewer, harder tokens, so its per-token perplexity is higher even for the same model quality. Comparing perplexities across vocabularies is therefore unfair.
- Convert to a common unit: bits per character . Here bits per token, so bits per character.
- Bits per byte or per character is also the quantity a compressor would achieve, which links language modelling to compression.
Common mistakes
- Saying perplexity can be below .
- Comparing token-level perplexities of models with different vocabularies.
- Mixing natural log and when converting.
How long your answer should be
Half a page to a page; 6 minutes.
Last checked on 4 December 2026.
Read this
Previous in Sequence models and transformers: A decoder has layers, query heads of dimension () and stores keys and values in 16-bit floats ( bytes). How large is the KV cache for one sequence of tokens with multi-head attention (MHA), grouped-query attention with KV heads (GQA), and multi-query attention (MQA, one KV head)? How many parameters does GQA save in the and projections?
Next in Sequence models and transformers: Interpolated absolute discounting uses with . Choose so that the distribution sums to , and prove it. Then explain why Kneser–Ney replaces the lower-order unigram by the continuation probability , and check that this also sums to . If with distinct followers and , what is ?