bpe tokenizer
a language model reads tokens, not letters or words. byte-pair encoding learns them from a corpus: start with single letters, find the neighbouring pair that occurs most, glue it into one symbol everywhere, and repeat. the merges it learns, in order, are the tokenizer.
try this
- press play and let it run out. on a corpus this small the merges end up building whole words: low_, lower_, newer_.
- type slower in the bottom box. it was never in the corpus, yet it splits into s + lower_, pieces the merges did build.
- add newest three times to the corpus. the very first merge changes from e + r to w + e, and widest now splits as wide + st_.