Papers › BPE Stays on SCRIPT: Structured Encoding for Robust Multilingual Pretokenization

BPE Stays on SCRIPT: Structured Encoding for Robust Multilingual Pretokenization

30 May 2025arXiv:2505.24689archive 2025-07-28

Sander Land, Catherine Arnett

Byte Pair Encoding (BPE) tokenizers, widely used in Large Language Models, face challenges in multilingual settings, including penalization of non-Western scripts and the creation of tokens with partial UTF-8 sequences. Pretokenization, often reliant on complex regular expressions, can also introduce fragility and unexpected edge cases. We propose SCRIPT (Script Category Representation in PreTokenization), a novel encoding scheme that bypasses UTF-8 byte conversion by using initial tokens based on Unicode script and category properties. This approach enables a simple, rule-based pretokenization strategy that respects script boundaries, offering a robust alternative to pretokenization strategies based on regular expressions. We also introduce and validate a constrained BPE merging strategy that enforces character integrity, applicable to both SCRIPT-BPE and byte-based BPE. Our experiments demonstrate that SCRIPT-BPE achieves competitive compression while eliminating encoding-based penalties for non-Latin-script languages.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2505.24689")

Code

Syntology Ran 12 of 13 code samples harvested from 1 repository linked to this paper; 1 has no recorded run. Of those that ran: 12 ran with no contract checked.

By repository: official repository: 13 samples from 1 repository, 12 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

sanderland/script_bpe officialmentioned in papermentioned on GitHubApache-2.0 report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

13 samples harvested; 12 ran; 0 honoured the contract we drafted; 1 has no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

12ran
1unverified

Licence: 0 of the 13 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from sanderland/script_bpe. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

char_name sanderland/script_bpe/script_bpe/pretokenize/scriptencoding.py official repository ran fingerprinted Apache-2.0 (permissive) · e87d24f9415e5231 · report
flatten_model_metadata sanderland/script_bpe/script_bpe/analysis/experiments.py official repository ran Apache-2.0 (permissive) · 596259fa949215c0 · report
format_latex_value sanderland/script_bpe/script_bpe/analysis/formatting.py official repository ran Apache-2.0 (permissive) · bd0a8fb03ae8a736 · report
format_results sanderland/script_bpe/paper_utils/script_bpe/monolingual_compression.py official repository ran Apache-2.0 (permissive) · 7a5f392192c6a1f1 · report
format_tokens_millions sanderland/script_bpe/script_bpe/analysis/formatting.py official repository ran Apache-2.0 (permissive) · bb57f9ebf56c9d71 · report
format_with_relchange sanderland/script_bpe/script_bpe/analysis/formatting.py official repository ran Apache-2.0 (permissive) · e73bf9272554cac3 · report
get_config_hash sanderland/script_bpe/script_bpe/analysis/experiments.py official repository ran Apache-2.0 (permissive) · 75ffe04bfd9ceece · report
join_workers sanderland/script_bpe/script_bpe/utils.py official repository ran Apache-2.0 (permissive) · 3654bb76cf003e14 · report
normalize_whitespace sanderland/script_bpe/script_bpe/corpus/registry.py official repository ran fingerprinted Apache-2.0 (permissive) · 0d64647d6f44ca2c · report
select_drop_batch sanderland/script_bpe/script_bpe/tokenizers/_mi_prune.py official repository ran Apache-2.0 (permissive) · c60aff84445cbfba · report
shutdown_pool sanderland/script_bpe/script_bpe/utils.py official repository ran Apache-2.0 (permissive) · 59a3a3ed2eef89cb · report
token_array sanderland/script_bpe/script_bpe/utils.py official repository ran Apache-2.0 (permissive) · 2b40f6e6aaa2fd22 · report
compute_mi_table sanderland/script_bpe/script_bpe/tokenizers/_mi_prune.py official repository unverified Apache-2.0 (permissive) · b946980d96fb85ed · report

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

BPE

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections