Component-Weighted Centroid Search for Exact Incremental BPE
Organizations: Yale University
Abstract
Exact incremental BPE maintains the canonical tokenization state after every appended byte. The recent algorithm of Jiang and Gong (2026) does this in worst-case time, where is the maximum canonical token length. Its centroid search visits components and can pay another for ordered point location at each one. Within Jiang and Gong's normalized/proper merge-stage model, we change only that local search. Each interval is weighted by the size of the recursive component it selects, so a move from size to size costs . These charges telescope, giving time per append and over an -byte stream, with the same BPE semantics and asymptotic space. We also construct a normalized proper BPE family over a fixed alphabet where count-balanced search uses probes on a reachable update, while the weighted search uses . A Rust implementation matches the predicted probe counts on every tested instance. On ordinary vocabularies the queried degrees are small, however, and the improvement is a worst-case guarantee rather than an average-speed result.
Figures & tables
Appendix figures & tables3 assets
Supplementary material from the paper’s appendix.
Appendix
| Vocabulary | Corpus | Record probes | Endpoint comparisons | ||
|---|---|---|---|---|---|
| Binary | Weighted | Binary | Weighted | ||
| GPT-2 | English | 2/4/5/5/7 | 1/2/2/3/4 | 2/4/5/5/7 | 2/4/4/5/7 |
| GPT-2 | Code | 2/4/5/6/7 | 1/2/2/3/4 | 2/4/5/6/7 | 2/4/4/6/8 |
| RoBERTa-base | English | 2/4/5/5/7 | 1/2/2/3/4 | 2/4/5/5/7 | 2/4/4/5/7 |
| RoBERTa-base | Code | 2/4/5/6/7 | 1/2/2/3/4 | 2/4/5/6/7 | 2/4/4/6/8 |
| GPT-NeoX-20B | English | 2/4/5/5/7 | 1/2/2/3/3 | 2/4/5/5/7 | 2/4/4/5/6 |
| Vocabulary | Corpus | Search (%) | Max degree | p99 probes | Max probes | ns/update |
|---|---|---|---|---|---|---|
| GPT-2 | English | 9.53 | 4 | |||
| GPT-2 | Code | 7.40 | 4 | |||
| RoBERTa-base | English | 9.53 | 4 | |||
| RoBERTa-base | Code | 7.40 | 4 | |||
| GPT-NeoX-20B | English | 9.57 | 4 | |||
| GPT-NeoX-20B | Code | 12.26 | 5 |
| Retained MB | Search bytes/interval | Initialization ms | ||||
|---|---|---|---|---|---|---|
| Vocabulary | Binary | Weighted | Binary | Weighted | Binary | Weighted |
| GPT-2 | 38.50 | 44.71 | 144.71 | 190.17 | 41.21 [40.05,43.16] | 49.49 [49.30,50.93] |
| RoBERTa-base | 38.50 | 44.71 | 144.71 | 190.17 | 41.72 [40.88,42.08] | 49.58 [48.37,49.84] |
| GPT-NeoX-20B | 38.32 | 44.60 | 142.17 | 186.87 | 39.82 [39.60,39.87] | 54.48 [52.79,55.23] |