Views
No views yet
| Feature | Value |
|---|---|
| Vocabulary size | 64,000 |
| Algorithm | SentencePiece BPE + byte fallback |
| Character coverage | 0.9995 |
| Special tokens | ChatML (`< |
| Pre-tokenizer | Metaspace (▁) |
| Normalization | Identity (no aggressive NFKC) |
| Split digits / numbers | Yes |
| Split by Unicode script | Yes |
| Byte fallback | Enabled |
| Metric | Description | Direction |
|---|---|---|
| Fertility | Tokens per whitespace-delimited word | ↓ better |
| Characters per token | Compression efficiency | ↑ better |
| STRR | Single-Token Retention Rate (% of words kept intact) | ↑ better |
| Tokenizer | Fertility ↓ | Chars/Token ↑ | STRR ↑ |
|---|---|---|---|
| Custom (nyayalm-64k) | 1.483 | 4.294 | 0.709 |
| Gemma-4 | 1.536 | 4.102 | 0.495 |
| GPT-OSS-20B (o200k_harmony) | 1.600 | 3.962 | 0.448 |
| GPT-5 (o200k) | 1.600 | 3.962 | 0.448 |
| Llama-3.2 | 2.102 | 3.265 | 0.414 |
| Qwen3.5 | 2.329 | 3.126 | 0.408 |
| Claude (approx) | 3.252 | 2.779 | 0.393 |
| Tokenizer | English | Mixed | Nepali | Roman_Nepali |
|---|---|---|---|---|
| Custom (nyayalm-64k) | 1.131 | 1.135 | 1.252 | 2.417 |
| Gemma-4 | 1.131 | 1.099 | 1.769 | 2.147 |
| GPT-5 (o200k) | 1.147 | 1.157 | 1.823 | 2.272 |
| GPT-OSS-20B (o200k_harmony) | 1.147 | 1.157 | 1.823 | 2.272 |
| Llama-3.2 | 1.189 | 1.471 | 3.311 | 2.437 |
| Qwen3.5 | 1.189 | 1.587 | 4.179 | 2.362 |
| Claude (approx) | 1.172 | 1.984 | 7.277 | 2.573 |
| Tokenizer | English | Mixed | Nepali | Roman_Nepali |
|---|---|---|---|---|
| Custom (nyayalm-64k) | 0.869 | 0.865 | 0.816 | 0.283 |
| Gemma-4 | 0.756 | 0.768 | 0.243 | 0.213 |
| GPT-5 (o200k) | 0.675 | 0.712 | 0.218 | 0.188 |
| GPT-OSS-20B (o200k_harmony) | 0.675 | 0.712 | 0.218 | 0.188 |
| Llama-3.2 | 0.675 | 0.708 | 0.084 | 0.188 |
| Qwen3.5 | 0.675 | 0.708 | 0.059 | 0.188 |
| Claude (approx) | 0.656 | 0.688 | 0.040 | 0.188 |
1from transformers import AutoTokenizer
2
3tok = AutoTokenizer.from_pretrained("chhatramani/nyayalm-tokenizer-64k_v2")
4
5# Simple encode / decode
6text = "नेपालको संविधान २०७२ ले नागरिकलाई मौलिक हक प्रदान गरेको छ।"
7ids = tok.encode(text, add_special_tokens=False)
8print(len(ids), tok.decode(ids))
9
10# ChatML conversation
11messages = [
12 {"role": "system", "content": "You are a helpful Nepali legal assistant."},
13 {"role": "user", "content": "मेरो मौलिक हक के के हुन्?"},
14]
15prompt = tok.apply_chat_template(
16 messages,
17 tokenize=False,
18 add_generation_prompt=True,
19)
20print(prompt)1Pythonprint(tok.convert_tokens_to_ids("<|endoftext|>")) # 63982
2print(tok.convert_tokens_to_ids("<|im_start|>")) # 63983
3print(tok.convert_tokens_to_ids("<|im_end|>")) # 63984
4print(len(tok))1bibtex@misc{nyayalm-tokenizer-64k-v2,
2 title = {NyayaLM 64k SentencePiece-BPE Tokenizer},
3 author = {Chhatramani},
4 year = {2026},
5 url = {https://huggingface.co/chhatramani/nyayalm-tokenizer-64k_v2}
6}