How a model gets its vocabulary, and what each token turns into. Step 1 is pure counting. Step 2 gives every token a row of random numbers. Training (not shown here) is what turns those numbers into meaning.
Start with single characters. Count every pair of neighbors in the text. Glue the most common pair into one new token. Repeat. The yellow pair is the one that merges next. Spaces stick to the front of the word after them, shown as ␣.
| Pair | Becomes | Count |
|---|
Each token's ID is just its row number. Each row starts as small random numbers, roughly between -0.05 and 0.05. Nothing here means anything yet. The number of columns is the model's width. We show 8 so it fits. The real 0.8B uses 1,024.
To tokenize anything, replay the merges in the same order. Then each token's ID picks its row. That row, not the letters, is what goes into the model.
Shrink everything down to rows of 2 numbers, so we can draw them as arrows. The training text says that after straw comes berry. To score a possible next token, multiply matching numbers in the two rows and add them up. Higher score, more likely. The numbers are scaled up from the real ones so you can watch them move.
Nudge = − learning rate × derivative. The derivative says which way each number should move and how much it matters. The learning rate, chosen by people, sets the step size. Here only straw's row moves. In a real model every number moves on every step, including berry's and Friday's rows and all the layers, and the learning rate is about 0.0003.
Same idea, bigger numbers. Every Qwen3.5 size shares one vocabulary, so the rows are the same count. Only the width changes.