通过源码归属优化分词器,减少无效令牌,提升模型效率与安全。
From Where Words Come: Efficient Regularization of Code Tokenizers Through Source Attribution

- 基于代码来源多样性改进BPE算法,引入合并跳过机制
- 实验显示可显著减少未充分训练的无用令牌数量
- 适合注重推理效率与安全性的生产级LLM部署
大型语言模型的效率与安全性在很大程度上依赖于分词质量。优质分词器不仅能提升推理速度与语言理解能力,还能增强对越狱攻击的防御力并降低幻觉风险。本文聚焦代码分词的效率问题,从数据源多样性角度出发,发现训练数据中仓库和语言分布不均,导致分词器产生大量未使用、因而训练不足的令牌,以及大量源特定的重复性无效令牌。为此,我们修改BPE目标函数并引入合并跳过策略,提出源归属式BPE(SA-BPE),在不改变原有推理流程的前提下,有效缓解过拟合,大幅减少未充分训练的令牌数量,为生产环境提供高效可靠的技术工具。
原文摘要 · Abstract (English)
Efficiency and safety of Large Language Models (LLMs), among other factors, rely on the quality of tokenization. A good tokenizer not only improves inference speed and language understanding but also provides extra defense against jailbreak attacks and lowers the risk of hallucinations. In this work, we investigate the efficiency of code tokenization, in particular from the perspective of data source diversity. We demonstrate that code tokenizers are prone to producing unused, and thus under-trained, tokens due to the imbalance in repository and language diversity in the training data, as well as the dominance of source-specific, repetitive tokens that are often unusable in future inference. By modifying the BPE objective and introducing merge skipping, we implement different techniques under the name Source-Attributed BPE (SA-BPE) to regularize BPE training and minimize overfitting, thereby substantially reducing the number of under-trained tokens while maintaining the same inference procedure as with regular BPE. This provides an effective tool suitable for production use.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。