arXiv:2611.07346cs.DSNov 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2611.07346

GreedTok is a Constant-Factor Approximation for Partition-Cover Tokenization

Kundan Baliga, Aiden Xie, Aditya Byju

Abstract

GREEDTok (Lim, Tan, Choo and Lauw, NeurIPS 2025) builds a tokenizer vocabulary greedily for the partition-cover objective: choose kk tokens so as to maximize the number of adjacent character pairs merged when the corpus is segmented optimally. The objective is neither submodular nor supermodular, so the classical 1−1/e1-1/e analysis does not apply, and a worst-case guarantee was left open. We prove that GREEDTok is a constant-factor approximation: on every corpus and for every budget kk it achieves at least 0.2752 of the optimum, and it is optimal for k=1k=1. The bound holds for both the exact greedy loop and the lazy priority-queue loop of the published algorithm and its code. The key ingredient is a shift lemma: if two occurrences of a not-yet-chosen token overlap and both are still usable, they offer exactly the same gain, so GREEDTok's left-to-right scoring loses nothing when occurrences collide. A per-occurrence charging argument, with window distributions certified in exact arithmetic or given in closed form, completes the proof. In the other direction, we construct corpora on which GREEDTok, with adversarial tie-breaking, achieves at most a fraction of the optimum tending to (7−ln⁡2)/12≈0.5256(7 - \ln 2)/12 \approx 0.5256 (below 0.5380 when every greedy choice is unique). Finally, we show that the objective is NP-hard to approximate within 1−1/315801 - 1/31580, to our knowledge the first inapproximability result for it.

Code, certificates and result files: Zenodo, doi:10.5281/zenodo.23954767 (Appendix E).

1 Introduction

A tokenizer fixes the units in which a language model reads text. Its vocabulary is chosen once and then used on every input, so a vocabulary that segments text into fewer tokens gives shorter sequences, less computation and more text per context window. Choosing the vocabulary is a combinatorial optimization problem, and the methods used in practice solve it greedily. It is natural to ask how far a greedy vocabulary can be from the best one. For bottom-up, merge-based tokenizers such as BPE this question has recently been studied in depth: Zouhar et al. [6] bound greedy BPE in terms of an instance-dependent curvature, and Kozma and Voderholzer [4] gave the first constant-factor bounds. In this paper we answer the question for GREEDTok, a greedy algorithm for a different and more direct formulation of tokenization.

The problem. Lim, Tan, Choo and Lauw [1] cast tokenization as a partition-cover problem. We are given a corpus of words with counts and a budget kk, and we choose a set SS of at most kk tokens, each a string of length at least 2. Every word is then segmented optimally into tokens of SS and single characters, and the objective f(S)f(S) counts, weighted by word counts, the adjacent character pairs that end up inside a token. Maximizing ff is thus the same as minimizing the total number of tokens. The problem is NP-hard [1, 2].

The algorithm. GREEDTOK [1] builds SS one token at a time, always choosing the candidate with the largest score, where a score is computed by scanning the candidate's occurrences from left to right. Unlike max-coverage greedy, GREEDTOK's choices also fix where a token is used: its occurrences are frozen, and later tokens may absorb them but not cut through them. We write gtg_t for the gain of the tt-th choice, Gt=g1+⋯+gtG_t = g_1 + \cdots + g_t for the value after tt steps, and GTk=Gk\mathrm{GT}_k = G_k for the final value with budget kk.

Why the standard analysis fails. The textbook 1−1/e1-1/e bound for greedy rests on submodularity: at every step the optimal solution still offers, in total, at least the remaining gap OPT−Gt\mathrm{OPT} - G_t. Here this fails in two ways. The objective is neither submodular nor supermodular [1, App. A], and not even weakly submodular.¹ More importantly, a single commit can make every occurrence of an optimal token unusable, so greedy may destroy more optimal value than it gains. Lim et al. observed good empirical ratios and left a guarantee open: “Although we show that GreedTok achieves an approximation ratio of at least 0.9(1−1/e)0.9(1-1/e) for large kk, a formal proof is lacking. Nevertheless, this is an intriguing theoretical problem.” [1, §6].

Main results. Write OPTk\mathrm{OPT}_k for the optimum with budget kk.

Lower bound (Theorem 16). On every corpus and for every k≥1k \geq 1, GTk≥0.2752⋅OPTk\mathrm{GT}_k \geq 0.2752 \cdot \mathrm{OPT}_k, and GT1=OPT1\mathrm{GT}_1 = \mathrm{OPT}_1. This holds for any tie-breaking, for the exact greedy loop and for the lazy priority-queue loop of the published pseudocode and code.

Upper bound (Proposition 18). There are corpora on which GREEDTOK, with adversarial tie-breaking, achieves at most a fraction of OPTk\mathrm{OPT}_k that tends to (7−ln⁡2)/12≈0.5256(7 - \ln 2)/12 \approx 0.5256. With every greedy choice unique, there are instances with ratio below 0.5380 for arbitrarily large kk.

Hardness (Theorem 20). Maximizing ff with an unrestricted vocabulary is NP-hard to approximate within 1−1/315801 - 1/31580.

Hence the worst-case ratio of GREEDTOK lies in [0.2752,(7−ln⁡2)/12][0.2752, (7 - \ln 2)/12], and the best ratio achievable in polynomial time lies in [0.2752,1−1/31580][0.2752, 1 - 1/31580].

Contributions. The new ideas are a shift lemma for overlapping occurrences (Lemma 4), a charging argument over random substrings (“windows”) of the optimal tokens (Section 4), two families of bad instances (Section 5), and the first inapproximability reduction for this objective (Section 6).

Related work. Worst-case guarantees for tokenizers have so far concerned bottom-up (merge-based) tokenization. Zouhar et al. [6] showed that greedy BPE is a 1σ(1−e−σ)\frac{1}{\sigma}(1 - e^{-\sigma})-approximation for an instance-dependent curvature σ\sigma. Kozma and Voderholzer [4] proved the pair-encoding problem

¹For the single word xaby, S={ab}S = \{\mathtt{ab}\} and S′={xa,by}S' = \{\mathtt{xa}, \mathtt{by}\} give f(S)=f(S+xa)=f(S+by)=1f(S) = f(S + \mathtt{xa}) = f(S + \mathtt{by}) = 1 but f(S∪S′)=2f(S \cup S') = 2, so the submodularity ratio is 0.

APX-complete and bounded BPE's worst-case ratio between 1/3 and 0.625; the extended version of their paper [5] lowers the upper bound to (1−e−2)/2(1-e^{-2})/2. For direct tokenization (choose a vocabulary, then segment optimally), the setting of GREEDTOK, the problem is NP-complete [1, 2], and for the compressed-length objective it is APX-hard even over a binary alphabet [3]. We study the complementary objective, the number of pairs covered, and give the first inapproximability bound for it. ConvexTok [7] rounds an LP relaxation and certifies per-instance optimality gaps, whereas our guarantee is worst-case and instance-independent.

Outline. Section 2 explains the proof in plain words on a running example. Section 3 gives the model. Section 4 proves the lower bound, Section 5 gives the bad instances, and Section 6 the hardness result. Long proofs are in Appendices A–C. Appendix D relates our model to the released implementation, and Appendix E collects all computations.