← Latest papers
💬 NLP

Cross-Tokenizer On-Policy Distillation via Byte-Prefix Marginalization

This paper introduces Byte-Prefix Marginalization (BPM), a novel cross-tokenizer on-policy distillation method that re-expresses teacher distributions over a shared byte space to preserve probability mass and improve student model performance across mathematics and programming benchmarks.

Original authors: Hao Wang, Kun Yuan, Wenlin Zhong, Minglei Zhang, Han Xiao, Ming Sun, Honggang Qi

Published 2026-07-27
📖 6 min read🧠 Deep dive

Original authors: Hao Wang, Kun Yuan, Wenlin Zhong, Minglei Zhang, Han Xiao, Ming Sun, Honggang Qi

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine a world where giant, brilliant AI brains are built by different architects, each using their own unique language to think. One architect might speak in long, flowing sentences, while another chops thoughts into tiny, rapid-fire syllables. This is the reality of modern "Large Language Models" (LLMs). They are incredibly smart, but they often speak different "token" languages. A token is just a chunk of text—like a word, a part of a word, or even a single letter—that the computer uses to process information.

Now, imagine you want to build a smaller, faster, and cheaper AI student that can learn from these giant teachers. This is called "distillation." Usually, you'd just have the student copy the teacher's answers. But here's the catch: if the teacher and student speak different token languages, a direct copy-paste is impossible. It's like trying to teach a student who only speaks English by handing them a textbook written entirely in a code of emojis and symbols. The student sees the symbols, but they don't know which symbol matches which English word. If you try to force a match, you might accidentally teach the student that a picture of a cat means "apple," or worse, you might throw away half the teacher's wisdom because it doesn't fit the student's dictionary.

This paper tackles that exact headache. The researchers wanted to know: Can we teach a student AI to learn from a teacher that speaks a completely different "token" language, without losing any of the teacher's brilliance or accidentally teaching it nonsense?

The Solution: The "Byte-Prefix" Translator

The authors, a team from KwaiKAT and the University of Chinese Academy of Sciences, introduced a clever new method called Byte-Prefix Marginalization (BPM). To understand how it works, let's ditch the complex math for a moment and think about how computers actually see text.

Even though different AIs chop text into different-sized "tokens" (chunks), they all agree on the underlying bytes. Bytes are the tiny, invisible building blocks of text—the raw 0s and 1s that make up every letter, space, and punctuation mark. Whether an AI sees the word "unbelievable" as one giant token, or breaks it into "un," "bel," and "ievable," they all agree that the bytes for "un" come first, followed by the bytes for "bel," and so on.

The authors realized that instead of trying to match the messy, different-sized tokens, they could translate the teacher's wisdom into this shared "byte language" first. Here is how BPM works, step-by-step:

  1. The Byte Map: Imagine the teacher's next prediction is a cloud of probability. The teacher says, "There's a 30% chance the next word is 'unbelievable'."
  2. The Longest Match: The student's tokenizer looks at the bytes for "unbelievable" and asks, "What is the longest chunk of my dictionary that fits at the start of these bytes?" Maybe the student has a token for "un" and another for "belie."
  3. The Transfer: BPM takes the teacher's 30% probability for "unbelievable" and hands it over to the student's token "un" (or "belie," whichever is the longest match). It's like saying, "If the teacher thinks 'unbelievable' is likely, then the student should definitely think 'un' is likely, because 'un' is the first part of that word."
  4. The Safety Net: What if the teacher says something the student's dictionary can't even start with? BPM doesn't just throw that probability away. It puts it into a special "residual" bucket, ensuring that 100% of the teacher's probability mass is preserved. Nothing is lost.

This method creates a perfect, "mass-preserving" target. It guarantees that the student learns exactly what the teacher intended, even if they speak different languages, as long as they agree on the bytes.

The "Whitespace" Trap and the Fix

However, the researchers discovered a funny, tricky problem. When the teacher and student are writing code, sometimes the next "token" is just a bunch of spaces or tabs (indentation). Because different tokenizers chop up spaces differently, the teacher might be saying, "I'm adding three spaces," while the student's tokenizer sees that as "I'm adding one big space token."

If the student tries to copy the teacher's exact probability for these space tokens, it gets confused. It starts learning the teacher's specific "chopping style" for spaces rather than the actual logic of the code. The authors found that in some cases, this confusion caused the student's code to collapse completely—its ability to write working programs dropped from 49% to a disastrous 9%.

To fix this, they added a simple "whitespace mask." It's like a referee that says, "Hey, if the next step is just spaces, don't try to copy the teacher's exact space-token probability. Just ignore that part of the lesson." This tiny rule saved the day, preventing the collapse and letting the student focus on the actual code logic.

The Results: Smarter Students, Faster

The team tested this method by taking three different giant AI teachers (Qwen3-32B, GLM-Z1-9B, and MiniMax-M2.7) and trying to teach them to a single, smaller student model (Qwen3.5-2B). These teachers had very different token languages, making the task quite hard.

They compared their new BPM method against other existing ways of handling different tokenizers. The results were clear:

  • Better Scores: On six tough benchmarks for math and coding, the BPM-trained students consistently outperformed the other methods. They improved the average score by 3.7 to 6.6 points over the strongest previous attempts.
  • Closing the Gap: The method managed to close 33.5% to 43.9% of the performance gap between the tiny student and the giant teacher. That's a huge chunk of the teacher's brainpower transferred to the student.
  • Robustness: The method worked well even when the teacher and student were very different (like the MiniMax teacher), proving that the "byte-prefix" approach is a universal translator.

Why This Matters

This paper suggests that we don't need to force all AI models to use the same dictionary to learn from each other. By using the shared "byte" language as a bridge, we can mix and match the best teachers from different families and teach them to efficient students without losing any knowledge. It's a bit like realizing that while everyone speaks different dialects, they all agree on the alphabet. If you teach the student to read the alphabet first, you can teach them anything, no matter who the teacher is.

The authors showed that this approach is not just a theoretical idea but a practical tool that works today, helping to create smaller, faster, and smarter AI models that can solve complex math and coding problems without needing the massive computing power of their giant teachers.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →