A training corpus has three sentences: "⟨s⟩ i like tea ⟨/s⟩", "⟨s⟩ i like coffee ⟨/s⟩" and "⟨s⟩ you like tea ⟨/s⟩". The vocabulary of predicted words is {i, you, like, tea, coffee, ⟨/s⟩}, so V=6. Using add-one smoothing, what is the bigram probability of the sentence "⟨s⟩ you like coffee ⟨/s⟩", and what does the unsmoothed MLE give?

Sequence models and transformers, Language modelling
Level L2 Elementary. Length Medium. Nature Mat Mathematical.

What's being asked

Whether you can count bigrams and apply the add-one formula with the right denominator.

Key idea

Add-one smoothing: P(w∣v)=c(vw)+1c(v)+V. The sentence probability is the product of four such terms.

Steps

  1. Count the contexts: c(⟨s⟩)=3, c(you)=1, c(like)=3, c(coffee)=1.
  2. Count the bigrams needed: c(⟨s⟩ you)=1, c(you like)=1, c(like coffee)=1, c(coffee ⟨/s⟩)=1.
  3. MLE: 13×1×13×1=19≈0.111.
  4. Add-one: P(you∣⟨s⟩)=23+6=29, P(like∣you)=21+6=27, P(coffee∣like)=23+6=29, P(⟨/s⟩∣coffee)=21+6=27.
  5. Multiply: 2⋅2⋅2⋅29⋅7⋅9⋅7=163969≈0.0040.
  6. Smoothing lowers the probability of this seen sentence from 0.111 to 0.004, because mass is moved to the many unseen bigrams.

Common mistakes

How long your answer should be

Half a page; 3–4 minutes.

Last checked on 4 December 2026.

Read this

Previous in Sequence models and transformers: What are the two gates of a GRU and what does each control? How is a GRU different from an LSTM?
Next in Sequence models and transformers: Reference: "the cat is on the mat" (6 words). Candidate 1: "the the the the the the the". Candidate 2: "the cat mat". (a) What is the clipped unigram precision of Candidate 1? (b) For Candidate 2, what are the unigram precision and the brevity penalty, so what is its unigram-only BLEU?