Interactive demo · 4 min
Visualization of the tokenization algorithm used in GPT and other language models
Change text and click outside or press Reset
This visualization omits the end-of-word marker (typically denoted as </w>) for clarity.
In real BPE, each word's final character is marked with a special symbol, allowing the algorithm to distinguish
tokens like "er" at the end of a word ("lower") from "er" in the middle ("merry").
This ensures BPE knows not to merge tokens across word boundaries. In this app, we use a | separator between words
that serves a similar role but is hidden from display.