Paper commentary
The Left Ripple of Byte-Pair Encoding: Certified Lookbehind for Every Dictionary
Byte-pair encoding's left ripple can be decided exactly for every dictionary
- Problem Berglund and van der Merwe bounded how far an appended string changes byte-pair tokens, but left open how far a prepended string can change them. Their example already had infinite propagation.
- Method The authors compute the origin radius exactly with a product of two automaton runs that guess the final tokens, in polynomial time.
- Results The origin radius is infinite exactly when one periodic word has two canonical tilings with no common boundary.

Table 1 : The main results, each with its hypothesis, the cost of its procedure where it has one, and its statement, withmthe number of rules andsthe number that fire. Unless another parameter is named, a polynomial cost is in the size of the dictionary written out.
Original paper · CC BY 4.0 · Nicklas Nidhögg · The Left Ripple of Byte-Pair Encoding: Certified Lookbehind for Every Dictionary · Original paper figure · Extracted the figure area from page 4 of the original PDF.Where the prepend question stalls
A byte-pair tokenizer runs a list of merge rules in priority order, so the result on a string can depend on the whole string. That makes incremental use hard, because reusing old tokens and recomputing them both depend on how far a local change travels. Appending was already understood: Berglund and van der Merwe bounded the effect of an appended string by |D| tokens.
Prepending was not. Their example of a left-side change had infinite propagation.
Their closing questions were twofold: which dictionaries produce an endless left ripple, and is there a cheap test for them? When the ripple is finite, can the lookbehind be computed efficiently? Their random tests suggested the ripple is often finite, but they left the definition of the lookbehind open.
Two ways to measure a left change
The lookbehind can be measured in two ways, and the paper defines both as separate quantities. That furthest position is also the furthest one whose token origin moves, and the ripple is zero when no span changes. The supremum of that count is the origin radius, and the label distance is the edit distance between the two token sequences.
The two measures answer different questions, because they track different parts of the tokenization. The origin ripple sizes the region that an implementation maintaining spans may need to revisit. The label distance is the change that a consumer of the token stream actually sees. A bounded origin ripple bounds the label distance, as Proposition 1 states, but the converse fails.
The one-rule dictionary (a, a) has bounded labels and unbounded origins, so the two definitions are not equivalent.
The paper's Proposition 1 says the label distance is at most one above the origin ripple, which ties the two measures together. The mirror of the source paper's Definition 6 lies at most M minus 1 below the origin ripple and never above it. Here M is the longest token, as stated in Proposition 3.
Which dictionaries blow up
Such a rule makes any dictionary infinite, so the blow-up is decided by the rules alone. The ordering condition is clause (b) of the revised Definition 5 of the earlier work, and the authors read the condition off that clause. The authors use a six-rule dictionary with clause (a) alone to show the ordering condition can't be dropped.
The test reads off the rules rather than off tokenized strings, which is the kind of property the earlier paper asked for. A dictionary's origin radius is decided for every dictionary, so the answer doesn't depend on sampled inputs. The earlier paper's random testing suggested the ripple is often finite, and the paper treats that impression as unconfirmed.
That table carries 244 effective self-pairs, and the first one sits at merge 41, counted from zero. So the origin radius is infinite from the forty-second merge on, a dictionary-level fact rather than a sampled one.
The census of 484 small dictionaries shows the same pattern on the smallest cases. The origin radius is infinite on 370 of those 484 census dictionaries. The authors make no claim about a distribution on dictionaries from that census.
Computing the radius with an overlap graph
The origin radius is decidable for every dictionary and computed exactly, with executable certificates, in polynomial time in the dictionary written out. The method starts from a spelling automaton whose states are a start state and pairs (t, j) with t in V and 1 to |t|. A pair (t, j) records that j symbols of a guessed final token have been read, so the automaton branches on every guess.
Its accepting runs on an input are exactly the canonical tokenizations of that input, so each input has one accepting run. Runs that guess wrongly still branch and die, which is why the automaton is a guessing device rather than a tokenizer.
From the start state, reading t[0] enters (t, 1), and from (t, |t|) a transition for each (t, v) in E enters (v, 1). The overlap graph runs two copies of this automaton on the same symbols, so one copy can be ahead of the other. For a prepended symbol a, the sources are the start-state pairs (t, 1) with t[0] equal to a, because the second copy has already read a.
A pair is jointly final when both of its components are final.
Theorem 3 uses this graph to decide the origin radius for every dictionary, in polynomial time. It returns radius certificates in both directions, so a claimed radius comes with a witness and a matching bound.
The automaton rests on canonical adjacency, which says a list of tokens tokenizes its concatenation exactly when the list is canonical. Every token and every adjacent pair must be canonical, meaning in V and in E, for the list to be the tokenization. The authors note this matches the bigram characterization of Vieira et al., and their proof makes the projection lemma explicit.
Neither clause of the revised Definition 5 nor the ordering condition is used in that proof.
Emitting tokens as they become final
A streaming tokenizer must decide, after each input symbol, which tokens are already settled, and this paper gives a polynomial method for that decision. Berglund et al. had proved the zero-delay property for proper dictionaries under one pass per rule, using the tokenizer of their Algorithm 1. The paper extends that result to every dictionary, so a dictionary no longer needs to be proper for the streaming guarantee to hold.
The delay bound behind it is Q(D) trailing symbols, which an appended string can change at most.
A token is settled when no continuation of the input changes it, and the settled tokens form a common prefix over finitely many continuations. A streaming tokenizer that outputs exactly these settled tokens after every symbol runs in polynomial time, by Theorems 5 and 6. A tokenizer that looks up a whole piece in its vocabulary before merging can emit the same way, by Corollary 11.
This answers the question that Dalirrooyfard and Ye left open, whether byte-pair encoding alone admits zero delay.
Emitting that common prefix from a compiled subsequential transducer was already classical, citing Berglund et al.'s approach to such transducers. The new part is the polynomial procedure that computes the prefix directly from the dictionary, instead of compiling a transducer first. The paper's streaming result therefore rests on the subsequentiality of the tokenization, which Corollary 5 states for every dictionary.
Chain search and the GPT-2 merge table
Under the ordering condition, the changed suffix of an appended symbol is built from a chain of rules, each moving a frontier. The frontier moves at a stage only when the pass of a rule merges an occurrence crossing it, and that rule is then useful. A graph on the rules prunes the search, with the heaviest paths bounding the search results from above.
On GPT-2's whole merge table of 50,000 rules, the right span radius is 129 symbols. The sum of the left operands gives a bound of 167,515 for the same table, so the chain search gives a far smaller delay. The pruned chain search computes both right radii in about a second, with the start radius at 118. The search visits 71 states and prunes 17,442 of them.
The lookahead constant on this table is 119, one above the start radius of 118.

