cs.DSSep 30, 2026

Component-Weighted Centroid Search for Exact Incremental BPE

Authors: Harshit Verma, Rex Ying

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 O(log⁡2t)O(\log^2 t) worst-case time, where tt is the maximum canonical token length. Its centroid search visits O(log⁡t)O(\log t) components and can pay another O(log⁡t)O(\log t) 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 mm to size m′m' costs O(1+log⁡(m/m′))O(1+\log(m/m')). These charges telescope, giving O(log⁡t)O(\log t) time per append and O(nlog⁡t)O(n\log t) over an nn-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 Θ(log⁡2t)Θ(\log^2 t) probes on a reachable update, while the weighted search uses Θ(log⁡t)Θ(\log t). 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

Explore similar work

CardsList
  1. Incremental BPE Tokenization

    May 29, 2026Shenghu Jiang, Ruihao GongByte-Pair EncodingTokenizer

  2. Pruned BPE: Post-training Visibility Pruning and Token Reallocation for Byte Pair Encoding

    Aug 1, 2026Kenny ShaoByte-Pair EncodingSubword Tokenization

  3. Joint Optimization for Greedy Longest-match Tokenization

    Jul 25, 2026Adhiraj Singh, Deepanshu Mody, Ghina Al Shdaifat +4Byte-Pair EncodingToken Compression