BPE and WordPiece both merge subwords. What is the one thing they disagree on?
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
BPE picks the next merge by raw pair frequency; WordPiece picks the merge that maximally increases corpus likelihood, scored as freq(AB) over freq(A) times freq(B).
Picture a kid stacking blocks. Both kids start with a pile of letter blocks and a rule: each turn, glue two blocks together to make a bigger block, and add the new shape to your toolbox. The first kid (BPE) glues whichever two blocks happen to sit next to each other most often. Simple counting. The second kid (WordPiece) is fussier. It only glues two blocks together if the pair shows up much more often than you would expect from how often each block shows up on its own. That ratio rewards merges that are genuinely surprising. After many turns, both kids have a toolbox of bigger blocks they can use to build any word. They tend to pick similar blocks for common words but diverge on rarer combinations, which is why a text tokenized with BPE and the same text tokenized with WordPiece end up looking subtly different.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
4 min: state the shared training skeleton, name BPE's frequency criterion, name WordPiece's likelihood criterion with the freq(AB) over freq(A) times freq(B) ratio, explain why the ratio rewards surprising merges, and place both algorithms in the 2026 production landscape with one or two model examples each.
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Saying BPE and WordPiece differ in how they segment at inference time. They differ in how they pick merges during training; both apply learned merges greedily at encoding time.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.