Benchmarking tool for tokenizer efficiency across languages and models
Project description
mothertoken
Every model has a native tongue. The question is whether yours matches.
Toolkit for comparing tokenizer efficiency across languages, model families, and user-supplied Hugging Face refs.
[!NOTE] The bundled benchmark is curated and representative, not exhaustive. Use direct Hugging Face refs when you want to compare tokenizers outside the starter set.
Installation
# Published package
pip install mothertoken
For local development:
git clone https://github.com/inimaz/mothertoken
cd mothertoken
uv sync
uv pip install -e .
CLI Usage
The mothertoken command is available after installation.
Common questions
I speak a language that is not English. Which tokenizer is most efficient for it?
mothertoken rank spanish
Show demo
I have this text and a chosen model. How many tokens does it use?
mothertoken tokenize "Hola Mundo" --model gpt-4o
Show demo
I am choosing between a few models. Which one tokenizes my text best?
mothertoken compare "Travesura realizada" --model gpt-oss --model Qwen/Qwen3-0.6B
Show demo
I have this model. Which languages does it tokenize best, which ones worst?
mothertoken benchmark run --models gpt-oss,YOUR_MODEL1,YOUR_MODEL2
Show demo
Rank tokenizers for a language
Rank supported tokenizers for a specific language using the precomputed benchmark data.
mothertoken rank spanish
# Raw FLORES+ codes still work
mothertoken rank spa_Latn
List tokenizers
See which tokenizer IDs can be used and which familiar models use them.
mothertoken list
Tokenize exact text
Count tokens for exact text using local tokenizers by default. Add --language to estimate the English-equivalent token count from the benchmark multiplier.
mothertoken tokenize "Hola Mundo" --language es
# Check one model
mothertoken tokenize "Hello" --model gpt-4o
# Check a Hugging Face model/tokenizer ref directly
mothertoken tokenize "Hello" --model Qwen/Qwen3-0.6B
# Estimate the English-equivalent count for a known language
mothertoken tokenize "مرحبا بالعالم" --language ar --model gpt-4o
# Compare against your own English translation
mothertoken tokenize "مرحبا بالعالم" --language ar --english-text "Hello world"
# Tokenize a file
mothertoken tokenize --file prompt.txt
# Compare translated files
mothertoken tokenize --file prompt.ar.txt --language ar --english-file prompt.en.txt
Compare selected tokenizers
Compare aliases from mothertoken list with direct Hugging Face refs. This is the main workflow when you care about a specific set of models.
mothertoken compare "Travesura realizada" \
--model gpt-4o \
--model Qwen/Qwen3-0.6B \
--model mistralai/Mistral-7B-v0.1
mothertoken compare --file prompt.txt \
--model mistralai/Mistral-7B-v0.1 \
--model deepseek-ai/DeepSeek-V4-Pro
Benchmark data
mothertoken benchmark shows benchmark help. Use benchmark run to create benchmark data, benchmark use to choose the active benchmark, and benchmark status to inspect what commands will use.
When --output is omitted, benchmark run writes to the user-owned benchmark file and makes it active:
mothertoken benchmark run --languages eng_Latn,arb_Arab --models gpt-4o,Qwen/Qwen3-0.6B
Before it starts, the command prints the file it will write. The default user config locations are platform-specific:
| OS | User config directory |
|---|---|
| Linux / XDG | $XDG_CONFIG_HOME/mothertoken or ~/.config/mothertoken |
| macOS | ~/Library/Application Support/mothertoken |
| Windows | %APPDATA%\mothertoken |
To write somewhere else:
mothertoken benchmark run \
--languages eng_Latn,arb_Arab \
--models gpt-4o,Qwen/Qwen3-0.6B \
--output benchmark.json
Make an existing benchmark active:
mothertoken benchmark use benchmark.json
mothertoken benchmark status
Return to the bundled default benchmark:
mothertoken benchmark use --default
Researcher Workflow
Benchmark regeneration and model-extension docs live in docs/benchmarking.md.
You can also benchmark a direct Hugging Face ref without adding it to default_tokenizers.yaml:
uv run mothertoken benchmark run --languages eng_Latn,arb_Arab --models Qwen/Qwen3-0.6B
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mothertoken-0.1.1.tar.gz.
File metadata
- Download URL: mothertoken-0.1.1.tar.gz
- Upload date:
- Size: 26.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f4e82a7045a3283067a6268da894752c1acc1eea1c7b5b5ffb13d6d117307a91
|
|
| MD5 |
c01f38a3eafb001bb2397aa20609570f
|
|
| BLAKE2b-256 |
f937cf5e206a169247ccde4cbba34c9c21df019d3922760ab582a0326009b616
|
Provenance
The following attestation bundles were made for mothertoken-0.1.1.tar.gz:
Publisher:
python-publish.yml on inimaz/mothertoken
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mothertoken-0.1.1.tar.gz -
Subject digest:
f4e82a7045a3283067a6268da894752c1acc1eea1c7b5b5ffb13d6d117307a91 - Sigstore transparency entry: 1942306723
- Sigstore integration time:
-
Permalink:
inimaz/mothertoken@80e0eb540bcd3b50d21c56f5dc04fc0e430366c2 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/inimaz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@80e0eb540bcd3b50d21c56f5dc04fc0e430366c2 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file mothertoken-0.1.1-py3-none-any.whl.
File metadata
- Download URL: mothertoken-0.1.1-py3-none-any.whl
- Upload date:
- Size: 31.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
153dfe1be236a5c14f22e73fabcbbc1ec1d2d6ead4671a51a8d57ff02546fd0d
|
|
| MD5 |
81e5f512cf19a460356d663af5eb663f
|
|
| BLAKE2b-256 |
ebe5be04ef746ca98e51e9bd9524fbeb4d884b878b8f6b066141a40e9978aa99
|
Provenance
The following attestation bundles were made for mothertoken-0.1.1-py3-none-any.whl:
Publisher:
python-publish.yml on inimaz/mothertoken
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mothertoken-0.1.1-py3-none-any.whl -
Subject digest:
153dfe1be236a5c14f22e73fabcbbc1ec1d2d6ead4671a51a8d57ff02546fd0d - Sigstore transparency entry: 1942306794
- Sigstore integration time:
-
Permalink:
inimaz/mothertoken@80e0eb540bcd3b50d21c56f5dc04fc0e430366c2 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/inimaz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@80e0eb540bcd3b50d21c56f5dc04fc0e430366c2 -
Trigger Event:
workflow_dispatch
-
Statement type: