Cross-Tokenizer Likelihood Scoring Algorithms for Language Model Distillation

Buu Phan, Ashish J Khisti, Karen Ullrich

Introduction: The Vocabulary Misalignment Problem

Distilling knowledge from a large "teacher" language model (LM) to a smaller "student" model is a standard practice for deploying capable AI on edge devices. However, this process often breaks down when the teacher and student utilize different tokenizers—a challenge known as vocabulary misalignment.

Standard distillation techniques assume both models operate within the same probability space, meaning they share an identical vocabulary. In real-world scenarios, developers frequently need the student to have a smaller vocabulary to minimize memory overhead, or they may wish to distill insights from a model in one family (e.g., Llama) into a model from another (e.g., Gemma).

Cross-tokenizer likelihood scoring converts next-token probabilities from a native tokenizer (e.g., Qwen2.5) to a target tokenizer (e.g., Gemma2).

When tokenizers differ, "tokenization bias" occurs. A sequence represented as a single token by the teacher might be split into multiple tokens by the student. If the teacher's vocabulary makes certain sub-token sequences impossible, it sends a misleading, zero-probability signal to the student during training. Existing workarounds often rely on complex auxiliary losses or heuristic sequence alignments that introduce significant overhead and require extensive hyperparameter tuning. This paper introduces a probabilistic framework that uncovers a recursive structure within Byte-Pair Encoding (BPE) to compute exact likelihoods across different vocabularies, enabling highly accurate cross-tokenizer distillation.

Methodology: Bridging the Tokenizer Gap

The authors propose Cross-Tokenizer Likelihood Scoring, a mathematical approach to realign a teacher's probability space with a student's. The framework addresses two primary scenarios:

1. The Subset Regime (Vocabulary Trimming)

This scenario applies when the student's vocabulary is a strict subset of the teacher's. The authors introduce the concept of Relative Alphabets, treating the smaller vocabulary as a foundational base for the larger one. By leveraging this relationship, they developed an $\mathcal{O}(1)$ algorithm capable of computing exact next-token probabilities. This efficiency makes it highly practical for real-time sequential sampling during training.

2. The General Case (Arbitrary Vocabularies)

When distilling between entirely different models, vocabularies are arbitrary and rarely overlap perfectly. To solve this, the researchers developed a lossless recursive procedure that "demerges" BPE tokens back into their base components to find a common representational ground.

The BPE vocabulary hierarchy and the corresponding merge/demerge operators used to translate token sequences.

Because this exact recursive demerging can be computationally expensive, the authors also provide a fast beam-search approximation. This approximation prunes low-probability paths, focusing only on high-probability "covers" to keep the process computationally viable for large-scale training without sacrificing significant accuracy.

Key Insights

  • BPE is a Deterministic Hierarchy: The core breakthrough of this method is the realization that BPE is not merely a static mapping dictionary; it is a deterministic hierarchy. By exploiting BPE merge rules, the algorithm can mathematically "undo" a teacher's tokenization to accurately project how it would distribute probability mass over the student's distinct tokens.
  • Solving the "Impossible" Token Constraint: Tokenization bias creates hard constraints. For example, if a teacher model processes "122" as a single token, it assigns a 0% probability to the sequence of separate tokens "12" followed by "2". This framework corrects this misleading signal, ensuring the student is not penalized for generating valid sub-token sequences.
  • Efficiency via Pruning: In the general case, language models tend to concentrate most of their probability mass on a very small number of candidate tokens. By utilizing beam search to focus exclusively on these high-probability paths, the method achieves near-lossless accuracy while drastically reducing computational load.

Results and Benchmarks

The researchers evaluated their algorithms across a diverse battery of benchmarks, including mathematical reasoning (GSM8K), coding (HumanEval, MBPP), general instruction following (Alpaca), summarization (DialogSum), and common sense reasoning (ARC, BoolQ, CommonsenseQA, HellaSwag, PIQA).

  • Memory Efficiency & Performance: By trimming the vocabulary of a Qwen2.5-1.5B model using the subset regime, the researchers reduced the memory footprint of the language modeling head by 12%. Remarkably, this compression actually improved baseline performance by up to 4% on evaluated reasoning tasks.
  • State-of-the-Art Distillation: On the GSM8K math benchmark, their Partial KL (PKL) method achieved 55.6% accuracy, outperforming the previous state-of-the-art cross-tokenizer method (ALM) by over 2%.
  • Robustness: The proposed approach consistently outperformed heuristic baselines like DSKD and ULD across almost all tested vocabulary sizes (16k, 32k, 64k) and tasks, demonstrating that principled probabilistic alignment is vastly superior to heuristic alignment.

Limitations and Future Work

While highly effective, the approach has some limitations. The general case approximation still requires roughly 0.5 seconds per next-token evaluation, which introduces computational overhead compared to standard "same-tokenizer" distillation. Additionally, the current mathematical framework is tailored specifically to Byte-Pair Encoding (BPE). While BPE is the industry standard (used by models like GPT-4 and Llama), adapting this method for other tokenization schemes like Unigram or WordPiece would require further derivation.

Future research directions include exploring "on-policy" distillation—where the student generates its own text during training—and applying these algorithms to "tokenization adaptation," enabling pre-trained models to be seamlessly migrated to entirely new vocabularies for specific domains or languages.

Summary updated

BibTeX
@inproceedings{phan2026cross,
  author = {Buu Phan and Ashish J Khisti and Karen Ullrich},
  title = {{Cross-Tokenizer Likelihood Scoring Algorithms for Language Model Distillation}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=hD69qj15Os},
}
Figure