Downloads · 30 days
9
7% of all-time downloads
FatimahEmadEldin/Isnad-AI-Identifying-Islamic-Citation
Isnad-AI-Identifying-Islamic-Citation is a machine learning model from FatimahEmadEldin. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
<p align="center" <img src="https://placehold.co/800x200/dbeafe/3b82f6?text=Isnad+AI+-+Islamic+Citation+Detection" alt="Isnad AI - Islamic Citation Detection" </p
Downloads · 30 days
9
7% of all-time downloads
All-time downloads
122
Public
Parameters
135M
538 MB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors538 MB · 100%
From the Hugging Face model README
This repository contains the official fine-tuned model for the Isnad AI system, the submission to the IslamicEval 2025 Shared Task 1A. The model is designed to identify character-level spans of Quranic verses (Ayahs) and Prophetic sayings (Hadiths) within text generated by Large Language Models (LLMs).
This model fine-tunes AraBERTv2 (aubmindlab/bert-base-arabertv2) on a specialized token classification task. Its purpose is to label tokens within a given Arabic text according to the BIO schema:
B-Ayah (Beginning of a Quranic verse)I-Ayah (Inside a Quranic verse)B-Hadith (Beginning of a Prophetic saying)I-Hadith (Inside a Prophetic saying)O (Outside of any religious citation)The key innovation behind this model is a novel rule-based data generation pipeline that programmatically creates a large-scale, high-quality training corpus from authentic religious texts, completely eliminating the need for manual annotation. This method proved highly effective, enabling the model to learn the contextual patterns of how LLMs cite Islamic sources.
You can easily use this model with the transformers library pipeline for token-classification (or ner). For best results, use aggregation_strategy="simple" to group token pieces into coherent entities.
from transformers import pipeline
# Load the token classification pipeline
model_id = "FatimahEmadEldin/Isnad-AI-Identifying-Islamic-Citation"
islamic_ner = pipeline(
"token-classification",
model=model_id,
aggregation_strategy="simple"
)
# Example text from an LLM response
text = "يوضح لنا الدين أهمية الصدق، ففي الحديث الشريف نجد أن النبي قال: عليكم بالصدق. كما أنزل الله في كتابه الكريم: يا أيها الذين آمنوا اتقوا الله وكونوا مع الصادقين."
# Get the identified spans
results = islamic_ner(text)
# Print the results
for entity in results:
print(f"Entity: {entity['word']}")
print(f"Label: {entity['entity_group']}")
print(f"Score: {entity['score']:.4f}\n")
# Expected output:
# Entity: عليكم بالصدق
# Label: Hadith
# Score: 0.9876
# Entity: يا أيها الذين آمنوا اتقوا الله وكونوا مع الصادقين
# Label: Ayah
# Score: 0.9912
The model was trained exclusively on a synthetically generated dataset to overcome the lack of manually annotated data for this specific task. The pipeline involved several stages:
quran.json (containing all Quranic verses) and a JSON file of the Six Major Hadith Collections.The aubmindlab/bert-base-arabertv2 model was fine-tuned with the following key hyperparameters:
2e-5The model was evaluated using the official character-level Macro F1-Score metric for the IslamicEval 2025 shared task.
The system achieved a final F1-score of 66.97% on the blind test set, demonstrating the effectiveness of the rule-based data generation approach.
| Methodology | Test F1 Score |
|---|---|
| Isnad AI (Rule-Based Model) | 66.97% |
| Generative Data (Ablation) | 50.50% |
| Database Lookup (Ablation) | 34.80% |
A detailed evaluation on the manually annotated development set provided by the organizers shows a strong and balanced performance.
Final Macro F1-Score on Dev Set: 65.08%
| Class | Precision | Recall | F1-Score |
|---|---|---|---|
| 🟢 Neither | 0.8423 | 0.9688 | 0.9011 |
| 🔵 Ayah | 0.8326 | 0.5574 | 0.6678 |
| 🟡 Hadith | 0.4750 | 0.3333 | 0.3917 |
| Overall | 0.7166 | 0.6198 | 0.6535 |
(These results are from the official scoring.py script run on the development set).
Hadith class is lower than for Ayah, indicating it may miss or misclassify some prophetic sayings.If you use this model or the methodology in your research, please cite the paper:
Coming soon