Comprehensive Guide & Technical Deep-Dive into DivinityAI – Islamic Grounded RAG
DivinityAI – Islamic Grounded RAG is a state-of-the-art Retrieval-Augmented Generation system designed to provide accurate, hallucination-free Quran and Hadith searches. This guide explores its architecture, key features, and real-world applications.
The Challenge: Why DivinityAI – Islamic Grounded RAG Was Built
General-purpose large language models (LLMs) often hallucinate religious texts, fabricating Quranic verses and Hadith narrations. This unreliability is particularly problematic in a domain where textual accuracy is critical. DivinityAI addresses this challenge by implementing a strict “corpus-lock” policy, ensuring that every answer is grounded in authentic Quran and canonical Hadith collections.
Core Architecture & Technical Stack Deep-Dive
DivinityAI is built as a modular application with a Django backend serving a React SPA, deploying local embeddings and remote LLM orchestrators. The architecture includes:
- Frontend: React 19 single-page application styled using Tailwind CSS v4, with specialized Arabic rendering layouts.
- Backend: Django web service exposing REST endpoints via Django REST Framework (DRF).
- Vector Database: ChromaDB server deployed locally on port 8040, tracking separate collections for `quran_collection` and `hadith_collection`.
- Sparse Index: `rank_bm25` indexes saved on disk, allowing fast exact-token matches without vector overhead.
- Embedding Model: A local Ollama service serving `embeddinggemma` is queried at `http://localhost:11434` to embed all query variants.
- LLM Engine: OpenRouter handles the text generation (`google/gemini-2.5-flash`), while Groq is used to perform high-speed validation tasks (`llama-3.3-70b`).
Key Features Breakdown & Practical Benefits
DivinityAI offers several key features designed to ensure accuracy and reliability:
- Strict Corpus-Lock Policy: Refuses answers not grounded in authentic Quran and canonical Hadith collections.
- Five-Path Intent Router: Classifies queries into Quran verse, Hadith, Fiqh, Calculation, or Off-Domain categories.
- HyDE Expansion & Sub-Query Decomposition: Enhances retrieval accuracy for nuanced jurisprudential queries.
- Hybrid Search: Combines BM25 sparse matching with BGE-M3 dense embeddings for comprehensive retrieval.
- Deterministic Citation Verification: Ensures every citation is validated through a four-tier verification chain.
- Pre-Generation Evidence Sufficiency Checks: Confirms sufficient evidence before generating answers.
- Post-Generation Fatwa Boundary & Hallucination Detectors: Ensures the final output is free from hallucinations and adheres to scholarly boundaries.
Real-World Use Cases & Applications
DivinityAI is designed for scholarly research, academic study, and high-stakes domain-specific applications. Key use cases include:
- Scholarly Research: Authenticated Quran and Hadith reference discovery without hallucination risks.
- Academic Study: Comparative analysis of classical Arabic religious texts.
- Reference Design Pattern: High-stakes zero-hallucination domain-specific RAG architectures.
How It Works: Step-by-Step Workflow
The workflow of DivinityAI involves several sequential steps:
- Intent Classification: Categorizes the query into one of five paths.
- Scope Enforcement: Rejects off-domain queries or those with low routing confidence.
- Query Rewriting: Executes HyDE and splits Fiqh questions into sub-queries.
- Hybrid Retrieval: Runs BGE-M3 dense queries against ChromaDB and BM25 token searches against the active collection.
- RRF & Verification: Blends retrieval lists via Reciprocal Rank Fusion and validates citations.
- Sufficiency Check: Confirms sufficient evidence to formulate an answer.
- Synthesis: Compiles the final response using Gemini 2.5 Flash.
- Audit: Audits the response text and appends appropriate legal/scholarly disclaimers.
Comparison: DivinityAI – Islamic Grounded RAG vs Traditional Approaches
| Feature | DivinityAI – Islamic Grounded RAG | Traditional Approaches |
|---|---|---|
| Hallucination Risk | Zero | High |
| Citation Accuracy | 95%+ | Variable |
| Domain Specificity | High | Low |
| Query Classification | Five-path Intent Router | None |
| Verification Process | Deterministic 4-tier | None |
Frequently Asked Questions (FAQ)
Q1: What is DivinityAI – Islamic Grounded RAG?
DivinityAI – Islamic Grounded RAG is a Retrieval-Augmented Generation system designed to provide accurate, hallucination-free Quran and Hadith searches.
Q2: How does DivinityAI ensure accuracy?
DivinityAI implements a strict corpus-lock policy and a deterministic four-tier citation verification chain to ensure accuracy.
Q3: What are the key features of DivinityAI?
Key features include a five-path Intent Router, HyDE expansion, hybrid search, and deterministic citation verification.
Q4: What are the real-world applications of DivinityAI?
DivinityAI is used for scholarly research, academic study, and high-stakes domain-specific applications.
Q5: How can I access DivinityAI?
You can access DivinityAI at https://muslim.nevatal.tech.
Conclusion & Next Steps
DivinityAI – Islamic Grounded RAG represents a significant advancement in the field of Retrieval-Augmented Generation, offering a reliable, hallucination-free solution for Quran and Hadith searches. Explore the live project at https://muslim.nevatal.tech to experience its capabilities firsthand.
Leave a Reply