Datasets:

Languages:
Tamil
ArXiv:
License:
Dataset Viewer
Duplicate
The dataset viewer is not available for this split.
Cannot load the dataset split (in streaming mode) to extract the first rows.
Error code:   StreamingRowsError
Exception:    TypeError
Message:      Couldn't cast array of type int64 to null
Traceback:    Traceback (most recent call last):
                File "/src/services/worker/src/worker/utils.py", line 147, in get_rows_or_raise
                  return get_rows(
                      dataset=dataset,
                  ...<4 lines>...
                      column_names=column_names,
                  )
                File "/src/libs/libcommon/src/libcommon/utils.py", line 272, in decorator
                  return func(*args, **kwargs)
                File "/src/services/worker/src/worker/utils.py", line 127, in get_rows
                  rows_plus_one = list(itertools.islice(safe_iter(ds, dataset=dataset), rows_max_number + 1))
                File "/src/services/worker/src/worker/utils.py", line 483, in safe_iter
                  yield from ds.decode(False) if ds.features else ds
                File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 2840, in __iter__
                  for key, example in ex_iterable:
                                      ^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 2373, in __iter__
                  for key, pa_table in self._iter_arrow():
                                       ~~~~~~~~~~~~~~~~^^
                File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 2398, in _iter_arrow
                  for key, pa_table in self.ex_iterable._iter_arrow():
                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
                File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 536, in _iter_arrow
                  for key, pa_table in iterator:
                                       ^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 419, in _iter_arrow
                  for key, pa_table in self.generate_tables_fn(**gen_kwags):
                                       ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/packaged_modules/json/json.py", line 343, in _generate_tables
                  self._cast_table(pa_table, json_field_paths=json_field_paths),
                  ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/packaged_modules/json/json.py", line 132, in _cast_table
                  pa_table = table_cast(pa_table, self.info.features.arrow_schema)
                File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2378, in table_cast
                  return cast_table_to_schema(table, schema)
                File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2312, in cast_table_to_schema
                  cast_array_to_feature(
                  ~~~~~~~~~~~~~~~~~~~~~^
                      table[name] if name in table_column_names else pa.array([None] * len(table), type=schema.field(name).type),
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                      feature,
                      ^^^^^^^^
                  )
                  ^
                File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 1861, in wrapper
                  return pa.chunked_array([func(chunk, *args, **kwargs) for chunk in array.chunks])
                                           ~~~~^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2152, in cast_array_to_feature
                  return array_cast(
                      array,
                  ...<2 lines>...
                      allow_decimal_to_str=allow_decimal_to_str,
                  )
                File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 1863, in wrapper
                  return func(array, *args, **kwargs)
                File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2014, in array_cast
                  raise TypeError(f"Couldn't cast array of type {_short_str(array.type)} to {_short_str(pa_type)}")
              TypeError: Couldn't cast array of type int64 to null

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.

Tamil Monolingual Pretraining Corpus (Model H)

Corpus and tokenizer for Model H, the higher-resource half of a two-model coursework project (Language Models and Agents, Monsoon 2026) that trains two completely independent ~25M-parameter decoder-only Transformers — one Tamil, one Nepali.

The two models share no data, tokenizer, vocabulary, or weights. This repository holds the Tamil side only. The Nepali side is nepali-corpus; a combined mirror of both lives at nepali-tamil-corpus.

Dataset summary

Raw Cleaned
Documents 960,450 756,206 (78.7% survival)
Size 9.40 GB 7.96 GB
Tokens 824.0M 661.83M

All counts are exact — encoded with this repository's own frozen SentencePiece model, not estimated from a bytes-per-token constant.

Collection split

The parent assignment requires at least 20% of training tokens to come from manual collection (own crawling, scraping and OCR) rather than downloaded public corpora.

Raw Clean
Manual 190.5M (23.1%) 139.14M (21.02%)
Downloaded 633.5M (76.9%) 522.69M

Tamil clears the floor natively on both raw and clean counts; no rebalancing was applied.

Splits

Document-level, 96/2/2, assigned deterministically by content hash. No document appears in more than one split, and cross-set deduplication ran against the downloaded corpora before splitting.

Split Documents Tokens Manual share
train 726,016 635.47M 21.08%
validation 15,029 13.66M 20.30%
test 15,161 12.70M 18.95%

Repository layout

raw/          unfiltered collected corpus, one JSONL shard per source
clean/        train.jsonl / val.jsonl / test.jsonl + manifest.json + rejected.jsonl
tokenizer/    tamil.model, tamil.vocab, config.json, stats.json, examples.json

Every document carries source, licence, register, collection (manual / downloaded), content_sha256_16, and extractor version, so the manual-vs-downloaded split above is auditable rather than asserted.

Tokenizer

SentencePiece BPE, 32,000 vocabulary, trained from scratch on this corpus (no pretrained tokenizer). Measured on the held-out validation split:

Metric Value
Fertility (tokens/word) 2.0916
Characters per token 3.7403
Bytes per token 10.1238
Unknown-token rate 0.0
Byte-fallback rate 0.0
Vocabulary utilisation 78.5%
Sequence length p50 / p95 / p99 9 / 16 / 22

The zero unknown-token rate is guaranteed by construction, not an empirical result: byte_fallback=True means any unrepresentable character decomposes into byte tokens rather than <unk>. The byte-fallback rate is the honest form of the same question, and it is also 0.0 — the learned vocabulary covered every character in the validation split.

Vocabulary size was selected empirically, not by heuristic: a sweep over 8k/16k/24k/32k/48k × {BPE, Unigram} gated on lossless round-trip, zero unknowns, ≥60% held-out vocabulary utilisation, and an embedding table ≤50% of the ~25M parameter budget, then lowest fertility among survivors. 48k had better fertility (1.990) but its embedding table would consume 74% of the model budget, leaving under four transformer layers.

Tamil's fertility is materially worse than Nepali's at every vocabulary size (16k: 2.291 vs 1.431; 32k: 2.087 vs 1.324) — an agglutinative-vs-inflectional difference, stable across the grid, not a budget artifact. Consequence: at a fixed token budget this model sees roughly a third less text than the Nepali model, which is why the downstream evaluation leads with bits-per-byte rather than perplexity.

Was 32k too large? Tested rather than assumed, after noting the embedding table is 49% of the parameter budget at 32k vs. 12% at 8k. Extended the A/B to four arms (8k/16k/24k/32k), each sized near 25M parameters so a result can't be explained by one arm being a bigger model, compared at equal bytes:

Vocab Layers Params BPB (↓ better) Perplexity
8,000 12 24.5M 0.7448 124.07
16,000 10 24.1M 0.7245 241.57
24,000 9 25.4M 0.7114 320.36
32,000 7 24.9M 0.7001 371.48

Monotonic — every step up in vocabulary improved BPB, 6.00% total, against the known bias of short proxy runs toward smaller vocabularies. Perplexity ranks the four arms in exactly the reverse order, the cleanest demonstration in this project of why it is not comparable across tokenizers.

Cleaning pipeline

Parameters follow FineWeb-2 (Penedo et al., 2025, arXiv:2506.20920), the current reference for multilingual pretraining data, because several English-tuned defaults are actively harmful outside English:

  • C4 filters are not applied — measured to degrade performance multilingually.
  • char_duplicates_ratio is 0.1, not the English 0.01.
  • Paragraph-level Gopher repetition filters are disabled — the extractor does not preserve paragraph structure, so those ratios would score extraction, not text.
  • Normalisation is NFC only. NFKC rewrites conjuncts and compatibility forms that carry real orthographic distinctions in Tamil.

Also applied: Gopher quality and repetition filters, a FineWeb line-punctuation filter (disabled for verse, books and subtitles, where unterminated lines are the norm rather than a defect), running-header stripping for OCR'd page scans, PII redaction of emails and public IPv4 addresses, and MinHash LSH near-duplicate detection (14 bands × 8 hashes, 5-grams) with duplicate-cluster sizes retained for optional upsampling.

Rejection breakdown, largest first:

Reason Documents Share
gopher_qual:no_stop_words 99,149 10.3%
gopher_rep:dup_5gram 54,970 5.7%
near_duplicate 20,929 2.2%
fw_qual:line_punct 9,008 0.9%
other repetition n-gram filters 18,312 1.9%
everything else 86 0.0%

Survival varies sharply by source, which is itself a signal: internet-archive 99.1%, solvanam.com 93.3%, keetru.com 86.2%, sangraha-verified 82.3%, ta.wikisource.org 76.7%, ta.wikipedia.org 53.2%, ta.wikibooks.org 29.4%. The low Wikipedia-family numbers are stubs and list-shaped articles failing the stop-word gate, not a misfiring filter.

Known limitations

  • A small amount of subtitle text has its vowel signs stripped. Confined entirely to opensubtitles-opus: 1,078 of 23,326 documents (4.6% of that source). Affected text reads அவர்கள் ஏதவதஒன்ற… where it should read அவர்கள் ஏதாவது ஒன்று… — matras dropped and word boundaries lost. Since subtitles are 1.5% of the corpus this is ~0.06% of Tamil overall, too small to shift BPE merge statistics, so it is reported rather than removed. It survived cleaning; a matra-ratio filter would catch it on a rebuild.
  • OCR noise is present in book-sourced text — e.g. Tamil digit eight (௮) substituted for the letter அ, stray punctuation from scan artifacts. This is a property of the source scans, not of the pipeline.
  • Register is news-heavy. Long-form literary and legal text is present but is a minority of tokens.

Licensing and provenance

Mixed, per document. This is a research corpus assembled for a coursework project and is not a single-licence redistribution. Every record carries its own licence field; consult it before reuse. Broadly:

  • Public-domain and openly-licensed material (Internet Archive public-domain texts, Project Madurai, CC BY-SA wiki content).
  • Government and institutional publications.
  • Copyrighted news and literary text retained under a non-commercial academic research use rationale, recorded per source.

Downloaded components retain their upstream licences (Sangraha, OPUS/OpenSubtitles, Wikipedia dumps). If you intend to redistribute or use this commercially, you must re-derive rights per source — do not treat this repository as a blanket grant.

Citation

Corpus assembled for the Individual Project, Language Models and Agents, Monsoon 2026. Cleaning methodology follows Penedo et al., FineWeb-2 (arXiv:2506.20920) and Rae et al., Gopher (arXiv:2112.11446).

Downloads last month
34

Papers for LMA-Project-Resources-Vijay/tamil-corpus