What Bangla costs in tokens
Type or paste Bangla. Each tokenizer splits it in your browser using the same vocabulary files the benchmark measured, and shows how many tokens it needs compared with the same sentence in English, and how many written syllables (aksharas such as ক্ষু) its tokens cut apart.
Presets are the 24 hand-written Bangla / English pairs in fixtures/parallel.jsonl.
Normalization settings
Tokenizers
Vocabulary files load when you switch one on. Sizes are the minified tokenizer.json.
Cost against English
Bangla tokens ÷ English tokens for your text. The ring marks each tokenizer's result on the 488 Belebele passages.
| Tokenizer | Bangla tokens | English tokens | Cost × | Tokens / word | Chars / token | Aksharas cut | Mid-codepoint splits |
|---|
Reading the token strips
- টোকেন one token, shaded alternately so neighbours are distinguishable.
- া red left edge: this token starts inside an akshara, so a written syllable is split.
- E0 A6 dashed: the token is raw bytes of a character, not a whole character. Hover or focus it to see which one.
- ␣আর ␣ marks a space that belongs to the token.
Numbers from results/*.json in bangla-llm-bench.
Cost against English
Total Bangla tokens ÷ total English tokens, 95% bootstrap interval over passages.
Akshara breakage
Share of multi-codepoint aksharas and of conjuncts cut by at least one token boundary, and of boundaries that fall inside a codepoint.
Full tokenizer table
Encoding audit
Belebele Bangla passages, before any normalization.
results/audit_belebele.json
Retrieval, same questions in three scripts
nDCG@10 on Belebele question to passage retrieval (900 questions, 488 passages).
results/retrieval_belebele-{bn,bn-latn,en}.json
Generation tasks
Live rows come from one local model served by Ollama; mock rows are deterministic baselines, not model results.
| Task | Model | Provenance | n | Metrics (mean, 95% CI) |
|---|
results/generation/*.json
About this demo
This page runs the tokenizer part of bangla-llm-bench in the browser. What is different from the repository:
- Tokenization uses JavaScript ports:
js-tiktokenfor cl100k_base and o200k_base, and@huggingface/tokenizers(the tokenizer engine inside Transformers.js) for the Hugging Face vocabularies, loaded fromtokenizer.jsonfiles exported from the pinned revisions the study used. The Python package usestiktokenandtransformers. - A parity test checks every tokenizer against the Python package on the 24 fixture pairs plus edge-case strings: token ids, and the akshara and conjunct breakage counts, match exactly. Text outside those strings could still tokenize differently in a rare case.
- IndicBERT v2's
Whitespacepre-tokenizer is served as the equivalentSplitrule, because the JavaScript version treats Bengali letters as non-word characters. The export script checks that the rewrite gives identical ids. - Normalization, akshara segmentation and the word splitter are TypeScript ports of
normalize.py,script.pyandwords.py, tested against the Python output. - Claude is not included: its tokenizer is not public, and the study did not have an API key to count tokens either.
- The live numbers describe only the text you enter. The study numbers are corpus totals over Belebele, measured on 2026-11-24; they are shown unchanged in the results tab.