CoolFace
Modelpublic

openeurollm/tokenizer-256k

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

OpenEuroLLM Tokenizer (256k)

A 262,144-token SentencePiece BPE tokenizer designed for efficient tokenization across all EU official languages and additional European languages. Trained on 173 GB of curated multilingual text from the OpenEuroLLM data catalogue on LUMI HPC.

Key Results

  • Best fertility (tokens per word) on 26 out of 38 European languages, outperforming Llama 3.2, Gemma 3, GPT-OSS, EuroLLM, Qwen 2.5, DeepSeek V3, and Mistral v0.3
  • Lowest average fertility overall: 2.12 across 38 languages
  • Particularly strong on lower-resource EU languages: Lithuanian (31% fewer tokens than Llama), Hungarian (22%), Icelandic (26%), Maltese (25%)
  • English fertility (1.58) within 5% of best (GPT-OSS, 1.51) — no trade-off

Usage

python
from transformers import AutoTokenizer

tok = AutoTokenizer.from_pretrained("openeurollm/tokenizer-256k")

text = "Hello world! Bonjour le monde. Hej världen!"
ids = tok(text)["input_ids"]
decoded = tok.decode(ids, skip_special_tokens=True)

print(f"Tokens: {len(ids)}")
print(f"Decoded: {decoded}")

Batch encoding

python
texts = [
    "The quick brown fox jumps over the lazy dog.",
    "Der schnelle braune Fuchs springt über den faulen Hund.",
    "Le rapide renard brun saute par-dessus le chien paresseux.",
]
batch = tok(texts, padding=True, return_tensors="pt")
print(batch["input_ids"].shape)  # (3, max_len)

Special Tokens

TokenIDPurpose
<unk>0Unknown
<bos>1Beginning of sequence
<eos>2End of sequence
<start_of_turn>3Chat turn start
<end_of_turn>4Chat turn end
<start_of_image>5Image start
<end_of_image>6Image end
<image_soft_token>7Image placeholder
<fim_prefix>8Fill-in-middle prefix
<fim_middle>9Fill-in-middle middle
<fim_suffix>10Fill-in-middle suffix
<tool_call>11Tool call start
</tool_call>12Tool call end
<unused_0><unused_99>13–112Reserved for future use
<pad>262,144Padding

Training Details

ParameterValue
AlgorithmBPE (SentencePiece)
Vocabulary size262,144
Training data173 GB multilingual corpus
Data mix70% English, 10% code/math, 20% other languages (37 languages)
Character coverage0.9995
NormalizationIdentity (lossless)
Byte fallbackEnabled
Digit splittingEnabled
Max piece length16
Trained onLUMI HPC (CSC, Finland)
Training time~9 hours (32 CPUs, 128 GB RAM)

Data Sources

The training corpus aggregates cleaned/deduplicated text from: C4, FineWeb-2, Nemotron-CC, MADLAD-400, HPLT, FinePDFs, German-Commons, StarCoder, Proof-Pile-2, Cosmopedia-v2, and FineMath.

Languages (37 + English)

EU Official (23): bg, hr, cs, da, nl, et, fi, fr, de, el, hu, ga, it, lv, lt, mt, pl, pt, ro, sk, sl, es, sv

Additional European (14): sq, eu, bs, ca, gl, is, lb, mk, no, ru, sr, tr, uk, cy

Fertility Evaluation

Average tokens per word across 38 European languages (lower = better), evaluated on 200 Wikipedia articles per language:

TokenizerVocabAvg FertilityLanguages Won
Ours 262k262k2.1226
GPT-OSS 20B200k2.268
EuroLLM 1.7B128k2.273
Ours 128k131k2.310
Gemma 3 4B262k2.350
DeepSeek V3129k2.520
Llama 3.2 1B128k2.561
Qwen 2.5152k2.830
Mistral v0.333k2.970

See Also