TL;DR
Token Distillation is a novel method for adding new words to a pretrained Large Language Model's (LLM) vocabulary by optimizing their embeddings to match the model's internal hidden states. By "distilling" the knowledge already stored in the Transformer's layers, this approach creates high-quality embeddings in minutes, significantly outperforming traditional methods like subtoken averaging or next-token prediction.
The Problem: Over-Tokenization and Initialization
Most LLMs are "frozen" with a static vocabulary determined during their initial training. When these models encounter domain-specific terms (like medical jargon) or new languages, they fragment these words into multiple "subtokens." For example, the word palatable might be split into <_pal> <at> <able>.
This "over-tokenization" causes two major headaches:
- Performance Loss: The model struggles to synthesize the meaning of fragmented pieces that may not be individually informative.
- Efficiency Loss: Longer sequences mean higher computational costs and slower inference, especially given the quadratic scaling of self-attention.
While we can add new tokens to a vocabulary to fix this, initializing their embedding vectors is notoriously difficult. If you start with a random vector, the model "forgets" what the word means. If you just average the embeddings of the subtokens, you ignore the complex semantic construction that happens deep within the Transformer's attention layers.
Methods: Behavior-Matching via Token Distillation
The authors propose Token Distillation, a "behavior-matching" approach. Instead of looking only at the input embedding table, they look at how the entire model processes a word.
- The Teacher Phase: They take a snippet of text containing the target word (e.g., "The food is palatable"). They pass the original, fragmented subtoken version through the frozen LLM and record the hidden states (the internal representations) at a specific layer (usually the last one).
- The Student Phase: They replace the fragmented subtokens with a single new token.
- The Optimization: They optimize only the new token's embedding vector to minimize the Mean Squared Error (MSE) between the new hidden states and the "teacher" hidden states.
Essentially, they are asking: "What single input vector would make the rest of the model react exactly as if it had seen the original sequence of subtokens?" This allows the new embedding to capture the "functional knowledge" stored in the Transformer's attention and feed-forward weights.
Key Insights and Experimental Setup
The researchers evaluated their method across several challenging scenarios, including the biomedical domain (PubMed), language adaptation (French and Arabic), and multi-word tokens (e.g., "Software Development"). They tested a wide range of open-weight models, including Mistral-7B, Llama 3/3.1/3.2, OLMo2, and Qwen3.
Several profound insights emerged from the study:
- Knowledge is in the Layers, not the Table: The semantics of a word aren't fully stored in the raw input embeddings. Meaning is constructed as data passes through the layer stack. Therefore, any initialization method that doesn't "consult" the layers is fundamentally limited.
- Efficiency is a Feature: Token Distillation is incredibly fast. It can initialize 2,500 new tokens on a single GPU in under 10 minutes.
- Context Generation: If you don't have a massive corpus to find examples of your new word, you can simply ask an LLM to generate its own "synthetic" contexts for the distillation process.
- Early Layer Sufficiency: Interestingly, much of the "subtoken-to-word" synthesis happens very early in the model (around layer 4). This suggests the process could be sped up even further by only distilling early layers.
Key Results
Token Distillation proved highly effective across multiple benchmarks and models.
- Superior Performance: In biomedical benchmarks, Token Distillation consistently outperformed "Subtoken Mean" and "Next Token Prediction" (NTP) tuning. It even beat ZeTT, a state-of-the-art method that uses expensive, pretrained hyper-networks to predict embeddings.
- Better Definitions: When asked to define the new tokens, models initialized with Token Distillation produced much more accurate and semantically similar definitions compared to the original fragmented versions.
- Massive Speedups: For Arabic, adding 1,000 new tokens reduced the total token count by 36%. Because of how Transformers work, this translated to a ~50% compute saving in training-style forward/backward passes.
- Zero-Shot Success: In some cases, adding French tokens via distillation allowed Llama-3-8B-Instruct to outperform its own original tokenization performance without any further fine-tuning.
Limitations and Future Work
While powerful, the method has a few limitations:
- Output Embeddings: This method specifically targets input embeddings. To handle generating the new tokens (output embeddings), the authors still recommend a secondary phase of standard Next Token Prediction.
- Ambiguous Subtokens: The method struggles with very short, lexically ambiguous subtokens (like
<ed>or<fer>) that appear in thousands of different contexts with different meanings. - Teacher Dependency: If the original model is completely unable to understand a concept when fragmented, the "teacher" hidden states will be poor, and the distillation will fail. It cannot "teach" a model something it truly doesn't know; it can only "compress" what it already understands.
Future work may move toward a more "localized" identification of subtoken contextualization—perhaps identifying specific attention heads that are responsible for merging subtokens into concepts.
Summary updated