Papers › Zero-Shot Tokenizer Transfer

Zero-Shot Tokenizer Transfer

13 May 2024arXiv:2405.07883archive 2025-07-28

Benjamin Minixhofer, Edoardo Maria Ponti, Ivan Vulić

Language models (LMs) are bound to their tokenizer, which maps raw text to a sequence of vocabulary items (tokens). This restricts their flexibility: for example, LMs trained primarily on English may still perform well in other natural and programming languages, but have vastly decreased efficiency due to their English-centric tokenizer. To mitigate this, we should be able to swap the original LM tokenizer with an arbitrary one, on the fly, without degrading performance. Hence, in this work we define a new problem: Zero-Shot Tokenizer Transfer (ZeTT). The challenge at the core of ZeTT is finding embeddings for the tokens in the vocabulary of the new tokenizer. Since prior heuristics for initializing embeddings often perform at chance level in a ZeTT setting, we propose a new solution: we train a hypernetwork taking a tokenizer as input and predicting the corresponding embeddings. We empirically demonstrate that the hypernetwork generalizes to new tokenizers both with encoder (e.g., XLM-R) and decoder LLMs (e.g., Mistral-7B). Our method comes close to the original models' performance in cross-lingual and coding tasks while markedly reducing the length of the tokenized sequence. We also find that the remaining gap can be quickly closed by continued training on less than 1B tokens. Finally, we show that a ZeTT hypernetwork trained for a base (L)LM can also be applied to fine-tuned variants without extra training. Overall, our results make substantial strides toward detaching LMs from their tokenizer.

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="2405.07883")

Code

Syntology Ran 7 of 12 code samples harvested from 2 repositories linked to this paper; 5 have no recorded run. Of those that ran: 2 ran · honoured contract; 3 ran · our draft was wrong; 2 ran with no contract checked.

By repository: official repository: 4 samples from 1 repository, 2 ran; community (archive-listed): 8 samples from 1 repository, 5 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

bminixhofer/zett officialmentioned in papermentioned on GitHubjax report
bminixhofer/alm mentioned on GitHubjax 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

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

2ran · honoured contract
3ran · our draft was wrong
2ran
5unverified

Licence: 4 of the 12 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 2 repositories linked to this paper, official or community; each sample names its own and says which. “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.

cosine_similarity bminixhofer/zett/zett/utils.py official repository ran fingerprinted no licence file found · pointer only · 2b0a0e9fa563dfe2 · report
huber_loss bminixhofer/zett/zett/utils.py official repository ran no licence file found · pointer only · 5e0f65316506050d · report
is_byte_level bminixhofer/zett/zett/tokenizer_converters.py official repository unverified no licence file found · pointer only · 19bd359bd36dab7f · report
softmax bminixhofer/zett/zett/utils.py official repository unverified no licence file found · pointer only · adb54f0d1ae9c13b · report
_count_leading_whitespace bminixhofer/alm/tokenkit/align.py community (archive-listed) ran · honoured contract Apache-2.0 (permissive) · df697d2b038fd81b · report
_get_increasing_offset_pairs bminixhofer/alm/tokenkit/align.py community (archive-listed) ran · our draft was wrong Apache-2.0 (permissive) · 322a59478cf137c9 · report
_get_left_count bminixhofer/alm/tokenkit/align.py community (archive-listed) ran · honoured contract Apache-2.0 (permissive) · 7599260f4b86d5cb · report
_make_left_count_match_or_be_zero bminixhofer/alm/tokenkit/align.py community (archive-listed) ran · our draft was wrong Apache-2.0 (permissive) · f88844e93e9833c0 · report
identity_byte_fn bminixhofer/alm/tokenkit/align.py community (archive-listed) ran · our draft was wrong Apache-2.0 (permissive) · 37423810abd3aed9 · report
BaseModelKind bminixhofer/alm/tokenkit/align.py community (archive-listed) unverified Apache-2.0 (permissive) · 9e3479886595acee · report
ByteifyTokenizer bminixhofer/alm/tokenkit/align.py community (archive-listed) unverified Apache-2.0 (permissive) · af0c3aef5a8da60c · report
get_alignment_indices bminixhofer/alm/tokenkit/align.py community (archive-listed) unverified Apache-2.0 (permissive) · f5449b81ca075977 · report

Tasks

XLM-R

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

BASEHyperNetwork

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