Skip to main content
Back

Qatar's Fanar-Sadiq Beats GPT-5 on Islamic Knowledge Without Hallucinating Scripture

Fanar-Sadiq routes Islamic queries to specialized agents for scripture lookup, fatwa reasoning, and deterministic zakat and inheritance calculation — hitting 76.5% average accuracy and 1.9M real-world uses

Pro

Paper, Full Access
  • Fanar-Sadiq is a bilingual Arabic/English multi-agent Islamic QA system that routes queries to specialized tools instead of using a single RAG pipeline.
  • A hybrid classifier assigns queries to 9 intent types (fiqh, Quran, zakat, inheritance, prayer times, etc.) with 90.1% accuracy, beating zero-shot GPT-5.
  • Deterministic calculators handle zakat and inheritance with madhhab-sensitive branching, validated against 887 real fatwas at 90.83% match rate.
  • A fine-tuned NL2SQL model (Qwen3-4B on 48k pairs) achieves 100% accuracy on Quran verse retrieval, eliminating hallucinated scripture.
  • Fanar-Sadiq scores 76.5% average across 5 benchmarks, outperforming GPT-5 on open-ended Islamic QA (65.4% vs 51.2% on IslamicFaithQA).
  • The system is publicly accessible via API and has been used ~1.9M times with a 77.4% user approval rate.

When a Muslim user asks an AI assistant to quote a Quranic verse, they expect the exact Arabic text, not a plausible paraphrase. When they ask how to split an inheritance, they need arithmetic that respects centuries of jurisprudential rules, not a fluent but legally wrong answer. Standard large language models fail both tests regularly. Fanar-Sadiq, a new multi-agent Islamic QA system from Qatar Computing Research Institute, was built specifically to close that gap.

The system is a core component of Fanar, Qatar's sovereign Arabic-centric AI platform. Developed by Qatar Computing Research Institute at Hamad Bin Khalifa University and supported by the Ministry of Communications and Information Technology, Fanar is Qatar's first Arabic generative AI platform. Fanar-Sadiq is the Islamic knowledge layer sitting on top of it, and it has already seen real-world scale: it is deployed in production on IslamWeb and IslamOnline, two of the world's largest Islamic information platforms, where it has processed millions of queries.

Why a single RAG pipeline breaks down

Retrieval-augmented generation (RAG) , the technique of pulling relevant documents from a database before generating an answer , has become the standard fix for hallucination in knowledge-intensive domains. The idea is simple: ground the model's output in real sources. But Islamic queries are not a single type of problem. They span at least three fundamentally different execution modes:

  • Verbatim scripture lookup , "What does verse 2:255 say?" requires returning the exact canonical Arabic text, not a paraphrase.
  • Jurisprudential reasoning (fiqh) , fatwa-style questions need evidence from Quran, Hadith, and classical legal texts, with explicit citations and acknowledgment of scholarly disagreement.
  • Rule-constrained computation , zakat (obligatory almsgiving) and inheritance (faraid) follow strict arithmetic and legal rules that generative models routinely get wrong.

Forcing all three through a single retrieve-then-generate pipeline produces predictable failures: misquoted verses, unsourced jurisprudential claims, and numerically inconsistent calculations. Fanar-Sadiq's answer is to stop treating them as one problem.

Nine intents, one router

The system's entry point is a hybrid query classifier that assigns every incoming query to one of nine intent categories before any generation happens. Those categories are: fiqh ruling, Quran retrieval, general Islamic knowledge, greeting, zakat calculation, inheritance calculation, dua (supplication) lookup, Islamic calendar, and prayer times.

The classifier uses a two-tier approach. The primary tier prompts an LLM at zero temperature to output a structured JSON object with an intent label, confidence score, rationale, and a flag indicating whether document retrieval is needed. If confidence falls below 0.5 or the output is malformed, a fallback embedding-based classifier kicks in, computing cosine similarity against pre-computed prototype embeddings for each intent. The hybrid classifier achieves 90.1% accuracy on a manually annotated dataset of 700 queries, beating zero-shot GPT-5 (89.3%) and Gemini (89.7%).

Four Islamic knowledge tools showing intent routing: Fiqh ruling, Quran verse retrieval, Zakat calculator, and Inheritance calculator with example queries and responses

Once a query is classified, it is routed to one of four execution branches:

  1. Tool calls , deterministic modules for greetings, Islamic calendar conversion, prayer times and Qibla direction, and dua lookup from a curated verbatim store.
  2. Calculation pipeline , rule-based engines for zakat and inheritance.
  3. Knowledge retrieval pipeline , RAG-based answering for fiqh rulings and general Islamic knowledge, with citation normalization.
  4. Quranic retrieval pipeline , a dedicated sub-router that further classifies Quran queries into specific verse, full surah, statistics, or interpretation, then selects the right execution path for each.

Deterministic calculators as a first-class feature

