Datasets:
The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
Error code: DatasetGenerationError
Exception: CastError
Message: Couldn't cast
text: string
language: string
source: string
dataset: string
register: string
licence: string
collection: string
identifier: string
title: string
year: null
content_sha256_16: string
cluster_id: int64
split: string
file: string
pages_kept: int64
to
{'text': Value('string'), 'language': Value('string'), 'source': Value('string'), 'dataset': Value('string'), 'register': Value('string'), 'licence': Value('string'), 'collection': Value('string'), 'identifier': Value('string'), 'title': Value('string'), 'year': Value('int64'), 'content_sha256_16': Value('string'), 'cluster_id': Value('int64'), 'split': Value('string')}
because column names don't match
Traceback: Traceback (most recent call last):
File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1827, in _prepare_split_single
for key, table in generator:
^^^^^^^^^
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 613, in wrapped
for item in generator(*args, **kwargs):
~~~~~~~~~^^^^^^^^^^^^^^^^^
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 2306, in cast_table_to_schema
raise CastError(
...<3 lines>...
)
datasets.table.CastError: Couldn't cast
text: string
language: string
source: string
dataset: string
register: string
licence: string
collection: string
identifier: string
title: string
year: null
content_sha256_16: string
cluster_id: int64
split: string
file: string
pages_kept: int64
to
{'text': Value('string'), 'language': Value('string'), 'source': Value('string'), 'dataset': Value('string'), 'register': Value('string'), 'licence': Value('string'), 'collection': Value('string'), 'identifier': Value('string'), 'title': Value('string'), 'year': Value('int64'), 'content_sha256_16': Value('string'), 'cluster_id': Value('int64'), 'split': Value('string')}
because column names don't match
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 1694, 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 1880, in _prepare_split_single
raise DatasetGenerationError("An error occurred while generating the dataset") from e
datasets.exceptions.DatasetGenerationError: An error occurred while generating the datasetNeed help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
text string | language string | source string | dataset string | register string | licence string | collection string | identifier string | title string | year int64 | content_sha256_16 string | cluster_id int64 | split string |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
"कला १\n\nनेपाल सरकार\nशिक्षा, विज्ञान तथ(...TRUNCATED) | nepali | internet-archive | archive.org | books | see item metadata | downloaded | sanskrit-grade-1 | Sanskrit Grade 1 | null | 79306b4d16a524d9 | 1 | train |
"३% नमः शिवाय\nभगवान् वेदव्यासद्वारा प(...TRUNCATED) | nepali | internet-archive | archive.org | books | see item metadata | downloaded | 20230920_20230920_0856 | Himavatkhanda - Skanda Purana | 2,023 | a5e9b36d4abd28ed | 3 | train |
") के ! 0000 हि हर त्य\n\n|\n४ $ है ;\n\\ ह |\n0४४ हि ¢ ॥ ॥) (...TRUNCATED) | nepali | internet-archive | archive.org | books | see item metadata | downloaded | holy-quran-translation-in-nepali-language | Holy Quran Translation in Nepali (नेपाली) Language | 2,020 | 2afcf85c55a5d4a3 | 4 | train |
"गरुड पुराण नेपाली भाषाटीका प्रारम्भ\n(...TRUNCATED) | nepali | internet-archive | archive.org | books | see item metadata | downloaded | garud-puran-nepali-bhasha-tika | Garud Puran Nepali Bhasha Tika | null | 9c3349984d85da6d | 5 | train |
"|\n\nनेपाली\nनेपालभाषा\nशब्दावली\n\nव्कष्(...TRUNCATED) | nepali | internet-archive | archive.org | books | see item metadata | downloaded | nepali-nepalbhasha-shabdavali-edited-by-krishna-prakash-shrestha | "नेपाली नेपालभाषा शब्दावली - कृष्णप्र(...TRUNCATED) | null | 69ee342584bf79fa | 6 | train |
"प्र\n|\n\nम ह |\nन\n\nभूमिका\n\nहाम्रो देशमा उप(...TRUNCATED) | nepali | internet-archive | archive.org | books | see item metadata | downloaded | NepalmaBauddhaDharmaBhuvanLalPradhan | "नेपालमा बौद्धधर्म, भुवनलाल प्रधान Nepalma(...TRUNCATED) | null | 069e108a6fe93be8 | 7 | train |
"(५ 0 ।\n३. की |\n१, ची 7] क ५ | ५ ग ५ ७ न\n|\n+ | कु 07 | १५ (...TRUNCATED) | nepali | internet-archive | archive.org | books | see item metadata | downloaded | bhimsen-thapa-ra-tatkalin-nepal-by-chittaranjan-nepali | "जनरल भीमसेन थापा र तत्कालीन नेपाल - चि(...TRUNCATED) | null | be70213205de75ab | 8 | train |
"नेपाल\n\nर\nनेवाल\nमूलतः ऋग्वेदिक शब्द\n\n(...TRUNCATED) | nepali | internet-archive | archive.org | books | see item metadata | downloaded | nepal-ra-newal-moolatah-rigvaidik-shabda-by-shivaraj-sharma | "नेपाल र नेवाल मूलत: ऋग्वैदिक शब्द (शिव(...TRUNCATED) | null | 2f48fab1505ef674 | 9 | train |
"साहित्यको\n\nमातभाषा सा\nइतिहास\n\nगुकार(...TRUNCATED) | nepali | internet-archive | archive.org | books | see item metadata | downloaded | nepalbhasha-sahityako-itihas-rajan-lal-ras-joshi | "नेपालभाषा साहित्यको इतिहास (राजनलाल (...TRUNCATED) | null | 01bdf0ce3f826e32 | 10 | train |
"ह\n\n(संस्क्तशास्त्रम्)\n\nएच्छिकम्\nनवमद(...TRUNCATED) | nepali | internet-archive | archive.org | books | see item metadata | downloaded | sanskrit-vyakranam-2-9-10 | Sanskrit Vyakranam 2 9 10 | null | 728224c34cd22278 | 11 | train |
Nepali Monolingual Pretraining Corpus (Model L)
Corpus and tokenizer for Model L, the lower-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 Nepali side only. The Tamil side is
tamil-corpus;
a combined mirror of both lives at
nepali-tamil-corpus.
Dataset summary
| Raw | Clean (final, post-cap) | |
|---|---|---|
| Documents | 1,130,886 | 857,643 (train 823,831 / val 17,858 / test 15,954) |
| Size | 8.53 GB | ~6.9 GB |
| Tokens (exact, frozen tokenizer) | 763.4M | 536.65M |
All counts are exact — encoded with this repository's own frozen SentencePiece model, not estimated from a bytes-per-token constant.
Collection split, and the 20% floor
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, uncapped | Clean, final (post-cap) | |
|---|---|---|---|
| Manual | 156.6M (20.5%) | 17.3% | 113.72M (~21.18%) |
| Downloaded | 606.8M (79.5%) | — | 422.93M |
Nepali cleared 20% on the raw corpus, but manual content survives cleaning at a lower
rate than downloaded content (legal/government OCR text in particular — see Known
Issues), so the clean-but-uncapped corpus fell back under the floor. Rather than
resuming collection to chase the clean number directly, scripts/balance_mix.py drops
downloaded documents until manual reaches 20%, keeping every manually-collected token —
legitimate because the corpus is already well past the 500M target, so there is
downloaded volume to spare. Which documents are dropped is decided by
content_sha256_16: sorting by that hash and keeping a prefix is deterministic across
re-runs, independent of file order, and uncorrelated with source, register and length,
so the downloaded side's internal composition is left statistically unchanged. The cap
is applied per split, and uncapped splits are preserved alongside as
<split>_uncapped.jsonl so the decision stays auditable and reversible.
Final result clears both requirements with margin, not exactly on the line: 536.65M total tokens (target ~500M), ~21.18% manual (floor 20%).
Why Nepali was the harder collection target
Stated plainly, because it shaped the corpus:
- Nepali Wikipedia is small — ~30,000 real articles once localized MediaWiki namespace pages are filtered out. Once exhausted, the crawl's largest single manual channel drops to near-zero yield. This is a ceiling on the source, not a tooling gap.
- A PDF text-layer bug cost tokens rather than adding them. Nepal parliament records
and
supremecourt.gov.nplaw-journal volumes embed text layers that pass every quality guard while silently dropping Devanagari conjuncts and matras. Verified by OCRing the same pages and diffing. 8.8M already-extracted tokens were discarded and re-OCR'd rather than kept. - A crawler pagination trap burned roughly an hour of collection time. Two government
domains (
heoc.mohp.gov.np,koshi.gov.np) served "next page" links that appended rather than replaced a query parameter; following them recursively inflated one logical page into ~410,000 distinct-looking URLs across the two. Caught by comparing kept-document growth against fetch volume, then fixed and the poisoned frontier purged. - A cleaning filter bug cost more manual tokens than any of the above. The
line-punctuation filter (exists to catch nav menus and link farms) was initially
applied to
legal/governmentregisters and rejected 89% ofsupremecourt.gov.npvolumes, because judgment headers are structured metadata one field per line that correctly ends in no danda. Fixing the register exemption recovered ~28M clean manual tokens — the single largest correction made during collection. See Known Issues.
Also worth recording: a WordPress frontier-plumbing filter (dropping REST-API,
duplicate share-link, and RSS-feed URLs, which were 66.4% of sahityasangraha.com's
queued frontier) roughly tripled effective crawl throughput late in collection.
Repository layout
raw/ unfiltered collected corpus, one JSONL shard per source
clean/ train.jsonl / val.jsonl / test.jsonl (final, post-cap)
+ train_uncapped.jsonl / val_uncapped.jsonl / test_uncapped.jsonl
+ manifest.json + rejected.jsonl
tokenizer/ nepali.model, nepali.vocab, config.json, stats.json, examples.json
Every document carries source, licence, register, collection (manual /
downloaded), content_sha256_16, and extractor version.
Sources
Manual collection spans 42 crawled domains plus OCR and PDF extraction:
- Legal —
nkp.gov.np(8,698 Supreme Court judgments, full BS 2015–2083 walk, 73.8% cleaning survival),supremecourt.gov.nplaw-journal volumes (221 PDFs, 98.1% survival),lawcommission.gov.np,molcpa.gov.npstatute text. - Government — 16 ministry/provincial domains (
npc.gov.np,mof.gov.np,moha.gov.np,mohp.gov.np,ird.gov.np,koshi.gov.np,bagmati.gov.np,nsonepal.gov.np, …), Nepal parliament verbatim records. - Encyclopedic / reference —
ne.wikipedia.org,ne.wiktionary.org,ne.wikibooks.org(CC BY-SA 4.0).ne.wikisource.org/ne.wikiquote.orgwere checked and found not to exist as live wikis (api.phpreturns HTML, not JSON). - Literature —
sahityapost.com,nepalisahitya.com,sahityasagar.net,sahityasangraha.com, public-domain Internet Archive texts. - News — a set of Nepali outlets disjoint from the downloaded IRIIS archive, checked against a 99-domain do-not-recrawl list so nothing already downloaded was re-crawled.
Downloaded components: IRIIS news archive (209.1M tokens), Internet Archive book text derivatives (190.9M), Sangraha verified + unverified (204.1M), OPUS/OpenSubtitles.
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) | 1.6365 |
| Characters per token | 3.7755 |
| Bytes per token | 10.0235 |
| Unknown-token rate | 0.0 |
| Byte-fallback rate | 0.000049 |
| Vocabulary utilisation | 85.4% |
| Sequence length p50 / p95 / p99 | 14 / 29 / 78 |
Vocabulary size was selected empirically: a sweep over 8k/16k/24k/32k/48k × {BPE, Unigram} gated on lossless round-trip, zero unknowns, ≥60% held-out utilisation, and an embedding table ≤50% of the ~25M parameter budget, then lowest fertility among survivors — 32k cleared the utilisation gate at 85.7% (48k rejected: embedding would be 74% of budget). A downstream A/B (bits-per-byte, trained not asserted) independently confirmed 32k over 24k. Extended 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) run separately for this language, not inferred from Tamil:
| Vocab | Layers | Params | BPB (↓ better) | Perplexity |
|---|---|---|---|---|
| 8,000 | 12 | 24.5M | 0.7966 | 169.29 |
| 16,000 | 10 | 24.1M | 0.7643 | 299.95 |
| 24,000 | 9 | 25.4M | 0.7445 | 359.12 |
| 32,000 | 7 | 24.9M | 0.7375 | 411.07 |
Monotonic — every step up in vocabulary improved bits-per-byte, 7.42% total from 8k to
32k, the same pattern found independently on Tamil (6.00% margin, see the Tamil card).
32k wins in both languages; see report/phase1.md §3.1.2 for the combined result and
figures/vocab_ab_bpb.png for both languages' curves together.
Nepali needed one cross-check the Tamil freeze didn't: the sweep's own fertility (1.324) undersold the frozen result (1.6365) by 24%. Verified the frozen model itself was correct — evaluating it on the sweep's own held-out text reproduced 1.320, matching the sweep almost exactly — and ruled out a source-mix bug (legal-register share was ~4% in both the sweep sample and the real validation split). 1.6365 is reported as authoritative since it is measured against the model's actual held-out split of the actual shipped corpus.
Language purity
Nepali and Hindi share the Devanagari block, so a script-ratio filter cannot separate them. A monolingual gate rejects documents on positive evidence of Hindi rather than on absence of Nepali markers — measurement showed 15.7% of documents return "insufficient signal" (overwhelmingly short but genuinely Nepali) against only 0.3% with actual Hindi evidence, so failing closed would have discarded roughly 50× more good text than bad. The gate fired on 412 of 1,130,886 documents in the final clean (0.04%), independently confirming that measurement. Internet Archive material, whose uploader language tags are unreliable, is additionally gated fail-closed at ingest.
Cleaning pipeline
Follows FineWeb-2 (Penedo et al., 2025, arXiv:2506.20920) with multilingual
corrections — C4 filters not applied, char_duplicates_ratio 0.1 rather than the English
0.01, paragraph-level Gopher repetition disabled, NFC-only normalisation (NFKC would
rewrite Devanagari conjuncts).
Two Nepali-specific additions:
strip_latin_segments— English boilerplate scraped alongside Nepali text sits in its own clause between danda (।), pipe or newline separators, so a clause-level majority vote removes it wholesale rather than leaving fragments.- Register-aware repetition tolerance. Statute and judgment text is legitimately
formulaic — fixed formulae, party and statute names restated in full on every reference.
Measured on this corpus, legal documents sit at a median duplicate-5-gram character
fraction of ~0.22 against a 0.15 web threshold while reading as clean prose. Applying
the web threshold unmodified left
nkp.gov.np— the largest single manual source — surviving cleaning at 2%. Legal and government registers get a 2.0× multiplier, which admits the genre while still rejecting genuinely degenerate text.
Plus MinHash LSH near-duplicate detection (14 bands × 8 hashes, 5-grams) and PII redaction of emails and public IPv4 addresses.
Overall cleaning survival: 89.4% (1,010,981 of 1,130,886 documents), notably higher than Tamil's 78.7% — Nepali's Gopher stop-word rejection is 0.2% of the corpus vs. Tamil's 10.3%, consistent with a corpus weighted more toward long-form legal/government/news prose and less toward short Wikipedia stubs.
Known issues
The line_punct filter bug, described above, is the largest single data-quality
finding for this corpus: it silently rejected 89% of supremecourt.gov.np volumes and
73% of nkp.gov.np judgments before being caught by inspecting rejected documents
directly (not just the reject count) and confirming they were clean, well-formed legal
prose. Fixed by exempting legal/government registers from the filter, the same
exemption already granted to verse and scanned books for the identical reason (headers
and line-broken text legitimately lack terminal punctuation).
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, CC BY-SA wiki content), Government of Nepal official
publications, and copyrighted news and literary text retained under a non-commercial
academic research use rationale recorded per source.
Downloaded components retain their upstream licences (IRIIS, Sangraha, OPUS). 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
- 15