--- language: - hi - ne license: cc-by-4.0 task_categories: - text-generation tags: - hindi - nepali - devanagari - pretraining-corpus --- # LMA Phase 1 --- Hindi and Nepali pretraining corpora Two monolingual corpora built for a pair of ~25M-parameter decoder-only Transformers. Hindi is the higher-resource language, Nepali the lower-resource one. Both are written in Devanagari (U+0900-U+097F), so **script cannot be used to tell them apart** --- separating them is the central technical problem this dataset solves rather than assumes. | language | documents | characters | manual (chars) | tokens | manual (tokens) | train | val | test | unseen domain | |---|---|---|---|---|---|---|---|---|---| | Hindi | 5,094,185 | 2.588B | 23.1% | 655.2M | 24.5% | 3,564,832 | 762,609 | 763,607 | 3,137 (bbc_hindi) | | Nepali | 6,755,888 | 2.513B | 22.0% | 558.9M | 22.0% | 4,726,832 | 1,014,710 | 1,011,740 | 2,606 (nagarik_news) | Both corpora clear the project's requirement that at least 20% of final tokens come from manually collected text. ## Nepali was downsampled, Hindi was not Nepali's cleaned corpus held 9,031,132 download documents against 207,956 manual ones, a manual share of 17.0% by characters -- below the 20% the project requires. Manual text is the scarce side and cannot be conjured, so the download bucket was thinned instead: 6,547,932 documents kept out of 9,031,132 (72.5%), lifting the manual share to 22.0%. The selection is a seeded shuffle accumulating to a character budget, so it is uniform over documents and leaves the length distribution unchanged; keeping the longest documents instead would have biased the tokenizer's training data. Only the download bucket was touched, because it is a single source (IndicCorp v2) and thinning it costs no register diversity, unlike the manual bucket which carries all the literature, encyclopedic and long-form text. **Nothing was deleted.** `stage2.jsonl` is intact and the selection lives in a committed list of document ids, so a choice that turns out wrong is fixed by regenerating one text file rather than by re-downloading and re-cleaning. The files published here are the downsampled corpus. Hindi needed none of this: at 23.1% manual it already cleared the floor, and trimming it would have shrunk the corpus for no benefit. ## Layout ``` hindi/raw/ what the collectors fetched, unmodified hindi/clean/ after the nine cleaning stages hindi/tokenized/ one line per document, with the actual token pieces nepali/... the same three ``` All files are gzipped JSONL, one JSON object per line. For a browsable copy of the tokenized data, see the Kaggle mirrors linked at the end. **A note on the `clean/` files for Nepali.** `stage2.jsonl` there holds all 9,239,088 cleaned documents, which is the corpus *before* downsampling. The 6,755,888-document selection published as the Nepali corpus is defined by the committed id list, not by a separate file. Use the split id lists if you want exactly the corpus described in the table above. ## Provenance Two buckets. **download** is IndicCorp v2, a public corpus. **manual** is text whose fetching and cleaning code was written for this project --- news sitemaps and link crawls, MediaWiki API harvests, and literature sites. Every document carries a `doc_id` of the form `:::`, so any line can be traced to the source and the collection run that produced it. ## Cleaning Nine stages in two passes. Pass 1 streams: Unicode NFC and Indic normalization; a Hindi/Nepali language-ID ensemble; foreign-script repair and removal; quality filters (length, script ratio, symbols, digits, repetition, PII anonymisation); exact deduplication by content hash; and CCNet-style learned filters. Pass 2 needs the whole corpus at once: paragraph deduplication, then MinHash+LSH near-duplicate removal at Jaccard 0.8. Verification is part of the pipeline, not an afterthought: **0 foreign letters across all 14,333,273 documents**, and five independent layers checking that the two corpora share nothing --- including a character n-gram classifier that separates them at 100% accuracy. ## Splits Document level, never line level, stratified by source, seed 1337, **70/15/15 by characters**. One entire source is additionally held out per language as an unseen-domain test set (`bbc_hindi`, `nagarik_news`), which measures how the model handles text whose house style it has never seen. **Splits were made before the tokenizer was trained**, so the tokenizer never saw validation or test text. Cross-split near-duplicate leakage was measured after splitting: **zero** in both languages. ## Tokenized files Produced by the tokenizers at [meet5568/lma_models](https://huggingface.co/meet5568/lma_models) --- unigram 10,000 for both languages. Each line stores the token **pieces** rather than numeric ids: ```json {"doc_id": "hi:manual:bbc_hindi:f79a...", "bucket": "manual", "source": "bbc_hindi", "n_tokens": 256, "text": "एशियाई खेलः पाकिस्तान ने भारत को हराया ...", "tokens": ["▁एशियाई", "▁खेल", "ः", "▁पाकिस्तान", "▁ने"]} ``` Ids are one `piece_to_id` lookup away and storing both would add ~2 GB per language for no new information. ## Browsable mirrors The gzipped files here cannot be previewed in a browser. The tokenized data is also on Kaggle, where it can be read directly: - https://kaggle.com/datasets/meet6868/lma-hindi-corpus - https://kaggle.com/datasets/meet6868/lma-nepali-corpus ## Limitations Web-scraped text carries the biases of what is published online: news dominates, and formal registers are over-represented relative to conversational Nepali and Hindi. PII is anonymised with placeholders rather than removed. Contamination between the two languages was one-directional before cleaning --- Nepali documents misidentified as Hindi outnumbered the reverse by roughly 120x, which is why the language-ID stage runs before the cheap filters.