arXiv:2601.05833cs.CL2026-01ACL

提出轻量级预分词器Peek2,提升大模型边缘推理速度

Peek2: Regex-free Byte-level Byte-Pair Encoding Pretokenizer for LLM Inference on Edge Devices

  • 设计线性时间复杂度的字节级预分词算法,内存占用极低
  • 在微基准测试中吞吐提升最高达2.48倍,整体编码效率提升1.14倍
  • 兼容GPT-3/LLaMA-3等主流模型,适配边缘设备部署

预分词是字节级BPE分词器中的关键步骤,但针对边缘推理的优化研究较少。本文提出的全新实现Peek2,可作为GPT-3、LLaMA-3和Qwen-2.5中使用的cl100k类预分词器的即插即用替代方案。通过分析原始cl100k预分词器逻辑,我们提出一种新的预分词算法,具备线性时间复杂度和恒定、极低的内存使用,适合边缘场景。测试结果表明,其在微基准测试中吞吐量最高提升2.48倍,并在完整字节级BPE编码流程中实现1.14倍的整体吞吐提升,具体效果因数据集而异,且输出结果与基于正则表达式的基线分词器完全一致。

原文摘要 · Abstract (English)

Pretokenization is a crucial, sequential pass in Byte-level BPE tokenizers, yet little work has been done to optimize it for edge-side inference. Our proposed new implementation, Peek2, serves as a drop-in replacement for cl100k-like pretokenizers used in GPT-3, LLaMa-3, and Qwen-2.5. After breaking down and analyzing the logic of the original cl100k pretokenizer, we introduced a new pretokenization algorithm with linear time complexity and constant, trivial memory usage, suited for edge scenarios. Test results show that it increases microbenchmarking throughput by up to $ 2.48\times $ and delivers a $ 1.14\times $ improvement in overall throughput across the entire Byte-level BPE encoding process, depending on the dataset, while providing identical results as the baseline Regex-based tokenizer.

边缘计算分词优化大模型推理字节级编码

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