Perplexity, Cross-Entropy, and Compression
Held-out log-loss is a file size: an arithmetic coder turns any language model into a compressor within two bits of it — which makes perplexity a branching factor, bits per character its honest unit, and the unknown-word convention a flattering lower bound
Overview & Motivation
Two language models score the same held-out finance text. One reports a perplexity of , the other . Which is better? As posed, the question has no answer. The first model is a character -gram, so its perplexity is per character. The second is a word trigram, so its perplexity is per word. Put both on one unit and the order flips: the word model spends bits per character, and the character model .
This topic makes that comparison precise by reading a language model three ways, and proving each reading.
- A forecaster scored by log-loss. Held-out log-loss estimates a cross-entropy, and the logarithm is the score that rewards a forecaster for reporting what it actually believes.
- A branching factor. Perplexity counts the equally likely choices the model behaves as if it faced at each token. The asymptotic equipartition property makes “behaves as if” exact.
- A compressor. An arithmetic coder turns any sequential model into a code whose length is within two bits of the model’s . So held-out cross-entropy is the size of the file the model would write. We run that coder on the whole held-out corpus of the n-gram topic: characters become one codeword of bits, bits above the model’s own figure.
The file-size reading settles two questions the previous topics left open. The subword topic charged bits for a piece and called it compression, and Theorem 4 makes that exact for a whole file. The n-gram topic reported log-loss per word, and Theorem 5 shows that comparing models across tokenizers needs a unit the tokenizer does not choose: characters, bytes, or words. Proposition 5 shows that the unknown-word convention can only flatter a model. The finance case study then takes everything out of domain, to public EDGAR filings, where a Kneser–Ney model predicts worse than a uniform guess and a stock lzma compressor beats every model on the page.
Cross-entropy and the log score
The n-gram topic’s interpolated Kneser–Ney model scores nats per token on held-out text: the average of over its predicted tokens. In bits that is per token, and it already sounds like a code length. We start with what that average estimates.
Throughout, a sentence is padded with two <s> symbols in front and one </s> behind, and every word and the final </s> is a predicted token. is the n-gram topic’s vocabulary, . The normalized string of a sentence is its words joined by single spaces, followed by a sentence-end mark. Its characters are therefore each word’s letters plus one separator after each word, a space or the sentence end. The held-out text has sentences, predicted tokens, and characters. Logarithms are natural (in nats) unless written (in bits).
Definition 1 (Cross-entropy, log-loss, and perplexity).
For distributions and on a finite set, the cross-entropy of relative to is , and is the entropy. A sequential model scores a text by its negative log-likelihood
For a unit occurring times in the text (the model’s own tokens, characters, or word tokens), the log-loss per unit is , and the perplexity per unit is . Bits per character (bpc) is .
Proposition 1 (Cross-entropy is entropy plus divergence).
, with equality if and only if .
This is Proposition 1 of formalML’s KL divergence: expand and apply Gibbs’ inequality. We use it as a tool, four times on this page: in Corollary 1, Proposition 2(3), Corollary 2, and Proposition 3.
Corollary 1 (The log score is strictly proper).
For every distribution , the expected log-loss is minimized at and nowhere else.
Proof.
. Only the divergence depends on , and by Proposition 1 it is zero exactly at .
∎A forecaster scored by log-loss does best, on average, by reporting its true belief. That is the property strictly proper names (Gneiting and Raftery 2007). Training a language model by minimizing empirical cross-entropy is maximum likelihood, the reading the n-gram topic proved for relative frequencies, and strict propriety is why maximum likelihood rewards a model for reporting its true beliefs. Not every score has it. Under the linear score , putting all mass on the most likely outcome does at least as well as reporting itself, and strictly better unless is uniform on its support. For more than two outcomes, the logarithm is the only proper score that depends on the forecast only through the probability given to what happened (Bernardo 1979).
Proposition 2 (What a perplexity is).
- For a text of tokens with model probabilities , the perplexity is , the geometric mean of the inverse probabilities, which is at most their arithmetic mean.
- A model that is uniform on symbols has perplexity exactly on every text.
- For every distribution , .
- Consequently, a perplexity above means the model did worse on that text than the uniform distribution on .
Proof.
For (1), , and the arithmetic–geometric mean inequality bounds it by . For (2), every . For (3), , and is Proposition 1 with uniform on the support of . Statement (4) is (2) with .
∎On the held-out text, interpolated Kneser–Ney’s nats per token is a perplexity of : the model is as uncertain as if it chose uniformly among about seventeen words at each token. On the public EDGAR excerpts of the finance case study, the same model scores nats, a perplexity of . That is above , whose logarithm is , so on that text the model predicts worse than the uniform distribution over its own vocabulary. Modified Kneser–Ney () does too. Laplace smoothing, which leans hardest toward uniform, scores and stays just under the line.
Perplexity as a branching factor
Roll a three-sided die weighted , , and three hundred times. There are possible sequences, but the die does not visit them evenly. Almost all of its probability falls on a set that holds a fraction of the sequences. Each sequence in that set has a probability whose geometric mean per roll is close to , so each is about as probable as a run of uniform choices among faces per roll, rather than three. This is the precise sense in which perplexity is a branching factor.
Theorem 1 (The asymptotic equipartition property).
Let be independent draws from on a finite alphabet, with entropy and . For , the typical set is
Then
For any model with , likewise .
Proof.
is a sum of independent terms, each with mean and variance . Chebyshev’s inequality bounds the probability that its average leaves by , which is the first bound and the weak law of large numbers. Every sequence in has probability between and . Summing the lower bound over gives , the second bound. Summing the upper bound gives , the third. The statement for is Chebyshev’s inequality applied to the terms , whose mean is .
∎So almost all the probability sits on the typical set, and every member of it has probability within a factor of : per symbol, each typical sequence is about as probable as a uniform choice among options. That is a statement about each sequence’s probability, not the set’s size. With fixed, the theorem pins only between and , and the table below shows it sitting well above . Likewise, by the theorem’s last statement, a text drawn from has with high probability, so the model assigns it about the probability a uniform guesser among options per symbol would. Its perplexity is that number of options.
For the die, nats. Counting type classes exactly with :
| rolls | Chebyshev’s floor | ||
|---|---|---|---|
The probability of the typical set climbs to one, and the growth rate of its size stays within of , as the theorem says. At the set has members out of , against . Formal statements of this kind are often quoted as “about sequences.” The table shows what “about” means: within , with fixed while grows.
From held-out text to cross-entropy
A held-out log-loss is one number computed from one text, so it comes with an uncertainty. For interpolated Kneser–Ney there are two candidate standard errors: if every token is an independent draw, and if every sentence is. The second is right, and the reason is in what the held-out average estimates.
Definition 2 (The sentence source).
Sentences are independent and identically distributed finite token sequences, each ending in </s>. For a model , write for the negative log-likelihood of sentence and for its number of predicted tokens. The per-token cross-entropy of against the source is .
Theorem 2 (Held-out log-loss is a ratio estimator).
If and are finite, the held-out per-token log-loss of sentences, , converges to almost surely. If the second moments are also finite, then
and the variance of is estimated consistently by
Proof.
By the strong law of large numbers (formalStatistics, Law of Large Numbers), the sentence averages and converge almost surely to and , and is a continuous function of the pair away from . For the limit law, write . The numerator is the average of the independent terms , which have mean . The central limit theorem (formalStatistics, Central Limit Theorem) gives , and Slutsky’s theorem divides by . Replacing by in the sample variance is consistent by the same two laws.
∎Two things follow. First, the held-out average estimates a ratio of means, not the mean of per-sentence averages, so long sentences count for more. Second, the independent unit is the sentence: tokens in one sentence share a history, so treating them as independent understates the error. On the corpus the sentence-level standard error is times the naive one.
We checked the theorem where the answer is known exactly. For twenty random bigram sentence sources, absorbing-chain algebra gives and in closed form. The held-out average of sampled sentences lands within four standard errors of every time. For one of those sources, replications of sentences each check the interval : it covers times (), within binomial noise of the nominal . On the held-out corpus:
- interpolated Kneser–Ney scores nats per token;
- modified Kneser–Ney minus interpolated Kneser–Ney, paired sentence by sentence, is , twenty-four standard errors from zero, although the two models’ own intervals overlap;
- the open-vocabulary code of the next section spends bits per character.
Pairing removes the variation the two models share, which is most of it. Formal tests and the bootstrap belong to the later topic on significance testing.
Remark (Shannon–McMillan–Breiman (cited)).
Sentences need not be independent for the held-out average to mean something. For a stationary ergodic source on a finite alphabet, converges almost surely to the entropy rate (McMillan 1953 in mean, Breiman 1957 almost surely). For a model of finite Markov order with positive conditionals, is an ergodic average of a function of finitely many coordinates, so Birkhoff’s ergodic theorem sends it to the cross-entropy rate. Algoet and Cover (1988) prove the first statement by sandwiching between exactly such Markov approximations. The companion notebook checks both limits along single paths of length of random ergodic Markov chains, whose rates formalML’s Shannon Entropy computes in closed form.
Corollary 2 (Every model bounds the entropy rate).
For a stationary source and any sequential model , for every . When the limits exist, the cross-entropy rate is therefore at least the entropy rate, with equality when .
Proof.
Apply Proposition 1 to the joint distributions of symbols: , where and are the two laws of the first symbols. Divide by and let grow.
∎So any model’s held-out cross-entropy estimates an upper bound on the entropy rate of the source. Brown et al. (1992) bounded English at bits per character this way. For our generator the lowest figure on this page is modified Kneser–Ney’s open-vocabulary code, at bits per character; the interpolated Kneser–Ney code run below gives . That figure comes from one held-out text, so it estimates the bound rather than certifying it.
Compression is prediction
A binary code gives each symbol a codeword of bits. It is prefix-free if no codeword begins another, and uniquely decodable if concatenations of codewords can be split back in only one way. Picture each codeword as an interval of . Read as a binary fraction , and let it name the dyadic interval , of length . A codeword that begins another names an interval containing the other’s. So a prefix-free code is a set of disjoint dyadic intervals, and its lengths satisfy
This is Kraft’s inequality. Conversely, any lengths satisfying it admit a prefix code: lay the intervals left to right in order of increasing length. Both directions, with Shannon’s source-coding theorem (in bits), are proved in formalML’s Shannon Entropy. We add the step that extends the converse from prefix codes to every uniquely decodable code.
Definition 3 (Codes).
A binary code on a finite set is a map with lengths . Its extension sends a message to the concatenation . The code is uniquely decodable if its extension is injective, and prefix-free if no codeword is a proper prefix of another.
Theorem 3 (McMillan's inequality).
Every uniquely decodable code satisfies .
Proof.
Let and let be the longest codeword length. For each , multiply out the -th power:
where counts the messages of symbols whose concatenated codeword has exactly bits. Unique decodability makes those concatenations distinct strings of bits, and there are only such strings, so and . If , the left side grows exponentially in and the right side linearly, which is impossible for large . So .
∎Prefix codes therefore lose nothing: any lengths a uniquely decodable code achieves, a prefix code achieves too. The companion notebook checks the theorem exhaustively. Of the binary codes with three or four codewords of at most three bits, are uniquely decodable by the Sardinas–Patterson test, and of those are not prefix-free; is one. None violates Kraft’s inequality, and none of the codes that violate it is uniquely decodable. A brute-force count of the parsings of every bit-string up to ten bits agrees with Sardinas–Patterson on all codes.
Proposition 3 (Coding with the wrong model costs its divergence).
For a model , the Shannon code has lengths . It is realized by a prefix code, and when symbols are drawn from ,
where the subscript marks quantities in bits.
Proof.
, so Kraft’s inequality gives a prefix code with these lengths. Since , taking expectations under places in , and Proposition 1 writes .
∎The bits a model wastes per symbol, beyond the source’s entropy, are its divergence from the source. For coded with the uniform model, the code spends bits per symbol: the entropy’s plus a divergence of . The rounding up to whole bits costs up to one more bit per symbol. Over a text of thousands of symbols that is thousands of bits, and the next theorem removes it.
Theorem 4 (Arithmetic coding).
Let be a sequential model and a message. Start from the interval . At step , divide the current interval into consecutive slices, one per possible next symbol, the slice for symbol having a fraction of the interval’s width, and keep the slice for . The final interval has width . Let and , and let the codeword be the -bit binary expansion of . Then:
- the dyadic interval lies inside ;
- over any prefix-free set of messages (for example, all messages with a fixed number of symbols), these codewords form a prefix code;
- the shortest codeword whose dyadic interval fits has a length with .
Proof.
(1) By the choice of , . By the choice of , , so . (2) The slices of an interval are disjoint, so by induction on the symbols, two messages that differ at some position have disjoint final intervals as long as neither is a prefix of the other. Their dyadic subintervals are then disjoint too. A codeword that began another would name a dyadic interval containing the other’s, so neither codeword begins the other. (3) The upper bound is (1). For the lower bound, a dyadic interval of length inside an interval of width needs .
∎So the whole message costs at most two bits more than , not one bit more per symbol. Our coder replaces each probability with an integer frequency , so every symbol of the alphabet keeps a nonzero slice. It then carries the interval as exact big-integer fractions: with the total frequency and the frequency of the symbols before ,
so that the interval is at every step. The bounds of Theorem 4 then hold exactly for the integer model. On random sequential models and messages, decoding recovers every message and the two-sided bound holds in exact integer arithmetic. Over all messages of five symbols from a three-symbol model, the codewords are prefix-free with Kraft sum at most one.
To code real text, the model needs a way to write down words it has never seen.
Definition 4 (The open-vocabulary word code).
The open-vocabulary form of a word model codes a word in as one symbol. It codes any other word as <unk> followed by its letters and an end mark, which are spelled by a speller: a character trigram Kneser–Ney model fit to the word types that occur exactly once in training, the stand-ins for unseen words that Good–Turing reasoning suggests. The word history sees <unk>, as in the n-gram topic.
The speller can also spell words that are in . That wastes a little code space, so the code is slightly deficient, but it never fails. Under interpolated Kneser–Ney, the entire held-out text — symbols, counting the letters of spelled words — becomes one codeword of bits. The model’s own is , so the codeword is bits longer. Quantizing to integer frequencies costs less than bits in all, and decoding reproduces all sentences exactly. That is bits per character. As in Theorem 4(2), the decoder is told the number of symbols; sending the count as well would add about bits. Coding each symbol separately with its Shannon code would take bits, more. The subword topic’s reading of a unigram model as a code, bits per piece, is now exact to within two bits for a whole file.
Proposition 4 (A compressor is a model).
If is a uniquely decodable code on a set of texts, then satisfies , so the length of every compressed file is the negative log-probability, in bits, of the text under a sub-probability model. Conversely, Theorem 4 turns every sequential model into a code within two bits of its negative log-probability.
Proof.
The first statement is Theorem 3, since . The second is Theorem 4.
∎So compressors and language models can be ranked on one scale, bits per character. “Given the training text” means the coder may use the training corpus. For zlib that is a genuine conditional code, a KiB preset dictionary the decoder also holds. For bz2 and lzma it is the extra length , an approximation to one.
| bits per character | held out, alone | held out, given training text | EDGAR, alone | EDGAR, given training text |
|---|---|---|---|---|
| zlib, level 9 | ||||
| bz2, level 9 | ||||
| lzma, preset 9e | ||||
| interpolated Kneser–Ney, arithmetic-coded (codeword length) | — | — |
The last row is the length of the actual codeword, like the compressors’ rows. Elsewhere the page reports the model’s own per character, which on EDGAR is : the -bit codeword is bits longer than the model’s . In domain, the Kneser–Ney code beats every general-purpose compressor that sees the same training text. bz2 needs more bits, because its block sort finds the corpus’s long templated phrases. On the EDGAR excerpts the order reverses, and lzma beats every model on the page. lzma wins by adapting to the text it is coding, and Theorem 4 allows that too: may be learned from the symbols already coded, as long as the decoder can learn it the same way. This is prequential coding (Dawid 1984; formalML’s Minimum Description Length), and adaptive models like PPM (Cleary and Witten 1984) were built on it.
Choosing the unit
One model, one text, two perplexities. On the held-out sentences made only of in-vocabulary words, interpolated Kneser–Ney (with <unk> removed and the rest renormalized) has a perplexity of per word token and per character. Nothing about the model changed between the two numbers, only the count we divided by.
Theorem 5 (Tokenization invariance).
Let be a distribution on strings, each ending in an end mark, and let be an injective tokenizer from strings to token sequences. The token model satisfies for every string . Consequently, for a text and any two units and occurring and times in it,
and every unit whose count does not depend on the model (characters, bytes, word tokens) ranks any set of models identically.
Proof.
The chain rule over tokens multiplies the conditionals of the single distribution , the image of under . Because is injective, the string corresponds to the one token sequence , so . The unit identity is for each unit. A unit whose count is the same for every model divides every model’s total by one constant, which preserves the order.
∎The theorem is close to bookkeeping, and its force is in what it rules out. A per-token perplexity divides a model’s total by the number of tokens its own tokenizer produced. Two models with different tokenizers divide by different numbers, so their per-token perplexities measure model quality and token length together.
The construction behind it shows that a word model really is a character model. Let be the word model with <unk> removed and renormalized, a proper distribution on sentences of in-vocabulary words. After a context , the words beginning with a partial word form a contiguous block of the sorted vocabulary, with total probability
The next letter then has probability . Write for the probability gives </s> after the context . The character after a complete word is its separator, with
where is the context after . After a space the next word cannot be </s>, so the first letter is normalized by instead of . Each word’s factors telescope to , and the separators carry the decisions to stop. On all sentences, the character factorization and the word factorization agree to . The character view also shows where a model spends its bits. In halvorsen reported revenue …, the first letter of halvorsen costs bits and the next eight cost almost nothing. The first letter of reported costs .
Now compare models built on different tokenizers. Each row is a Kneser–Ney model of the order shown, scored on the same held-out text:
| model | tokens per character | nats per token | perplexity per token | bits per character | perplexity per word token |
|---|---|---|---|---|---|
| character 3-gram | |||||
| character 5-gram | |||||
| character 7-gram | |||||
| BPE, , 5-gram | |||||
| BPE, , 5-gram | |||||
| BPE, , 5-gram | |||||
| word trigram, open vocabulary | |||||
word trigram, <unk> as one event — not a code | () |
The BPE vocabularies are the subword topic’s tokenizer, and pieces is the minimum of its two-part description length. Per-token perplexity calls the character -gram the best model by a wide margin. In bits per character it ranks fifth of seven, and the open word trigram ranks first. Bits per character and perplexity per word token order the models identically, as Theorem 5 requires. Per-token perplexity rewards short tokens: a token that carries less of the text is easier to predict. The models also see different amounts of context — characters for the -gram, about for both the word trigram and the largest BPE model — so the table compares models as built, not tokenizers in isolation.
The last row is not a code at all, which is the next point.
Proposition 5 (The unknown-word convention can only flatter).
Let a closed-vocabulary model give the symbol <unk> probability after a context , and let an open completion spell each out-of-vocabulary word with probability , where . Then
The closed score is not the length of any code for the text, because it gives one probability to infinitely many different strings.
Proof.
The open model’s probability of the text is the closed model’s probability times one spelling factor for each out-of-vocabulary word, and each factor is at most one. Two texts that differ only in their unknown words receive the same closed probability. There are infinitely many unknown words, so each text with one has infinitely many such siblings, all with the same positive closed probability, and the closed probabilities summed over texts diverge. By Theorem 3, the lengths of any uniquely decodable code satisfy , so no such code has lengths . (A sum below one would not have ruled out a code: by Proposition 4, compressors are sub-probability models.)
∎How much the convention flatters depends on how many words it hides. Send every word seen at most times in training to <unk>, refit interpolated Kneser–Ney, and train the speller on the training occurrences of those words:
| out-of-vocabulary tokens | perplexity per token, closed | bits per character, open | EDGAR, closed perplexity | EDGAR, open bpc | ||
|---|---|---|---|---|---|---|
| (the n-gram topic’s ) | ||||||
| all words |
In domain, every step down in vocabulary lowers the closed perplexity and lengthens the honest code. A model that knows no words at all, and predicts only <unk> or </s>, reports a perplexity of . On EDGAR the honest code instead falls from to bits per character as the cutoff rises, though not at every step. Out of domain, the word model’s vocabulary is worth less than a speller trained on more words.
Coding a sentence, choosing a unit
The laboratory makes the last two sections visible. In panel A, pick a sentence and a smoother, then step through the symbols. Each row is the current interval, stretched to full width and cut into the slices of the likeliest next symbols. The chosen slice becomes the next row. The ticker below shows the bits of the codeword that are already settled. Under interpolated Kneser–Ney the in-domain sentence’s codeword is bits, and Laplace smoothing’s is . In the second sentence, the unknown word nonroyaltys (the subword topic’s running example) costs of the bits the model gives the sentence, whose codeword is bits: for <unk> and for its letters. On the EDGAR sentence the smoothers trade places. Panel B ranks the table’s models by the unit you choose, and its slider moves the unknown-word cutoff: the closed perplexity falls toward one while the honest code grows.
halvorsen reported revenue of million for the second quarter (61 characters)
Rows show the last 6 symbols. Hollow slices are the likeliest alternatives, placed where they sit in the interval; shaded rows are the speller at work on an unknown word. The whole held-out text under interpolated KN is one codeword of 98,345 bits (0.6371 bits per character).
Lower is better (log scale). Per-token perplexity divides by each model's own token count; bits per character and perplexity per word token divide every model by the same count, so they always agree. The open word model's bits per character is its arithmetic code: 98,345 bits for 154,362 characters.
A perplexity above |V| = 3,427 is worse than a uniform guess over the vocabulary. The codeword lengths are exact (big-integer arithmetic coding); "closed" scores count every unknown word as one event and are not code lengths.
Finance case study: out of domain, the zip file wins
Where this goes next
- Neural language models. They are trained by minimizing exactly the cross-entropy of Corollary 1, and reported in perplexity per token of their own tokenizer, which Theorem 5 says to convert before comparing.
- Scaling laws. Loss-versus-compute curves are fit in nats per token. Theorem 5 says such curves are comparable only within one tokenizer; across tokenizers, a tokenizer-free unit is needed. The fits themselves are empirical.
- Adaptive prediction. lzma’s EDGAR win is a model that learns from the text it is coding. Cache models, neural models with long contexts, and in-context learning are increasingly capable versions of the same idea.
- Calibration and testing. Strict propriety says the log score rewards honest probabilities on average; the calibration topic asks whether a model’s probabilities are honest event by event. Differences like are the raw material of the significance-testing topic.
Honest caveats
Implementation
The companion notebook (notebookPath) imports perplexity_cross_entropy.py, which owns every number on this page and imports the n-gram topic’s smoothers, the subword topic’s BPE, and the shared finance corpus. Running it as a script executes a harness of assertion-based tests in under twenty seconds on a laptop CPU. The tests cover:
- Proposition 1 against SciPy’s entropy and divergence, Corollary 1, Proposition 2, and the out-of-domain comparison with the uniform model.
- Theorem 1 exactly, by summing over type classes, on random sources, for the model version as well.
- Theorem 2 against exact targets from absorbing-chain algebra, the coverage of its intervals, and the corpus standard errors; the Shannon–McMillan–Breiman limits on Markov chains; Corollary 2 by exact enumeration.
- Kraft’s inequality both ways, Theorem 3 exhaustively with Sardinas–Patterson cross-checked by brute force, and Proposition 3 on random pairs.
- Theorem 4 on random models, and on the whole held-out and EDGAR texts, decoded back exactly.
- The vectorized models against the n-gram topic’s scalar recursions, Theorem 5’s character factorization on every in-vocabulary sentence, the unit table, Proposition 5 and the cutoff table, and the finance case study.
The laboratory reads its data from a JSON file that one of those tests requires to equal the module’s viz_payload() exactly, so the figure cannot drift from the code.
References & Further Reading
- paper A Mathematical Theory of Communication — Claude E. Shannon (1948) Bell System Technical Journal 27 (3): 379–423. Entropy and source coding
- paper Prediction and Entropy of Printed English — Claude E. Shannon (1951) Bell System Technical Journal 30 (1): 50–64. Estimating an entropy rate by prediction
- paper The Basic Theorems of Information Theory — Brockway McMillan (1953) Annals of Mathematical Statistics 24 (2): 196–219. The equipartition property for ergodic sources
- paper Two Inequalities Implied by Unique Decipherability — Brockway McMillan (1956) IRE Transactions on Information Theory 2 (4): 115–16. Theorem 3
- paper The Individual Ergodic Theorem of Information Theory — Leo Breiman (1957) Annals of Mathematical Statistics 28 (3): 809–11. Shannon–McMillan–Breiman almost surely
- paper Generalized Kraft Inequality and Arithmetic Coding — Jorma Rissanen (1976) IBM Journal of Research and Development 20 (3): 198–203. Arithmetic coding
- paper Perplexity — a Measure of the Difficulty of Speech Recognition Tasks — Frederick Jelinek, Robert L. Mercer, Lalit R. Bahl, and James K. Baker (1977) Journal of the Acoustical Society of America 62 (S1): S63. Perplexity named
- paper Expected Information as Expected Utility — José M. Bernardo (1979) Annals of Statistics 7 (3): 686–90. The logarithmic score is the only proper local score
- paper Data Compression Using Adaptive Coding and Partial String Matching — John G. Cleary and Ian H. Witten (1984) IEEE Transactions on Communications 32 (4): 396–402. PPM: adaptive models as coders
- paper Present Position and Potential Developments: Some Personal Views. Statistical Theory: The Prequential Approach — A. Philip Dawid (1984) Journal of the Royal Statistical Society, Series A 147 (2): 278–92. Prequential coding
- paper Arithmetic Coding for Data Compression — Ian H. Witten, Radford M. Neal, and John G. Cleary (1987) Communications of the ACM 30 (6): 520–40. Arithmetic coding in finite precision
- paper A Sandwich Proof of the Shannon–McMillan–Breiman Theorem — Paul H. Algoet and Thomas M. Cover (1988) Annals of Probability 16 (2): 899–909. SMB via Markov approximations
- paper An Estimate of an Upper Bound for the Entropy of English — Peter F. Brown, Stephen A. Della Pietra, Vincent J. Della Pietra, Jennifer C. Lai, and Robert L. Mercer (1992) Computational Linguistics 18 (1): 31–40. A model's cross-entropy as an entropy bound
- book Elements of Information Theory — Thomas M. Cover and Joy A. Thomas (2006) 2nd ed. Wiley. The AEP, Kraft–McMillan, and arithmetic coding
- paper Strictly Proper Scoring Rules, Prediction, and Estimation — Tilmann Gneiting and Adrian E. Raftery (2007) Journal of the American Statistical Association 102 (477): 359–78. Proper scoring rules
- paper What Kind of Language Is Hard to Language-Model? — Sabrina J. Mielke, Ryan Cotterell, Kyle Gorman, Brian Roark, and Jason Eisner (2019) Proceedings of ACL 2019, 4975–89. Comparing language models by total surprisal rather than per-token loss
- documentation Data Compression and Archiving — Python Software Foundation (2026) Python 3 documentation: zlib, bz2, and lzma, the reference coders