TY - BOOK AU - Nguyen Le Quang AU - Chaklam Silpasuwanchai, AU - Chutiporn Anutariya, AU - Chantri Polprasert, TI - A hybrid architecture for legal reasoning: integrating retrieval-augmented generation and prompt compliance filtering T2 - Project PY - 2025/// CY - Pathum Thani, Thailand PB - Asian Institute of Technology KW - Information retrieval KW - Automation KW - Generative artificial intelligence N1 - 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; Master of Science (Professional) - Asian Institute of Technology, 2025 N2 - 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{u2019}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. UR - http://203.159.5.9/ait-thesis/detail.php?q=B23688 ER -