arXiv:2511.20849cs.CLcs.AI2025-11中稿 · Transactions on Ma…被引 1

新分词器减少文本令牌数,提升模型训练与推理效率。

Length-MAX Tokenizer for Language Models

  • 将分词优化转化为图分割问题,贪心算法求解最小平均令牌长度。
  • 相比BPE,令牌数减少14%~18%,64K词表下仍降13.0%。
  • 降低推理延迟13.7%,提升吞吐16%,且下游任务性能更优。

我们提出一种新型语言模型分词器——Length-MAX分词器,通过最小化平均字符对应令牌数,减少训练和推理阶段的令牌数量。该方法将长度加权目标最大化建模为图分割问题,并设计贪心近似算法求解。在FineWeb及多样化数据集上,词表大小从10K到50K时,相比字节对编码(BPE)减少14%~18%的令牌数,64K词表下减少13.0%。在124M、355M和1.3B参数的GPT-2模型上,从零训练五次均显示达到固定验证损失所需的训练步数分别减少18.5%、17.2%、18.5%,推理延迟降低13.7%、12.7%、13.7%,124M模型下吞吐量提升16%。同时,在下游任务中表现更佳:LAMBADA困惑度降低11.7%,HellaSwag准确率提升4.3%。该分词器实现99.62%词汇覆盖率,测试集外词汇率仅为0.12%。结果表明,优化平均令牌长度而非仅频率,可有效提升语言建模效率,且不牺牲甚至提升下游性能。该分词器兼容生产系统,推理阶段可减少18%的嵌入与键值缓存内存占用。

原文摘要 · Abstract (English)

We introduce a new tokenizer for language models that minimizes the average tokens per character, thereby reducing the number of tokens needed to represent text during training and to generate text during inference. Our method, which we refer to as the Length-MAX tokenizer, obtains its vocabulary by casting a length-weighted objective maximization as a graph partitioning problem and developing a greedy approximation algorithm. On FineWeb and diverse domains, it yields 14--18\% fewer tokens than Byte Pair Encoding (BPE) across vocabulary sizes from 10K to 50K, and the reduction is 13.0\% when the size is 64K. Training GPT-2 models at 124M, 355M, and 1.3B parameters from scratch with five runs each shows 18.5\%, 17.2\%, and 18.5\% fewer steps, respectively, to reach a fixed validation loss, and 13.7\%, 12.7\%, and 13.7\% lower inference latency, together with a 16\% throughput gain at 124M, while consistently improving on downstream tasks including reducing LAMBADA perplexity by 11.7\% and enhancing HellaSwag accuracy by 4.3\%. Moreover, the Length-MAX tokenizer achieves 99.62\% vocabulary coverage and the out-of-vocabulary rate remains low at 0.12\% on test sets. These results demonstrate that optimizing for average token length, rather than frequency alone, offers an effective approach to more efficient language modeling without sacrificing -- and often improving -- downstream performance. The tokenizer is compatible with production systems and reduces embedding and KV-cache memory by 18\% at inference.

分词器高效训练语言模型

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