CoolFace
Modelpublic

cmeister/tokenizer-lm-ablations

sourceHugging Faceapache-2.0updated 1mo agoView on Hugging Face
1likes
Model Card

Tokenizer ablations: 220 language models trained from scratch

220 language models that share an architecture, a training corpus, a document order and a hyperparameter set, and differ in the tokenizer they were trained with. 94 tokenizers are involved, of which 90 are released here and 4 are off-the-shelf tokenizers cited rather than redistributed. Every model was trained for this study, not adapted from an existing checkpoint.

Acknowledgments: These analyses were part of the development for the Apertus 2.0 tokenizer, funded by the Swiss AI Initiative.

Training regimes

RegimeModelsDescription
std-1B9724 layers, width 1536, 1.27B parameters, 9.2B tokens, standard mixture
mathcode-20B-from-scratch6924 layers, width 1536, 1.27B parameters, 20.0B tokens, math and code mixture, trained from scratch
cross-scale-d16-300M1816 layers, width 1024, 0.60B parameters, 3.5B tokens, standard mixture, scale ladder
cross-scale-d121812 layers, width 768, 0.38B parameters, 3.5B tokens, standard mixture, scale ladder
cross-scale-d8188 layers, width 512, 0.22B parameters, 3.5B tokens, standard mixture, scale ladder

Loading a model

Each model lives in its own subfolder. The architecture is not one of the built-in transformers architectures, so loading needs trust_remote_code=True; the model class ships in each subfolder as nanochat_model.py.

python
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained(
    "cmeister/tokenizer-lm-ablations", subfolder="models/full-128k-allmulti-equal-bpe",
    trust_remote_code=True, dtype="float32")
tokenizer = AutoTokenizer.from_pretrained("cmeister/tokenizer-lm-ablations", subfolder="models/full-128k-allmulti-equal-bpe")

text = "def add(a, b):\n    return a + b\n"
ids = [0] + tokenizer(text)["input_ids"]   # training prepends BOS

Training prepended the beginning-of-sequence token to every document, and the released tokenizer files carry no post-processor that would do this on their own. Prepend the id yourself, as above, or the model receives input it never saw in training. Each model card states its own BOS id.

What varies, and what does not

Within a training regime, every model sees the same documents in the same order with the same optimizer settings. The tokenizer changes the token sequence those documents produce, so token counts, sequence packing and the effective amount of text per context window differ between models. That is the effect under study, not a confound to remove.

Ablation grid: the tokenizer axis

One row per tokenizer. pretokenizer names the regex constant in the training script; normalizer and vocab are read from the released tokenizer file itself. In the names, gpt4o, claude and gpt2 refer to a borrowed pretokenization regex, not to those vendors' tokenizers.

TokenizerAlgorithmPretokenizerNormalizerTraining dataVocabModelsLoads with
NousResearch/Meta-Llama-3-8B (cited only)n/an/an/an/an/a4transformers
allmulti-equal-bpebpeREGEX_GPT4Ononeallmulti_equal1282601transformers
apertus (cited only)n/an/an/an/an/a2transformers
bpe-nfc-clean-balancedBPEn/aNFCn/a1280042transformers
bpe-nfc-clean-balanced-v128kbpeREGEX_CLEANNFCbalanced1280041transformers
bpe-nfc-clean-balanced-v160kbpeREGEX_CLEANNFCbalanced1600041transformers
bpe-nfc-clean-balanced-v200kbpeREGEX_CLEANNFCbalanced2000041transformers
bpe-nfc-clean-balanced-v64kbpeREGEX_CLEANNFCbalanced640041transformers
bpe-nfc-clean-balanced-v96kbpeREGEX_CLEANNFCbalanced960041transformers
bpe-nfc-clean-fineweb2fullBPEn/aNFCn/a1280001transformers
bpe-nfc-clean-nomark-balancedbpeREGEXCLEANNOMARKNFCbalanced1280041transformers
bpe-nfc-gpt4-fineweb2fullBPEn/aNFCn/a1280001transformers
bpe-nfc-plus2-balancedbpeREGEXCLEANPLUS2NFCbalanced1282604transformers
bpe-nfc-plus3-balancedbpeREGEXCLEANPLUS3NFCbalanced1282602transformers
claude-allmulti-equal-bpebpeREGEX_CLAUDEnoneallmulti_equal1282601transformers
claude-balanced-bpebpeREGEX_CLAUDEnonebalanced1282608transformers
claude-balanced-nfc-bpebpeREGEX_CLAUDENFCbalanced1282606transformers
claude-balanced-unigramunigramREGEX_CLAUDEnonebalanced1282606transformers
claude-english-bpebpeREGEX_CLAUDEnoneenglish1282606transformers
clauderev-balanced-bpebpeREGEXCLAUDEREVSequencebalanced1282602transformers
gpt2-balanced-bpebpeByteLevelnonebalanced1282601transformers
gpt4o-allmulti-equal-nfc-bpebpeREGEX_GPT4ONFCallmulti_equal1282601transformers
gpt4o-allmulti-equal-norepeat-bpebpeREGEX_GPT4Ononeallmultiequalnorepeat1282601transformers
gpt4o-balanced-bpebpeREGEX_GPT4Ononebalanced1282608transformers
gpt4o-balanced-maxfiles50-bpebpeREGEX_GPT4Ononebalanced_maxfiles501282601transformers
gpt4o-balanced-nfc-bpebpeREGEX_GPT4ONFCbalanced1282606transformers
gpt4o-balanced-unigramunigramREGEX_GPT4Ononebalanced1282606transformers
gpt4o-balanced-unigram-tunedunigramREGEX_GPT4Ononebalanced1282601transformers
gpt4o-code-bpebpeREGEX_GPT4Ononecode1282606transformers
gpt4o-codegrad00-bpebpeREGEX_GPT4Ononecodegrad001282601transformers
gpt4o-codegrad05-bpebpeREGEX_GPT4Ononecodegrad051282601transformers
gpt4o-codegrad30-bpebpeREGEX_GPT4Ononecodegrad301282601transformers
gpt4o-codegrad50-bpebpeREGEX_GPT4Ononecodegrad501282601transformers
gpt4o-english-bpebpeREGEX_GPT4Ononeenglish1282606transformers
gpt4o-english-fullbyte-bpebpeREGEX_GPT4Ononeenglish1282602transformers
gpt4onl-balanced-bpebpeREGEXGPT4ONONLnonebalanced1282603transformers
gpt4onl-codegrad00-bpebpeREGEXGPT4ONONLnonecodegrad001282601transformers
gpt4onl-codegrad05-bpebpeREGEXGPT4ONONLnonecodegrad051282601transformers
gpt4onl-codegrad30-bpebpeREGEXGPT4ONONLnonecodegrad301282601transformers
gpt4onl-codegrad50-bpebpeREGEXGPT4ONONLnonecodegrad501282601transformers
highmid-bpebpeREGEX_GPT4Ononehighmid1282601transformers
highmid-unigramunigramREGEX_GPT4Ononehighmid1282601transformers
highres-bpebpeREGEX_GPT4Ononehighres1282601transformers
highres-unigramunigramREGEX_GPT4Ononehighres1282601transformers
llama3 (cited only)n/an/an/an/an/a2transformers
pabpe-nfc-apertus-fineweb2full-capped-tuned-hybridwindowBPEn/aNFCn/a1278352transformers
pabpe-nfc-clean-balancedBPEn/aNFCn/a1278361transformers
pabpe-nfc-clean-balanced-hybridwindowBPEn/aNFCn/a1278361transformers
pabpe-nfc-clean-fineweb2fullBPEn/aNFCn/a1278351transformers
pabpe-nfc-clean-fineweb2full-capped-tuned-hybridwindowBPEn/aNFCn/a1278352transformers
pabpe-nfc-clean-fineweb2full-consv2-engfull-eu3-gm110kBPEn/aNFCn/a1311962transformers
pabpe-nfc-clean-fineweb2full-consv2-eudata-gm110kBPEn/aNFCn/a1311961transformers
pabpe-nfc-clean-fineweb2full-consv2-eudata-gm90kBPEn/aNFCn/a1311961transformers
pabpe-nfc-clean-fineweb2full-consv2-eudata4-gm100kBPEn/aNFCn/a1311961transformers
pabpe-nfc-clean-fineweb2full-consv2-eusino-v2c-frde-kr120-gm130k-v200kBPEn/aNFCn/a2001242transformers
pabpe-nfc-clean-fineweb2full-consv2-eusino-v2c-gm120k-v200kBPEn/aNFCn/a2001242transformers
pabpe-nfc-clean-fineweb2full-consv2-frde2-gm110kBPEn/aNFCn/a1311962transformers
pabpe-nfc-clean-fineweb2full-consv2-plus3-repcap8BPEn/aNFCn/a1311412transformers
pabpe-nfc-clean-fineweb2full-consv2-prelim-mul-v131072BPEn/aNFCn/a1311962transformers
pabpe-nfc-clean-fineweb2full-hybridwindowBPEn/aNFCn/a1278351transformers
pabpe-nfc-clean-fineweb2full-plus2-capped-tuned-hybridwindowBPEn/aNFCn/a1278352transformers
pabpe-nfc-clean-fineweb2full-plus2-capped-tuned-hybridwindow-consv2-tailcuts-gm90k-v130-sp-eng5gBPEn/aNFCn/a1310282transformers
pabpe-nfc-clean-fineweb2full-plus3-capped-tuned-hybridwindow-consv2BPEn/aNFCn/a1278352transformers
pabpe-nfc-clean-fineweb2full-plus3-capped-tuned-hybridwindow-consv2-tailcuts-gm70k-v130-sp-eng5gBPEn/aNFCn/a1310282transformers
pabpe-nfc-clean-fineweb2full-plus3-capped-tuned-hybridwindow-consv2-tailcuts-gm90k-v130-sp-eng5gBPEn/aNFCn/a1310282transformers
pabpe-nfc-clean-fw2full-plus3-cap-hw-consv2-gm90k-tailcuts-eng5g-repcap8BPEn/aNFCn/a1311412transformers
pabpe-nfc-gpt4-balancedBPEn/aNFCn/a1278265transformers
pabpe-nfc-gpt4-balanced-hybridwindowBPEn/aNFCn/a1278261transformers
pabpe-nfc-gpt4-fineweb2fullBPEn/aNFCn/a1278251transformers
pabpe-nfc-gpt4-fineweb2full-hybridwindowBPEn/aNFCn/a1278251transformers
punct-allmulti-equal-bpebpePunctuation+ByteLevelnoneallmulti_equal1282601transformers
punct-balanced-bpebpePunctuation+ByteLevelnonebalanced1282609transformers
punct-balancedhalf-superbpe-t64k-copyBPEn/anonen/a1280041transformers
punct-english-bpebpePunctuation+ByteLevelnoneenglish1282606transformers
rightalign-balanced-bpebpeREGEXGPT4ORIGHTALIGNnonebalanced1282606transformers
rightalign-balanced-nfc-bpebpeREGEXGPT4ORIGHTALIGNNFCbalanced1282606transformers
rightalign-balanced-unigramunigramREGEXGPT4ORIGHTALIGNnonebalanced1282606transformers
scripttok-bpe-scriptenc_gpt4o_cbn/an/anonen/an/a2script_tok
scripttok-mingram-scriptenc_cbn/an/anonen/an/a2script_tok
scripttok-mingram-scriptenc_cb_nln/an/anonen/an/a2script_tok
superbpe-apertus-fineweb2full-capped-hybridwindowBPEn/aNFCn/a1280042transformers
superbpe-clean-c2-balancedBPEn/aNFCn/a1280042transformers
superbpe-clean-c3-balancedBPEn/aNFCn/a1280042transformers
superbpe-clean-fineweb2full-capped-hybridwindowBPEn/aNFCn/a1280042transformers
superbpe-clean-fineweb2full-capped-hybridwindow-t110k-v130kBPEn/aNFCn/a1300042transformers
superbpe-clean-fineweb2full-plus2-cappedv2-hybridwindow-t110k-v130k-consv2BPEn/aNFCn/a1300042transformers
superbpe-gpt4-fineweb2full-hybridwindowBPEn/aNFCn/a1280041transformers
superbpe-gpt4o-balancedBPEn/anonen/a1280045transformers
superbpe-pabpe-nfc-gpt4-balancedBPEn/aNFCn/a1280041transformers
superbpe-pabpe-nfc-gpt4-t64kBPEn/aNFCn/a1280041transformers
swiss-ai/Apertus-70B-2509 (cited only)n/an/an/an/an/a4transformers
whitespace-balanced-bpebpeSplit(\s+)+ByteLevelnonebalanced1282602transformers
whitespace-balanced-unigramunigramMetaspacenonebalanced1282561transformers
whitespace-multiheavy-bpebpeSplit(\s+)+ByteLevelnonemultiheavy1282601transformers

