Source-linked AI summary

Certified Splitting: Decidability and Anchor Supply for Maximal-Munch Tokenization

Nicklas Nidhögg

arXiv:2610.08854v1cs.FLcs.DCcs.PL

TL;DR

A token that is itself valid may still occur inside a longer maximal-munch token, so recognizing universally safe starting positions matters for sound work division. This paper decides certificate windows and inventories, then derives splitting and other consequences from certified anchors. It reports the resulting guarantees and measurements within their stated scopes.

  • Problem

    A token’s occurrence does not by itself make a safe cut: in T = {ab, b}, b occurs inside the token ab, while certificates require agreement across all completely tokenizable contexts.

    Source: §1 · p. 1
  • Method

    The paper decides proposed certificates and exact inventories through a declared window budget, using enumeration and a product search for certification decisions.

    Source: §1 · p. 2, §3 · p. 6
  • Results

    Certified anchors support splitting and other applications as theorems, and the UTF-8 shape has a computed synchronization distance of three bytes.

    Source: §3 · p. 10, §9 · p. 27
  • Takeaways & Limitations

    Certificate inventories and gap bounds can provide design-time synchronization guarantees for token sets, including grammars with designed delimiters or bounded tokens.

    Source: §3 · p. 10

    The paired anchor-set comparison cannot identify its suggested mechanism because the vocabularies differ in provenance, merge depth, training corpus, and construction.

    Source: §6 · p. 16

Abstract

from arXiv · show

A certificate is a window of bytes with an origin inside it: wherever the window occurs in a completely tokenizable input, the token covering the window's final byte begins at that origin. Decided from the token set alone, a certified position marks where work may soundly begin. This paper decides certification and reads its anchors forward, into cuts, edits and audits. Certification is decided two ways: online with a completeness cutoff for literal vocabularies, and offline through an armed-run verifier for arbitrary regular token sets. Either route, under a declared window budget, yields the anchor inventory, with a witness on each refusal. The consequences are theorems. Cutting an input at certified anchors and scanning the chunks independently reproduces the sequential segmentation, with no speculation and no fixup pass. A byte substitution that keeps the input tokenizable moves boundaries only strictly between the certified anchors witnessed in the unchanged bytes on either side of it. For tokens of length at most L, an edit at p moves no boundary at or below p - L + 1. A delimiter permits a sound cut before it exactly when it sits only token-initial, and one after it exactly when only token-final, so the embedded-delimiter failure is refused. Two instruments follow: the anchor-free span of a finite certified inventory, decided bounded or not with its exact supremum, three for the UTF-8 shape; and a differential auditor deciding whether two token sets place different boundaries on an input both tokenize, with witnesses. Every theorem carries an executable check. Every measurement is a named program's output or arithmetic on such outputs, each program shipped with the paper or pinned by commit in the library it studies; that library's threaded scanner splits the archived campaign corpus at certified anchors, its boundary stream byte-identical throughout.

1 Introduction

The paper turns a context-wide certificate into a decision procedure and uses it to ask where maximal-munch work can safely begin. It adds exact inventories and measured anchor supply, while keeping universal proofs distinct from results about named material.

1 Introduction

  • Over T = {ab, b}, cutting at b splits ab inside its committed token, while a is certified because it occurs only at token offset zero.The example shows why sound cuts require a theorem over all completely tokenizable inputs, not tests where b stands alone.Source: §1 · pp. 1–2
  • The paper decides each proposed certificate and exact inventory through a declared budget, then answers recognition, cost, and anchor-supply questions for maximal-munch scanning.Its applications turn the certificate into consequences for safe work division and other uses.Source: §1 · p. 2
  • Theorems do not require anchor density, but supply and edit measurements describe named material under named policies, budgets, and seeds.The subword vocabularies are BPE-derived token sets read under maximal munch, not ranked merge procedures.Source: §1 · p. 2
  • Earlier work introduced single-byte certificates [27] and bounded-window certificates [28], while this paper adds arbitrary-regular-set decisions, inventories, span analysis, auditing, and measurements.The earlier window work did not decide arbitrary windows or provide an inventory or price.Source: §1 · p. 2

