Tokenisation via Convex Relaxations

Jan Tempus, Philip Whittington, Craig W. Schmidt, Dennis Komm, Tiago PimentelarXiv 2026

TL;DR

Current tokenization algorithms like Byte-Pair Encoding (BPE) rely on greedy, localized choices to build a vocabulary, often missing the bigger picture. This paper introduces ConvexTok, a novel approach that frames tokenization as a global optimization problem using linear programming relaxations. The resulting tokenizer consistently improves compression metrics and language model bits-per-byte (BpB), while providing a mathematical guarantee that it is within 1% of the theoretical compression optimum.

What Problem Does This Paper Address?

Before a language model can process text, the raw input must be broken down into pieces called tokens. Standard tokenizers, such as BPE, do this using a "greedy" heuristic: they repeatedly merge the most frequent adjacent pairs of tokens in a dataset until they reach a target vocabulary size.

While simple and fast, this local strategy is suboptimal. It frequently creates unnecessary intermediate tokens and leaves better global compression layouts on the table. Ideally, we want a tokenizer that optimizes the vocabulary globally for compression. However, finding a truly compression-optimal vocabulary is an NP-hard problem. Because of this computational barrier, the community has historically stuck to greedy approximations without knowing exactly how much performance they were sacrificing.

Methods

The authors tackle this challenge by reinterpreting tokenization through the lens of polyhedral optimization.

  1. The Tokenisation Graph: They first map the text dataset to a directed acyclic graph (DAG). In this graph, vertices represent positions between characters, "byte-edges" represent raw characters, and "token-edges" represent potential multi-byte tokens. Finding a tokenization sequence becomes equivalent to finding the shortest path through this graph.
Figure 1: Tokenisation graph con- structed from D = {abaa, aba}. Black edges represent Ebyte and others represent Etok.
  1. Integer to Linear Programming: They formulate this shortest-path problem as an Integer Program (IP). To make it computationally tractable, they apply a convex relaxation, transforming the discrete IP into a continuous Linear Program (LP). This defines a "tokenisation polytope" that can be solved efficiently using modern solvers (specifically, NVIDIA's CuOPT library).
  2. Rounding Schemes: Because the LP solution contains "fractional" tokens (e.g., selecting 40% of a token), the authors introduce three rounding schemes to map the continuous solution back to a valid, discrete vocabulary:
  3. Deterministic (Det): Selects the top $K$ tokens with the highest continuous values.
  4. Biased (Bias): Ranks tokens by their continuous value divided by their length, favoring shorter tokens that generalize better out-of-distribution.
  5. Integral-only (Int): Only keeps tokens that the LP was absolutely certain about (values $\ge 0.999$).

Datasets

The models and tokenizers were trained and evaluated on:

  • ClimbMix400B: A highly curated, large-scale pretraining corpus derived from NVIDIA’s Nemotron-ClimbMix dataset, used for training both the tokenizers and the GPT-style language models.
  • FLORES+: A benchmark multilingual dataset used to evaluate how well the tokenizers generalize to out-of-distribution and multilingual settings.

Key Insights and Ideas

  • The "Self-Rounding" Polytope: Intriguingly, as the target vocabulary size increases, the LP solution naturally becomes more integral (less fractional). At larger vocabulary sizes, the optimization problem becomes less ambiguous, meaning the LP solver does most of the heavy lifting, leaving very little ambiguity for the rounding phase.
  • BPE is Surprisingly Good: One of the most comforting findings for practitioners is that standard BPE—despite being entirely greedy—is actually remarkably close to the global compression optimum (typically within 1–3%).
  • The Saturation Effect: The marginal value of adding more tokens to a vocabulary drops drastically after a certain point. At vocabulary sizes of 128k and 256k, even the highly restrictive Int rounding scheme (which discards a large portion of the vocabulary budget) achieves near-optimal compression.

Key Results

ConvexTok consistently establishes a provable lower bound on compression, allowing researchers to certify exactly how close a tokenizer is to perfection.

  • Near-Zero Integrality Gap: The Deterministic (Det) rounding scheme achieves results incredibly close to the LP lower bound. At a vocabulary size of 256k, the integrality gap ratio reaches 99.997%, meaning it is empirically indistinguishable from the global optimum.
  • Downstream Performance: When evaluating language models trained with these tokenizers, ConvexTok (specifically Det) consistently achieved better validation bits-per-byte (BpB) than BPE across almost all vocabulary sizes. Performance on downstream reasoning tasks (CORE metrics) was competitive with BPE, showing notable advantages at larger vocabulary scales (e.g., 128k and 256k).

Limitations and Future Work

The primary limitation acknowledged by the authors is that their framework is strictly tied to a compression objective. While compression correlates strongly with language model performance, it isn't the only metric that matters (others include unigram log-likelihood or fertility).

Furthermore, because the paper demonstrates that we are already within 1% of the absolute compression limit on a fixed training set, the authors note that trying to squeeze more compression out of standard tokenization is likely a dead end. Instead, they suggest future work should focus on applying this linear programming approach to alternative objective functions or relaxing pre-tokenization boundaries.

Summary updated

BibTeX
@misc{tempus2026tokenisation,
  author = {Jan Tempus and Philip Whittington and Craig W. Schmidt and Dennis Komm and Tiago Pimentel},
  title = {{Tokenisation via Convex Relaxations}},
  year = {2026},
  eprint = {2605.22821},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2605.22821},
}
Figure