Why does a maximum-likelihood n-gram language model fail on unseen n-grams, and what does smoothing do about it?

Sequence models and transformers, Language modelling
Level L1 Beginner. Length Short. Nature Th Theoretical.

What's being asked

Whether you see that zero counts give zero sentence probability, and that smoothing moves probability mass to unseen events.

Key idea

The MLE estimate is P(wi∣wi−1)=c(wi−1wi)/c(wi−1). An unseen bigram has count 0, so one such bigram makes the whole sentence probability 0 and perplexity infinite.

Steps

  1. An n-gram model multiplies conditional probabilities along the sentence, P(w1…wN)=∏iP(wi∣wi−n+1:i−1).
  2. With the MLE estimate, any n-gram absent from the training corpus gets probability 0. Natural language is sparse, so many valid test n-grams are absent.
  3. One zero factor makes the whole product 0, and the perplexity (which has the probability in its denominator) becomes infinite.
  4. Smoothing takes a little probability mass from seen n-grams and gives it to unseen ones, so every probability is positive and the distribution still sums to 1.
  5. Examples: add-one (Laplace), interpolation with lower-order models, back-off, Kneser–Ney.

Common mistakes

How long your answer should be

4–5 sentences.

Last checked on 4 December 2026.

Read this

Previous in Sequence models and transformers: What is the difference between the skip-gram and CBOW models of word2vec, and when would you prefer each?
Next in Sequence models and transformers: What is the difference between greedy decoding and beam search for generating a sequence? Why is neither guaranteed to find the most probable sequence?