NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Length-MAX Tokenizer for Language Models

Dong Dong, Weijie SuarXiv 2025 · DOI

Abstract

Length-MAX is a novel tokenizer that prioritizes longer, semantically rich tokens by maximizing a length-weighted objective (frequency × length) rather than frequency alone. By reducing the number of tokens needed to represent text by 14–18%, Length-MAX enables nearly 20% faster training and significantly lower inference latency. Empirical evaluations show that this approach not only improves efficiency but also enhances model performance on long-range reasoning and dependency tasks.

Introduction

Most modern language models rely on Byte Pair Encoding (BPE) or its variants for tokenization. These methods are primarily "frequency-driven," iteratively merging the most common symbol pairs. While effective, this approach often results in "fragmentation," where text is broken into more discrete units than necessary.

Because the computational complexity of the attention mechanism scales quadratically with sequence length ($O(L^2)$), these extra tokens act as a significant tax on training time, inference speed, and memory (specifically the KV-cache). Furthermore, fragmented sequences make it harder for models to capture long-range dependencies, as the semantic context is spread across more tokens. Length-MAX addresses these issues by shifting the tokenization objective from pure frequency to a length-weighted metric.

Methods

Length-MAX departs from the frequency-centric paradigm by introducing a length-weighted scoring function. Instead of simply counting occurrences, the algorithm maximizes the product: score(t) = frequency(t) × length(t). This objective rewards longer substrings that maintain high coverage across the corpus, effectively reducing fragmentation.

The Length-MAX Tokenizer pipeline, featuring a scoreboard architecture and Rabin-Karp rolling hashes for scalable training.

The authors formalize tokenization as a graph partitioning problem. To handle massive datasets like the 18.5T token FineWeb, they developed a greedy $O(N)$ approximation algorithm implemented with a "scoreboard" architecture. This system uses Rabin-Karp rolling hashes to allow parallel processing across hundreds of CPU cores with high efficiency.

Unlike standard BPE, Length-MAX operates directly on raw UTF-8 bytes without requiring whitespace-based pre-tokenization. This allows it to capture multi-word units (e.g., "in the midst of") as single tokens. For inference, the vocabulary is compiled into a Rust-based Deterministic Finite Automata (DFA), which decodes text 3–4 times faster than conventional implementations.

Evaluation Framework

The models and tokenizers were trained using shards of the FineWeb dataset (10B, 40GB, and 150GB). Robustness was tested across five domains: News, Technical, Literature, Conversation, and Mixed. Downstream performance was measured using a comprehensive suite of benchmarks, including GLUE, LAMBADA (long-range dependency), HellaSwag (reasoning), PIQA, SQuAD, and TinyStories.

Key Insights

  • Flattening the Zipf Head: Standard tokenizers exhibit a highly skewed distribution where a few short tokens (like "the") dominate. Length-MAX reallocates this probability mass to multi-word units (like "the United States"), resulting in a flatter distribution that still preserves the essential power-law tail necessary for model quality.
  • Efficiency as a Quality Proxy: By reducing the "Tokens Per Character" (TPC), the model effectively gains a larger "lookback" window for the same amount of compute. This increased context density is a primary driver for improvements in long-range reasoning tasks.
  • Orthogonality: The length-weighted approach is fundamentally different from linguistic "boundary-aware" methods, suggesting potential for future hybrid approaches.

Key Results

Length-MAX demonstrates superior performance across efficiency and accuracy metrics. It yields 14–18% fewer tokens than BPE across various vocabulary sizes. In training experiments with GPT-2 models (124M to 1.3B parameters), models reached target validation loss in 18.5% fewer steps.

Comparative results showing Length-MAX improvements in training efficiency, tokenization density (TPC), MNLI accuracy, and LAMBADA perplexity.

Inference efficiency also saw marked improvements, with 13.7% lower latency and an 18% reduction in KV-cache memory consumption. Downstream gains were equally impressive:

  • GLUE: Improved macro average by 4.7 points (+12.8% relative).
  • LAMBADA: Perplexity dropped by 11.7%, indicating better handling of long-range dependencies.
  • TinyStories: In head-to-head evaluations, GPT-4 preferred Length-MAX generated stories in 85% of cases, citing superior coherence and grammar.

Limitations and Future Work

While promising, Length-MAX has several limitations. The current study focused exclusively on English; its impact on morphologically rich or logographic languages remains to be explored. Additionally, due to compute constraints, empirical training was limited to 1.3B parameters.

Because embeddings are tied to the specific tokenizer used during pre-training, Length-MAX is not a "drop-in" replacement for existing models and requires training from scratch. Finally, at extremely large vocabulary sizes (100k+), the relative advantage of Length-MAX narrows as all tokenizers naturally begin to converge toward whole-word units.

Summary updated

BibTeX
@misc{dong2025length,
  author = {Dong Dong and Weijie Su},
  title = {{Length-MAX Tokenizer for Language Models}},
  year = {2025},
  eprint = {2511.20849},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2511.20849},
}
Figure