ICS 582Lecture 03Part 07
Interpolation, backoff and absolute discounting
Combining n-gram orders by linear interpolation or backoff, stupid backoff at web scale, tuning on held-out data, and the Church and Gale observation that motivates subtracting a fixed discount of about 0.75.
- Concepts
- 6
- Slides
- 68-80
- Reading
- 36 min
Why this part matters
Part 06 left you with a model that assigns probability zero to any n-gram it never saw, and with add-one smoothing as a blunt first repair. Every count-based language model that people actually ship goes further: it combines several n-gram orders and it discounts counts in a measured way. Modified interpolated Kneser-Ney was the standard n-gram baseline from around 2000 and is what KenLM builds today. Stupid backoff powered Google's machine translation language models trained on 2 trillion tokens. And the move of mixing one distribution with another under a tuned weight is still alive in research, for example in the kNN-LM, which interpolates a neural model with a nearest-neighbour distribution.
This part builds those ingredients one at a time: mixing orders by interpolation, choosing the mixing weights on held-out data, backing off when the long context has nothing to say, and subtracting a fixed discount whose size you can read off a real experiment. Exams typically ask you to contrast interpolation with backoff, to compute an interpolated or discounted probability by hand, and to justify d ≈ 0.75 from the Church and Gale table. All three are rehearsed below.
By the end you can
- Compute an interpolated trigram probability from given λs and component estimates, and explain why the λs must sum to 1.
- Explain how λs and other hyperparameters are tuned on held-out data, and why training and test data cannot be used.
- Contrast interpolation, Katz-style backoff and stupid backoff, and compute a stupid backoff score down to its unigram base case.
- Read the Church and Gale held-out table and argue for a fixed discount of about 0.75.
- Compute interpolated absolute discounting for a bigram, including λ(w_{i-1}) and d = n1/(n1 + 2n2).
Suppose you need the probability of food after want chinese. The Unigram estimate is P(food) = 0.01, the Bigram estimate is P(food | chinese) = 0.52, and the Trigram want chinese food never occurred in training, so its maximum likelihood estimate is 0. A pure trigram model would declare the sentence impossible. Instead, take a weighted average of the three with weights λ = (0.1, 0.3, 0.6): 0.1 × 0.01 + 0.3 × 0.52 + 0.6 × 0 = 0.001 + 0.156 + 0 = 0.157. The zero is gone, and the estimate is driven by the evidence that does exist.
That is linear interpolation. The trigram is the sharpest predictor when it has data, but Sparsity means it very often has none, which is exactly the Zero-probability problem of part 06. Lower orders are blunter but almost always have counts. Mixing them lets each order contribute what it is good at. SLP3 writes the trigram version as follows.
The constraint that the λs sum to 1 is not decoration. Each component is itself a probability distribution over the vocabulary, so summing the mixture over every possible next word gives λ1 · 1 + λ2 · 1 + λ3 · 1 = Σλ = 1. With weights summing to more than 1 the model would invent probability mass, and with less it would leak some. A weighted average of distributions is a distribution, and that is all the constraint guarantees.
Worked example
Interpolating P(food | want chinese)
Collect the three estimates
P(food) = 0.01, P(food | chinese) = 0.52, P(food | want chinese) = 0 because the trigram is unseen.Weight and add
0.1 × 0.01 + 0.3 × 0.52 + 0.6 × 0 = 0.001 + 0.156 + 0 = 0.157.Now suppose the trigram had been seen
With P(food | want chinese) = 0.8, the same weights give 0.001 + 0.156 + 0.6 × 0.8 = 0.001 + 0.156 + 0.48 = 0.637. The trigram dominates, but the lower orders still contribute.Result
Interpolation turns an impossible event into 0.157 and still lets a well-attested trigram push the estimate up to 0.637.
Weights that depend on the context
A single fixed λ vector treats every context alike, which wastes information. If the bigram want chinese has been seen thousands of times, the trigrams built on it are well estimated and deserve more weight; if it has been seen twice, they do not. SLP3 therefore lets each λ be a function of the two preceding words, which is context-dependent interpolation. In its words, if we have particularly accurate counts for a particular bigram, we assume that the counts of the trigrams based on this bigram will be more trustworthy.
The idea is old. Jelinek and Mercer introduced interpolated estimation in 1980, which is why it is also called Jelinek-Mercer smoothing or deleted interpolation. Chen and Goodman's large empirical study found that interpolated models, which always combine the higher and lower orders, typically work better than backoff models, because low counts of 1 or 2 are poorly estimated and benefit from being blended even when they are not zero (Goodman 2001). Jurafsky's own slide states the verdict in three words: interpolation works better.
Quick check
With λ1 = 0.1, λ2 = 0.3 and λ3 = 0.6, the trigram is unseen, P(w | previous word) = 0.5 and P(w) = 0.02. What is the interpolated probability?
Recall
Why must the interpolation weights sum to 1?
Where do the numbers 0.1, 0.3, 0.6 come from? Try them out. Take three tokens from a development set and write down, for each, the unigram, bigram and trigram estimates that the training counts give.
| Token | P1 (unigram) | P2 (bigram) | P3 (trigram) |
|---|---|---|---|
| Token 1 | 0.01 | 0.52 | 0 |
| Token 2 | 0.02 | 0.30 | 0.50 |
| Token 3 | 0.005 | 0.10 | 0.40 |
Now score the same three tokens under three candidate weight vectors. For each, mix the components, multiply the token probabilities, take the base-2 log, and turn that into Perplexity with PP = 2^(−log2 L / 3).
| λ = (λ1, λ2, λ3) | Token probabilities | log2 likelihood | Perplexity |
|---|---|---|---|
| (0.1, 0.3, 0.6) | 0.157, 0.392, 0.2705 | −5.909 | 3.92 |
| (0.6, 0.3, 0.1) | 0.162, 0.152, 0.073 | −9.12 | 8.22 |
| (0, 0, 1) | 0, 0.50, 0.40 | −∞ | ∞ |
The first vector gives a held-out perplexity of 3.92, the second 8.22, and the third, which is the pure maximum likelihood trigram, gives probability 0 to the first token and therefore infinite perplexity. You pick the first. That is the whole procedure, done properly: the λs are hyperparameters, values that are not counts and are not learned from the counts. SLP3 says so in a footnote, contrasting them with regular counts that are learned from the training data. The recipe has two stages. First fit every n-gram probability on the training set and freeze it. Then search over λ to maximize the likelihood of a separate held-out corpus, which is the same as minimizing its perplexity. The same holds for k in add-k and for the discount d later in this part.
Why not tune on the training data itself? Because on training data the maximum likelihood trigram already fits best: every training trigram has a nonzero count, so the likelihood keeps rising as λ3 grows and peaks at λ3 = 1. That is exactly the third row of the table, which collapses on any new text. Held-out data contains the unseen n-grams that the lower orders exist to cover, so only it can reward them. And the Test set is off limits, because once you tune on it the reported perplexity is no longer an honest estimate of performance on unseen text.
Recall
Why tune λ on held-out data and not on training data?
Score floor after quietly on the, in a corpus of N = 10,000 tokens. The four-gram quietly on the floor has count 0, so drop the oldest context word. The trigram on the floor also has count 0, even though on the itself was seen 20 times, so drop another word. The bigram the floor has count 3 and the has count 60, so its Relative frequency is 3 / 60 = 0.05. Each step down cost a factor of 0.4, so the score is S = 0.4 × 0.4 × 0.05 = 0.008.
This is Backoff: use the highest order whose full n-gram count is above 0, and otherwise drop one context word and try again. Unlike interpolation it uses exactly one order per word. Notice what triggered each step. The context on the was perfectly familiar; it was the n-gram on the floor that was missing. Backoff fires on a zero n-gram count, not on an unseen context.
The specific recipe: stupid backoff
The factor 0.4 is the signature of Stupid backoff, introduced by Brants, Popat, Xu, Och and Dean at EMNLP-CoNLL 2007 for Google's translation system. Their equation 5 defines a score, and their equation 6 ends the recursion at the unigram level.
If the bigram the floor had also been unseen and floor occurred 5 times, the recursion would reach the base case: S = 0.4³ × 5 / 10,000 = 0.064 × 0.0005 = 0.000032. The authors write S instead of P to emphasize that these are not probabilities but scores, and the reason is easy to see. In the context on the, the relative frequencies of the continuations that were seen already sum to 1. Every unseen continuation then adds 0.4 × S(w | the) on top. For floor alone that is 0.4 × 0.05 = 0.02, so the total over the vocabulary is at least 1.02, and every other unseen word pushes it higher.
A proper backoff model fixes this in two ways at once. Katz backoff (Katz 1987) first discounts the seen n-grams, replacing the relative frequency with a smaller P*, which frees some probability mass in each context. Then it gives the lower order a context-dependent normalizing weight α(context) chosen so that the freed mass is spread over exactly the unseen words. SLP3 (Jan 2023 edition, section 3.5) is explicit that without discounting the total probability would be greater than 1; the current draft adds that stupid backoff gives up the idea of trying to make the language model a true probability distribution. Discounting is therefore not optional for backoff, and it is the subject of the rest of this part.
Why did Google accept a model that is not a distribution? A translation decoder only compares candidate outputs, so it needs relative scores, not normalized probabilities. Stupid backoff needs no discount estimation and no α per context, so it is cheap to compute with MapReduce over training data that reached 2 trillion tokens and a model of about 300 billion n-grams. At small data sizes it was about 1 BLEU point behind Kneser-Ney, and the gap narrowed as data grew until the two were close. The authors' footnote explains the name: it originated at a time when they thought such a simple scheme could not possibly be good; their view changed, but the name stuck.
| Interpolation | Katz backoff | Stupid backoff | |
|---|---|---|---|
| When are lower orders used? | Always, for every word, seen or unseen | Only when the full n-gram count is 0 | Only when the full n-gram count is 0 |
| Discounting of seen n-grams | Implicit, through the λ weights | Yes, Katz discounts P* to free mass | None |
| True probability distribution? | Yes, because Σλ = 1 | Yes, with the normalizing α | No, it returns scores |
| Where used | Classic speech and text LMs; the base of Kneser-Ney | Katz 1987 style speech recognizers | Google MT, trained on 2 trillion tokens |
Quick check
Why is the stupid backoff score not a true probability distribution?
Recall
State the difference between interpolation and backoff in one sentence each.
Recall
Give the two facts that make stupid backoff not a distribution, and why Google still used it.
Look at what add-one smoothing did to the Berkeley Restaurant Project corpus. The bigram want to occurred 608 times. After adding one to every cell and renormalizing, its reconstituted count is 238, and P(to | want) falls from 0.66 to 0.26.
Add-one on the Berkeley Restaurant bigrams, SLP3 sections 3.6.1 and 3.6.2
- C(want to), raw count
- 608
- C*(want to), reconstituted after add-one
- 238
- P(to | want), MLE
- 0.66
- P(to | want), add-one
- 0.26
- Discount ratio d_c = C*/C for want to
- 0.39
- Discount ratio d_c = C*/C for chinese food
- 0.10
- Bigram cells sharing the added mass
- about 1446² ≈ 2.1 million
One of the most frequent, most reliable bigrams in the table lost more than half its probability. The discount ratio d_c, reconstituted count over original count, is 0.39 for want to and 0.10 for chinese food. The mass went to the roughly 1446² possible bigram cells, most of which are zeros. SLP3 sums it up: too much probability mass is moved to all the zeros. Making the added amount smaller does not cure it. Add-k with k = 0.05 moves less mass, but SLP3 reports that it still does not work well for language modeling, generating counts with poor variances and often inappropriate discounts (Gale and Church 1994).
Read the problem the other way round. Any Smoothing method that gives mass to unseen events must take it from seen events, which is why SLP3 says these methods are called smoothing or Discounting. The question is not whether to discount but how much, and from which counts. A good discount barely touches large counts, whose estimates are already reliable, and mostly adjusts small counts, where most of the uncertainty lives. And the amount should be measured, on data the model did not train on, not guessed. The next concept does exactly that measurement.
Slide 75's last point, smoothing that respects how language uses context, is a preview: the discount here fixes how much mass moves, and Kneser-Ney smoothing in the next part fixes where it goes.
Recall
What two properties should a good discount have that add-one and add-k lack?
Take every bigram that appeared exactly 4 times in the first 22 million words of AP newswire, and count how often each appears in the next 22 million words. The average is 3.23, not 4. The bigrams did not change; the first count was partly luck.
This is the experiment of Church and Gale (1991), reported in SLP3 (Jan 2023 edition, section 3.7.1, Fig. 3.9). Repeat it for every training count from 0 to 9 and subtract the held-out average from the training count.
| Training count c | Average held-out count | c minus held-out |
|---|---|---|
| 0 | 0.0000270 | mass MLE sets to zero |
| 1 | 0.448 | 0.552 |
| 2 | 1.25 | 0.75 |
| 3 | 2.24 | 0.76 |
| 4 | 3.23 | 0.77 |
| 5 | 4.21 | 0.79 |
| 6 | 5.23 | 0.77 |
| 7 | 6.21 | 0.79 |
| 8 | 7.21 | 0.79 |
| 9 | 8.26 | 0.74 |
For every count from 2 to 9 the gap is nearly constant, between 0.74 and 0.79. Training counts systematically overestimate future counts, and by a fixed amount rather than by a fixed percentage. SLP3 concludes that, except for the held-out counts for 0 and 1, all the other bigram counts could be estimated pretty well by just subtracting 0.75. This held-out data plays exactly the role of the Development set in the second concept: it measures a quantity the training counts cannot reveal about themselves.
The two exceptions are informative. The count-0 row, 0.0000270, is the mass that maximum likelihood wrongly sets to zero. It is a tiny average, but it is averaged over an enormous number of unseen pairs, so in total it adds up to real probability that a discount must supply. The count-1 row is the outlier: singletons reappear 0.448 times, a gap of about 0.55, so a single discount of 0.75 would overcharge them. That is why SLP3 suggests a separate discount of 0.5 for count 1, and why Modified Kneser-Ney uses separate discounts for counts 1, 2 and 3+.
Quick check
In Church and Gale's AP newswire data, bigrams seen 5 times in the first 22 million words occur on average how often in the next 22 million?
Recall
What does the count-1 row (0.448) of the Church and Gale table tell you?
The context chinese was seen 10 times, followed by food 6 times, restaurant 3 times and cuisine once. Subtract d = 0.75 from each count: food keeps 5.25 / 10 = 0.525, restaurant keeps 2.25 / 10 = 0.225, cuisine keeps 0.25 / 10 = 0.025. Together they keep 0.775. The missing 3 × 0.75 / 10 = 0.225 is a pot of freed probability, and it is handed out to every word in proportion to its unigram probability.
That is interpolated absolute discounting, the direct use of the Church and Gale finding. Its bigram form subtracts a fixed d from every nonzero count and interpolates with the unigram distribution.
Each part of the formula has a job. The first term is the discounted relative frequency: big counts barely move, small counts move a lot, as the previous concept demanded. The max(·, 0) keeps unseen bigrams at zero in this term instead of letting them go negative. The weight λ(w_{i-1}) is the Backoff weight (lambda), and it is not a free parameter: it is exactly the mass the first term removed, so the two terms together sum to 1.
Worked example
P_AD after chinese with d = 0.75
Discount the seen bigrams
(6 − 0.75)/10 = 0.525, (3 − 0.75)/10 = 0.225, (1 − 0.75)/10 = 0.025. Sum 0.775.Compute the freed mass
Three continuation types, so λ(chinese) = 0.75 × 3 / 10 = 0.225 = 1 − 0.775.A seen word
With P(food) = 0.02: P_AD(food | chinese) = 0.525 + 0.225 × 0.02 = 0.525 + 0.0045 = 0.5295.An unseen word
With P(tea) = 0.001: P_AD(tea | chinese) = 0 + 0.225 × 0.001 = 0.000225. Not zero.Check normalization
Summing over the whole vocabulary: 0.775 + 0.225 × Σ_w P(w) = 0.775 + 0.225 × 1 = 1.Result
The distribution after chinese sums to exactly 1, food stays near its MLE of 0.6, and tea gets a small positive probability. Note that cuisine, a singleton, lost 75% of its count; the count-1 row of the Church and Gale table says that is too much, which is the argument for a smaller discount on singletons.
Choosing d
The discount d is the one Hyperparameter left, and there are two standard ways to set it. The first is to read it off the table: SLP3 says setting all the d values to 0.75 would work very well, or perhaps keeping a separate second discount of 0.5 for the bigrams with counts of 1. Jurafsky's slide puts it as save ourselves some time and just subtract 0.75. The second is a closed-form estimate from Ney, Essen and Kneser (1994), which uses only the count of counts of the training data.
For example, with n1 = 6000 bigram types seen once and n2 = 1500 seen twice, d = 6000 / (6000 + 3000) = 6000 / 9000 ≈ 0.667. The estimate needs no held-out data, and its value lands close to the 0.75 that Church and Gale measured directly. In practice, KenLM estimates modified Kneser-Ney with separate discounts for counts 1, 2 and 3+, while BerkeleyLM ships plain absolute discounting in which every discount is 0.75.
The next part keeps this exact structure, a discounted higher-order term plus a λ times a lower-order distribution, and changes only the lower-order distribution. Kneser-Ney smoothing replaces the unigram P(w_i) with a continuation probability, which asks how many different contexts a word appears in rather than how often it appears.
Quick check
With absolute discounting, d = 0.75, context h seen 20 times with 8 distinct following word types. What is λ(h)?
Recall
Compute d if a corpus has 6000 bigram types seen once and 1500 seen twice.
Recall
In absolute discounting, where does λ(w_{i-1}) come from?
Recap
If you remember nothing else
- Linear interpolation: P̂ = λ1 P(w) + λ2 P(w | w_{n-1}) + λ3 P(w | w_{n-2} w_{n-1}) with Σλ = 1; it always mixes every order, and λ can depend on the context.
- λs, k and d are hyperparameters: fix the counts, then choose them to maximize held-out likelihood (minimize held-out perplexity), for example with EM.
- Backoff uses the highest order whose n-gram count is above zero; a correct backoff model must discount and renormalize (Katz).
- Stupid backoff (Brants et al. 2007) uses raw relative frequencies, a fixed 0.4 per step, and ends at S(w) = count(w)/N; scores, not probabilities, but close to Kneser-Ney at web scale.
- Add-one discounts badly: C(want to) drops from 608 to 238 and P(to | want) from 0.66 to 0.26.
- Church and Gale: across 22M + 22M AP words, bigrams of count 2 to 9 reappear about c − 0.75 times; singletons reappear 0.448 times.
- Interpolated absolute discounting: max(C − d, 0)/C(w_{i-1}) + λ(w_{i-1}) P(w), with λ(w_{i-1}) = d × types / C(w_{i-1}) and d ≈ 0.75 or n1/(n1 + 2n2).
- Kneser-Ney (next part) keeps this structure and replaces the unigram P(w) with a continuation probability.
Sources
- Speech and Language Processing, 3rd ed. draft, Chapter 3: N-gram Language ModelsBookJurafsky and Martin, Stanford (draft of Aug 19, 2026)Section 3.6: interpolation eqs. 3.29 and 3.30, held-out λ and EM, stupid backoff, add-one numbers(opens in a new tab)
- Speech and Language Processing, 3rd ed. draft (Jan 7, 2023)BookJurafsky and Martin, StanfordSection 3.5 Katz backoff (eq. 3.30) and section 3.7.1 absolute discounting: Church and Gale table, eqs. 3.32, 3.33, 3.38, 3.39(opens in a new tab)
- Language Modeling: smoothing, interpolation and backoff (lecture slides)ArticleDan Jurafsky, StanfordInterpolation works better; just subtract 0.75(opens in a new tab)
- Large Language Models in Machine TranslationPaperEMNLP-CoNLL 2007, pp. 858-867 (Brants, Popat, Xu, Och and Dean)Stupid backoff, eqs. 5 and 6, α = 0.4, 2 trillion tokens(opens in a new tab)
- A comparison of the enhanced Good-Turing and deleted estimation methods for estimating probabilities of English bigramsPaperComputer Speech and Language 5(1):19-54, 1991 (Church and Gale)The 22M + 22M AP newswire held-out experiment(opens in a new tab)
- On structuring probabilistic dependences in stochastic language modellingPaperComputer Speech and Language 8(1):1-38, 1994 (Ney, Essen and Kneser)Absolute discounting and d = n1/(n1 + 2n2)(opens in a new tab)
- Estimation of probabilities from sparse data for the language model component of a speech recognizerPaperIEEE Transactions on Acoustics, Speech, and Signal Processing 35(3):400-401, 1987 (Katz)Katz backoff(opens in a new tab)
- An empirical study of smoothing techniques for language modelingPaperComputer Speech and Language 13(4), 1999 (Chen and Goodman)Interpolated models typically beat backoff models(opens in a new tab)
- A Bit of Progress in Language ModelingPaperJoshua Goodman, Microsoft Research, 2001Jelinek-Mercer origin of interpolation; modified Kneser-Ney discounts for counts 1, 2 and 3+(opens in a new tab)
- KenLM estimation (lmplz)DocsKenneth HeafieldModified Kneser-Ney in KenLM; BerkeleyLM uses absolute discounting with every discount 0.75(opens in a new tab)
- Generalization through Memorization: Nearest Neighbor Language ModelsPaperICLR 2020 (Khandelwal et al.)Interpolating a neural LM with a kNN distribution under a tuned λ(opens in a new tab)