Implementation of the mawaris fiqh hybrid chatbot based on retrieval-augmented generation and rule-based expert system

Authors

  • Irpan Afrizal Putra Eriani Department of Informatics Engineering, UIN Sultan Syarif Kasim Riau, Pekanbaru 28293, Indonesia
  • Nazruddin Safaat Harahap Department of Informatics Engineering, UIN Sultan Syarif Kasim Riau, Pekanbaru 28293, Indonesia
  • Suwanto Sanjaya Department of Informatics Engineering, UIN Sultan Syarif Kasim Riau, Pekanbaru 28293, Indonesia
  • Muhammad Irsyad Department of Informatics Engineering, UIN Sultan Syarif Kasim Riau, Pekanbaru 28293, Indonesia

DOI:

https://doi.org/10.59190/stc.v6i3.392

Keywords:

Hybrid Chatbot, LLM, Mawaris Fiqh, RAG, Rule-Based Expert System

Abstract

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.

Downloads

Published

2026-06-26

How to Cite

Eriani, I. A. P., Harahap, N. S., Sanjaya, S., & Irsyad, M. (2026). Implementation of the mawaris fiqh hybrid chatbot based on retrieval-augmented generation and rule-based expert system. Science, Technology, and Communication Journal, 6(3), 339-354. https://doi.org/10.59190/stc.v6i3.392