You need to agree to share your contact information to access this dataset

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this dataset content.

Dataset Card for Badr Fiqh Retrieval Triplets

Dataset Description

Badr Fiqh Retrieval Triplets is an Arabic dataset developed for fine-tuning dense retrieval and sentence-embedding models for Islamic jurisprudence (fiqh). Each sample contains a question–positive–negative training triplet together with the title and primary school of the source book.

The hard negatives are deliberately selected from closely related fiqh contexts. A model must therefore distinguish passages that contain the requested ruling from passages that discuss a related issue without answering the question.

The dataset was introduced in What Makes a Good Fiqh Retriever? Answer Retrieval for Arabic Islamic Jurisprudence.

Dataset Overview

Attribute Description
Language Arabic
Domain Islamic jurisprudence (fiqh)
Task Dense passage retrieval / sentence-embedding fine-tuning
Format Triplets with source and madhhab metadata
Total size 19,319 samples
Training split 18,354 samples
Validation split 965 samples

Associated Resources

Supported Tasks and Uses

The dataset is intended primarily for:

  • fine-tuning dense passage retrievers and sentence-embedding models;
  • contrastive training with objectives such as MultipleNegativesRankingLoss;
  • studying answer-bearing retrieval, where topical similarity alone is not sufficient for relevance.

This release contains fine-tuning triplets. It does not contain the 503-question retrieval test collection described separately in the paper.

Dataset Structure

Data Instance

Each line in the JSONL files follows this structure:

{
  "anchor": "ما هي السنة الأولى من سنن الوضوء التي ذكرها أبو العباس أحمد الصاوي في كتابه حاشية الصاوي؟",
  "positive": "وَهَلْ التَّثْلِيثُ وَالتَّفْرِيقُ...",
  "negative": "...",
  "source_title": "حاشية الصاوي على الشرح الصغير",
  "mazhab": "مالكي"
}

Data Fields

Field Type Description
anchor string An Arabic fiqh question.
positive string The passage containing the ruling needed to answer the question.
negative string A topically related hard negative that does not contain the requested ruling.
source_title string The title of the source book from which the question and positive passage were derived.
mazhab string The primary madhhab associated with the source book: حنفي, مالكي, شافعي, or حنبلي.

The mazhab value represents the primary school of the source book and its author.

Source Books

source_title mazhab
الإنصاف حنبلي
الجوهرة النيرة حنفي
حاشية الصاوي على الشرح الصغير مالكي
حاشيتا قليوبي وعميرة شافعي
درر الحكام شرح غرر الأحكام حنفي

Data Splits

Split Samples
Train 18,354
Validation 965
Total 19,319

Five percent of the samples were reserved for validation using a fixed random seed of 42. The split was not stratified by topic, source, or school.

Distribution by School

The full dataset has the following source-school distribution:

School Samples
Shafi'i 5,040
Hanafi 5,001
Hanbali 4,879
Maliki 4,399
Total 19,319

Loading and Using the Dataset

Load All Splits

from datasets import load_dataset

dataset = load_dataset("somayaeltanbouly/Badr_fiqh_retrieval")
print(dataset)

The expected structure is:

DatasetDict({
    train: Dataset({
        features: ['anchor', 'positive', 'negative', 'source_title', 'mazhab'],
        num_rows: 18354
    })
    validation: Dataset({
        features: ['anchor', 'positive', 'negative', 'source_title', 'mazhab'],
        num_rows: 965
    })
})

Filter by Madhhab or Source

# Select samples from Maliki sources
maliki_train = dataset["train"].filter(
    lambda sample: sample["mazhab"] == "مالكي"
)

# Select samples from a specific source book
sawi_train = dataset["train"].filter(
    lambda sample: sample["source_title"] == "حاشية الصاوي على الشرح الصغير"
)

Select Only Training Fields

When a training pipeline expects only the triplet columns, the metadata fields can be excluded without changing the original dataset:

triplets = dataset["train"].select_columns(
    ["anchor", "positive", "negative"]
)

Dataset Creation

Source Data

The samples were constructed from five classical fiqh books in the Jami' al-Fiqh corpus. These sources collectively represent the four Sunni schools. Passages were segmented by mas'alah (an individual juristic issue) to preserve the contextual boundaries of each ruling.

Question and Positive-Passage Construction

Questions were generated from source passages using Gemini 2.5 Flash. The model was prompted to produce question–answer pairs grounded in the supplied fiqh passage, including its original structural annotations. The source chunk was retained as the positive passage, and at most one question was kept for each chunk to reduce redundancy.

The prompts were developed in consultation with Islamic studies experts and refined through multiple review rounds. Generated batches were manually inspected during development to check that the questions were faithful to the source passages and reflected the intended rulings.

Hard-Negative Selection

For each question, a negative passage was selected from the same section as the positive passage but from a different subsection. This strategy produces negatives that are topically close to the question while not providing its specific requested ruling.

Records whose positive or negative passage exceeded 512 tokens under the aubmindlab/bert-base-arabertv02 tokenizer were excluded.

Metadata

The source_title field was assigned from the structured source record. The mazhab field was assigned according to the primary school associated with the source book and its author. These fields use a controlled set of book titles and Arabic school labels to support consistent filtering.

Language and Preprocessing

Questions are written in Modern Standard Arabic, while source passages contain the formal and classical Arabic characteristic of fiqh literature. No translation or romanization was applied. Users should expect orthographic and formatting variation typical of digitized classical texts.

Limitations and Responsible Use

  • The dataset is intended for retrieval research and training, not for issuing independent religious rulings.
  • Questions were generated automatically and may contain occasional wording artifacts despite manual quality checks.
  • Each positive passage reflects its source text and context; it should not be interpreted as a universal fiqh position.
  • The mazhab field identifies the source book's primary school, not every school or juristic opinion referenced in the passage.
  • A hard negative is non-answer-bearing for its paired question, but it may be relevant to another question or broader topic.
  • The dataset is limited to five source books and does not represent the full diversity of fiqh literature.
  • Downstream systems should preserve source attribution and school context when presenting retrieved passages.

Licensing Information

This dataset is released under the Creative Commons Attribution-NonCommercial 4.0 International License (CC BY-NC 4.0).

Citation

If you use this dataset, please cite the associated paper:

@misc{eltanbouly2026fiqhretriever,
  title         = {What Makes a Good Fiqh Retriever? Answer Retrieval for Arabic Islamic Jurisprudence},
  author        = {Somaya Eltanbouly and Heba Sbahi and Samer Rashwani and Abdessalam Bouchekif and Mutaz al-Khatib and Shahd Gaben and Mohammed Ghaly},
  year          = {2026},
  eprint        = {2608.20246},
  archivePrefix = {arXiv},
  primaryClass  = {cs.IR},
  url           = {https://arxiv.org/abs/2608.20246}
}

Contact

For questions or feedback, please open a discussion on the dataset repository.

Downloads last month
15

Collection including somayaeltanbouly/Badr_fiqh_retrieval_triplets

Paper for somayaeltanbouly/Badr_fiqh_retrieval_triplets