TL;DR
VocAgnoLM is a new framework that allows small language models to learn from powerful "teacher" models even when they use completely different tokenizers. By using character-level offsets to align mismatched token sequences and leveraging teacher loss for importance reweighting, it enables a 1B student model to achieve a 46% performance boost in math tasks using a teacher with only 6% vocabulary overlap.
What Problem Does This Paper Address?
In modern AI, we often use a large, high-performing "teacher" model to guide the training of a smaller "student" model. However, this usually requires both models to share the exact same vocabulary (tokenizer). If the teacher sees the word "Uncertainty" as one token and the student sees it as three (Un, certain, ty), standard guidance methods like KL-Divergence break down because the token sequences and output probability distributions (logits) no longer align.
As shown in Figure 1, this is a major bottleneck: powerful models like Qwen2.5-Math share as little as 6.32% of their vocabulary with popular small models like TinyLlama.
Methods
The authors propose Vocabulary-agnostic Teacher Guided Language Modeling (VocAgnoLM), which consists of two main components:
- Token-level Lexical Alignment: Instead of trying to force vocabularies to match, the authors use character-level offsets from the raw text to create a one-to-many mapping. For every student token, they identify the specific range of teacher tokens that cover the same characters. This is illustrated in Figure 2, where different tokenization schemes for "Probability, Uncertainty" are mapped together.
- Teacher Guided Loss: Since the logit spaces are different, the student cannot directly mimic the teacher's output probabilities. Instead, VocAgnoLM uses the teacher's loss on the corresponding tokens to determine which student tokens are most "important" to learn from. The student's training objective is reweighted so it focuses on tokens where the teacher provides high-quality guidance, effectively filtering the training data on-the-fly.
Datasets
- Pretraining Corpus: The models were trained on OpenWebMath, a dataset containing roughly 15 billion tokens of high-quality mathematical web content.
- Evaluation Suite: The authors tested performance across 9 mathematical reasoning benchmarks, including GSM8k, MATH, SVAMP, ASDiv, and MMLU-STEM. These cover a range of difficulties from elementary school word problems to university-level mathematics.
Key Insights and Ideas
- Granularity is King: The authors found that coarse-grained alignment (dividing text into equal "chunks") fails as you try to get more precise. As shown in Figure 3, as the number of chunks increases, the overlap between teacher and student sequences drops sharply. VocAgnoLM’s token-level approach maintains 100% coverage (IoS), ensuring the student always receives precise guidance.
- Stronger Teachers Always Help: A common fear in distillation is that if a teacher is "too smart" or too different, the student won't learn. This paper proves the opposite: even with minimal vocabulary overlap, a stronger teacher (like Qwen2.5-Math-Instruct) leads to significantly better student performance than a weaker teacher with a matching vocabulary.
- Special Tokens Matter: The study found that "unmapped" tokens (like
<bos>or<eos>tokens that don't have a direct lexical counterpart in the teacher) should still be included in training. Excluding them leads to a massive drop in performance, suggesting these tokens carry critical structural information for the student.
Key Results
- Massive Gains: Using Qwen2.5-Math-Instruct as a teacher, a TinyLlama 1.1B student achieved a 46% improvement over naive continual pretraining.
- Outperforming Baselines: VocAgnoLM outperformed Universal Logit Distillation (ULD)—a recent method designed for mismatched vocabularies—by 33% in average math scores.
- Scalability: The performance of the student model scaled linearly with the performance of the teacher model, regardless of how different their tokenizers were. This suggests that the method successfully "transcends" the vocabulary barrier.
Limitations and Future Work
- Computational Overhead: The method requires running inference on a large teacher model during the student's training process, which increases the total computational cost.
- Domain Specificity: While the results in the mathematical domain are impressive, the authors note that large-scale validation across more general domains (like general web text or code) is left for future work.
- Teacher Inference: The current approach relies on the teacher's loss. Future iterations might explore ways to use teacher internal representations (hidden states) in a vocabulary-agnostic way to provide even richer guidance.
Summary updated