KnowML
Interactive

Tokenizer Lab

Seven words, twelve merges, one vocabulary — built in front of you. Every pair count, every merge decision and every token on this page comes from running byte-pair encoding, not drawn as a diagram of it. By the last tab you will know precisely why a model that reads tokens cannot count the letters in "strawberry".

Step through at your own pace · prerequisites: NLP Evolution (09)

How to use this page ▾

Start on Train BPE — the other three tabs all use the vocabulary it builds. There is no random seed anywhere on this page: given the corpus and the tie-break rule, byte-pair encoding is deterministic, so every count you see is reproducible with a pencil. The Train and Encode tabs each end with a self-check that recomputes their result by a second, independent route and prints whether the two agree.

What this page simplifies, on purpose

Related pages