What concretely breaks when you try to load a pretrained model checkpoint with a different tokenizer vocabulary?
A team has a pretrained LLM checkpoint trained with a 50,000-token vocabulary. They want to swap to a new tokenizer with a 100,000-token vocabulary that has better multilingual coverage. Explain precisely what breaks at the model architecture and weight level, and describe what remediation options exist with their costs.
Swapping vocabularies misaligns the embedding table and lm_head, both indexed by token ID, so every lookup and logit points at the wrong token; fixes range from expansion to adaptation to full retrain.
Imagine you wrote a phone book where each name sits at a numbered line, and you memorized which name lives on which line. Now a friend hands you a new phone book with twice the names, in a totally different order. Your memorized line numbers all point to the wrong people now. The model has the same kind of memory: it learned what lives at each numbered line, the tokenizer is what assigns those line numbers, and a new tokenizer reshuffles the lines. You either rewrite the whole memory from scratch, or carefully copy what you can and learn the new entries, but you cannot just trust the old line numbers anymore.
Detailed answer & concept explanation~4 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.
4 min: two tensors carry vocab_size + remapping misaligns old rows + expansion adds untrained rows + expand vs adapt vs retrain + subword-average init + why the choice is sticky.
Real products, models, and research that use this idea.
- When OpenAI introduced o200k_base for GPT-5.5, it came with new model training rather than a tokenizer swap into prior checkpoints, because the embedding and head weights are bound to the original IDs.
- Open-source teams localizing Llama 4 to Indic or Arabic scripts use embedding initialization by averaging plus continued pretraining, not a tokenizer replacement, to add coverage.
- Hugging Face's resize_token_embeddings API supports vocabulary expansion by appending rows, which is why adding special tokens works but wholesale vocabulary replacement does not.
What an interviewer would ask next. Try answering before peeking at the approach.
QIf you must keep the same model and only add 5,000 domain tokens, what exact steps preserve existing behavior?
QHow would you measure whether vocabulary adaptation succeeded before committing to a full deployment?
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.
Listing only the embedding table while forgetting that the lm_head shares the vocab_size dimension and breaks identically on the output side.
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.