Dataset Viewer

The dataset viewer should be available soon. Please retry later.

QuranLab — Qur'an and Hadith Training Mix

Training-ready data derived from the QuranLab corpora: continued-pretraining text, grounded instruction data, preference pairs, verifiable prompts, retrieval pairs and a held-out evaluation set — all built on the same verse and ḥadīth keys as quranlab/quran and quranlab/hadith.

QuranLab is a volunteer effort. Our aim is to present these works carefully and at high quality, and to help them travel faithfully — in the spirit in which they were written — not to claim them as ours.

The corpora behind this mix reach you through the work of Tanzil Project, fawazahmed0/quran-api, QuranEnc.com, Tafsir Center for Quranic Studies and Quranic Universal Library (QUL), among others. Who to thank, and what we consulted without ever quoting, is set out in SOURCES.md.

The cpt subset carries a meta.mix_weight per row: the raw corpus is dominated by classical commentary, so the weights rebalance it (tafsīr 57% → 30%, Qur'anic text 0.3% → 10%) without discarding text. The recipe is in cpt_mixture.yaml.

The emphasis throughout is on models that cite what they use and decline what they cannot support: a large share of the instruction and preference data teaches abstention, wrong-context rejection and exact-quote fidelity rather than fluent recall.

Subsets

config rows split
cpt 1,933,774 train
dpo 18,935 train
eval 2,877 test
hard_negatives 9,094 train
rag_chunks 503,489 train
reranker 3,070 train
retriever 3,070 train
rlvr 9,000 train
sft 23,935 train
source_edges 1,950,107 train
source_units 2,027,763 train

Scope

This mix contains Qur'an and ḥadīth derived material only. Risale-i Nur derived rows are governed separately under their own permissions and are excluded here — 406,055 rows were filtered out on export, and a gate re-reads the staging to prove none survived.

Usage

from datasets import load_dataset

sft  = load_dataset("quranlab/islamic-llm-training", "sft",  split="train")
dpo  = load_dataset("quranlab/islamic-llm-training", "dpo",  split="train")
cpt  = load_dataset("quranlab/islamic-llm-training", "cpt",  split="train")
ev   = load_dataset("quranlab/islamic-llm-training", "eval", split="test")

For agents and pipelines

Deterministic facts an automated consumer needs, so nothing has to be inferred from a sample.

  • Config naming: one config per training stage: cpt, sft, dpo, rlvr, retriever, reranker, hard_negatives, eval
  • Join key: meta.source_ids carries the originating verse_key / hadith_key, so any row can be traced back to the source corpora
  • Default config: sft
  • Format: Parquet, one directory per config, split train.
  • Terms and credit are per config in metadata/, never per row — join on the config name when you need them.
  • eval is a held-out split — the sources behind it were removed from the training targets, so keep it out of training.
  • meta.task_type names what a row teaches (abstention, quote repair, grade explanation, …); filter on it to build a focused mix.
  • cpt rows carry meta.mix_weight. The raw corpus is dominated by classical commentary, so sample each source in proportion to its weight rather than reading the file straight through — cpt_mixture.yaml in this repo has the full recipe.

Inspect it without downloading the data:

# every config and split
curl https://datasets-server.huggingface.co/splits?dataset=quranlab/islamic-llm-training

# a first page of rows
curl "https://datasets-server.huggingface.co/first-rows?dataset=quranlab/islamic-llm-training&config=sft&split=train"

# machine-readable schema and provenance (Croissant JSON-LD)
curl https://huggingface.co/api/datasets/quranlab/islamic-llm-training/croissant

Query it in place with SQL — no full download:

hf datasets sql quranlab/islamic-llm-training "SELECT * FROM 'sft' LIMIT 5"
import duckdb
duckdb.sql("SELECT count(*) FROM 'hf://datasets/quranlab/islamic-llm-training/sft/*.parquet'")

Quality, and how to check it yourself

Nothing is released until the integrity gate passes. Every claim below is something you can re-run rather than take on trust — here on the published data, not in our build tree:

What is guaranteed Evidence
Evaluation is genuinely held out whole surahs (19, 36, 55, 112) plus a hash-selected hadith bucket were removed from training targets; measured target leakage is 0
Quotes are exact quoted source text is byte-verified against the corpora rather than paraphrased
Grades are never invented hadith grading rows carry the grader; wrong-grade and wrong-collection traps are included so a model that guesses is caught
Chat format is validated role order and structure are checked on every row before release; violations block the build
Gated material is excluded structurally rows are filtered on their provenance fields, not by text matching, and a post-build gate re-reads the staging to confirm none remain
from datasets import load_dataset

sft = load_dataset("quranlab/islamic-llm-training", "sft", split="train")
roles = {m["role"] for r in sft for m in r["messages"]}
assert roles <= {"system", "user", "assistant"}

# nothing from the gated corpus
assert not any("risale" in str(r["meta"]).lower() for r in sft)

Where a source is genuinely missing, the row is published empty and labelled rather than filled by guessing from a neighbouring entry. Coverage numbers in this card count only real content.

Terms

Public-domain and CC sources are kept verbatim; everything else is included with credit to its author or publisher and removed on request via the Community tab. Per-source terms are documented in the upstream corpora.

Citation

@misc{quranlab_islamic_llm_training_2026,
  title        = {QuranLab — Qur'an and Hadith Training Mix},
  author       = {QuranLab},
  year         = {2026},
  publisher    = {Hugging Face},
  howpublished = {\url{https://huggingface.co/datasets/quranlab/islamic-llm-training}}
}
Downloads last month
-