n/a in the pretokenizer, normalizer or training-data columns means the tokenizer was not built by this repository's training script and has no row there. Its build settings are in its own card, taken from the build manifest the external trainer wrote or from the model registry note.

Ablation grid: the model axis

The per-model settings and headline metrics are in ablation_grid.csv (220 rows) and models.json. Each model's own card repeats its row. The columns are the architecture (layers, width, heads, vocabulary, value-embedding dimension, soft cap), the training point (step, token budget, seed) and the evaluation results.

Architecture

nanochat (Karpathy), MIT licensed, with three patches applied for this study (branch tokenizer-lm-patches, commit f919449):

  1. 1.ve_dim: the per-layer value-embedding tables are built at a reduced dimension and projected up to the key and value dimension by a learned matrix, instead of being built at full width. All released models use ve_dim=128. Without this, a 128k vocabulary would spend most of the parameter budget on those tables.
  2. 2.logit_softcap: the logit soft cap is a config field where 0 disables it, instead of a hardcoded 15. Released models use 15 unless their card says otherwise.
  3. 3.width_lr_exponent: the AdamW learning-rate width scaling exponent is configurable, set to -1.0 for muP. This affects training only.

The rest is nanochat as published: rotary embeddings, QK norm, ReLU squared MLP, sliding-window attention on three of every four layers, a smear gate that mixes the previous token, a backout term at the middle layer, per-layer residual and x0 scalars, parameterless RMSNorm, and untied input and output embeddings.