2 Setting

The setting fixes maximal-munch scanning over byte strings and defines certificates as occurrence-wise guarantees about token starts. Two scan properties, memorylessness and confinement of matches, support the later reasoning.

2 Setting

  • A literal token set is a finite nonempty collection of nonempty byte strings; maximal munch commits the longest matching prefix, failing when none matches.For regular token sets, equal-length matches are resolved by list priority; a literal set is the singleton-language case.Source: §2 · p. 4
  • From any boundary of a completely tokenizable input, scanning the suffix as a new input commits exactly the tokens committed from there onward.The scan has no state beyond its current position, so its choices depend only on the remaining suffix.Source: §2 · p. 4
  • A token committed at an earlier boundary ends at or before any later boundary, because committed tokens partition the input.This confines matches relative to boundaries used in subsequent arguments.Source: §2 · p. 4
  • A certificate requires that, at every occurrence of its window in every completely tokenizable input, the token covering the final byte begins at the specified origin.This guarantee is sufficient for a sound cut but stronger than merely having a boundary at the origin; the witnessing occurrence is part of an anchor.Source: §2 · p. 4

3 Deciding certification

Certification is decidable for literal vocabularies by a completeness cutoff and for arbitrary regular token sets by a finite-state verifier. The resulting tools decide inventories and anchor-free spans, including whether a span is unbounded.

Online certification

  • A violating window of length h exists for a literal token set with maximum token length L iff one exists on an input of length at most N = h+2L−2.The cutoff is attained: for T = {aab} and W = ba, the shortest violating input is aabaab, of length six.Source: §3 · pp. 5–6

Online limitation

  • The online scan cannot always emit boundaries irrevocably: for T = {a+b, a}, no fixed lookahead settles whether the first token ends after a or b.Certification still decides in this case by verifying completed segmentations rather than computing them.Source: §3 · p. 6

Offline certification

  • For arbitrary regular token sets, a finite armed-run automaton accepts exactly the boundary markings produced by greedy scans, making window certification decidable.The automaton tracks token runs from each marked position; an armed accept later than the segment end witnesses a longer match.Source: §3 · pp. 6–7

Anchor inventories

  • A declared window budget H yields a computable inventory of certified pairs for regular token sets, without string enumeration or a cutoff.The construction tests each pair by a union-emptiness problem over the armed-run product.Source: §3 · p. 7

Unrestricted width

  • Unrestricted-width certification is decidable via effectively regular languages, but existence is meaningful chiefly for windows occurring in tokenizable inputs because nonoccurring windows certify vacuously.The unrestricted language is closed under left extension; that closure need not preserve whether a window occurs.Source: §3 · pp. 7–8

Anchor-free span

  • For a finite certified inventory, boundedness and the exact supremum of anchor-free stretches are decidable; an unanchored-exit cycle characterizes unboundedness.The UTF-8 shape has computed synchronization distance three, while the miniature C-like grammar has no bound because identifiers can be arbitrarily long.Source: §3 · pp. 8–10

4 Splitting theorems

Certified anchors make cuts exact, while edit damage is confined by unchanged certified anchors and, under a token-length bound, by a stricter lower edge. Delimiter cuts are sound precisely under token-initial or token-final conditions.

Certified cuts

  • Scanning chunks between certified anchors and concatenating their segmentations reproduces the sequential scan exactly.The anchors are established from the token set before the input exists, so the cut guarantee applies to every completely tokenizable input.Source: §4 · p. 11

Regular token sets

  • The cut-at-boundaries result extends to regular token sets because both scans choose the same longest available token, resolving equal-length ties by the same priority.The proof relies on the scan’s fixed preference optimum, not merely on its dependence on the remaining suffix and partitioning into committed tokens.Source: §4 · p. 11

