TL;DR
JOLT (Joint Optimization for Greedy Longest-match Tokenization) is a new optimization framework that directly aligns subword vocabulary training with greedy left-to-right longest-match decoding (the inference rule used by WordPiece). By formulating vocabulary selection as an integer program with unique "greedy-consistency" constraints, JOLT achieves near-optimal text compression, closing up to 99.4% of the remaining compression gap left by standard heuristic tokenizers like BPE.
What Problem Does This Paper Address?
Tokenizers break down raw text into subword units (tokens) that language models can process. Efficient tokenization is highly desirable: producing shorter token sequences allows models to fit more text into a fixed context window and reduces inference costs.
Traditionally, vocabularies are constructed using greedy heuristics like Byte Pair Encoding (BPE) or WordPiece. However, these heuristics build vocabularies procedurally rather than directly optimizing for the specific decoding rules used during inference. While recent research has successfully optimized vocabularies for "shortest-path" or "split-tree" decoding rules, no mathematical optimization method existed for Greedy Left-to-Right (GL2R) longest-match tokenization—the fast and ubiquitous decoding rule underlying WordPiece. JOLT addresses this gap by framing vocabulary learning as a formal optimization problem tailored specifically to GL2R decoding.
Methods
The authors introduce JOLT, which formulates vocabulary learning as a joint Integer Program (IP) over vocabulary-selection variables (which tokens to keep) and segmentation-choice variables (how to split words).
Key components include:
- Greedy-Consistency Constraints: Standard optimization constraints only ensure that a chosen split uses tokens present in the vocabulary. JOLT introduces a novel set of constraints ensuring that no longer valid token exists in the vocabulary that would override the chosen segmentation during a real left-to-right decoding scan. This guarantees that the training objective perfectly matches deployment-time tokenization.
- Fallback-Driven Escalation: Instantiating all possible text segmentations causes an exponential explosion of variables. To keep the problem tractable, JOLT initially only considers low-order segmentations (e.g., maximum of 2 tokens) alongside a "fallback" option ($\mathcal{F}$). If the linear programming (LP) solver allocates weight to the fallback, JOLT dynamically introduces higher-order segmentations for those specific words in subsequent training rounds.
- LP Relaxation and Rounding: Because solving the full IP at scale is NP-complete, JOLT solves a continuous LP relaxation and applies a contribution-based weighted rounding scheme to extract a fixed-size discrete vocabulary.
Datasets
- MiniPile: A high-quality, English-dominant subset of The Pile corpus, split into a 75% training set and a 25% validation set.
- Pretokenization: The corpus is initially segmented into word-level "pretokens" using a length-capped version of the GPT-4o regular expression (
GPT4O_REGEX_16).
Key Insights and Ideas
- BPE is Surprisingly Near-Optimal: By solving the LP relaxation, the authors established a mathematical lower bound (a certificate of the absolute best possible compression). They discovered that standard BPE already sits within a mere 1–2% of this theoretical optimum for GL2R inference. BPE's left-to-right merge heuristic naturally aligns well with longest-match decoding.
- The Power of Strategic Short Tokens: Counter-intuitively, JOLT optimizes compression by retaining more single-byte tokens than BPE. It does this strategically to suppress competing prefixes, preventing a sub-optimal token from triggering early and allowing a much longer, more efficient match to occur a few bytes later down the string.
Key Results
- Gap Closure: JOLT successfully closes 89.6% to 99.4% of the compression headroom between BPE-greedy and the theoretical LP lower bound on the training scope.
- Minimal Rounding Loss: The rounded discrete vocabularies perform exceptionally close to the ideal continuous LP bound, exhibiting a rounding gap of only 0.008% to 0.176%.
- Validation Performance: On held-out validation data, JOLT consistently outperforms BPE, yielding up to 0.78% fewer tokens at a vocabulary size of 32k, with compression gains scaling positively as the training scope increases.
Limitations and Future Work
- Computational Expense: Solving large-scale linear programs is computationally demanding. JOLT's full pipeline can take up to 113 hours of wall-clock time on a single node for large training scopes.
- Scope and Language Constraints: The optimization only covers the top-$N$ highest-frequency pretokens (excluding the long tail), is capped at a segmentation order of $M=3$, and was only evaluated on an English-dominant corpus using whitespace-based pretokenization. Its performance on non-whitespace-delimited languages (like Chinese or Japanese) remains untested.
- Intrinsic Evaluation Only: The paper focuses entirely on compression metrics (token counts) and does not evaluate the downstream impact of JOLT vocabularies on language model training wall-time or accuracy.
Summary updated