Part I · Turning Language into Space Chapter 02

Tokenization: Puzzle Pieces of Text

Why AI doesn't read letters or whole words — and how chopping text shapes what it sees.

7 min read · 3 interactive labs · Zero math required

In Chapter 1, we talked about AI guessing the next word. That's a great mental picture — and now it's time for a delightful plot twist: Large Language Models don't actually read words. And they don't read individual letters either.

Wait — why not? Imagine designing the vocabulary box for an AI:

So engineers found a brilliant middle ground called tokenization. Common words stay intact as a single puzzle piece (apple, the). Longer, rarer, or unfamiliar words split neatly into reusable subword chunks (un + believe + able).

Type anything you like into the live tokenizer below — or click the presets to see how differently plain English, compound words, code, and numbers get sliced.

Lab 2.1 Live Interactive Tokenizer
Type anything or pick a preset
Characters
0
Tokens
0
Compare the Characters bar to the Tokens bar! Plain English compresses cleanly (about 3 to 4 characters per token), while weird compounds, punctuation-heavy code, and long numbers fracture into many smaller chips. Notice the faint · marks — most tokenizers glue the leading space right onto the front of the next word.

How Does the AI Invent Its Puzzle Pieces?

Nobody sits down and hand-writes a list of 50,000 subword chunks. Instead, the tokenizer discovers the best puzzle pieces automatically from a giant pile of text using a wonderfully simple recipe called Byte-Pair Merging.

Think of it like snapping Lego bricks together:

  1. Start by splitting all text into individual characters.
  2. Count which pair of neighboring pieces shows up together most often.
  3. Fuse that winning pair into a brand-new single brick and add it to your vocabulary box.
  4. Repeat thousands of times until your box is full!

Watch this happen step-by-step on the short phrase "the other there". Pay attention to how the total piece count shrinks with every single merge.

Lab 2.2 Byte-Pair Merging: How the Vocabulary Forms
Step 0 / 5
Pieces left
15
In just 5 merges, 15 scattered characters snap together into 5 clean pieces — and the model has learned reusable bricks like th, the, and ther that will work on thousands of other English words too.

The "Strawberry" Illusion

Now we can solve the mystery from the start of the chapter: why did so many powerful AI models famously insist that "strawberry" only has two R's instead of three?

Because the model never sees the letters. By the time your question reaches the AI's brain, the tokenizer has already sealed the word into 3 solid token bricks — each represented by a single ID number. Asking an LLM to count the R's inside strawberry is like handing someone three locked boxes labeled #496, #675, and #15717 and asking them to count how many letter R's are painted on the inside!

Flip the switch below to jump back and forth between Human Eyes and LLM Eyes across three classic AI blind spots.

Lab 2.3 The "Strawberry" Illusion
Toggle how humans vs. LLMs see text
This single visual explains a whole family of quirky AI mistakes: spelling puzzles, reversing words, counting letters, and big-number arithmetic. It's not that the model forgot how to count — it's that tokenization glued the characters together before the model ever looked at them.
Where We're Going Next

Now our text has been sliced into clean, reusable puzzle pieces, each with its own ID number. Wait: ID numbers like #496 and #15717 are just arbitrary labels — they don't tell the model what anything means. In Chapter 3, we turn those bare IDs into glowing points on a Map of Meaning.

Check Your Intuition

Why do modern LLMs split text into subword tokens instead of using individual letters or whole words?