Skip to main content

Benchmarking tool for tokenizer efficiency across languages and models

Project description

mothertoken logo

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] Alpha release: 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

Question Command
I speak a language that is not English. Which tokenizer is most efficient for it? mothertoken rank spanish
I have this text and a chosen model. How many tokens does it use? mothertoken tokenize "Hola Mundo" --model gpt-4o
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
How good are the known models at tokenizing my language? mothertoken rank arabic
I have this model. Which languages does it tokenize best, which ones worst? mothertoken benchmark --models gpt-oss,YOUR_MODEL1,YOUR_MODEL2

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

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 --languages eng_Latn,arb_Arab --models Qwen/Qwen3-0.6B

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mothertoken-0.1.0.0a2.tar.gz (23.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mothertoken-0.1.0.0a2-py3-none-any.whl (28.3 kB view details)

Uploaded Python 3

File details

Details for the file mothertoken-0.1.0.0a2.tar.gz.

File metadata

  • Download URL: mothertoken-0.1.0.0a2.tar.gz
  • Upload date:
  • Size: 23.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mothertoken-0.1.0.0a2.tar.gz
Algorithm Hash digest
SHA256 a76d76c2f3aac2b52e65732cbef55df73a6b4a75ff327c5a0cd5bed530a5883b
MD5 260371d29d57d8f0c92541e0eed12218
BLAKE2b-256 ba52fe942bfea4d5e5451e71c15879d76f2e7c0b03de19b1b1716b71a52fc312

See more details on using hashes here.

Provenance

The following attestation bundles were made for mothertoken-0.1.0.0a2.tar.gz:

Publisher: python-publish.yml on inimaz/mothertoken

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mothertoken-0.1.0.0a2-py3-none-any.whl.

File metadata

File hashes

Hashes for mothertoken-0.1.0.0a2-py3-none-any.whl
Algorithm Hash digest
SHA256 689f38c1dcf36fc56e3ba6ca364493e12f3bc48a50a73f4c433b8785d4791191
MD5 7636d4e27d924eda03bdf882ee69f2d3
BLAKE2b-256 84189fcd4114cd3002504219f493c6c413f7938ce99bdc2b345d2c6a93048f57

See more details on using hashes here.

Provenance

The following attestation bundles were made for mothertoken-0.1.0.0a2-py3-none-any.whl:

Publisher: python-publish.yml on inimaz/mothertoken

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page