Decoder. plain-English AI glossary

N-gram model

▼ Fading

A statistical shortcut: predict the next word based purely on the previous N-1 words, no deep learning required.

Think of it like

A fancy autocomplete that only remembers the last few words you typed: "The quick brown" -> probably "fox."

Example

Predict SMS text on a phone: if you type "see you," the next word is very likely "tomorrow" or "soon." A bigram model (N=2) learns these patterns from millions of texts.

How it actually works

An N-gram is a sequence of N words. A bigram model (N=2) says: given the word "the," what's the most likely next word? It's just counting — count how many times "the dog" appears, divide by total times "the" appears. Unigram, bigram, trigram, and higher-order n-grams capture increasingly distant context, but they hit a wall: they can't model long-range dependencies and they explode in memory (you need to count every possible sequence). Neural language models — especially Transformers — replaced n-grams because they learn from data more efficiently and handle long context.

For product teams

A clever statistical baseline that worked surprisingly well before deep learning; still fast for simple tasks.

For engineers

A Markov chain language model that estimates P(word_i | word_{i-N+1}...word_{i-1}) by counting occurrences in a corpus.

Related

Read anything AI without the jargon

Look up any term in plain English, or save terms as you read with the free Chrome extension.

Open DecoderAdd to Chrome