🧠

TokenTales

How does AI guess the next word? By counting. Come see.

🔮 Open the model console →

The secret behind "AI writing"

A language model — the thing behind chatbots — has one job: guess the next word. It learns by reading a LOT of text and counting which word tends to follow which. Then, to "write," it just keeps picking the word that most often came next. That is (almost) the whole trick.

  1. Train. TokenTales builds a real, tiny "n-gram" model on a public-domain rhyme — right here, in your browser.
  2. Predict. You see a phrase and guess which word the model thinks comes next.
  3. Reveal. The counts appear as a bar chart — you see it is just counting, not magic.
  4. Watch it write. Give it a starting word and watch the model continue, one most-likely word at a time.

No chatbot, no internet, no big model — everything runs on your device. Real language models are far bigger, but the counting idea is the same.

Meet the crew — the pieces of a language model

  • Token — a single word (or piece of a word); a model reads and predicts one token at a time.
  • Tally — the counter: how many times each word followed another (the model's whole "memory").
  • Gram — the look-back: a bigram uses the last 1 word, a trigram the last 2 — more look-back, smoother writing.
  • Nova — the guide: the model has no idea what words mean; it predicts the most common next word. Knowing that is knowing how AI really works.

Painted friends + storybooks are coming soon.