Greedy BPE with Replacement Counts Saves at Least (1-(1-2/k)^k)/2 of the Optimum, Which Is Tight as k Grows
Byte-Pair Encoding (BPE) builds the tokenisers of many language models by repeatedly merging a most frequent adjacent pair of symbols; each replacement shortens the training text by one symbol. Kozma and Voderholzer showed that k greedy merges save, in the worst case, between 1/3 and ½(1 − e−2) ≈ 0.4323 of what the best k merges save, and asked for the exact constant. We answer this for the rule they analyse, which ranks a pair by the replacements its merge makes: on every string and word table, at every budget k and for every tie-breaking rule, greedy saves at least ½(1 − (1 − 2/k)k) of the optimum, so ½(1 − e−2) is the exact worst case, approached as k → ∞ but never attained. The proof rests on a shadow inequality: after i steps the optimum is at most 2Gi + k gi+1, where Gi is greedy's saving so far and gi+1 its next gain. Our near-worst inputs use alphabets that grow with k; how close to this worst case greedy comes over bytes, at practical budgets, is open. Deployed trainers rank pairs by overlapping counts, which differ only where three equal tokens are adjacent; for that rule every run saves more than 0.38954 of the optimum (by an exact computer check), and on alphabets that grow with k the worst case for large budgets is at most 0.40407. The record includes the paper, its LaTeX source, and the code and exact checks that reproduce every computed result. This paper supersedes the preprints 10.5281/zenodo.24330797, 10.5281/zenodo.24330801 and 10.5281/zenodo.24330831.
Authors
- Kundan Baliga
- Aditya Byju
- Aiden Xie
Institutions
- Georgia Institute of Technology (US)
- University of Illinois Urbana-Champaign (US)
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-11-22
- DOI
- https://doi.org/10.5281/zenodo.24450171
- Primary Topic
- Algorithms and Data Compression
- Type
- preprint