Each released checkpoint was checked against the training-time model: the same random token ids run through both give the same logits in float32, and the top-1 prediction agrees at every position.

Training data

One mixture, used for both tokenizer training and language-model training: 35% English web text (FineWeb-Edu), 30% multilingual text over 30 languages and 8 scripts (a quality-filtered FineWeb-2), 15% mathematics (FineMath 4plus), 15% code (StarCoderData, highest quality tier). Multilingual weights are proportional to each language's estimated character count in the source, so low-resource languages get less data, which is the resource gradient the cross-lingual study measures.

The math and code regime continues from the same corpus family with a mixture weighted toward mathematics and code. Code evaluation uses a StarCoderData tier held out from training.

Upstream licenses, as their dataset cards state them: FineWeb-Edu ODC-By, FineWeb-2 ODC-By, FineMath ODC-By, StarCoderData listed as other.

What is not here

Models whose tokenizer was later found defective are not released. Two defects were found during the study: a tokenizer family that stripped newline and carriage-return characters and had an incomplete byte alphabet, and a SuperBPE stage-2 pretokenizer that split combining marks its stage 1 had kept together, which breaks Bengali, Devanagari, Tamil, Thai and Arabic sequences. The affected checkpoints stay on the training cluster with their defect recorded. Where a slug names both a defective original and a later fixed retrain, the released model is the retrain, identified by comparing the tokenizer file against the archived defective copy.

A separate family of runs trained on a quota-based corpus was retired for a cross-lingual confound rather than a defect. Those are not released either.

Files

FileContents
models.jsonone record per model: architecture, training point, metrics, provenance
tokenizers.jsonone record per tokenizer: build settings and which models use it
ablation_grid.csvthe two axes joined, one row per model
models/<run>/weights, config, tokenizer, model class, conversion record
tokenizers/<slug>/the tokenizer file as trained, plus its config

Citation

TokEval: A Tokenizer Evaluation Suite. Clara Meister. COLM 2026.