AI ATLASAn interactive field guide
CONCEPT 52 / Language and Transformers / Interactive study

N-gram language models.

Predict the next word by looking back 1, 2, or 3 words and counting how often each continuation appeared.

Recent words → Branching next-word tree

Begin with the loaded example. Change one control and watch the diagram and numbers update together.

52 / LIVE LABORATORYLoaded example
All calculations shown here run in the browser from the visible controls and bundled examples.

Inside the calculation

Why it matters

Looking only a few words back is fast and simple, but quickly runs out of exact matches in small datasets.

All calculations shown here run in the browser from the visible controls and bundled examples.