Peek2: Regex-free Byte-level Byte-Pair Encoding Pretokenizer for LLM Inference on Edge Devices
Abstract
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 and delivers a 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.
Cite
@article{arxiv.2601.05833,
title = {Peek2: Regex-free Byte-level Byte-Pair Encoding Pretokenizer for LLM Inference on Edge Devices},
author = {Liu Zai and Iraklis Klampanos},
journal= {arXiv preprint arXiv:2601.05833},
year = {2026}
}
Comments
7 pages, 5 figures, accepted to ACL SRW 2026, for associated code, see https://github.com/omegacoleman/tokenizers_peek2 v2: updated to match accepted version in ACL SRW 2026