Source-linked AI summary

Fanar-Sadiq: A Multi-Agent Architecture for Grounded Islamic QA

Ummar Abbas, Mourad Ouzzani, Mohamed Y. Eltabakh, Omar Sinan, Gagan Bhatia, Hamdy Mubarak, Majd Hawasly, Mohammed Qusay Hashim, Kareem Darwish, Firoj Alam

arXiv:2603.08501v3cs.CL

TL;DR

Islamic QA must address hallucination, source-attribution errors, and heterogeneous queries requiring scripture accuracy, jurisprudential grounding, or rule-constrained computation. Fanar-Sadiq uses bilingual multi-agent intent routing with specialized retrieval, verification, and deterministic calculation modules. Across five public benchmarks, it achieves 76.5 average accuracy, outperforming open-source baselines while remaining competitive with proprietary models.

  • Problem

    Islamic QA requires grounded canonical sources and jurisprudential nuance, but fixed retrieve-then-generate pipelines are insufficient for diverse query types.

  • Method

    Fanar-Sadiq routes Islamic queries to specialized modules for fiqh retrieval, exact Quranic lookup, and deterministic Sunni zakat and inheritance computation with verification.

  • Results

    76.5 average accuracy across five benchmarks, versus 45.9 for ALLaM-7B and 62.4 for Fanar-2-27B, while remaining near Gemini-3-Pro at 79.6 and GPT-5 at 77.1.

  • Takeaways & Limitations

    Intent-aligned execution supports strong broad Islamic QA performance while improving reliability through specialized tools, citation normalization, and verification.

  • Takeaways & Limitations

    Responses depend on retrieval coverage, source quality, and routing decisions; calculators also have scope limits for specified heirs, assumptions, schools, and disputed cases.

Abstract

from arXiv · show