Edit damage

  • After a tokenizable single-byte substitution, every changed boundary lies strictly between certified anchors witnessed in unchanged bytes on either side.If all token words have length at most L, no boundary at or below p − L + 1 can change for an edit at p.Source: §4 · pp. 11–12

Delimiter splitting

  • Splitting before each delimiter occurrence is sound iff the delimiter appears only token-initial, and splitting after it is sound iff it appears only token-final.A delimiter embedded at a noninitial or nonfinal token position yields a single-token input on which the corresponding split fails to preserve segmentation.Source: §4 · p. 12

5 The differential auditor

The auditor decides whether regular token sets disagree on boundaries of inputs both tokenize or on which inputs tokenize, and computes a witness when either differential exists. Its security use is limited to these lexical comparisons; it does not compare token identities when boundaries coincide.

5 The differential auditor

  • Theorem 7 decides boundary disagreement on jointly tokenizable inputs and domain difference, computing a witness input whenever either exists.The domain differential is an input tokenized by exactly one set.Source: §5 · p. 13
  • For boundary disagreement, a product of armed-run verifiers tracks both true boundary sets and accepts when a flag records a position marked by only one side.Armed pruning rejects guesses outside each set’s greedy segmentation.Source: §5 · p. 13
  • For domain difference, determinized byte projections track surviving marking configurations, allowing the search to test non-membership on either side.The subset construction is needed because a nondeterministic product cannot establish that one side rejects.Source: §5 · p. 13
  • The auditor checks lexical boundary and tokenization-domain differences, but not token identity when boundaries coincide or priority ties.These predicates address lexer disagreements relevant to request smuggling, polyglot inputs, and log mangling.Source: §5 · p. 13
  • The campaign’s conventional and split-friendly grammars differ on SN: the conventional row has boundary set {0}, while the split-friendly row has {0, 1}.The conventional grammar against itself is proved differential-free over every input, not merely a corpus.Source: §5 · p. 13
  • Table 2 reports searched space, not running time; the two differential decisions are the only constructions here using a subset construction.Its entries are reachability questions over construction-specific state spaces.Source: §5 · pp. 13–14, Table 2 · p. 14

6 Measurements

Measurements apply the certification and edit results to byte-pair vocabularies and lexer grammars, with supply depending on the inventory and material. The reported outcomes include held-out transfer, edit damage, and grammar-specific anchor availability, alongside explicit scope limits.

  • Across evaluation blocks, trained-vocabulary supply ranged from 131 to 448 anchors per block (median 242), while external supply ranged from 537 to 756 (median 688).The ranges do not overlap, though each varies enough that a slice-wide aggregate hides block-level spread.Source: §6 · p. 16
  • Through H = 4, supply rose to 242.1 anchors per kibibyte for the trained vocabulary and 651.2 for the external vocabulary, without flattening at the budget.Width four added more anchors for the external vocabulary than width three; supply beyond H = 4 was not estimated.Source: §6 · pp. 16–17
  • The frozen inventory retained 209.4 of 242.1 anchors per kibibyte for the trained vocabulary and 608.6 of 651.2 for the external vocabulary.These held-out values are 86.5% and 93.5% of their respective ceilings on one adjacent-slice transfer, not guarantees.Source: §6 · p. 17
  • The sixty sampled n-gram candidates yielded 57.8 anchors per kibibyte for the trained vocabulary versus its exhaustive 242.1, and 427.4 versus 651.2 for the external vocabulary.The trained vocabulary’s sampled total was nearly all supplied by certified bytes; the external vocabulary’s sampled pairs overlapped heavily with its certified-byte positions.Source: §6 · pp. 17–18
  • Across 200 paired substitutions, the trained-minus-external hull difference had median 3 bytes and ninetieth percentile 13; it was positive in 144 trials, zero in 38, and negative in 18.The reported damage bounds depend on the declared H ≤ 4 inventory; its slack is an upper bound on global slack.Source: §6 · p. 18
  • Edit slack is reported as both hull slack and unoccupied admissible positions; these inventory-relative measures can differ because one subtracts hull width and the other moved-boundary count.The comparison is made for both the evaluation-tailored ceiling inventory and the frozen hybrid inventory.Source: §6 · pp. 18–19, Table 6 · p. 19
  • Synchronization distance is unbounded for both subword vocabularies, newline is not a sound split delimiter for either, and the 48-merge and 384-merge vocabularies disagreed on all 64 held-out slices.Each disagreement was exhibited by the two scans of that slice.Source: §6 · pp. 19–20
  • All four campaign grammars had unbounded anchor-free spans, while certified-anchor cuts reproduced archived scans; supply ranged from 6.7 anchors per kibibyte for block comments to 324.4 for bare tokens.The conventional and split-friendly grammars used the same corpus: making newline its own token raised supply from 25.7 to 41.0 anchors per kibibyte. Of 156 certified pairs, 39 were vacuous and anchored no corpus positions; campaign edits moved boundaries only between flanking shared-context anchors, with median hull one byte and maximum two.Source: §6 · pp. 20–21