Table 6 : The right radii of GPT-2’s merge prefixes by the pruned chain search, with the lookahead boundQ(D), the rule graph’s bounds and the states the search visits; the append product agrees to 400 merges and the plain search to 1,600.
Original paper · CC BY 4.0The authors replay the attaining strings through the tokenizer from the definition, so these values are lower bounds. The product search agrees with the pruned search up to 400 merges and the plain search up to 1,600. At 200 merges the rule-graph bound C start of 6 exceeds the start radius of 5, and the search still returns 5. The product search exhausts 12 GB of address space at 800 merges.
Bounding label changes from an edit
The label distance is the edit distance between the two token sequences that an edit produces, which is the change a consumer of the token stream sees. Boundedness of the label measure is decided for every dictionary in polynomial time. A bound under every prepended symbol also gives a bound under every edit, by Corollary 10.
Under the ordering condition, one symbol edit moves the tokenization by at most the Fibonacci number F of 2|D|+2 tokens. Table 1 states the same result as one edit moving at most F 2m+2 and (m+1)(m+2)/2 tokens, under the ordering condition. For ordered dictionaries of m rules, the largest label distance one edit causes is Θ(m²). It lies at least ⌊(m² + 11m + 20)/10⌋ and at most (m+1)(m+2)/2 for m at least 1.
Stated asymptotically, the largest distance lies between m² over 10 and m² over 2.
The edit product has states that pair a side flag with a state of each copy of the spelling automaton. Insertions, deletions and substitutions move the two copies differently, and side one reads the same symbol again. Any path of the edit graph from a diagonal source to an exit gives the distance of the two tokenizations.
When the boundedness test succeeds, the supremum is computed by profiles, and the authors iterate a cap k until the maximum stabilizes. Profiles grow exponentially in the value and the longest token, so the value isn't computed in polynomial time. The decision itself stays polynomial, while only the exact value pays this cost.
Census and production tables
The census asks how common infinite reach is among small dictionaries, and the production tables are checked against the same question. The authors make no claim about a distribution on dictionaries from the census, so it doesn't say how common infinite reach is in practice. The census counts infinite reach on the smallest dictionaries, which is why its count stays limited to them.
On the first 100 merges, the overlap graph under a space is infinite for 6 of 39 symbols of cl100k base and 3 of 48 for o200k base. At most 5 and 5 symbols stay under the rest of those two tables, so the count is not uniform across tables. The right radii of GPT-2's whole table are computed by the chain search, and the prefixes are listed in Table 6.
The executions cover 2,490 dictionaries, and 373 of them have a product the tokenization splits. The streaming tokenizer emits the stable prefix after every symbol of 1,492 inputs and flushes each one.
Where the checks and proofs stop short
The limitations section names where the executed checks and the proofs stop short of the full claim. The census of 484 dictionaries gives infinite origin radius on 370 of them, but it makes no claim about a distribution on dictionaries. The census counts infinite reach on the smallest dictionaries, so the count doesn't say how common infinite reach is in practice.
Past that horizon, only the proof carries the lemma, and no execution checks it.
The lookahead bound Q(D) is attained by the doubling dictionary, and it lies far above the values measured on the tables.
Paper info
- Authors
- Nicklas Nidhögg
- Venue
- arXiv · Preprint
- First published
- 2026-11-9
- Added
- 2026-11-11
- Updated
- 2026-11-9
- Version
- v1
- arXiv
- 2611.13061
- Category
- cs.FL · cs.CL · cs.DS · cs.PL
- Original paper terms
- CC BY 4.0
- What we show
- Paper info, commentary and permitted figures from the original paper
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Abstract
Berglund and van der Merwe formalized byte-pair encoding and bounded how far an appended string can change a tokenization, leaving the converse open: how far can a string prepended on the left change it, which dictionaries make that ripple infinite, and can it be computed efficiently when finite? We answer all three for every dictionary. The origin radius, how far a prepend can change covering spans, is decided with radius certificates by a product of two runs of the automaton that guesses the final tokens, in time polynomial in the dictionary written out, and it is infinite exactly when one periodic word has two canonical tilings with no common boundary. Under their ordering condition it is infinite exactly when some rule (t, t) finds its two copies adjacent at its own stage, and such a rule makes any dictionary infinite. A finite radius makes every window of a width read off the radii have a cut, and the radius is finite exactly when such cuts are dense. The token machine completes for every dictionary, and the tokenization is subsequential, extending what Berglund, Martens and van der Merwe proved for proper ones under one pass per rule. A streaming tokenizer emits after every symbol exactly the tokens that no continuation changes, in polynomial time, answering a question of Dalirrooyfard and Ye. Boundedness of the label measure, the edit distance of the token sequences, is decided for every dictionary in polynomial time as well, and under the ordering condition the largest distance one edit causes over dictionaries of m rules lies asymptotically between m^2/10 and m^2/2. GPT-2's merge table carries 244 effective self-pairs, so its origin radius is infinite from the forty-second merge on, and that of cl100k, o200k and Llama 3 from their first. Every measured number is its program's output, and what is not executed is named.
Quote from the paper
Nicklas Nidhögg (2026). The Left Ripple of Byte-Pair Encoding: Certified Lookbehind for Every Dictionary. arXiv:2611.13061v1. https://arxiv.org/abs/2611.13061v1
BibTeX
@misc{nidhgg2026left,
title = {{The Left Ripple of Byte-Pair Encoding: Certified Lookbehind for Every Dictionary}},
author = {Nicklas Nidhögg},
year = {2026},
eprint = {2611.13061},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2611.13061v1}
}