You are fine-tuning on Python code only. Should you reuse the base tokenizer, train a new one, or extend the vocab?
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Fine-tuning an instruction-tuned model: reuse the base tokenizer. Pretraining from scratch: train a fresh code-aware BPE. Extension is a middle ground only worth it with a clear vocab gap and enough fine-tune data.
Imagine you have a friend who already speaks English and writes neat handwriting. You want to teach them to be better at writing Python. Option one is to keep the alphabet they already know and just have them practice Python writing more. Option two is to invent a new alphabet just for Python. Option three is to add new letters to their existing alphabet for special Python words. If you switch alphabets entirely, your friend forgets how to write English the next day. If you only add a few new letters and have them practice a lot, they keep their English and pick up Python tricks. If you are starting from a baby who has no alphabet yet, inventing a Python-only one from the start makes sense. The right answer depends on whether your friend already knows a lot or is starting fresh.
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 tokenizer and model embeddings are one trained artifact. Branch the decision: fine-tuning an instruction-tuned model means reuse the base tokenizer; pretraining from scratch means train a fresh code-aware BPE. Cover the extension middle option with its preconditions (clear vocab gap, ~100 occurrences per new token, tolerance for some instruction-tuning degradation). Cite Codestral, Qwen Coder 2.5, and GPT-5-code as the 2026 production examples.
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.
Replacing the tokenizer when fine-tuning an instruction-tuned model, then being surprised the model lost all its pretrained capability.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.