Skip to content
nonconvexcard

Perplexity is not comparable across tokenisers

NumericalBeginner⏱ 15 minLLMsperplexitytokenisationevaluationbits per byte

Problem

Two models assign the same total probability to a corpus of C=106C = 10^6 characters, but tokenise it into T1=2.5×105T_1 = 2.5\times10^5 and T2=5×105T_2 = 5\times10^5 tokens. Given −log⁡q(corpus)=1.6×106-\log q(\text{corpus}) = 1.6\times10^6 nats, compute both perplexities and the bits-per-character for each, and state which comparison is meaningful.

Compute the requested quantities and say what they mean. A number without an interpretation is not an answer.

Solution

Opening this before you have a real attempt on paper is the fastest way to feel like you understand something you cannot reproduce.

Related problems

All problems
SolvedProblemFieldTypeDifficultyTime
Maximum likelihood is KL minimisationLLMsProofBeginner15 min
The cross-entropy gradient is the prediction errorLLMsProofBeginner15 min
The irreducible loss is the conditional entropyLLMsProofIntermediate30 min
Build and instrument a minimal RAG pipeline runRAGCodingAdvanced1 day
Temperature monotonically controls entropyLLMsProofAdvanced30 min