arXiv:2604.05192cs.CL2026-04中稿 · COLM

让词元化更快:通过聚合候选组合,训练速度提升600倍。

Faster Superword Tokenization

论文配图:Faster Superword Tokenization
图 1 · 摘自论文原文
  • 将连续词元的合并候选按频率聚合,避免全程存入内存。
  • 1GB数据训练时间从4.7天缩短至约10分钟,提速超600倍。
  • 开源了高效Python和Rust实现,适合自然语言处理开发者使用。

字节对编码(BPE)是一种广泛应用的词元化算法,其词元无法跨预分词边界扩展,功能上仅限于表示完整单词。BoundlessBPE和SuperBPE通过放宽这一限制,允许形成跨预分词的超词(superwords),即由多个预词元组成的短语。然而,先前实现训练极不实用:例如,BoundlessBPE在1GB数据上需4.7个CPU天。本文发现,两个或以上连续预词元构成的超合并候选可按频率聚合,如同普通预词元一般,从而避免将完整文档保留在内存中。我们提出一种两阶段的BoundlessBPE框架,先学习常规合并,再学习超合并,结果与原实现一致。此外,我们证明两阶段的BoundlessBPE与SuperBPE近似等价,唯一区别在于SuperBPE中的手动超参数可在第二阶段自动确定。这些改进使训练速度大幅提升,同量数据下,BoundlessBPE和SuperBPE分别仅需603秒和593秒,提速超过600倍。针对BPE、BoundlessBPE和SuperBPE,我们均开源了参考级Python实现和高效Rust实现。

原文摘要 · Abstract (English)

Byte Pair Encoding (BPE) is a widely used tokenization algorithm, whose tokens cannot extend across pre-tokenization boundaries, functionally limiting it to representing at most full words. The BoundlessBPE and SuperBPE algorithms extend and improve BPE by relaxing this limitation and allowing the formation of superwords, which are combinations of pretokens that form phrases. However, previous implementations were impractical to train: for example, BoundlessBPE took 4.7 CPU days to train on 1GB of data. We show that supermerge candidates, two or more consecutive pretokens eligible to form a supermerge, can be aggregated by frequency much like regular pretokens. This avoids keeping full documents in memory, as the original implementations of BoundlessBPE and SuperBPE required, leading to a significant training speedup. We present a two-phase formulation of BoundlessBPE that separates first-phase learning of regular merges from second-phase learning of supermerges, producing identical results to the original implementation. We also show a near-equivalence between two-phase BoundlessBPE and SuperBPE, with the difference being that a manually selected hyperparameter used in SuperBPE can be automatically determined in the second phase of BoundlessBPE. These changes enable a much faster implementation, allowing training on that same 1GB of data in 603 and 593 seconds for BoundlessBPE and SuperBPE, respectively, a more than 600x increase in speed. For each of BoundlessBPE, SuperBPE, and BPE, we open-source both a reference Python implementation and a fast Rust implementation.

词元化加速NLP

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。