The most technically distinctive part of Fanar-Sadiq is its treatment of computation as a separate, non-generative concern. The zakat calculator extracts structured parameters from the user's query , asset classes, amounts, debts , and passes them to a rule engine. It supports five asset groups including monetary assets, agricultural produce, livestock, foreign currency, and major cryptocurrencies. The nisab (minimum wealth threshold) is computed as the minimum of 85g of gold or 595g of silver at current prices, following the scholarly view that the lower threshold is more beneficial to the poor.

The inheritance calculator is more complex. It implements Islamic faraid (inheritance law) across three phases: assigning fixed Quranic shares (fard), distributing the remainder through the residuary chain (asaba), and enforcing arithmetic consistency through awl (proportional reduction when shares exceed 100%) and radd (redistribution of surplus). Crucially, when schools of Islamic jurisprudence disagree , for instance, whether a spouse is eligible for radd , the calculator returns parallel distributions for each school rather than collapsing to a single answer. The team validated this calculator against 887 real inheritance fatwas crawled from IslamWeb, achieving a 90.83% match rate.

Keeping scripture verbatim

For Quran queries, the system routes to a dedicated pipeline with its own sub-classifier. Specific verse requests invoke a direct database lookup that returns canonical Arabic text verbatim, bypassing generation entirely. For complete surah or statistical queries (e.g., "how many verses in Al-Baqarah?"), the system uses a fine-tuned NL2SQL model , a Qwen3-4B model trained on 48,000 natural-language-to-SQL pairs over a structured Quran database , to guarantee exact outputs. This model achieves 100% accuracy on verse retrieval queries and 94.59% on counting queries with five in-context examples, compared to 95.16% and 83.78% for the base Fanar model.

For fiqh answers, the retrieval pipeline searches over 500,000+ documents including six major Hadith collections, classical jurisprudential texts, and contemporary fatwas, using Qwen3-Embedding-4B embeddings. The reasoning agent is instructed to apply a strict source hierarchy (Quran > Sahih Hadith > Consensus > Analogy), assign citation tags to every evidence span, and invoke the Quran tool for exact verse text rather than paraphrasing.

How it performs

The team evaluated Fanar-Sadiq on five public benchmarks spanning both open-ended generation and multiple-choice formats:

BenchmarkTypeFanar-SadiqGPT-5Gemini-3-Pro
PalmX (Islamic culture)MCQ85.5%82.3%84.4%
IslamicFaithQAOpen-ended65.4%51.2%56.6%
FatwaQAOpen-ended65.1%63.6%67.0%
IslamTrust (ethics)MCQ94.2%95.2%95.6%
QIAS (inheritance)MCQ72.2%93.0%94.5%
Average76.5%77.1%79.6%

The biggest wins are on open-ended benchmarks where hallucination is directly penalized. On IslamicFaithQA, Fanar-Sadiq reaches 65.4%, compared with 56.6% for the strongest proprietary baseline. The system also substantially outperforms open-source baselines: ALLaM-7B at 45.9% and Fanar-2-27B at 62.4%.

The clearest weakness is the QIAS inheritance benchmark, where Fanar-Sadiq scores 72.2% against GPT-5's 93.0%. The gap is partly structural: even when the deterministic calculator produces the correct inheritance shares, the system must still map those shares to one of the benchmark's discrete multiple-choice options, which introduces an additional alignment error. The authors flag this as a target for future work.

The real breakthrough

The headline number , competitive with GPT-5 at 76.5% average , undersells what is actually new here. The real advance is the architecture, not the score. By separating intent classification, deterministic computation, verbatim lookup, and retrieval-grounded generation into distinct execution paths, the system eliminates entire categories of failure that a single pipeline cannot avoid by design. A general-purpose LLM cannot guarantee that a Quranic verse is quoted exactly. Fanar-Sadiq's verse lookup tool can, because it never generates the verse at all.

Fanar-Sadiq handles nine distinct Islamic query types through dedicated specialist agents: fiqh jurisprudential reasoning, Quranic verse retrieval, Hadith verification across more than 51,000 Hadith, supplication lookup, zakat calculation, inheritance distribution, prayer times, Qibla direction, and Hijri calendar conversion. That breadth, combined with deterministic guarantees on the computational modules, is what drove 1.9 million real-world accesses in under a year, with a 77.4% user like rate across rated responses.

Availability and limitations

Fanar-Sadiq is publicly accessible via API and a web application at no cost. The paper does not release model weights or training code, but the system prompt templates, classifier schema, and calculator algorithms are documented in detail in the paper's appendix.

The authors are clear about what the system cannot do. It does not replace qualified scholars or issue binding fatwas. Routing errors can send a calculation-heavy query to the generative fiqh agent, producing legally inconsistent outputs. Citation coverage depends on the quality of the retrieval corpus, and the inheritance calculator covers only selected schools and disputed cases. For high-stakes personal decisions, the system explicitly recommends consulting a qualified scholar , a design choice that reflects the broader challenge of deploying AI in domains where the cost of a wrong answer is not just inconvenient, but consequential.