arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2410.09303cs.CLcs.LG
收藏

从用于FIM任务和模型集成的分词语言模型中获取精确的字节级概率

Exact Byte-Level Probabilities from Tokenized Language Models for FIM-Tasks and Model Ensembles

University of Toronto(多伦多大学);Meta AI

Buu Phan, Brandon Amos, Itai Gat, Marton Havasi, Matthew Muckley, Karen Ullrich

AI总结:

本研究针对分词语言模型的分词偏差问题,提出字节-分词表示引理建立分词与字节级分布映射,开发零样本转换算法消除偏差,在FIM任务和跨词汇表模型集成中分别实现18%和3.7%的性能提升。

摘要:

分词与语言模型(LMs)中许多未被充分理解的缺点相关,但仍是长序列扩展的重要组件。本研究通过分析和比较分词模型与其字节级(或无分词)对应模型的随机行为,探究分词如何影响模型性能。我们发现,即使两个模型在统计上等价,它们对下一个字节的预测分布也可能存在显著差异,我们将此现象称为“分词偏差”。为全面描述这一现象,我们引入字节-分词表示引理(Byte-Token Representation Lemma),这是一个在学习到的分词分布与其等效字节级分布之间建立映射的框架。基于这一结果,我们开发了一种无需进一步训练或优化即可消除分词偏差的下一字节采样算法,即能零样本将分词LMs转换为统计等价的无分词模型。我们通过两个用例展示其广泛适用性:填空(FIM)任务和模型集成。在输入提示可能在分词中间终止、导致分布外分词的FIM任务中,我们的方法缓解了性能下降,在FIM编码基准中实现18%的提升,且持续优于标准的分词修复方法。对于每个模型使用不同词汇表的模型集成,我们的方法实现无缝集成,在推理、知识和编码的各种标准基准上,比单个模型性能提升高达3.7%。代码可在https://github.com/facebookresearch/Exact-Byte-Level-Probabilities-from-Tokenized-LMs获取。

英文摘要:

Tokenization is associated with many poorly understood shortcomings in language models (LMs), yet remains an important component for long sequence scaling purposes. This work studies how tokenization impacts model performance by analyzing and comparing the stochastic behavior of tokenized models with their byte-level, or token-free, counterparts. We discover that, even when the two models are statistically equivalent, their predictive distributions over the next byte can be substantially different, a phenomenon we term as ``tokenization bias''. To fully characterize this phenomenon, we introduce the Byte-Token Representation Lemma, a framework that establishes a mapping between the learned token distribution and its equivalent byte-level distribution. From this result, we develop a next-byte sampling algorithm that eliminates tokenization bias without requiring further training or optimization. In other words, this enables zero-shot conversion of tokenized LMs into statistically equivalent token-free ones. We demonstrate its broad applicability with two use cases: fill-in-the-middle (FIM) tasks and model ensembles. In FIM tasks where input prompts may terminate mid-token, leading to out-of-distribution tokenization, our method mitigates performance degradation and achieves 18% improvement in FIM coding benchmarks, while consistently outperforming the standard token healing fix. For model ensembles where each model employs a distinct vocabulary, our approach enables seamless integration, resulting in improved performance up to 3.7% over individual models across various standard baselines in reasoning, knowledge, and coding. Code is available at: https://github.com/facebookresearch/Exact-Byte-Level-Probabilities-from-Tokenized-LMs

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