Case & CodeA FIELD GUIDE TO AI
Start learning
Beginner

N-gram model

Also: n-gram models

In plain words

It predicts the next word from patterns in the previous few words.

The fuller definition

A language model that estimates the next word from counts of short word sequences. Smoothing and backoff can assign probabilities to unseen sequences.

How it fits together
  1. Count

    Observe short sequences

  2. Estimate

    Calculate probabilities

  3. Back off

    Handle sparse or unseen sequences

A simplified relationship, not a screenshot or a complete design.

A concrete example

A three-word model predicts a word using the preceding two words.

The distinction that matters

It uses a limited word history rather than a learned neural representation of a long context.

Related terms

Where it is taught

What actually happens when you ask AI a question?

Source and further reading

Jurafsky & Martin · Speech and Language Processing, ch. 3: N-gram Language Models

The definition and example are written for this library. The link gives background, official documentation or legal authority as labelled. Legal scope depends on the jurisdiction and current text; product features depend on release and settings.

Lessons, terms, practical guides and sources ESC