Implementation of the mawaris fiqh hybrid chatbot based on retrieval-augmented generation and rule-based expert system - Irpan Afrizal Putra Eriani; Nazruddin Safaat Harahap; Suwanto Sanjaya; Muhammad Irsyad (Science, Technology, and Communication Journal, 2026)
Islamic inheritance law (mawaris fiqh) regulates the distribution of inheritance based on the Quran, Sunnah, and ijma’. However, many people still have difficulty in understanding the concept of inheritance and performing accurate inheritance calculations due to the complexity of faraidh rules and limited sources of information about faraidh. This study aims to develop a hybrid-based mawaris chatbot that integrates retrieval-augmented generation (RAG) and rule-based expert system to support both conceptual question answering and deterministic inheritance calculations. This system is implemented using the Voyage-3-Large embedding model, Qdrant vector database, semantic caching, large language models (LLM) for contextual response generation using models from GPT-4o (main) and llama3.2:3b (fallback mode) as well as semantic cache using paraphrase-multilingual-MiniLM-L12-v2. The "Ask Concept" answering mode uses semantic search, confidence router, and RAG, while the "Calculate Inheritance" answering mode uses a rule-based expert system for heir identification, validation, faraidh calculation, and division result preparation. The system performance is evaluated for conceptual questions using BERTScore and weighted scoring model (WSM) for inheritance calculation questions. Experimental results show that the conceptual question-answering mode achieves a pass rate of 91.3% on questions in that domain. For inheritance calculation, the RAG-based approach achieves an average score of 44%, while the rule-based expert system achieves 100% in all evaluation categories. These findings indicate that the proposed hybrid architecture effectively combines the contextual reasoning capabilities of RAG with the deterministic accuracy of rule-based calculation, making it a reliable solution for mawaris consultation and inheritance distribution assistance.