🔮 Machines That Talk · Day 3

Guess the Next Word

Here's the whole secret of ChatGPT, Claude, and Gemini in one line: a language model does ONE thing — it guesses the next word. Over and over. Let's build one you can play with, and write a sentence by only ever picking what comes next.

↓ start guessing
🔮 Lab · The Next-Word Predictor

Pick the next word. Then do it again.

Your sentence so far is below. Under it are the model's top guesses for what comes next, with a bar showing how sure it is. Click any guess to add it — then it guesses again from the new last word. That's literally how an AI writes. Try 🤖 Auto-write to watch it always grab its #1 pick.

3 words

The bar = the model's confidence. Longer bar = it saw that word follow more often in its training text. Grown-ups call that a probability.

🐞 Break-It Challenge

Give it a word it was never taught

Our model only read a tiny story about a little robot. Tap a word below — it drops that word into the predictor above. The words in green live in its training text; the words in red do not. Watch what the guesses look like when it's off the map.

Watch for this: feed it "robot" or "little" and the guesses are sharp and related. Feed it "dinosaur" or "pizza" — words it never saw — and it can't find any real follow-up, so it just falls back to boring common words like "the". A model only knows what it was trained on. Push it off its training data and it flails or makes stuff up — that flailing is where AIs later hallucinate.
🏷️ The pro wordGuessing the next piece of text is called next-token prediction, and any machine that does it is a language model. The little counting model you just used — it just tallies which word followed which — is an n-gram model. The 2-word version you're playing with (look at the last word, guess the next) is called a bigram.
🎯 Boss Build · Beat the Bot

Guess what the model will guess

You've seen how it thinks. Now predict its prediction! Here's a bit of text ending in one word. Four words are offered — pick the one the model thinks is most likely to come next. Get it right and you score. Nail 3 to win the last badge!

Beaten: 0 / 3
🚀 Beyond the Basics

How the pros really do it

Your model only looks at the last word. Real AIs look at everything you wrote. Here's how next-word prediction grew up:

🎲

Guess the most common word (the lazy version)

Ignore context, always say the word that's most common overall. ✅ Dead simple. ⚠️ Says "the" forever — the sentence never makes sense.

🔢

Look back a few words (what you built)

Count which word usually follows the last one (or last few). ✅ Actually forms phrases. ⚠️ Forgets the start of the sentence and any word it never saw.

🧠

Read the whole context (the real deal)

A neural net weighs every word you wrote, learned from billions of sentences. ✅ Stays on topic for pages. ✅ Handles new words. ⚠️ Huge and expensive to train.

🏷️ Pro names to look upThe real ones are GPT, Claude, Gemini, and Llama. They're all built on an idea called the Transformer, and the trick that lets them look at the whole context at once is called self-attention.
🔬 Real Model Lab

A real neural net predicts the next word

The toy above counts word-pairs. This is SmolLM2 — a real neural language model that learned from millions of web pages, small enough to run on a basic laptop — right on your own device. Type a start and watch its real next-word probabilities, then let it write. One-time ~180 MB download; then it's cached and runs offline.

not loaded

First time only — after it downloads, it runs offline and loads instantly.

🎉 Day 3 Complete!

You built a language model and learned its one job: guess the next word. You wrote a whole sentence just by picking what comes next, you saw it flail on words it never learned, and you even out-guessed the bot. Every AI chatbot on Earth is a giant, fancy version of what you just played with.

Day 4: The Context Backpack →
Tomorrow: if a model only knows the last word, how does it remember your whole chat? It stuffs everything into a context backpack. 🎒
AI Adventure · Machines That Talk · Day 3 — made for young inventors 🚀