Cross-Tokenizer Likelihood Scoring Algorithms for Language Model Distillation
作者: Buu Phan, Ashish Khisti, Karen Ullrich
分类: cs.CL, cs.LG
发布日期: 2025-12-16
💡 一句话要点
提出基于BPE递归结构的跨Tokenizer似然评分算法,用于语言模型蒸馏。
🎯 匹配领域: 支柱二:RL算法与架构 (RL & Architecture)
关键词: 语言模型蒸馏 跨Tokenizer Byte-Pair Encoding 模型压缩 知识迁移 数学推理 序列似然评估
📋 核心要点
- 知识蒸馏中,教师和学生模型Tokenizer不同导致概率空间不一致,阻碍了知识有效传递。
- 利用BPE算法的递归结构,构建跨Tokenizer似然评分框架,实现不同词汇表间的概率评估。
- 实验表明,该方法在模型压缩和性能提升方面均有显著效果,尤其在数学推理任务上。
📝 摘要(中文)
本文针对知识蒸馏等训练范式中,教师和学生语言模型(LM)因Tokenizer不同而导致的概率空间不一致问题,提出了一种基于Byte-Pair Encoding (BPE) 算法内含递归结构的跨Tokenizer似然评分概率框架。该方法支持对与教师模型原生Tokenizer不同的词汇表进行序列似然评估,解决了学生词汇表是教师词汇表子集以及一般情况下的任意词汇表问题。在子集情况下,该框架计算精确似然,并以每个token仅O(1)的模型评估次数提供序列采样所需的next-token概率。用于蒸馏时,在Qwen2.5-1.5B模型上可减少高达12%的内存占用,并在评估任务上提高高达4%的基线性能。对于一般情况,引入了严格的无损过程,利用BPE递归结构,并辅以快速近似,保持大型词汇表设置的实用性。应用于数学推理蒸馏,该方法在GSM8K上的准确率比当前最佳水平提高2%以上。
🔬 方法详解
问题定义:论文旨在解决语言模型知识蒸馏中,教师模型和学生模型使用不同Tokenizer时,计算next-token似然比的难题。现有方法难以处理不同Tokenizer带来的概率空间不一致问题,尤其是在边缘设备部署时,为了降低内存开销,学生模型通常采用更小的词汇表,导致Tokenizer差异更加显著。
核心思路:论文的核心思路是挖掘并利用Byte-Pair Encoding (BPE) 算法的递归结构。BPE算法通过迭代地合并最频繁出现的字节对来构建词汇表,这种合并过程蕴含了递归关系。论文利用这种递归关系,构建了一个概率框架,使得可以在不同的Tokenizer之间进行概率转换和似然评分。
技术框架:整体框架包含两个主要部分:一是针对学生词汇表是教师词汇表子集的情况,二是针对一般情况,即学生词汇表是任意的情况。对于子集情况,框架能够计算精确的似然值,并提供next-token概率,用于序列采样。对于一般情况,框架首先采用无损程序,利用BPE递归结构进行处理,然后采用快速近似方法,以保证在大规模词汇表下的实用性。
关键创新:最重要的技术创新在于发现了BPE算法的递归结构,并将其应用于跨Tokenizer似然评分。与现有方法相比,该方法无需进行复杂的词汇表对齐或近似,而是直接利用BPE的内在特性,实现了更精确和高效的概率转换。
关键设计:在子集情况下,关键设计在于利用BPE的合并过程,将学生Tokenizer中的token概率分解为教师Tokenizer中token概率的组合,从而实现精确的似然计算。在一般情况下,关键设计在于无损程序的实现,以及快速近似方法的选择,以保证计算效率和精度。
🖼️ 关键图片
📊 实验亮点
实验结果表明,该方法在Qwen2.5-1.5B模型上实现了高达12%的内存占用减少,并在评估任务上提高了高达4%的基线性能。在数学推理任务GSM8K上,该方法比当前最佳水平提高了2%以上的准确率,证明了其在模型压缩和性能提升方面的有效性。
🎯 应用场景
该研究成果可广泛应用于语言模型压缩、知识蒸馏、边缘设备部署等场景。通过减小模型体积和提高推理效率,该方法有助于在资源受限的环境中部署高性能的语言模型。此外,该方法还可用于提升特定任务(如数学推理)的性能,具有重要的实际应用价值和广阔的发展前景。
📄 摘要(原文)
Computing next-token likelihood ratios between two language models (LMs) is a standard task in training paradigms such as knowledge distillation. Since this requires both models to share the same probability space, it becomes challenging when the teacher and student LMs use different tokenizers, for instance, when edge-device deployment necessitates a smaller vocabulary size to lower memory overhead. In this work, we address this vocabulary misalignment problem by uncovering an implicit recursive structure in the commonly deployed Byte-Pair Encoding (BPE) algorithm and utilizing it to create a probabilistic framework for cross-tokenizer likelihood scoring. Our method enables sequence likelihood evaluation for vocabularies different from the teacher model native tokenizer, addressing two specific scenarios: when the student vocabulary is a subset of the teacher vocabulary, and the general case where it is arbitrary. In the subset regime, our framework computes exact likelihoods and provides next-token probabilities for sequential sampling with only O(1) model evaluations per token. When used for distillation, this yields up to a 12% reduction in memory footprint for the Qwen2.5-1.5B model while also improving baseline performance up to 4% on the evaluated tasks. For the general case, we introduce a rigorous lossless procedure that leverages BPE recursive structure, complemented by a fast approximation that keeps large-vocabulary settings practical. Applied to distillation for mathematical reasoning, our approach improves GSM8K accuracy by more than 2% over the current state of the art.