LoPT: Lossless Parallel Tokenization Acceleration for Long Context Inference of Large Language Model
Wei Shao, Lingchao Zheng, Pengyu Wang, Peizhen Zheng, Jun Li, Yuwei Fan
TL;DR
LoPT targets the tokenization bottleneck in long-context LLM inference by delivering lossless parallel tokenization. It introduces a three-module pipeline—text splitting, parallel tokenization, and position-aware merge—with a dynamic chunk-length mechanism to guarantee outputs identical to sequential tokenization. The authors provide a theoretical consistency proof for WordPiece and BPE tokenization and validate the approach across English and Chinese long-text datasets, achieving lossless accuracy with substantial speedups over existing delimiter- and overlap-based methods. This work enables efficient, scalable long-context inference by removing tokenization-induced latency without compromising output fidelity.
Abstract
Long context inference scenarios have become increasingly important for large language models, yet they introduce significant computational latency. While prior research has optimized long-sequence inference through operators, model architectures, and system frameworks, tokenization remains an overlooked bottleneck. Existing parallel tokenization methods accelerate processing through text segmentation and multi-process tokenization, but they suffer from inconsistent results due to boundary artifacts that occur after merging. To address this, we propose LoPT, a novel Lossless Parallel Tokenization framework that ensures output identical to standard sequential tokenization. Our approach employs character-position-based matching and dynamic chunk length adjustment to align and merge tokenized segments accurately. Extensive experiments across diverse long-text datasets demonstrate that LoPT achieves significant speedup while guaranteeing lossless tokenization. We also provide theoretical proof of consistency and comprehensive analytical studies to validate the robustness of our method.
