← Latest papers
💬 NLP

Ansari: A Retrieval-Grounded Islamic AI Assistant -- Architecture, Deployment, and Lessons from 140,000 Conversations

This paper introduces Ansari, a deployed, retrieval-grounded Islamic AI assistant that mitigates factual fabrication and value misalignment by strictly answering questions based on authenticated religious texts with citations, demonstrating superior performance on Islamic benchmarks and offering critical lessons for faith-sensitive LLM deployments.

Original authors: M Waleed Kadous, Amr Elsayed, Abdullah Al Nahas, Ashraf Haress

Published 2026-08-24
📖 5 min read🧠 Deep dive

Original authors: M Waleed Kadous, Amr Elsayed, Abdullah Al Nahas, Ashraf Haress

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

In the modern world, people often turn to artificial intelligence to find answers, asking machines to explain complex ideas, solve problems, or offer guidance. These systems, known as large language models, are trained on vast amounts of text from the internet, learning to predict what words should come next in a sentence. They are remarkably fluent and can sound very convincing. However, this fluency comes with a hidden danger: the tendency to invent facts. When a machine does not know the answer, it may confidently make one up, creating a story that sounds true but is entirely false. This is a serious problem in fields where accuracy is critical, such as medicine or law, but it becomes even more delicate in the realm of religious faith. For millions of Muslims, religious texts like the Quran and the collections of the Prophet Muhammad's sayings are considered sacred and unchangeable. A single invented verse or a misattributed saying could lead a person to practice their faith incorrectly, causing spiritual harm. The challenge, then, is to build a machine that can speak with the ease of a human conversation but possesses the discipline to never speak without a source.

A team of researchers has built a system called Ansari to solve this exact problem. The name comes from a historical term for the helpers of the Prophet Muhammad in the city of Medina, reflecting the system's goal to be a supportive tool for the community. Since June 2023, this assistant has engaged in more than 140,000 conversations with people speaking over 25 different languages. Unlike standard chatbots that rely on their internal memory to generate answers, Ansari operates on a strict rule: it is not allowed to say anything unless it has first found it in a trusted book. The system works like a diligent researcher. When a user asks a question, the computer does not immediately try to write a response. Instead, it first uses special tools to search through authenticated digital libraries containing the Quran, collections of religious sayings, and detailed encyclopedias of Islamic law. It reads the results of these searches and constructs its answer only from the text it has found, attaching specific references so the user can verify the source. This process ensures that the machine cannot invent a religious rule or a sacred story; it can only report what is already written in the trusted sources it was given.

The researchers found that people use this tool in ways that go far beyond simple fact-checking. By analyzing a random sample of 10,000 conversations, they discovered that the most common requests were not about learning history or theology, but about how to live their daily lives. Nearly 40 percent of the questions were about practical matters, such as whether certain foods are permissible, how to handle specific medical situations while fasting, or how to navigate ethical dilemmas in modern life. Another significant portion of the questions came from people seeking support during times of grief, anxiety, or family crisis. The system was designed to recognize these moments of distress and respond with warmth, encouraging the user to speak with a local community leader while providing access to help lines. The study also revealed that religious leaders and teachers frequently used the assistant to prepare sermons and lesson plans, treating it as a partner in drafting content rather than just a search engine.

To ensure the system was working correctly, the team tested it against several rigorous standards. They ran the assistant through independent exams that measure knowledge of Islamic law and religious texts, where it performed better than other leading artificial intelligence models available to the public. In one specific test designed to see if a machine would agree with a false statement just to be polite, Ansari succeeded in challenging the error more than 96 percent of the time, whereas other models often fell into the trap of agreeing with the mistake. During a human evaluation conducted over the holy month of Ramadan, the assistant answered questions with high accuracy and, most importantly, did not invent a single false source in the sample tested. The researchers noted that while the system is highly effective, it is not perfect. It sometimes gets stuck in loops where it searches for information without finding a clear answer, and it can occasionally make mistakes with dates or time-sensitive facts. These errors remind the creators that the system is a tool to assist human understanding, not a replacement for the judgment of qualified scholars or the wisdom of the community.

The project offers a clear lesson for anyone trying to build artificial intelligence that deals with deeply held values or sensitive topics. The researchers argue that simply training a machine on more data is not enough. Instead, the rules governing the machine must be written down explicitly and made open for inspection. In the case of Ansari, the instructions that tell the computer how to handle disagreements between different schools of thought, how to cite sources, and how to behave in a crisis are stored in a document that anyone can read. This transparency turns the system prompt from a hidden technical setting into a public statement of policy. The team also found that while grounding the answers in real text prevents the machine from making things up, it does not fix every problem. The underlying computer model still carries the biases and limitations of the data it was originally trained on, which was not created by the religious community it now serves. This gap means that the system can never fully replace the human community that has spent centuries refining these traditions. Ultimately, the success of Ansari shows that it is possible to build a helpful religious assistant that respects the sanctity of its sources, provided the design prioritizes truth and accountability over speed and convenience.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →