Dataset Preview
Duplicate
The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
The dataset generation failed
Error code:   DatasetGenerationError
Exception:    ArrowInvalid
Message:      Schema at index 1 was different: 
morphbpe_seed42: struct<test_loss: double, test_f1: double, test_precision: double, test_recall: double, test_accuracy: double, test_runtime: double, test_samples_per_second: double, test_steps_per_second: double, epoch: double, finetune_minutes: double, pretrained_model: string, dataset: string, seed: int64, epochs: int64, tag: string>
bpe_seed42: struct<test_loss: double, test_f1: double, test_precision: double, test_recall: double, test_accuracy: double, test_runtime: double, test_samples_per_second: double, test_steps_per_second: double, epoch: double, finetune_minutes: double, pretrained_model: string, dataset: string, seed: int64, epochs: int64, tag: string>
unigram_seed42: struct<test_loss: double, test_f1: double, test_precision: double, test_recall: double, test_accuracy: double, test_runtime: double, test_samples_per_second: double, test_steps_per_second: double, epoch: double, finetune_minutes: double, pretrained_model: string, dataset: string, seed: int64, epochs: int64, tag: string>
unigram_seed1: struct<test_loss: double, test_f1: double, test_precision: double, test_recall: double, test_accuracy: double, test_runtime: double, test_samples_per_second: double, test_steps_per_second: double, epoch: double, finetune_minutes: double, pretrained_model: string, dataset: string, seed: int64, epochs: int64, tag: string>
bpe_seed2: struct<test_loss: double, test_f1: double, test_precision: double, test_recall: double, test_accuracy: double, test_runtime: double, test_samples_per_second: double, test_steps_per_second: double, epoch: double, finetune_minutes: double, pretrained_model: string, dataset: string, seed: int64, epochs: int64, tag: string>
bpe_seed1: struct<test_loss: double, test_f1: double, test_precision: double, test_recall: double, test_accuracy: double, test_runtime: double, test_samples_per_second: double, test_steps_per_second: double, epoch: double, finetune_minutes: double, pretrained_model: string, dataset: string, seed: int64, epochs: int64, tag: string>
morphbpe_seed2: struct<test_loss: double, test_f1: double, test_precision: double, test_recall: double, test_accuracy: double, test_runtime: double, test_samples_per_second: double, test_steps_per_second: double, epoch: double, finetune_minutes: double, pretrained_model: string, dataset: string, seed: int64, epochs: int64, tag: string>
morphbpe_seed1: struct<test_loss: double, test_f1: double, test_precision: double, test_recall: double, test_accuracy: double, test_runtime: double, test_samples_per_second: double, test_steps_per_second: double, epoch: double, finetune_minutes: double, pretrained_model: string, dataset: string, seed: int64, epochs: int64, tag: string>
unigram_seed2: struct<test_loss: double, test_f1: double, test_precision: double, test_recall: double, test_accuracy: double, test_runtime: double, test_samples_per_second: double, test_steps_per_second: double, epoch: double, finetune_minutes: double, pretrained_model: string, dataset: string, seed: int64, epochs: int64, tag: string>
vs
bpe_seed42: struct<test_em: double, test_f1: double, n_test: int64, finetune_minutes: double, pretrained_model: string, dataset: string, seed: int64, epochs: int64, tag: string, max_len: int64>
morphbpe_seed42: struct<test_em: double, test_f1: double, n_test: int64, finetune_minutes: double, pretrained_model: string, dataset: string, seed: int64, epochs: int64, tag: string, max_len: int64>
unigram_seed42: struct<test_em: double, test_f1: double, n_test: int64, finetune_minutes: double, pretrained_model: string, dataset: string, seed: int64, epochs: int64, tag: string, max_len: int64>
Traceback:    Traceback (most recent call last):
                File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1837, in _prepare_split_single
                  writer.write_table(table)
                  ~~~~~~~~~~~~~~~~~~^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/arrow_writer.py", line 764, in write_table
                  self.write_rows_on_file()  # in case there are buffered rows to write first
                  ~~~~~~~~~~~~~~~~~~~~~~~^^
                File "/usr/local/lib/python3.14/site-packages/datasets/arrow_writer.py", line 662, in write_rows_on_file
                  table = pa.concat_tables(self.current_rows)
                File "pyarrow/table.pxi", line 6320, in pyarrow.lib.concat_tables
                File "pyarrow/error.pxi", line 155, in pyarrow.lib.pyarrow_internal_check_status
                  return check_status(status)
                File "pyarrow/error.pxi", line 92, in pyarrow.lib.check_status
                  raise convert_status(status)
              pyarrow.lib.ArrowInvalid: Schema at index 1 was different: 
              morphbpe_seed42: struct<test_loss: double, test_f1: double, test_precision: double, test_recall: double, test_accuracy: double, test_runtime: double, test_samples_per_second: double, test_steps_per_second: double, epoch: double, finetune_minutes: double, pretrained_model: string, dataset: string, seed: int64, epochs: int64, tag: string>
              bpe_seed42: struct<test_loss: double, test_f1: double, test_precision: double, test_recall: double, test_accuracy: double, test_runtime: double, test_samples_per_second: double, test_steps_per_second: double, epoch: double, finetune_minutes: double, pretrained_model: string, dataset: string, seed: int64, epochs: int64, tag: string>
              unigram_seed42: struct<test_loss: double, test_f1: double, test_precision: double, test_recall: double, test_accuracy: double, test_runtime: double, test_samples_per_second: double, test_steps_per_second: double, epoch: double, finetune_minutes: double, pretrained_model: string, dataset: string, seed: int64, epochs: int64, tag: string>
              unigram_seed1: struct<test_loss: double, test_f1: double, test_precision: double, test_recall: double, test_accuracy: double, test_runtime: double, test_samples_per_second: double, test_steps_per_second: double, epoch: double, finetune_minutes: double, pretrained_model: string, dataset: string, seed: int64, epochs: int64, tag: string>
              bpe_seed2: struct<test_loss: double, test_f1: double, test_precision: double, test_recall: double, test_accuracy: double, test_runtime: double, test_samples_per_second: double, test_steps_per_second: double, epoch: double, finetune_minutes: double, pretrained_model: string, dataset: string, seed: int64, epochs: int64, tag: string>
              bpe_seed1: struct<test_loss: double, test_f1: double, test_precision: double, test_recall: double, test_accuracy: double, test_runtime: double, test_samples_per_second: double, test_steps_per_second: double, epoch: double, finetune_minutes: double, pretrained_model: string, dataset: string, seed: int64, epochs: int64, tag: string>
              morphbpe_seed2: struct<test_loss: double, test_f1: double, test_precision: double, test_recall: double, test_accuracy: double, test_runtime: double, test_samples_per_second: double, test_steps_per_second: double, epoch: double, finetune_minutes: double, pretrained_model: string, dataset: string, seed: int64, epochs: int64, tag: string>
              morphbpe_seed1: struct<test_loss: double, test_f1: double, test_precision: double, test_recall: double, test_accuracy: double, test_runtime: double, test_samples_per_second: double, test_steps_per_second: double, epoch: double, finetune_minutes: double, pretrained_model: string, dataset: string, seed: int64, epochs: int64, tag: string>
              unigram_seed2: struct<test_loss: double, test_f1: double, test_precision: double, test_recall: double, test_accuracy: double, test_runtime: double, test_samples_per_second: double, test_steps_per_second: double, epoch: double, finetune_minutes: double, pretrained_model: string, dataset: string, seed: int64, epochs: int64, tag: string>
              vs
              bpe_seed42: struct<test_em: double, test_f1: double, n_test: int64, finetune_minutes: double, pretrained_model: string, dataset: string, seed: int64, epochs: int64, tag: string, max_len: int64>
              morphbpe_seed42: struct<test_em: double, test_f1: double, n_test: int64, finetune_minutes: double, pretrained_model: string, dataset: string, seed: int64, epochs: int64, tag: string, max_len: int64>
              unigram_seed42: struct<test_em: double, test_f1: double, n_test: int64, finetune_minutes: double, pretrained_model: string, dataset: string, seed: int64, epochs: int64, tag: string, max_len: int64>
              
              During handling of the above exception, another exception occurred:
              
              Traceback (most recent call last):
                File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1858, in _prepare_split_single
                  num_examples, num_bytes = writer.finalize()
                                            ~~~~~~~~~~~~~~~^^
                File "/usr/local/lib/python3.14/site-packages/datasets/arrow_writer.py", line 781, in finalize
                  self.write_rows_on_file()
                  ~~~~~~~~~~~~~~~~~~~~~~~^^
                File "/usr/local/lib/python3.14/site-packages/datasets/arrow_writer.py", line 662, in write_rows_on_file
                  table = pa.concat_tables(self.current_rows)
                File "pyarrow/table.pxi", line 6320, in pyarrow.lib.concat_tables
                File "pyarrow/error.pxi", line 155, in pyarrow.lib.pyarrow_internal_check_status
                  return check_status(status)
                File "pyarrow/error.pxi", line 92, in pyarrow.lib.check_status
                  raise convert_status(status)
              pyarrow.lib.ArrowInvalid: Schema at index 1 was different: 
              morphbpe_seed42: struct<test_loss: double, test_f1: double, test_precision: double, test_recall: double, test_accuracy: double, test_runtime: double, test_samples_per_second: double, test_steps_per_second: double, epoch: double, finetune_minutes: double, pretrained_model: string, dataset: string, seed: int64, epochs: int64, tag: string>
              bpe_seed42: struct<test_loss: double, test_f1: double, test_precision: double, test_recall: double, test_accuracy: double, test_runtime: double, test_samples_per_second: double, test_steps_per_second: double, epoch: double, finetune_minutes: double, pretrained_model: string, dataset: string, seed: int64, epochs: int64, tag: string>
              unigram_seed42: struct<test_loss: double, test_f1: double, test_precision: double, test_recall: double, test_accuracy: double, test_runtime: double, test_samples_per_second: double, test_steps_per_second: double, epoch: double, finetune_minutes: double, pretrained_model: string, dataset: string, seed: int64, epochs: int64, tag: string>
              unigram_seed1: struct<test_loss: double, test_f1: double, test_precision: double, test_recall: double, test_accuracy: double, test_runtime: double, test_samples_per_second: double, test_steps_per_second: double, epoch: double, finetune_minutes: double, pretrained_model: string, dataset: string, seed: int64, epochs: int64, tag: string>
              bpe_seed2: struct<test_loss: double, test_f1: double, test_precision: double, test_recall: double, test_accuracy: double, test_runtime: double, test_samples_per_second: double, test_steps_per_second: double, epoch: double, finetune_minutes: double, pretrained_model: string, dataset: string, seed: int64, epochs: int64, tag: string>
              bpe_seed1: struct<test_loss: double, test_f1: double, test_precision: double, test_recall: double, test_accuracy: double, test_runtime: double, test_samples_per_second: double, test_steps_per_second: double, epoch: double, finetune_minutes: double, pretrained_model: string, dataset: string, seed: int64, epochs: int64, tag: string>
              morphbpe_seed2: struct<test_loss: double, test_f1: double, test_precision: double, test_recall: double, test_accuracy: double, test_runtime: double, test_samples_per_second: double, test_steps_per_second: double, epoch: double, finetune_minutes: double, pretrained_model: string, dataset: string, seed: int64, epochs: int64, tag: string>
              morphbpe_seed1: struct<test_loss: double, test_f1: double, test_precision: double, test_recall: double, test_accuracy: double, test_runtime: double, test_samples_per_second: double, test_steps_per_second: double, epoch: double, finetune_minutes: double, pretrained_model: string, dataset: string, seed: int64, epochs: int64, tag: string>
              unigram_seed2: struct<test_loss: double, test_f1: double, test_precision: double, test_recall: double, test_accuracy: double, test_runtime: double, test_samples_per_second: double, test_steps_per_second: double, epoch: double, finetune_minutes: double, pretrained_model: string, dataset: string, seed: int64, epochs: int64, tag: string>
              vs
              bpe_seed42: struct<test_em: double, test_f1: double, n_test: int64, finetune_minutes: double, pretrained_model: string, dataset: string, seed: int64, epochs: int64, tag: string, max_len: int64>
              morphbpe_seed42: struct<test_em: double, test_f1: double, n_test: int64, finetune_minutes: double, pretrained_model: string, dataset: string, seed: int64, epochs: int64, tag: string, max_len: int64>
              unigram_seed42: struct<test_em: double, test_f1: double, n_test: int64, finetune_minutes: double, pretrained_model: string, dataset: string, seed: int64, epochs: int64, tag: string, max_len: int64>
              
              The above exception was the direct cause of the following exception:
              
              Traceback (most recent call last):
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1369, in compute_config_parquet_and_info_response
                  parquet_operations, partial, estimated_dataset_info = stream_convert_to_parquet(
                                                                        ~~~~~~~~~~~~~~~~~~~~~~~~~^
                      builder, max_dataset_size_bytes=max_dataset_size_bytes
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                  )
                  ^
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 948, in stream_convert_to_parquet
                  builder._prepare_split(split_generator=splits_generators[split], file_format="parquet")
                  ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1683, in _prepare_split
                  for job_id, done, content in self._prepare_split_single(
                                               ~~~~~~~~~~~~~~~~~~~~~~~~~~^
                      gen_kwargs=gen_kwargs, job_id=job_id, **_prepare_split_args
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                  ):
                  ^
                File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1869, in _prepare_split_single
                  raise DatasetGenerationError("An error occurred while generating the dataset") from e
              datasets.exceptions.DatasetGenerationError: An error occurred while generating the dataset

Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.

tokenizer
string
vocab_size
int64
fertility
float64
chars_per_token
float64
bytes_per_token
float64
total_tokens
int64
total_words
int64
seconds
float64
kk-bpe-32k
32,000
1.6793
4.6724
8.4599
4,981,192
2,966,207
12.6
kk-unigram-32k
4
2
3.9232
7.1034
5,932,414
2,966,207
10.3
XLM-R
250,002
2.1811
3.5974
6.5136
6,469,672
2,966,207
16.4
GPT-4o (o200k)
200,019
2.5986
3.0196
5.4672
7,707,849
2,966,207
4.8
mBERT
119,547
2.9292
2.6787
4.8502
8,688,494
2,966,207
13
Qwen2.5
151,643
4.7862
1.6394
2.9683
14,196,803
2,966,207
17.3
Llama-3
128,000
4.8033
1.6336
2.9577
14,247,604
2,966,207
16
GPT-4 (cl100k)
100,277
5.8952
1.331
2.4099
17,486,314
2,966,207
3.5
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
Qwen2.5
null
null
null
null
null
null
null
XLM-R
null
null
null
null
null
null
null
mBERT
null
null
null
null
null
null
null
kk-morph-hf-unigram-32k
null
null
null
null
null
null
null
kk-morph-sp-unigram-32k
null
null
null
null
null
null
null
kk-hf-unigram-32k
null
null
null
null
null
null
null
kk-bpe-32k
null
null
null
null
null
null
null
kk-morph-hf-bpe-32k
null
null
null
null
null
null
null
kk-sp-unigram-32k
null
null
null
null
null
null
null
kk-sp-bpe-32k
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
null
kk-bpe-32k
32,000
1.6793
4.6724
8.4599
4,981,192
2,966,207
12.9
kk-sp-bpe-32k
32,000
1.758
4.4632
8.0812
5,214,647
2,966,207
11.2
kk-sp-unigram-32k
32,000
1.7617
4.454
8.0645
5,225,471
2,966,207
4.1
kk-hf-unigram-32k
32,000
2.0264
3.8722
7.011
6,010,620
2,966,207
23.8
XLM-R
250,002
2.1811
3.5974
6.5136
6,469,672
2,966,207
16.5
GPT-4o (o200k)
200,019
2.5986
3.0196
5.4672
7,707,849
2,966,207
4.9
mBERT
119,547
2.9292
2.6787
4.8502
8,688,494
2,966,207
13.4
Qwen2.5
151,643
4.7862
1.6394
2.9683
14,196,803
2,966,207
17.4
Llama-3
128,000
4.8033
1.6336
2.9577
14,247,604
2,966,207
16
GPT-4 (cl100k)
100,277
5.8952
1.331
2.4099
17,486,314
2,966,207
3.6
kk-bpe-32k
32,000
1.6793
4.6724
8.4599
4,981,192
2,966,207
12.9
kk-sp-bpe-32k
32,000
1.758
4.4632
8.0812
5,214,647
2,966,207
11.2
kk-morph-hf-bpe-32k
32,000
1.7608
4.4561
8.0682
5,223,030
2,966,207
62.7
kk-sp-unigram-32k
32,000
1.7617
4.454
8.0645
5,225,471
2,966,207
4.1
kk-morph-sp-unigram-32k
32,000
1.9449
4.0344
7.3048
5,768,923
2,966,207
8.5
kk-hf-unigram-32k
32,000
2.0264
3.8722
7.011
6,010,620
2,966,207
23.8
XLM-R
250,002
2.1811
3.5974
6.5136
6,469,672
2,966,207
16.5
kk-morph-hf-unigram-32k
32,000
2.3461
3.3445
6.0556
6,958,922
2,966,207
27
GPT-4o (o200k)
200,019
2.5986
3.0196
5.4672
7,707,849
2,966,207
4.9
mBERT
119,547
2.9292
2.6787
4.8502
8,688,494
2,966,207
13.4
Qwen2.5
151,643
4.7862
1.6394
2.9683
14,196,803
2,966,207
17.4
Llama-3
128,000
4.8033
1.6336
2.9577
14,247,604
2,966,207
16
GPT-4 (cl100k)
100,277
5.8952
1.331
2.4099
17,486,314
2,966,207
3.6