7 The artifact: the theorem as a scanner

The artifact cuts a corpus at certified anchors, scans chunks in parallel, and checks that their joined boundary stream matches sequential scanning. The measured timings are illustrative; boundary equality is the theorem-backed guarantee.

7 The artifact: the theorem as a scanner

  • The probe derives anchors from the campaign grammar before input exists, scans chunks in parallel, joins them, and asserts equality with the sequential boundary stream.Its inventory is pinned by repository, commit, and source digest.Source: §7 · p. 21
  • The chunked boundary stream is byte-identical in every tested configuration on both the half-mebibyte corpus and its sixteen-copy scaling case.The larger case repeats the same corpus, so it tests scale rather than input variety.Source: §7 · p. 22
  • On the recorded machine, scanning the 8,388,608-byte input took 35.06 milliseconds sequentially and 5.70 milliseconds with 32 workers, a 6.16 speedup.Timings include thread creation and joining but exclude anchor discovery, cut selection, and output concatenation; they are best-of-five measurements on one machine.Source: §7 · p. 22
  • The snap distances depend on the input, inventory, and worker grid, while the timings are machine-dependent and do not form part of the theorem’s guarantee.The equality of boundary streams is the stable fact the theorem promises.Source: §7 · p. 22

8 Related work

The paper distinguishes certification from neighboring ideas in code synchronization, scanner construction, and local or parallel partitioning. Its contribution is deciding safe origins for prioritized maximal-munch token languages and connecting those decisions to concrete scanning, editing, and gap questions.

Code synchronization and resolving blocks

  • Beyond the code-factorization special case, the paper reports finding no prior work deciding whether every occurrence of a window fixes the covering token’s origin for prioritized maximal-munch languages.In the code case, certification additionally requires the origin to be a factorization boundary at every occurrence and the window tail to be a codeword prefix.Source: §8 · pp. 22–23

Longest match as a finite-state relation

  • The armed-run construction decides properties of maximal-munch segmentations rather than merely relying on a scanner’s existence or its runtime algorithm.It validates proposed boundary marks and supports certificate testing; the related transducer work establishes a regular output range, while the existence of an offline verifier is an inference from that work.Source: §8 · p. 23

Equivalence of transducers, and what it decides

  • The differential decision separates domain equivalence from boundary equality and returns witnesses, using armed runs to compare the policies’ correctly marked scans.This differs from the symbolic-transducer equivalence framework, whose described decision is nonconstructive and whose counterexample generation is separate.Source: §8 · pp. 23–24

Incremental and checkpointed lexing

  • Certificate-based edit bounds need no cached scanner state, unlike incremental lexing, but apply only where the token set supplies an anchor.The next certified anchor witnessed in unchanged suffix bytes is a boundary in both versions; hopper uses this approach for range edits and may relex the whole input if no anchor is found.Source: §8 · p. 24

