Zenaique

What is the true consequence of swapping tokenizers after 1T tokens?

MCQ·Hard·4.0 · 0·~1 min·Asked atFigure AiNVIDIA
Attempt it
TL;DR

Embeddings and the output head are indexed by token ID, so a tokenizer swap scrambles inputs. You need embedding surgery plus an adaptation phase, and pre- and post-swap losses are not comparable.

Memory aid
Sign in to see the mnemonic that makes this stick.
Easy to grasp

Imagine a library where every book is stored by a slip number. You spent a year teaching a student which slip number leads to which book. Then management renumbers the entire library. Slip number 47 used to mean a physics textbook. Now it might mean a cookbook. If the student opens a slip without re-learning the new numbers, they walk into the wrong room. You cannot just hand them a new directory and expect them to keep studying. They have to relearn the mapping. Even after that, counting how many slips per minute they read does not compare across the two systems, because the slip counts work differently.

Concept explanation~2 min read

Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.

Some parts of a transformer are vocabulary-dependent and some are not. The middle of the model, the attention and feed-forward stack, works on continuous vectors. It does not know or care which token IDs produced those vectors. The two ends of the model, the input embedding and the output projection, are lookup tables indexed by token ID. A tokenizer swap breaks the ends without touching the middle.

A tokenizer swap is a structural migration, almost never worth doing mid-run, and best deferred to a model version boundary.

Which layers are vocabulary-dependent

Two layers depend directly on the token ID space: the input embedding matrix and the output projection. The input embedding has shape (V, d_model): row i is the learned vector for token ID i. The output projection has shape (d_model, V) and produces a logit per token ID, often with weights tied to the input embedding.

Everything between these two layers is vocabulary-agnostic. The attention layers receive d_model-dimensional vectors and produce d_model-dimensional vectors. The feed-forward layers do the same. None of these middle layers care which token ID produced a given input vector. They only care about the vector's content.

This structural fact is what tempts the wrong intuition. Engineers see that the bulk of the parameters live in the middle, observe that the middle is token-agnostic, and conclude that the whole model is. The two thin layers at the ends carry the vocabulary contract.

Why a naive swap scrambles inputs
Embedding surgery: the three-class alignment
The adaptation phase
Why cross-entropy is not comparable across vocabularies
Sign in to unlock the full deep dive.

Situations where this technique stops working.

Sign in to see when this approach fails.

2–4 min · Everything important, quickly.

Sign in to see the quick scan of the deep dive.

Real products, models, and research that use this idea.

  • Llama 3 expanded its tokenizer to 128k tokens for the new generation rather than swap mid-run. The migration was at a model-version boundary.
  • DeepSeek-Coder trained its own 32,000-token BPE tokenizer on a subset of its training corpus before pretraining, rather than swapping tokenizers later.
Sign in to see more production examples.

What an interviewer would ask next. Try answering before peeking at the approach.

QIf the new tokenizer is a strict superset of the old, can you skip the adaptation phase?
A

No. Even with a superset, the segmentation of common text changes when new merges are introduced. The model has to adapt to the new segmentation distribution, not just learn embeddings for novel tokens.

2 more follow-ups an interviewer would ask next. Sign in to reveal them.

Red flags & common mistakes

The phrases that signal junior thinking. Click to expand.

Most common mistake

Assuming the transformer body is token-agnostic and treating a tokenizer swap as a configuration change rather than a structural model migration.

Sign in to see all red flags and common mistakes.

60 second bullets to scan on the way to the call.

  • Which weight matrices are indexed directly by token ID?

  • Why is the transformer body itself token-agnostic?

Sign in to unlock the revision sheet.

Primary sources. Browse if you want the original framing.

Similar questions

Same topic, related formats. Practice these next.

4 curated
Next question
When does n-gram dedup…
MCQ·Medium