LLM City

How chatbots think — a beginner’s tour

Tour progress 0 / 6 districts
System online

Large language models aren’t magic. They’re cities of tiny bets.

Chatbots don’t “think” like people. They repeatedly guess the next little piece of text. Do that thousands of times and it can look like understanding.

Six stops · plain English · step by step

District 1 · Token Station

First, chop the sentence into bricks

You read “spaceship” as one idea. A language model doesn’t start there. It turns your text into tokens — small chunks it can count and compare.

In plain English Think of tokens like LEGO bricks for language. Sometimes a brick is a whole word (Mars). Sometimes it’s half a word, a comma, or even a space. The model only plays with bricks — not with the pretty sentence you typed.
  • Why? Computers are great with lists of numbers. Tokens are how text becomes that list.
  • Not always whole words. Long or rare words often get split into pieces.
  • Try it: edit the sentence below and watch the bricks change.
0 tokens Click a brick to inspect

Tip: try a long word like “internationalization” — you’ll often see it split.

Each colored brick is one token. Inside the model, each brick is really just an ID number — the neural net never “sees” your sentence as a human would.

District 2 · Probability Plaza

The model’s only job: guess the next brick

After it reads the tokens so far, it doesn’t jump to a finished paragraph. It asks one question over and over: “What token is most likely next?”

In plain English Imagine autocomplete on steroids. The model gives every possible next brick a score, turns those into percent chances, then picks one. Do that again and again and a sentence appears.
  • Not a search engine. It’s not looking up a saved answer — it’s making a bet.
  • Tallest bar = favorite. But it can still pick a shorter bar sometimes.
  • Try it: press Roll the next token and watch the story grow one brick at a time.

The tallest bar is the “safe” choice. Picking other bars is how writing stays interesting — and sometimes wrong.

Press Roll to pick one token from these odds. That’s called sampling.

District 3 · Attention Avenue

Which earlier words should we care about?

Before guessing the next token, the model looks backward. Attention is how it decides which past words matter most right now.

In plain English Like reading with a highlighter. If you’re about to write the word after about, you might highlight poem and moon more than The. Attention is that soft spotlight — not all words get equal light.
  • Pink outline = “I’m predicting the token after this word.”
  • Brighter blue = more attention (more useful for this guess).
  • Try it: click different words and watch the spotlight jump.
Predicting after this word Brighter = more attention

Click any word to move the “cursor.” The bars on the right show who gets the spotlight.

Spotlight budget

Attention is like a fixed budget of “focus points.” The bars below show how that budget is split across earlier words.

Real models run many spotlights at once (attention heads) — one might track names, another grammar, another quotes. Same idea, lots of copies.

District 4 · Memory District

The context window is a backpack, not a brain

Everything the model can use for this answer must fit in a limited list of tokens: instructions, chat history, and what it’s writing now. That list is the context window.

In plain English Imagine a backpack that only holds 24 bricks in this demo. When you zip in more bricks than fit, the oldest ones fall out the bottom. The model isn’t being forgetful like a person — those tokens are simply gone from what it can see.
Backpack capacity 0 / 24 tokens
Follow the three steps in order. Goal: see whether the green Sam chip is still in the backpack when you ask the name.
This demo only holds 24 tokens so you can overflow it on purpose. Real chat apps hold thousands or more.
District 5 · Temperature Tower

How “spicy” should the next guess be?

Remember those probability bars? Temperature reshapes them before the model picks. Same favorites, different willingness to take risks.

In plain English Think of a playlist. Low temperature = always pick the #1 hit. High temperature = sometimes spin the deep cuts. That’s why one setting feels boring and safe, and another feels creative (or messy).
  • Low (≈0.2): almost always the top choice — good for facts & code.
  • Medium (≈0.8): a mix — common for chat.
  • High (≈1.5): wilder words show up more — fun, less reliable.
0.8

Drag the slider, then sample. At low temp, “mat” should win almost every time.

If the chips all say the same word, temperature is low. If they’re mixed, temperature is high.

District 6 · City Center

Put it together: chat like a model

This is a tiny toy chatbot for learning — not ChatGPT. Real models are huge and much smarter, but they still follow the same basic loop.

In plain English Every reply is built brick by brick: split your words → glance back at important ones → bet on the next word → repeat until the answer is done.
1
Tokens
Your message becomes bricks.
2
Attention
It spotlights useful words.
3
Next-word bet
It samples from the odds.
0.9

Lower = safer, similar replies. Higher = more random wording. Same idea as District 5.

What just happened?

After each reply, read this board top to bottom. It’s the whole tour in one glance.

1 · Tokens (bricks)

Send a message to fill this in.

2 · Attention (spotlight)

Which words got more focus?

3 · Next-word bets

Which first words were most likely?

Click a suggested message, then match each board section to a district you already visited.