Large language models (LLMs) can answer religious knowledge queries fluently, yet they often hallucinate and misattribute sources, which is especially consequential in Islamic settings where users expect grounding in canonical texts (Qur'an and Hadith) and jurisprudential (fiqh) nuance. Retrieval-augmented generation (RAG) improves grounding, however, a single retrieve-then-generate pipeline is insufficient for diverse Islamic queries, including verbatim scripture, citation-grounded guidance, and rule-constrained computations such as zakat and inheritance. To address these challenges, we present Fanar-Sadiq, a bilingual Arabic-English Islamic QA system built on a multi-agent, tool-augmented architecture. It is a core component of the Fanar AI platform. Fanar-Sadiq routes Islamic queries to specialized modules within an agentic tool architecture. It supports intent-aware routing, retrieval-grounded fiqh answers with normalized citations and verification traces, exact verse lookup with quotation validation, and deterministic Sunni zakat and inheritance calculators with madhhab-sensitive branching. We evaluate the end-to-end system on public Islamic QA benchmarks and show strong effectiveness and efficiency. It is publicly accessible through an API and Web application and has received over 1.9M accesses in less than a year (https://api.fanar.qa/docs).

1 Introduction

Islamic QA requires grounded answers, stable citations, and reasoning that accommodates heterogeneous intents rather than treating every query as uniform retrieval-generation. Fanar-Sadiq addresses this with intent-aware routing, specialized tools, evidence tracking, and verification.

  • Hallucinated scripture, misattributed Hadith, and unqualified jurisprudential claims make reliability especially consequential in Islamic applications.
  • Islamic QA systems should ground responses in canonical sources, provide transparent citations, and support domain-specific reasoning beyond free-form generation.
  • Heterogeneous intents such as scripture lookup, fiqh guidance, and rule-based computation require different execution strategies and error handling.
  • Fanar-Sadiq classifies fine-grained Islamic query intents, routes each query to a specialized module, and applies citation tracking with post-generation verification.
  • The architecture goes beyond fixed RAG by routing queries to specialized tools, integrating evidence tracking and verification, and evaluating across public generative and multiple-choice benchmarks.
  • Tool- and evidence-routed execution improves faithfulness while remaining competitive on broader Islamic knowledge benchmarks.

2 Related Work

Related work moves from conventional retrieval-generation toward agentic and tool-augmented systems for heterogeneous, reasoning-intensive queries. Islamic QA benchmarks increasingly target grounded scripture, jurisprudence, inheritance, and ritual reasoning.

  • Standard retrieve-then-generate pipelines struggle with heterogeneous intents requiring multi-step reasoning or precise computation.
  • Agentic RAG and tool-augmented models interleave reasoning with external actions, while modular agents have been applied to mathematical and legal subtasks.
  • QuranQA and IslamicEval establish benchmarks for Quranic retrieval, grounded Quran/Hadith QA, and Quranic hallucination correction.
  • QIAS and Hajj-FQA target structured reasoning in inheritance and ritual jurisprudence, extending evaluation beyond static retrieval tasks.

3 System Architecture

Fanar-Sadiq uses hybrid intent routing to select among retrieval, Quranic lookup, deterministic calculation, and utility tools for heterogeneous Islamic queries. Specialized modules address scripture accuracy, jurisprudential evidence, and rule-constrained computation.

  • Architecture motivation: Treating text-grounded, rule-constrained, and symbolic time or geographic questions as one retrieve-then-generate task creates predictable sourcing, quotation, and arithmetic failures.
  • Specialized tools: The heterogeneous tool suite includes deterministic zakat and inheritance calculators, canonical verse lookup, and rule-based calendar and prayer-time computation.
  • Hybrid Query Classifier: A hybrid routing classifier selects execution routes for nine intents, including fiqh, Quran retrieval, zakat, inheritance, calendar, and prayer-time queries.
  • End-to-end routing: The architecture routes queries among tool calls, deterministic calculation, document-grounded retrieval QA, and Quranic retrieval before assembling referenced responses.
  • Calculation Pipeline: The zakat calculator extracts assets, amounts, and debts, then applies deterministic threshold and category-specific rules to produce cited input, deduction, and total breakdowns.
  • Calculation Pipeline: The inheritance calculator assigns fixed shares, allocates residuaries, enforces ‘awl and radd consistency, and returns parallel madhhab distributions for disputed cases.
  • Retrieval pipelines: Fiqh QA links rulings to normalized evidence spans, while Quran routing selects among specific-verse, full-surah, statistics, and interpretation subtypes.
  • Quranic Retrieval Pipeline: Specific verse requests return canonical ayah text verbatim, with surah-level fallback when references are partial or parsing fails.

4 Evaluation

Fanar-Sadiq is evaluated end-to-end against open-ended and multiple-choice Islamic QA benchmarks, using complementary datasets, exact-match scoring for MCQs, and LLM-based judging for generative answers.

  • Evaluation setup: The evaluation compares Fanar-Sadiq with proprietary and open-source baselines across a suite of Islamic QA benchmarks.The baselines include OpenAI and Gemini models, ALLaM-7B, and Fanar-2-27B.
  • Open-ended benchmarks: Two open-ended benchmarks assess faithful, grounded, and contextually appropriate generation.IslamicFaithQA contains 3,810 bilingual Arabic-English examples, while FatwaQA contains 2,000 Arabic fatwa-style QA pairs.
  • Multiple-choice benchmarks: Three multiple-choice benchmarks evaluate factual knowledge, inheritance reasoning, and value-consistent decision making through exact-match scoring.The benchmarks are PalmX, QIAS, and IslamTrust.
  • Evaluation protocol: Table 2 organizes evaluation datasets by format, language, size, and evaluation metric.Its caption defines ar and en as Arabic and English, and identifies GenQA and LLM-J as generative QA and LLM-judge.
  • Evaluation protocol: Open-ended responses are judged as correct, incorrect, or not attempted using GPT-4.1 with questions, responses, references, and available evidence.The verdicts are aggregated into percentage-correct and abstention-aware reliability measures.

5 Results & Discussion

Fanar-Sadiq achieves strong results across Islamic QA benchmarks, with its largest gains on open-ended tasks, while QIAS exposes a limitation in mapping computed inheritance distributions to discrete options.

  • Overall results: 76.5 average accuracy across five benchmarks exceeds ALLaM-7B at 45.9 and Fanar-2-27B at 62.4, while remaining competitive with Gemini-3-Pro at 79.6 and GPT-5 at 77.1.These are the reported Table 3 accuracy values.
  • Open-ended QA: 65.4 on IslamicFaithQA exceeds the strongest proprietary baseline at 56.6, while 65.1 on FatwaQA closely matches Gemini-3-Pro at 67.0.The paper identifies open-ended QA as the setting with the largest gains.
  • Interpretation: Intent-aware routing supports specialized execution modes instead of forcing every query through one retrieve-then-generate pipeline.The architecture combines canonical lookup, deterministic calculators, and retrieval-grounded fiqh answering with citation normalization.
  • Multiple-choice QA: 85.5 on PalmX and 94.2 on IslamTrust indicate strong performance on broad Islamic knowledge and value-sensitive decision making.The results are presented as evidence that the multi-tool design preserves general Islamic QA competence while improving reliability.
  • Limitations: 72.2 on QIAS trails proprietary models at 93.0-94.5, partly because correct deterministic inheritance shares still require selection of a discrete answer option.The paper identifies symbolic-to-option alignment as a future-work target.

6 Case Study: Chat Platform Integration

Fanar-Sadiq is integrated into the Fanar API and web chat platform through an orchestrator that classifies and routes queries, with substantial reported real-world usage.

  • Platform integration: The Fanar platform uses an orchestrator to mediate incoming queries and route Islamic content to the proposed multi-agent system.A fine-tuned binary classifier determines whether a query pertains to Islamic content.
  • Platform integration: The Islamic-content classifier achieves a macro-F1 score of 93.40.Further classifier and evaluation-dataset details are provided in the appendix.
  • Real-world usage: Approximately 1.9M API and chat-interface uses were recorded in less than a year, and 77.4% of 6,441 rated responses received likes.These figures are reported as real-world usage and user ratings.

7 Conclusion

Fanar-Sadiq is a tool-routed, multi-agent Islamic QA architecture that separates heterogeneous intents across specialized modules and evaluates their reliability on public benchmarks.

  • Architecture: Fanar-Sadiq separates retrieval-grounded QA, canonical scripture handling, and deterministic zakat and inheritance computation.The system also uses citation tracking, post-generation verification, quotation validation, and invariant checks.
  • Conclusion: Evaluations on public Islamic QA benchmarks report improved reliability from combining intent routing, specialized tools, and post-generation verification.The stated target failure modes include misquotation, weak jurisprudential attribution, and numerically inconsistent calculations.
  • Future work: Future work will expand jurisprudential coverage across schools of thought, improve routing robustness, and strengthen Hadith quotation validation.These are the paper's stated directions for extending the system.

Limitations

The system is not a substitute for qualified scholarly authority and remains constrained by retrieval coverage, routing quality, citation completeness, jurisprudential diversity, and calculator assumptions. Its open-ended evaluation also relies partly on automated judging that may miss nuance or legitimate scholarly disagreement.

  • Scope and reliability: The system does not replace qualified scholarly authority or issue binding fatwas.Its responses depend on retrieval corpora, curated sources, and routing decisions.
  • Scope and reliability: Routing errors can send calculation-heavy queries to free-form fiqh QA or select a suboptimal module.Citations may also remain incomplete, while diverse jurisprudential evidence can be difficult to summarize without oversimplification.
  • Calculator boundaries: Deterministic calculators depend on correctly specified heirs, assumptions, user parameters, calculation methods, local conventions, and moon-sighting criteria.Inheritance coverage may include only selected schools or disputed cases.
  • Evaluation: Open-ended evaluation partly relies on automated or LLM-based judging that may miss nuance, context, or legitimate scholarly disagreement.

Broader Impact

The paper frames Fanar-Sadiq as a tool for expanding access to grounded Islamic information while acknowledging risks from over-trust, conditional rulings, disagreement, and misuse. Its broader-impact safeguards emphasize traceability, scoped answers, uncertainty signaling, scholar consultation, privacy, and monitoring.

  • Potential benefits: The system can help users retrieve canonical references, navigate common questions, and perform rule-based zakat and inheritance computations with transparent outputs.The stated applications include education, personal learning, and community use, especially in bilingual settings.
  • Risks: Users may over-trust outputs, overlook conditional rulings, or treat summarized answers as universally applicable across schools, locales, and circumstances.
  • Risks: The system may be misused for selective quotation, sectarian framing, or misleading claims.
  • Mitigations: Mitigations include citations, audit traces, disagreement handling, scoped answers, uncertainty signaling, scholar consultation, privacy-preserving logging, data minimization, and continuous monitoring.

C.1.3 Evaluation

The system evaluates intent classification and implements specialized tools for bilingual Islamic queries, including calendar, prayer-time, Qibla, supplication, and zakat tasks.

  • Intent evaluation: The intent-labeled evaluation dataset contains 705 real user queries classified into nine categories by six annotators using majority voting.Instances without majority agreement were discarded.
  • Intent evaluation: 90.1% accuracy was achieved by the hybrid classifier, compared with 89.3% for zero-shot GPT-5 and 89.7% for Gemini.The evaluation benchmarks routing performance against LLM-only baselines.
  • Calendar and prayer tools: The calendar tool performs deterministic Hijri conversions and event lookups while accounting for Umm al-Qura rules, moon-sighting variation, and year rollover.It covers current dates, bidirectional conversions, event dates, and upcoming events.
  • Calendar and prayer tools: The prayer-time tool requires coordinates, UTC offset, calculation method, and target date, then returns times for all five daily prayers.It uses pyIslam and supports four recognized calculation methods with method-specific Fajr and Isha angles.
  • Retrieval and calculation tools: The Dua tool retrieves authenticated supplications through embedding-based candidate selection and deterministic page mapping, returning records verbatim with source attribution.This preserves Arabic text, diacritics, translations, and canonical references without generative rewriting.
  • Retrieval and calculation tools: The Zakat calculator applies category-specific rates and deterministic validation across monetary assets, agriculture, livestock, and other supported wealth categories.It computes Nisab using gold and silver prices and reports total Zakat, category breakdowns, and warnings.

C.7.2 Evaluation

The evaluation covers the inheritance calculator and Quran-focused NL2SQL pipeline, combining semantic validation with denotational SQL correctness across sampled user queries.

  • Inheritance evaluation: The inheritance calculator was evaluated by comparing calculator outputs with fatwa-stated distributions using GPT-5 semantic validation.The primary run successfully judged 883 cases.
  • Inheritance evaluation: 90.83% of 883 inheritance cases were labeled match, while 3.96% were mismatch, 2.27% partial, and 2.94% unclear.A second judging setup yielded 84.50% matches across 884 cases.
  • Inheritance evaluation: The inheritance results indicate high practical validity while identifying disagreement cases for targeted error analysis and iterative improvement.The calculator implements deterministic Sunni estate distribution with explicit madhhab-sensitive handling.
  • NL2SQL evaluation: The NL2SQL evaluation uses 62 analytical/retrieval queries and 74 counting queries sampled from realistic Fanar usage distributions.GPT-5 generated ground-truth SQL queries for the sampled inputs.
  • NL2SQL evaluation: Denotational correctness is measured by executing predicted and ground-truth SQL on the same SQLite Quran database rather than requiring identical SQL strings.This accommodates semantically equivalent queries with different syntax.
  • NL2SQL results: Perfect accuracy was achieved by the specialized NL2SQL model on analytical/retrieval queries across all N-shot settings, with counting accuracy improving as examples increased.Table 8 compares the specialized model with two Fanar variants.

D Evaluation Setups

The evaluation standardizes inference configurations across proprietary and open-source models to support comparisons on multiple Islamic QA tasks.

  • Evaluation configuration: Inference settings were standardized across proprietary and open-source models, with task-specific token limits of 1,000 for MCQ and 2,000 for open QA.The configurations also specify reasoning or thinking settings, temperature, and comparable token budgets.
  • Evaluation configuration: The evaluated systems include GPT-4.1, GPT-5, Gemini-3-Flash, Gemini-3-Pro, ALLaM-7B, and Fanar-2-27B.All models received identical task-specific system instructions.
Loading 2603.08501v3…