1
A hybrid architecture for legal reasoning : integrating retrieval-augmented generation and prompt compliance filtering | |
| Author | Nguyen Le Quang |
| Call Number | AIT PJPR PMDS no.25-04 |
| Subject(s) | Information retrieval--Automation Generative artificial intelligence |
| Note | A project report submitted in partial fulfillment of the requirements for the Degree of Master of Science (Professional) in Data Science and Artificial Intelligence Applications |
| Publisher | Asian Institute of Technology |
| Abstract | In 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. |
| Year | 2025 |
| Type | Project |
| School | School of Engineering and Technology |
| Department | Department of Information and Communications Technologies (DICT) |
| Academic Program/FoS | Professional Master in Data Science and Artificial Intelligence Applications (PMDS) |
| Chairperson(s) | Chaklam Silpasuwanchai,; |
| Examination Committee(s) | Chutiporn Anutariya;Chantri Polprasert; |
| Degree | Project (M.Sc.) - Asian Institute of Technology, 2025 |