The merge machine — watch a vocabulary being born
Here is a toy corpus of 20 words, exploded into single characters (the • marks end-of-word). The table shows every neighboring pair and how often it occurs. Press merge: the top pair fuses into a new symbol, everywhere at once, and the vocabulary grows by one. This is the entire BPE training algorithm — there is nothing else.
Same-colored tiles are the same symbol. Watch for t+h → th, then th+e → the — but the very first merges may surprise you: the algorithm only cares about raw pair counts.
The merge dial — from alphabet soup to whole words
Now a bigger corpus (~130 words), trained the same way at page load. Drag the dial to choose how many merges the tokenizer is allowed to use, and watch one sentence re-tokenize live. The curve underneath is the sentence's token count at every dial position — computed from the real merges, not drawn by hand.
Token birthdays — frequent words get names first
A word is "born" as a token the moment enough merges chain together to fuse it into a single symbol. Because merges are ranked by frequency, birth order is a frequency ranking: the corpus's favorite words get names first. The leaderboard below is computed live from the trained merges. Then type any word and ask when — or whether — it was ever born.
"Never born" doesn't mean unusable — the word still tokenizes fine, just as several pieces. In GPT's real vocabulary, " the" was among the earliest merges; your surname probably never got born at all.
The shredder — feed it a word it has never met
The merges are frozen now — training is over, exactly like a shipped model. Feed the tokenizer words it knows, words it half-knows, and words that don't exist. It never refuses (any spelling can be covered by characters), but watch a made-up word get destroyed into confetti while "garden" sails through as one piece.
Notice "gardens": never in the corpus, yet it reuses the fused "garden" symbol plus scraps — BPE generalizes to near words for free. Pure inventions get nothing but character-level shrapnel.
Goldilocks vocabulary — characters, words, or something in between
Why merge at all? Compare the three ways to slice the same sentence. Characters: tiny vocabulary, absurdly long sequences. Whole words: short sequences — until an unseen word appears and becomes a dead ❓UNK, its meaning erased. BPE: the compromise that never says UNK. Edit the sentence — try adding made-up words — and watch all three respond.