Laporkan Masalah

Pendekatan Retrieval-Augmented Generation untuk Sistem Penjawab Pertanyaan Dokumen Legal di Indonesia

RIZKI FAJAR ARISTANTO, Prof. D.r Azhari, MT; Muhammad Oriza Nurfajri S.Kom., M.IT.

2025 | Skripsi | ILMU KOMPUTER

Kompleksitas sistem hukum di Indonesia menimbulkan tantangan signifikan dalam akses informasi hukum yang akurat dan mudah dipahami oleh masyarakat luas. Struktur hierarkis dokumen hukum yang terdiri dari berbagai tingkatan peraturan, ditambah dengan terminologi hukum yang formal, menyebabkan kesulitan bagi masyarakat non-ahli dalam mengakses dan memahami isi peraturan. Di sisi lain, Large Language Model (LLM) yang digunakan dalam sistem penjawab pertanyaan sering mengalami halusinasi, menghasilkan informasi yang tidak akurat ketika menghadapi pertanyaan spesifik di luar data pelatihan. Untuk mengatasi tantangan tersebut, penelitian ini mengembangkan sistem Retrieval-Augmented Generation (RAG) yang mengintegrasikan kemampuan pengambilan informasi relevan dengan pemahaman mendalam terhadap granularitas dokumen hukum Indonesia. Sistem dirancang untuk mempertahankan struktur hierarkis dokumen hukum (Bab, Pasal, Ayat, Huruf) dalam proses chunking dan indexing. Metodologi penelitian mencakup pengumpulan 15 dokumen hukum autentik dari portal JDIH yang meliputi Undang-Undang, Peraturan Pemerintah, Peraturan Menteri, dan peraturan tingkat daerah. Arsitektur sistem menggabungkan pendekatan dense retrieval melalui WeaviateDB dengan sparse retrieval melalui Elasticsearch menggunakan metode Reciprocal Rank Fusion (RRF), serta Google Gemini 2.5 Flash sebagai layanan LLM. Evaluasi dilakukan menggunakan framework RAGAS pada dataset 150 pasangan pertanyaan-jawaban yang mencakup berbagai tipe query. Hasil evaluasi menunjukkan sistem berhasil melampaui seluruh target metrik: faithfulness mencapai 0.88 yang mengindikasikan sistem sangat jarang menghasilkan halusinasi, answer relevancy 0.88 menunjukkan jawaban yang sangat relevan, context precision 0.73 membuktikan mekanisme retrieval efektif, dan context recall 0.76 menunjukkan sistem mampu mengambil informasi lengkap dari korpus dokumen. Penelitian ini membuktikan bahwa implementasi sistem RAG untuk domain hukum Indonesia secara teknis feasible dan memberikan nilai signifikan dalam mendukung transformasi digital sektor hukum serta akses informasi hukum yang lebih inklusif di Indonesia. 

The complexity of the legal system in Indonesia poses significant challenges in accessing accurate and easily understandable legal information for the general public. The hierarchical structure of legal documents, consisting of various levels of regulations combined with formal legal terminology, creates difficulties for non-experts in accessing and comprehending regulatory content. On the other hand, Large Language Model (LLM) used in question-answering systems often experience hallucinations, producing inaccurate information when faced with specific queries outside their training data. To address these challenges, this research develops a Retrieval-Augmented Generation (RAG) system that integrates relevant information retrieval capabilities with a deep understanding of the granularity of Indonesian legal documents. The system is designed to maintain the hierarchical structure of legal documents (Bab, Pasal, Ayat, Huruf) during the chunking and indexing processes. The research methodology includes the collection of 15 authentic legal documents from the JDIH portal, including Laws (Undang-Undang), Government Regulations, Ministerial Regulations, and regional-level regulations. The system architecture combines a dense retrieval approach via WeaviateDB with sparse retrieval through Elasticsearch, utilizing the Reciprocal Rank Fusion (RRF) method, and leverages Google Gemini 2.5 Flash as the LLM service. Evaluation was conducted using the RAGAS framework on a dataset of 150 question-answer pairs covering various query types. The evaluation results show that the system successfully exceeded all target metrics: faithfulness reached 0.88, indicating the system very rarely produces hallucinations; answer relevancy of 0.88 shows highly relevant answers; context precision of 0.73 proves an effective retrieval mechanism; and context recall of 0.76 indicates the system is capable of retrieving complete information from the document corpus. This research demonstrates that the implementation of a RAG system for the Indonesian legal domain is technically feasible and provides significant value in supporting the digital transformation of the legal sector and more inclusive access to legal information in Indonesia.

Kata Kunci : Retrieval-Augmented Generation, Question Answering, Dokumen Hukum Indonesia, Large Language Model, Natural Language Processing, Sistem Informasi Hukum

  1. S1-2025-462190-abstract.pdf  
  2. S1-2025-462190-bibliography.pdf  
  3. S1-2025-462190-tableofcontent.pdf  
  4. S1-2025-462190-title.pdf