Cutting at a boundary, and deciding where one is

  • Certificates provide a token-set-derived sufficient cut condition, stronger than a boundary at the origin and distinct from checks made at known joins.The paper does not decide the weaker predicate that an origin is a boundary at every occurrence without requiring the final-byte-covering token to start there.Source: §8 · pp. 24–25

Parallel scanning

  • Certified-anchor parallel scanning avoids entry-state enumeration and reconciliation, unlike several exact or speculative alternatives, but can cut only where the grammar permits.Anchor supply determines where this approach is available; the cited approaches include transition enumeration, speculation, partition-and-restart scanning, and XML preparsing.Source: §8 · p. 25

The neighbouring quantity; Self-synchronization

  • A bounded scanner confirmation distance does not guarantee certified origins: for T = {aa}, the inventory is empty and the anchor-free span is unbounded.The paper also reports three as the computed anchor-free span for the UTF-8 token-set shape, while noting that the distance itself is already known.Source: §8 · pp. 25–26

Expected density under coverage, worst-case gaps without it

  • Unlike coverage-based local chunking and expected-density analyses, the paper measures certified-anchor gaps and supply without assuming every window contains a selected position.The paper connects bounded anchor-free span to unavoidable sets [34] and universal hitting sets [29], while restoring tokenization semantics to the question.Source: §8 · p. 26

9 Conclusion

The paper defines certification through a universal-context guarantee and turns it into decisions, applications, and executable checks. Its measurements describe named material rather than promising anchor density for every grammar.

9 Conclusion

  • A certificate is a window and origin such that every occurrence in every completely tokenizable input has its final-byte-covering token begin at that origin.Every certified position is a boundary, but not every boundary is certified.Source: §9 · p. 27
  • Certification is decided at inventory scale with witnesses, and its consequences include splitting, editing, delimiting, and anchor-free-span results checked by programs.The artifact cuts at precomputed anchors without speculation or reconciliation and asserts boundary-stream equality on every run.Source: §9 · p. 27
  • The theory concerns greedy maximal-munch scans of literal and regular token sets, while campaign grammars enter through class abstractions checked against byte-level scans.Density remains a measured corpus fact rather than a grammar-wide guarantee.Source: §9 · p. 27

A Reproduction and provenance

The reproduction gate regenerates and checks the paper’s emissions, with specified external inputs, digests, and optional stages. A pinned library probe independently checks many decisions and measurements against the paper’s explorations.

A Reproduction and provenance

  • The check-paper script regenerates every quoted in-bundle emission and compares it byte for byte, rebuilding scanner statistics when the pinned build is supplied.It also rebuilds the manuscript and checks named measurements against their producing emissions.Source: A Reproduction and provenance · p. 27
  • The gate refuses to skip absent inputs: GPT-2 reference files are checked against published digests, and the verify-all script fetches and verifies twitter.json.Campaign corpora ship with the bundle, allowing campaign emissions to rerun without network access.Source: A Reproduction and provenance · p. 28
  • The scanner runner pins the munch repository commit and probe-source digests, binding the measurements to that checkout rather than an arbitrary local version.The scanner probe links the library and includes its grammar header, so a source digest alone would not identify everything executed.Source: A Reproduction and provenance · p. 28
  • The library tests compare three decisions and a supply measurement with the exploration programs, while its recomputation probe reproduces emissions from library decisions.Across eleven emissions, 228 lines match byte for byte; seven agree up to omitted remainder fields and two use different names for the same decision, with none differing.Source: A Reproduction and provenance · pp. 28–29
  • Two scope differences remain: the library’s conservative window model can undercount certified windows, and its campaign density verdict corroborates rather than establishes the emission’s result.The probe’s anchor-free-span check covers byte expansions admitted by the conservative model, a subset of the exact class-window inventory.Source: A Reproduction and provenance · p. 29
Loading 2610.08854v1…