You are fine-tuning on a domain full of jargon and someone suggests adding new tokens to the tokenizer. What can go wrong, and how do you handle vocabulary changes correctly?
Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.
Model answer: the part to lead with
First question back: do you actually need new tokens? Subword splitting of jargon is usually fine, the model handles it. New tokens pay off for high-frequency control markers (role tags, tool-call delimiters) or when a term appears in a large fraction of your traffic and you care about sequence length. They rarely pay off for domain nouns.
Full worked answer
First question back: do you actually need new tokens? Subword splitting of jargon is usually fine, the model handles it. New tokens pay off for high-frequency control markers (role tags, tool-call delimiters) or when a term appears in a large fraction of your traffic and you care about sequence length. They rarely pay off for domain nouns.
If you do add them, the failure modes:
Random init. Resizing the embedding matrix draws new rows from the model's init distribution, which is nothing like the trained embedding manifold. You get large logits and loss spikes. Init at the mean of existing embeddings plus small noise, or better, at the mean of the token's own subword pieces:
model.resize_token_embeddings(len(tokenizer))
emb = model.get_input_embeddings().weight.data
for tok_id, pieces in new_tokens.items():
emb[tok_id] = emb[pieces].mean(dim=0)
If input and output embeddings are tied, you are initialising both at once, so check.
Frozen embeddings under LoRA. By default LoRA targets attention and MLP projections, so the embedding and lm_head stay frozen and your new tokens never train. They must go in modules_to_save.
Tokenizer drift between training and serving. Save the tokenizer with the adapter. If the serving stack loads the base tokenizer, your new IDs mean nothing, and you get silent garbage rather than an error.
Padded vocab. Embedding matrices are often padded to a multiple of 64 or 128 for tensor cores, so there are unused rows that can be sampled if you do not mask them.
EOS and pad. Setting pad_token = eos_token without masking pad positions in the labels teaches the model to stop early or never stop at all. This one burns people constantly.
Cheapest path: most modern tokenizers ship reserved/unused special tokens precisely for this. Repurpose those instead of resizing.
What a good answer covers
- First question back: do you actually need new tokens?
- Subword splitting of jargon is usually fine, the model handles it
- New tokens pay off for high-frequency control markers (role tags, tool-call delimiters) or when a term…
- They rarely pay off for domain nouns
- Resizing the embedding matrix draws new rows from the model's init distribution, which is nothing like…
Key terms: Random init · Frozen embeddings under LoRA · Padded vocab · EOS and pad
Interviewer follow-ups to expect
How would you verify after training that the new tokens actually learned anything?
What breaks if you add tokens to a model whose embeddings are tied and quantized to 4-bit?
Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep