You are building a 7B model for 25 languages including Hindi, Arabic, and Swahili. Design a fair tokenizer and name what it costs.
You are building a 7B model for 25 languages including Hindi, Arabic, and Swahili. Design a fair tokenizer and name what it costs.
200K-256K byte-level BPE, sampling temperature 0.3-0.5, NFC, per-language fertility+STRR+downstream eval. Fairness costs ~30 percent of model parameters and softmax latency grows linearly.
Imagine designing a phonebook for 25 different countries to share. If you give 1,000 entries to English alone, every other language has to spell things out letter by letter. If you give a fair share to each language, the phonebook becomes huge (which costs paper and time to flip through), but everyone gets quick lookups. A fair multilingual tokenizer is the second design. You spend more parameters on the bigger vocabulary, and the model takes slightly longer at every step because it has more options to choose from at the end. In return, speakers of Hindi, Swahili, Vietnamese, and other under-served languages get the same quality of service English speakers get. The cost of fairness is real (~30 percent of model parameters); the benefit is real too. Production teams decide whether to pay it based on who their users are.
Detailed answer & concept explanation~9 min readEverything 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. 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.
Open with the framing that a fair multilingual tokenizer is a parameter and latency budget decision disguised as a tokenization decision. Walk five design axes: vocab 200K-256K, sampling temperature 0.3-0.5, byte-level BPE, NFC normalization, per-language fertility+STRR+downstream eval. Explicitly surface the cost: 256K vocab on a 7B at d_model=4096 adds ~2.1B params (30 percent of model) and softmax latency grows linearly. Close with the production examples (Llama 3 128K, Qwen 3.5 152K, Gemma 2 256K) and the Token Tax research that motivates per-language evaluation.
Real products, models, and research that use this idea.
- Llama 3 and Llama 3.1 use a 128K byte-level BPE vocabulary, a middle ground that improves over Llama 2's 32K but does not fully achieve fairness for low-resource languages.
- Qwen 3.5 ships a 152K BPE optimized for strong Mandarin coverage and reasonable English performance.
- Gemma 2 uses a 256K SentencePiece-style BPE, the largest in the open-weight class as of 2026, with explicit multilingual fairness design.
- The 'Token Tax' research (Petrov 2023, Ahia 2023) demonstrated empirically that fertility predicts downstream task accuracy across languages, motivating the per-language fertility metric.
- Sarvam AI, OpenHathi, and BharatGPT are 2025-2026 production examples of Indic-specialized tokenizers that extend or replace English-centric vocabularies for stronger Hindi/Tamil/Bengali coverage.
What an interviewer would ask next. Try answering before peeking at the approach.
QSampling temperature 0.3 upsamples Swahili by 50x its web prevalence. Doesn't that produce a tokenizer that does badly on English where most of the actual product traffic is?
QWhy does fertility correlate with downstream accuracy across languages?
QHow does the softmax cost per step argument change for reasoning models that emit many output tokens?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Optimizing for English fertility and reporting only the mean, hiding that low-resource languages fragment at 3-5x English rates and pay the 'token tax' in cost, context, and downstream quality.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.