تطوير أداة للفتوى معتمدة على الفتاوى التونسية المعاصرة باستخدام نماذج اللغة الكبيرة ومنهج التوليد المعزز بالاسترجاع.

Developing a fatwa tool based on contemporary Tunisian fatwas using large language models and a retrieval-enhanced generative approach.

أ.د مختار الجبالي

أ.د مختار الجبالي

mokhtarjebali62@gmail.com

تونس | جامعة الزيتونة الدولية

حسن عبد السلام بن عياد

حسن عبد السلام بن عياد

hassan.abdessalem.benayed@gmail.com

تونس | جامعة الزيتونة الدولية

حبيب بن محمد حمام

حبيب بن محمد حمام

Habib.Hamam@umoncton.ca

كندا

الكلمات المفتاحية
الكلمات المفتاحية: أتمتة الفتوى، نماذج اللغة الكبيرة، التوليد المعزز بالاسترجاع، فتاوى تونسية. Keywords: Fatwa automation, LLM, RAG, Tunisian fatwas.

 في هذه الدراسة، نقدم أسس تطوير أداة متخصصة في الفتوى معتمدة على الفتاوى التونسية المعاصرة. تعتمد هذه الأداة على نماذج اللغة الكبيرة (LLMs) ويتم تعزيزها بفتاوى تونسية معاصرة لنخبة من مشايخ الزيتونة. تمّ تصميم الأداة باستخدام منهج التوليد المعزز بالاسترجاع (RAG)، حيث يسترجع النموذج المعلومات ذات الصلة من قاعدة بيانات متخصصة في الفتاوى التونسية قبل توليد الإجابة، هذه القاعدة قمنا بإعداد نواة لها تحتوي على قرابة المائة وخمسون سؤالا وجواب. 

لتقييم أداء النظام، تم إجراء اختبارات على مجموعة من الاستفسارات الحقيقية، حيث تم تحليل دقة وموثوقية الإجابات.

أظهرت النتائج أن الأداة تقلل بشكل كبير من عبء العمل على العلماء من خلال تقديم إجابات أولية تحتاج إلى حد أدنى من المراجعة، مما يسهم في تسريع عملية إصدار الفتاوى. تؤكد هذه الدراسة على إمكانات دمج نماذج اللغة الكبيرة مع قواعد المعرفة المتخصصة لأتمتة عمليّة الفتوى. 



This study presents the development of a specialized fatwa tool based on contemporary Tunisian fatwas. The tool leverages large language models (LLMs) and is enhanced with contemporary fatwas issued by a select group of scholars from Ez-Zitouna. 

It was designed using the Retrieval-Augmented Generation (RAG) approach, where the model retrieves relevant information from a specialized database of Tunisian fatwas before generating a response.

We prepared the core of this database, which contains around 150 carefully selected fatwa questions and answers.

To evaluate the system’s performance, tests were conducted on a set of real-world inquiries, analyzing the accuracy and reliability of the answers.

The results showed that the tool significantly reduces scholars’ workload by providing initial responses that require minimal review, thus contributing to the acceleration of the fatwa issuance process. This study highlights the potential of integrating large language models with specialized knowledge bases to automate the fatwa process.