How does weighting BPE merges by document frequency instead of raw token frequency change the resulting vocabulary?
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Standard BPE merges the most frequent adjacent pair by raw token count across the entire corpus. Describe what would change: both algorithmically and in terms of the resulting vocabulary: if instead you weighted merge priority by document frequency (number of documents containing the pair) rather than total occurrence count.
Weighting BPE merges by document frequency caps each document at one vote, so high-repetition outliers stop dominating and the vocabulary generalizes more broadly.
Imagine the team votes on which word pairs deserve their own shortcut. Under the usual rule, each person votes once per time they say a phrase, so one very chatty lawyer who repeats 'whereas party' five thousand times basically decides the outcome alone. Document-frequency weighting changes the rule to one document, one vote. The lawyer's repetition now counts the same as anyone else who used the phrase at all. The shortcuts that win are the ones lots of different people use, not the ones one person hammers. The result is a set of shortcuts that serves the whole team, at the cost of fewer shortcuts tuned to that one chatty corner.
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.
3 min: scoring-only change + raw count vs document frequency + IDF analogy + vocabulary reallocation + dense-domain cost + dedup as the production alternative.
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.
Assuming document-frequency weighting is strictly better. It generalizes across documents but underweights dense domains like code or DNA where in-document repetition is the signal.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.