Retrieval-Augmented Generation for Indonesian Criminal Law Information Using the LLaMA Model

Authors

  • Ariel Zakly Pratama Institut Teknologi Kalimantan
  • Arwin Marinta Institut Teknologi Kalimantan
  • Bagus Triyudanto Institut Teknologi Kalimantan
  • Saman Muhamad Institut Teknologi Kalimantan
  • Tirana Noor Fatyanosa Universitas Brawijaya https://orcid.org/0000-0002-2801-5947

DOI:

https://doi.org/10.35718/iiair.v1i1.1306

Keywords:

artificial intelligence, deep learning, chatbot, RAG, law, LLM, LLaMA

Abstract

Law is a set of rules that regulate boundaries of behavior
within society, is coercive in nature, and imposes sanctions
on violators. One of its branches is criminal law, which
focuses on violations of norms with the threat of sanctions.
However, the legal system often provides excessive
discretion to the judiciary, making legal outcomes difficult to
predict and potentially disadvantageous, especially for
individuals who lack legal understanding or cannot afford
legal representation. This disparity poses a significant
challenge to legal systems in many countries. In this study,
we demonstrate that artificial intelligence (AI) based on
Retrieval-Augmented Generation (RAG) can serve as an
innovative solution to support a more equitable enforcement
of the law. This technology integrates information retrieval
and data-driven text generation to help the public understand
their rights, access valid legal information, and obtain
relevant legal guidance. Based on the implementation and
testing of a criminal law chatbot using the LLaMA language
model, questions, generated answers, and the relevance of
the chatbot's responses were evaluated. Out of ten tested
questions, eight received relevant responses, while two were
deemed irrelevant. Additionally, the chatbot's capability to
retrieve legal documents based on user-provided prompts
was assessed. Of ten input prompts, the chatbot successfully
identified eight relevant documents, achieving a hit rate of
80%. Thus, the application of RAG in this legal chatbot can
provide an innovative solution to support law enforcement.
In the future, the use of AI in legal systems has the potential
to reduce information disparities, enhance transparency in
legal processes, and create a more efficient and accessible
legal system for all.

References

A. E. N. Lubis and F. D. Fahmi, “PENGENALAN DAN DEFINISI HUKUM SECARA UMUM (LITERATURE REVIEW ETIKA)”, JIMT, vol. 2, no. 6, pp. 768–789, Jul. 2021.

A. Efritadewi, “Modul Hukum Pidana. Tanjungpinang–Kepulauan Riau,”, Universitas Maritim Raja ali Haji, 2020

O. W. Holmes Jr, “The common law,” Routledge, 2020.

A. Munthuli et al., "Transformers for Multi-Intent Classification and Slot Filling of Supreme Court Decisions Related to Sexual Violence Law," in IEEE Access, vol. 11, pp. 76448-76467, 2023, doi: 10.1109/ACCESS.2023.3296261.

V. Tode et al., “A chatbot for medical purpose using deep learning,” International Journal of Engineering Research & Technology, 2021

ParkKoo-Rack, ‘Development of Artificial Intelligence-based Legal Counseling Chatbot System’, Journal of the Korea Society of Computer and Information, vol. 26, no. 3, pp. 29–34, 03 2021.

C. M. Greco and A. Tagarelli, “Bringing order into the realm of Transformer-based language models for artificial intelligence and law,” Artificial Intelligence and Law, vol. 32, no. 4. Springer Science and Business Media LLC, pp. 863–1010, Nov. 20, 2023. doi: 10.1007/s10506-023-09374-7.

K. I. Roumeliotis, N. D. Tselikas, and D. K. Nasiopoulos, “Llama 2: Early Adopters’ Utilization of Meta’s New Open-Source Pretrained Model.” MDPI AG, Aug. 01, 2023. doi: 10.20944/preprints202307.2142.v1.

P. Zhao et al., “Retrieval-Augmented Generation for AI-Generated Content: A Survey,” 2024, arXiv. doi: 10.48550/ARXIV.2402.19473.

S.-Q. Yan, J.-C. Gu, Y. Zhu, and Z.-H. Ling, “Corrective Retrieval Augmented Generation,” 2024, arXiv. doi: 10.48550/ARXIV.2401.15884.

“What is RAG (Retrieval Augmented Generation)?,” Trantorinc, May 07, 2024. https://www.trantorinc.com/blog/what-is-rag-retrieval-augmented-generation

T. Taipalus, “Vector database management systems: Fundamental concepts, use-cases, and current challenges,” Cognitive Systems Research, vol. 85. Elsevier BV, p. 101216, Jun. 2024. doi: 10.1016/j.cogsys.2024.101216.

S. Alshammari, L. Basalelah, W. A. Rukbah, A. Alsuhibani, and D. S. Wijesinghe, “PyZoBot: A Platform for Conversational Information Extraction and Synthesis from Curated Zotero Reference Libraries through Advanced Retrieval-Augmented Generation,” 2024, arXiv. doi: 10.48550/ARXIV.2405.07963.

J. Knapp and K. Moberg, “From Data to Descriptions: Efficient Data Retrieval in Autonomous Vehicle Development using Generative AI,” 2024

S. Lee et al., “A Survey on Evaluation Metrics for Machine Translation,” Mathematics, vol. 11, no. 4. MDPI AG, p. 1006, Feb. 16, 2023. doi: 10.3390/math11041006.

H. H. Arfisko and A. T. Wibowo, “Sistem Rekomendasi Film Menggunakan Metode Hybrid Collaborative Filtering Dan Content-based Filtering,” eProceedings of Engineering, vol. 9, no. 3, 2022.

Relevancy of RAG

Downloads

Published

30-04-2025

How to Cite

Zakly Pratama, A., Marinta, A., Triyudanto, B., Muhamad, S., & Noor Fatyanosa, T. (2025). Retrieval-Augmented Generation for Indonesian Criminal Law Information Using the LLaMA Model. Innovative Informatics and Artificial Intelligence Research, 1(1), 35–41. https://doi.org/10.35718/iiair.v1i1.1306