Greedy Byte-Pair Encoding Achieves at Least 0.361 of the Optimal Compression
Organizations: University of Illinois Urbana-Champaign · Georgia Institute of Technology
Abstract
Byte-Pair Encoding (BPE) builds a tokeniser by repeatedly merging a most frequent adjacent pair of symbols; its utility is the total reduction in string length achieved by merges. It was known that this greedy rule achieves at least a third of the optimal reduction. We prove that it always achieves at least 0.361 of the optimal reduction in string length, for every string, every budget and every tie-breaking rule; this is the first improvement of the bound one third. We also explain why one third was a barrier: the pair-packing relaxation behind it is tight, so a better bound must use more of the optimum's structure. When greedy destroys three of the optimum's merge points at once, one of them can usually be moved next door, because all copies of a rule of the optimum look alike; the remaining cases are paid for later. Along the way we determine the worst-case ratio for two merges exactly, bound it for three, and isolate a single inequality that would settle the problem.
Figures & tables
| term | meaning | defined in |
|---|---|---|
| affected gaps | the gaps , , whose neighbouring tokens a replacement changes | Section 4 |
| scan-order attribution | an object affected by several replacements of one step is charged to the leftmost | Section 4.2 |
| intact, moved, live node | a node of at its own intact junction; a node relocated once, next to the token that absorbed its junction; either of these | Section 4.2 |
| ghost | a placeholder left at the gap of a destroyed parent node | Section 4.2 |
| ghost class | the pair (parent label, side) of a ghost; it fixes the ghost’s type | Section 4.2 |
| kill / destroy | what a replacement does to a live node / to a ghost at one of its affected gaps | Section 4.2 |
| kind of replacement | creates | effect on live nodes | ||
|---|---|---|---|---|
| original triple, JL or JR, saved | a moved node | |||
| original triple, JR, failure | nothing | ; its image has | ||
| original triple, class A | a ghost | |||
| triple that is not original | nothing | , at least one of them moved | ||
| image of a failure | nothing | |||
| any other replacement | nothing |
| step | merge (count) | glues | affected | removes | kind | creates | ||||
| ( ) | JR, failure | — | ||||||||
| image | — | |||||||||
| class A | ghost at | |||||||||
| ; objects: one ghost, class , gap , type ; | ||||||||||
| ( ) | — | other | — | |||||||
| ghost | other (hit) | — | ||||||||
Appendix figures & tables2 assets
Supplementary material from the paper’s appendix.
Appendix
Byte-Pair Encoding
Byte-Pair Encoding (BPE) builds subword vocabularies by repeatedly merging frequent adjacent units to represent text efficiently for language models.
See all 23 papers