Kazakh Tokenizer Fertility Baseline

Reproducible fertility benchmark of subword tokenizers on the Kazakh language. Companion artifact for the paper "Tokenizer Optimization for Kazakh Small Language Models" (in preparation, target: ACM TALLIP).

Headline numbers

Tokenizer Fertility
πŸ₯‡ Best overall kk-bpe-32k 1.679
🚨 Worst GPT-4 (cl100k) 5.895
GPT-4 penalty GPT-4 (cl100k) is 3.51Γ— worse than the best Kazakh-trained tokenizer

β†’ The custom Kazakh BPE tokenizer is 3.51Γ— more efficient than GPT-4 for Kazakh text, which translates to ~72% lower API cost and ~3.5Γ— longer effective context window.

Full ranking (13 tokenizers)

Ours β€” Kazakh-trained, no morphology pre-segmentation

Tokenizer Vocab Fertility ↓ Chars/Token ↑
kk-bpe-32k 32,000 1.679 4.672
kk-sp-bpe-32k 32,000 1.758 4.463
kk-sp-unigram-32k 32,000 1.762 4.454
kk-hf-unigram-32k 32,000 2.026 3.872

Ours β€” Kazakh-trained, morphology-aware (Morfessor β†’ tokenizer)

Tokenizer Vocab Fertility ↓ Chars/Token ↑
kk-morph-hf-bpe-32k 32,000 1.761 4.456
kk-morph-sp-unigram-32k 32,000 1.945 4.034
kk-morph-hf-unigram-32k 32,000 2.346 3.345

Reference β€” multilingual / industry tokenizers

Tokenizer Vocab Fertility ↓ Chars/Token ↑
XLM-R 250,002 2.181 3.597
GPT-4o (o200k) 200,019 2.599 3.020
mBERT 119,547 2.929 2.679
Qwen2.5 151,643 4.786 1.639
Llama-3 128,000 4.803 1.634
GPT-4 (cl100k) 100,277 5.895 1.331

Methodology

Held-out evaluation set: 2,966,207 whitespace-words (β‰ˆ15K documents) from the validation split of Abzalbek89/corpus_clean.

Metrics:

  • Fertility = total tokens / total whitespace-words (lower is better).
  • Compression (chars/token) = total characters / total tokens (higher is better).
  • Compression (bytes/token) = total UTF-8 bytes / total tokens (higher is better).

Trained tokenizers (vocab = 32,000, all share the same training corpus):

  • kk-bpe-32k β€” HF tokenizers ByteLevel BPE
  • kk-sp-bpe-32k β€” SentencePiece BPE (character_coverage=1.0, NFKC)
  • kk-sp-unigram-32k β€” SentencePiece Unigram
  • kk-hf-unigram-32k β€” HF tokenizers Unigram with ByteLevel pre-tok
  • kk-morph-hf-bpe-32k β€” HF BPE on Morfessor-segmented corpus
  • kk-morph-hf-unigram-32k β€” HF Unigram on Morfessor-segmented corpus
  • kk-morph-sp-unigram-32k β€” SentencePiece Unigram on Morfessor-segmented corpus

