1 AIT Asian Institute of Technology

A hybrid architecture for legal reasoning : integrating retrieval-augmented generation and prompt compliance filtering

AuthorNguyen Le Quang
Call NumberAIT PJPR PMDS no.25-04
Subject(s)Information retrieval--Automation
Generative artificial intelligence

NoteA project report submitted in partial fulfillment of the requirements for the Degree of Master of Science (Professional) in Data Science and Artificial Intelligence Applications
PublisherAsian Institute of Technology
AbstractIn the evolving landscape of legal technology, the application of Large Language Models (LLMs) presents new opportunities for automating legal reasoning, document understanding, and case-based decision support. However, traditional LLMs often lack factual grounding and suffer from hallucinations, posing risks in high-stakes legal contexts. To address these challenges, this thesis proposes a hybrid architecture that integrates Retrieval-Augmented Generation (RAG) with a prompt compliance filtering mechanism to build a robust and trustworthy legal assistant system.The architecture leverages a combination of cutting-edge LLMs, including GPT-4 (OpenAI, 2024), Qwen3 (Team, 2025), and Llama (Llama Team, 2024), as the generative core. These models are dynamically augmented with context retrieved from a comprehensive legal corpus comprising statutes, regulations, and historical legal cases. A dense retriever module queries relevant documents from the legal knowledge base, which are then combined with the user’s prompt to form a retrieval-augmented input for the generator. To ensure domain-specific compliance and output integrity, a template-based prompt-validation gateway is applied at both the input and output stages. This layer enforces structured syntax, filters unsafe or incomplete queries, and verifies legal accuracy and tone in the generated responses.The system is evaluated on tasks such as legal case prediction, statute-based question answering, and legal argument synthesis. Experimental results demonstrate that the hybrid approach improves factual consistency, legal relevance, and prompt adherence compared to baseline LLM outputs. The architecture is modular, scalable, and adaptable to multilingual legal systems, positioning it as a practical framework for future intelligent legal assistants.
Year2025
TypeProject
SchoolSchool of Engineering and Technology
DepartmentDepartment of Information and Communications Technologies (DICT)
Academic Program/FoSProfessional Master in Data Science and Artificial Intelligence Applications (PMDS)
Chairperson(s)Chaklam Silpasuwanchai,;
Examination Committee(s)Chutiporn Anutariya;Chantri Polprasert;
DegreeProject (M.Sc.) - Asian Institute of Technology, 2025


Usage Metrics
View Detail0
Read PDF0
Download PDF0