Spot the error: 'BPE finds the globally optimal vocabulary by iteratively merging the most frequent pair.'
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Click any words you think contain an error. Click again to unmark.
BPE is greedy: it merges the highest-frequency pair at each step with no lookahead, so each merge is locally optimal, not globally optimal.
Imagine driving home and always turning toward whichever road looks busiest right now, never checking a map. You make a sensible choice at every junction, but the full route can still be far from the shortest one, because a good early turn can lock you out of a better path later. BPE works like that. At each step it merges whatever pair is most frequent right then, commits to it forever, and never reconsiders. The final vocabulary is reasonable but not provably the best. A planner that scored whole routes, which is what the Unigram approach does, could find a better overall answer that no single greedy turn would reveal.
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.
2 min: greedy per-step argmax + no lookahead/backtrack + local vs global optimality + Unigram likelihood pruning + why greedy still ships.
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.
Calling BPE an exact or globally optimal algorithm. It is greedy: each merge is locally optimal, and the cumulative vocabulary carries no global guarantee.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.