Skip to content

GreedTok Is a 0.3287-Approximation, and Greedy Tokenizers Lose Order 1/log⁡k1/\log k on Fixed Alphabets

Kundan Baliga, Aiden Xie, Aditya Byju

cs.DS

Abstract

A tokenizer's vocabulary is built once and used on every input, so it matters how much compression a greedy construction can lose. We study two greedy constructions: GreedTok (Lim et al., 2025), which adds the string that saves the most tokens, and byte-pair encoding (BPE), which merges a most frequent adjacent pair. We prove that GreedTok saves at least 0.32870.3287 of the optimal number of tokens saved on every corpus, while no constant above 0.338620.33862 is possible. The key idea is that, given the order of greedy's choices, the damage inside an optimal token is fixed by two numbers. On a fixed alphabet both algorithms are asymptotically optimal and their worst deficit with budget kk has order 1/log⁡k1/\log k: one counting argument gives the upper bound for both, and one binary corpus, whose first greedy commitment erases a boundary between optimal tokens, gives the matching lower bound for both (for GreedTok, on its committed segmentation), even if greedy's continuation may use almost twice the budget. For BPE on one binary string, a forced first merge can cost Ω(k)Ω(k) final tokens, yet 2k+32k+3 rules always repair it.

Create a lesson

Metadata

Comments
69 pages, 6 figures, 7 tables. v2 adds fixed-alphabet results for GreedTok and greedy BPE (deficit of order 1/log k, tight), a binary-string repair theorem for BPE, and an EPTAS for fixed alphabets; the 0.3287 bound is unchanged. Code and checkers: https://doi.org/10.5281/zenodo.24451478