BPE Stays on SCRIPT: Structured Encoding for Robust Multilingual Pretokenization

Sander Land, Catherine Arnett
5/30/2025
cs.CL

No official code found. Best implementation: sanderland/script_tok (21 stars, Apache-2.0, last commit 2026-03-04).

Abstract

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.

View on arXivView PDF

Code Implementations(1)

Apache-2.0

Code for the paper "BPE stays on SCRIPT"

214Shell, PythonMay 30, 20257 months agoApache-2.0
aibpelarge-language-modelstokenizationtokenizer

Similar Papers

Cite this paper

@article{land2025stays,
  title  = {BPE Stays on SCRIPT: Structured Encoding for Robust Multilingual Pretokenization},
  author = {Sander Land and Catherine Arnett},
  year   = {2025},
  eprint = {2505.24689},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2505.24689v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2505.24689.svg)](https://codeofpaper.com/paper/2505.24689)

Discussion