grouptok-en-sw-af-de-fr-es-zh-64k

A byte-level BPE tokenizer of 65,536 tokens for English, Swahili, Afrikaans, German, French, Spanish and Chinese, whose vocabulary is grouped by translation with grouptok: a group gathers tokens that translate each other, across languages (e.g. water, Wasser, eau, agua, maji).

Details

Vocabulary 65,536 tokens (the BPE baseline's, unchanged)
Model byte-level BPE, no prefix space, 256-byte alphabet
Groups translation groups of at most 14 members (twice the 7 languages); tokens without a translation link stay in groups of their own
Aligners awesome-align (layer 8) for German, French, Spanish and Chinese; XLM-R base (layer 8) for Swahili and Afrikaans
Trained with grouptok 0.5.0: GroupedTokenizer.train(..., tokenizer=<the BPE>), alignment and grouping only
Reserved tokens <|im_start|>, <|im_end|>, <think>, </think> (ids 0-3), never grouped
Training data the BPE's 1,000,000 English–X sentence pairs per language (below)

No pad, bos or eos token is declared; set them for your model if you need them.

How the groups are made

Each sentence pair is split by the BPE, and its language's aligner links the English subwords to the other side's. The links of all pairs and all languages are pooled and turned into groups, so one group can hold the word in several languages, although each aligner only ever saw English with one of them. English is the first side of every pair, so a group's member 0 is its English word.

Usage

Any library that reads tokenizer.json tokenizes text exactly as the BPE baseline:

from transformers import AutoTokenizer

tok = AutoTokenizer.from_pretrained("henryhale/grouptok-en-sw-af-de-fr-es-zh-64k")
tok("The water is cold").input_ids

The groups, with grouptok (pip install grouptok):

from huggingface_hub import snapshot_download
from grouptok import GroupedTokenizer

tok = GroupedTokenizer.from_pretrained(snapshot_download("henryhale/grouptok-en-sw-af-de-fr-es-zh-64k"))
groups = tok.readable_groups()
next(g for g in groups if " water" in g)

or from groups.json alone, each token's group and member slot:

import json
from huggingface_hub import hf_hub_download

groups = json.load(open(hf_hub_download("henryhale/grouptok-en-sw-af-de-fr-es-zh-64k", "groups.json")))
[(groups["token_group"][i], groups["token_member"][i]) for i in tok("The water is cold").input_ids]

Files

  • tokenizer.json, tokenizer_config.json: the tokenizer (and a chat template), identical to the BPE baseline
  • groups.json: the translation groups, each token's group id and member slot

Training data

The BPE baseline's: 1,000,000 English–X sentence pairs per language. Where a language has two corpora, all of the smaller one and the first rows of the larger one.

Language Corpora
German Europarl (WMT14) de-en, first 776,847 pairs; News Commentary de-en, all 223,153
French Europarl (WMT14) fr-en, first 790,521 pairs; News Commentary en-fr, all 209,479
Spanish Europarl en-es, first 761,128 pairs; News Commentary en-es, all 238,872
Chinese News Commentary (WMT19) zh-en, first 311,500 pairs; UN Parallel Corpus en-zh, first 688,500
Swahili NLLB mined pairs, best-scored first 1,000,000
Afrikaans NLLB mined pairs, best-scored first 1,000,000

Limitations

  • The groups inherit the aligners' errors, and the aligners differ by language, so group quality differs by language too.
  • Groups link single subwords one to one: multi-word expressions and their one-word translations are never grouped.
  • The training text is mostly parliamentary, news, UN and web-mined text, and the languages are balanced by number of sentence pairs, not by amount of text.

Citation

@misc{ssenono2026grouptok64k,
  title = {{grouptok-en-sw-af-de-fr-es-zh-64k}: A Translation-Grouped Tokenizer for {English}, {Swahili}, {Afrikaans}, {German}, {French}, {Spanish} and {Chinese}},
  author = {Henry Ssenono},
  year = {2026},
  howpublished = {Hugging Face model},
  url = {https://huggingface.co/henryhale/grouptok-en-sw-af-de-fr-es-zh-64k}
}
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Datasets used to train henryhale/grouptok-en-sw-af-de-fr-es-zh-64k

Collection including henryhale/grouptok-en-sw-af-de-fr-es-zh-64k