Model and Inference EngineeringTraining and model lifecycleStaff
Why can changing the tokenizer during training invalidate an otherwise loadable checkpoint?
By Amit Kumar3 min readWorked answer includedReviewed 27 Sept 2026
The question
Interview question
At a hypothetical step 120,000, preprocessing workers switch tokenizers to improve one language. Vocabulary size and model tensor shapes stay the same, and loss remains smooth. Explain how token identity, target labels and the training recipe may have changed. Design an investigation and recovery path, including the case where only tokenizer implementation speed changed and token outputs are intended to be identical.
Draft your approach first
Take a few minutes before you read the answer. Name the constraint that matters most, the failure you are designing for and how you would know it worked.
Reveal the worked answerWorked answer
Consider a hypothetical vocabulary where ID 41 means “invoice” and ID 902 means “cancel.” If an updated tokenizer swaps those meanings without remapping weights, an invoice input now selects the embedding learned for cancellation. The output labels change meaning too: predicting 41 is scored against a different word. Both matrices can keep exactly the same shape while the learned correspondence between inputs, outputs and optimizer history is broken.
I would stop the job at a completed step and find out exactly what changed. The model sees token IDs, not the text we think we fed it. If an old tokenizer maps a word to IDs 41 and 902, while the new one maps that word differently, the embedding rows and the optimizer moments attached to those rows retain their old history. Even with the same vocabulary size, IDs can be reassigned. A successful weight load only checks shapes. It does not prove that row 41 still means what it meant in the first 120,000 steps.
There are less obvious changes too. Normalization, pretokenization, special tokens, end of sequence markers and chat formatting can change which examples the optimizer sees. A different segmentation changes tokens per document, truncation, packing boundaries and the number of useful target tokens per step. If the learning rate schedule is driven by steps while the amount of text per step changes, the training recipe changes again. A smooth average loss can hide a regression in the affected language or a shift in which token positions are being predicted.
I would compare the immutable tokenizer files and settings from the checkpoint manifest with the exact preprocessing worker artifact. Encode a small fixed corpus spanning the affected language, control languages, tool and role markers, long documents and boundary cases. Compare token IDs, decoded text, sequence lengths and packed examples. Also inspect the data pipeline logs to identify the first mixed batch. A flag saying “tokenizer v2 deployed Tuesday” is not enough if workers rolled gradually or cached tokenized shards were mixed with fresh ones. The Hugging Face tokenizer documentation notes that adding tokens requires matching model embeddings. Equal matrix dimensions do not solve a changed mapping.
If the tokenizer was meant to remain fixed, roll the workers back and resume from the last checkpoint and data cursor before any changed examples entered an optimizer step. Replay or exclude the affected batches according to a recorded sample plan. Do not simply switch back at the next batch and pretend the mixed optimizer updates did not happen. If the change is intentional, treat it as a new training stage. Preserve old token IDs where possible, define any new embedding and output-head initialization, reset or transform affected optimizer state only with an explicit method, and reevaluate across languages and tasks. Record the lineage from the previous checkpoint rather than calling it the identical continuation.
What if the only change is faster tokenizer code and golden texts produce identical IDs? Then it may be a performance change, provided the full relevant input domain and packing output are equivalent. Test Unicode normalization, invalid bytes, special tokens and truncation too. I would still pin the artifact so the answer to this question is reproducible later. The model weights passed evaluation. Why did production tool calls break? asks why production serving used a tokenizer or chat template different from the evaluated weights. Here the training data itself changed midway, and the optimizer has already consumed some of it.
Related questions
- How would you decide whether a partially written distributed training checkpoint is safe to restore?Staff
- How can adding duplicated training data improve average loss while degrading rare customer workflows?Principal
- What must remain equivalent when a training checkpoint is resharded onto fewer GPUs?Staff
Keep practising model and inference engineering
Follow another question in this area, or search the complete library.
Get my essays on AI engineering and distributed systems by email. Subscribe to ArchCrux