Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
BPE learns merge rules by frequency, so an English-heavy corpus gives few merges to underrepresented languages, fragmenting their words and costing 3-10x more tokens per meaning.
Imagine a shorthand notebook where you invent symbols for the phrases you write most often. You write mostly in English, so you build hundreds of English shortcuts and almost none for Swahili. Now you try to write a Swahili sentence. You have no shortcuts, so you spell every piece out letter by letter, and it takes many more strokes than the same idea in English. A tokenizer works the same way: it builds shortcuts, called merges, for the language it saw most. Languages it barely saw get spelled out into many small pieces, so the same meaning costs far more tokens. That extra cost is the token tax.
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: merges allocated by frequency + fertility metric + byte-level does not fix it + three downstream costs + tokenizer-time lock-in.
import tiktoken
enc = tiktoken.get_encoding("cl100k_base")
# Semantically similar sentences across languages
samples = {
"English": "The relationship between data and accuracy matters.",
"Spanish": "La relacion entre datos y precision importa.",
"Swahili": "Uhusiano kati ya data na usahihi ni muhimu.",
}
for lang, text in samples.items():
n_tok = len(enc.encode(text))
n_word = len(text.split())
print(lang, n_tok, "tokens", "fertility", round(n_tok / n_word, 2))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.
Blaming word length for the token tax. Token count is driven by how many merge rules the language got, not by inherently longer words.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.