DivinityAI – Islamic Grounded RAG: Hallucination-Free Quran & Hadith AI Search
Key Takeaways
- DivinityAI enforces a strict corpus-lock policy to ensure zero hallucination in Quranic verses and Hadith citations.
- Features a five-path intent router, HyDE expansion, hybrid search, and deterministic citation verification.
- Built with Django ASGI/DRF, React 19/Vite, ChromaDB, BGE-M3 embeddings, and more.
- Optimized for Right-to-Left (RTL) Arabic typography and Uthmani script rendering.
The Challenge: Why DivinityAI – Islamic Grounded RAG Was Built
General-purpose large language models (LLMs) often hallucinate religious texts, fabricating Quranic surah and ayah numbers or merging distinct Hadith narrations. In a domain where textual accuracy is critical, these inaccuracies are unacceptable. DivinityAI was built to address this problem by implementing a strict “corpus-lock” policy, ensuring every answer is grounded in authenticated Quran and Hadith sources.
Core Architecture & Technical Stack Deep-Dive
Frontend & Backend
The frontend is a React 19 single-page application styled with Tailwind CSS v4, optimized for Right-to-Left (RTL) Arabic typography and Uthmani script rendering. The backend is powered by Django ASGI/DRF, providing REST endpoints for query processing.
Vector Database & Retrieval
DivinityAI uses ChromaDB for vector storage and a hybrid retrieval system combining BM25 sparse matching with BGE-M3 dense embeddings. This ensures both exact keyword matches and semantic understanding of queries.
Key Features Breakdown & Practical Benefits
Strict Corpus-Lock Policy
DivinityAI refuses to answer queries that cannot be verified from its locked corpus of Quran and Hadith texts, ensuring zero hallucination.
Intent Routing & Scope Guard
Queries are classified into five intents (Quran verse, Hadith, Fiqh, Calculation, Off-Domain) and routed accordingly. Off-domain queries are rejected with a polite message.
Deterministic Citation Verification
A four-tier verification chain (exact match, normalized, Levenshtein distance, semantic check) ensures all citations are accurate.
Real-World Use Cases & Applications
DivinityAI is ideal for scholarly research, authenticated Quran/Hadith reference discovery, and academic study of classical Arabic texts. It also serves as a reference design for high-stakes, zero-hallucination RAG architectures.
How It Works: Step-by-Step Workflow
- User submits a query.
- Intent Router classifies the query.
- Scope Guard checks for off-domain queries.
- Query Rewriter applies HyDE and sub-query decomposition.
- Hybrid Retrieval combines BM25 and dense search results.
- Citation Verifier validates references.
- Grounded Generation compiles the final answer.
- Safety Layer audits the response for hallucinations.
Comparison: DivinityAI vs Traditional Approaches
| Feature | DivinityAI | Traditional LLMs |
|---|---|---|
| Hallucination Rate | 0% (corpus-locked) | High (unconstrained) |
| Citation Accuracy | 95%+ verified | Unreliable |
| Query Intent Handling | Five-path router | Single-path |
Frequently Asked Questions (FAQ)
1. Does DivinityAI issue fatwas?
No, it displays source materials and scholarly positions without generating new religious rulings.
2. What languages does it support?
Full support for Arabic, English, and Malay, with optimized RTL Arabic typography.
3. How does it ensure citation accuracy?
Through a four-tier verification chain: exact match, normalized, Levenshtein distance, and semantic check.
4. Can it answer non-Islamic queries?
No, off-domain queries are rejected with an informational message.
Conclusion & Next Steps
DivinityAI – Islamic Grounded RAG sets a new standard for accuracy in religious text retrieval, combining advanced AI techniques with strict verification protocols. To experience it firsthand, visit the live project at https://muslim.nevatal.tech.