Reference tokenizers: mBERT, XLM-R, Llama-3, Qwen 2.5, GPT-4 (cl100k_base), GPT-4o (o200k_base).

Files

Path Description
experiment.py v1 β€” single Unigram baseline
experiment_v2.py v2 β€” extended (BPE/Unigram across libraries)
experiment_v3_fix.py v2 fix β€” re-measure SentencePiece tokenizers via raw SentencePieceProcessor
experiment_morph.py Experiment 2 β€” morphology-aware variants
morfessor.bin trained Morfessor segmentation model (top-1M Kazakh words)
v2/fertility_v2.csv, .json, .png fixed v2 numbers
v3/fertility_v3.csv, .json, .png extended v3 numbers (with morph-aware)
v3/RESULTS_V3.md human-readable v3 report

Reproducing

On a vast.ai / RunPod / Colab instance with β‰₯30GB disk and β‰₯16GB RAM:

pip install 'datasets>=2.14' 'transformers>=4.45' 'tokenizers>=0.20' \
            'sentencepiece>=0.2.0' 'huggingface_hub>=0.25' \
            tiktoken matplotlib morfessor

export HF_TOKEN=hf_...   # write access
export HF_USER=Abzalbek89

curl -fsSL -o experiment_morph.py \
  https://huggingface.co/datasets/Abzalbek89/kk-tokenizer-fertility-baseline/resolve/main/experiment_morph.py
python experiment_morph.py

Total runtime: ~30 min on cached Morfessor model, ~70 min cold start.

Companion tokenizer repos

ΒΉ Morphology-aware variants β€” apply Morfessor (morfessor.bin in this repo) before encoding.

Citation

@misc{kk_tokenizer_fertility_2026,
  title        = {Kazakh Tokenizer Fertility Baseline},
  author       = {Abzalbek Ulasbek},
  year         = {2026},
  howpublished = {\url{https://huggingface.co/datasets/Abzalbek89/kk-tokenizer-fertility-baseline}},
}

License

Apache 2.0


Last updated: fertility_v3.csv (13 tokenizers)

Downloads last month
354