รายละเอียดโครงงาน

หลักสูตร/ปี พ.ศ.
วิศวกรรมศาสตรบัณฑิต สาขาวิชาวิศวกรรมคอมพิวเตอร์ ปี พ.ศ. 2568

ภาคและปีการศึกษาที่สำเร็จการศึกษา
ภาคปลาย ปีการศึกษา 2568

ประเภทโครงงาน
โครงงานวิศวกรรม

ชื่อโครงงานภาษาไทย
การพัฒนาระบบปัญญาประดิษฐ์ทางกฎหมายไทย: กฎหมายแพ่งและอาญา

ชื่อโครงงานภาษาอังกฤษ
Thai Legal LLM System Development: Civil and Criminal Laws

ผู้พัฒนา
6410500220 ณฐพล พลนาการ

อาจารย์ที่ปรึกษาหลัก
จันทนา จันทราพรชัย

อาจารย์ที่ปรึกษาร่วม
-

บทคัดย่อ

งานวิจัยนี้นำเสนอการประยุกต์ใช้โมเดลภาษาขนาดใหญ่ (Large Language Models: LLMs) กับระบบกฎหมายไทย โดยมุ่งเน้นเฉพาะด้านกฎหมายแพ่งและกฎหมายอาญา โดยเฉพาะอย่างยิ่ง งานวิจัยนี้มุ่งเน้นไปที่กระบวนการปรับจูนโมเดล Llama เพื่อให้มีความเชี่ยวชาญในโดเมนกฎหมายไทยและสามารถให้เหตุผลเชิงกฎหมายได้อย่างถูกต้อง ด้วยชุดข้อมูลที่ได้รับการคัดสรรมาอย่างเหมาะสมกับข้อความกฎหมายไทย

มีการอธิบายกระบวนการจัดเตรียมข้อมูล การทำความสะอาดข้อมูล รวมถึงการสร้างข้อมูลสำหรับการทดสอบ นอกจากนี้ยังกล่าวถึงเทคนิคการปรับจูนภายใต้ข้อจำกัดด้านทรัพยากรอีกด้วย

ในส่วนของการนำไปใช้งาน มีการผสานรวมกับเฟรมเวิร์กมาตรฐานในสภาพแวดล้อมการทดสอบ โดยเริ่มจากเฟรมเวิร์กแบบเอเจนต์ (Agent-based Framework) ร่วมกับ OpenAI API ซึ่งสามารถเรียกใช้งานฟังก์ชันแบบไดนามิก เช่น การค้นหาคำพิพากษา และการตั้งคำถามตามบริบทได้

ยิ่งไปกว่านั้น ยังใช้เทคนิค Retrieval-Augmented Generation (RAG) เพื่อให้มั่นใจว่าคำตอบมีความถูกต้องและเกี่ยวข้อง โดยการดึงข้อมูลจากฐานความรู้ที่เชื่อถือได้ นอกจากนี้ยังเชื่อมต่อกับอินเทอร์เน็ตเพื่ออัปเดตข้อมูลแบบเรียลไทม์และเพิ่มความเข้าใจในบริบทให้ดียิ่งขึ้น

ระบบยังใช้ LangChain และ LangGraph เพื่อสร้างโครงสร้าง pipeline แบบแยกโมดูล ซึ่งช่วยให้สามารถจัดการการทำงานระหว่าง LLM, ส่วนประกอบของ RAG และฟังก์ชันของเอเจนต์ได้อย่างราบรื่น การออกแบบนี้ช่วยให้ระบบมีความยืดหยุ่นและสามารถปรับขยายให้รองรับกรณีการใช้งานด้านกฎหมายที่หลากหลายได้

ผลลัพธ์แสดงให้เห็นถึงความสามารถที่เพิ่มขึ้นอย่างมีนัยสำคัญในการตีความข้อความกฎหมาย การวิเคราะห์คำพิพากษา และการตอบคำถามของผู้ใช้งาน ทำให้ระบบนี้เป็นเครื่องมือที่มีศักยภาพสูงสำหรับนักกฎหมายและนักวิจัย

โดยเฉพาะผลการทดลองแสดงให้เห็นว่าโมเดลของเรามีอัตราการผ่าน (pass rate) สูงกว่า Llama3.3 ประมาณ 60% และสูงกว่า GPT-4o-mini ประมาณ 39% เมื่อประเมินร่วมกับผู้เชี่ยวชาญ ระบบของเราได้คะแนนเฉลี่ย 7.115 จาก 10 เทียบกับ GPT ซึ่งได้คะแนน 4

Abstract

This research presents an application of Large Language Models (LLMs) towards the domain of Thai legal systems, specifically focusing on civil and criminal law. Particularly, the study focuses on the fine-tuning methodology of the Llama model to specialize in Thai legal domain and reasoning using a curated dataset tailored to Thai legal texts. The dataset acquisition, data cleansing approaches, as well as the testing data generation are characterized.Then, the fine tuning techniques under the limited resources are also discussed.For the deployment, we integrates standard frameworks in the testing environment. First, with an agent-based framework with OpenAI APIs, it enables dynamic function calls such as case retrieval and contextual queries. In addition, retrieval-augmented generation (RAG) is used to ensure accurate and relevant responses by retrieving information from a robust knowledge base. Internet connectivity is incorporated to provide real-time updates and a better contextual understanding. The framework also leverages LangChain and LangGraph for modular pipeline construction, enabling seamless orchestration of the LLM, RAG components, and agent functions. This design ensures adaptability and scalability for various legal use cases. The results demonstrate significant improvements in legal text interpretation, case analysis, and user query resolution, making the system a promising tool for legal professionals and researchers. In particular, the experiments show that our model has about 60\% pass rate more than that of Llama3.3 and 39\% more than that of GPT-4o-mini. The validation with experts shows that a score of 7.115 out of 10 compares to GPT’s score of 4.

คำสำคัญ (Keywords)

Llama; Legal AI; Thai law; Civil law; Criminal law; RAG; LangChain; LangGraph

เว็บไซต์โครงงาน
-

วีดีโอคลิปของโครงงาน

ที่เก็บเวอร์ชันซอร์สโค้ด

https://drive.google.com/file/d/1MyU4HHst5ip8v1OKufedufVoQQdvIOQ1/view


สถานะการนำเข้าข้อมูล

ผู้นำเข้าข้อมูลครั้งแรก
ณฐพล พลนาการ (b6410500220)

แก้ไขครั้งสุดท้าย
เมื่อ April 1, 2025, 11:26 p.m. โดย ณฐพล พลนาการ (b6410500220)

สถานะการอนุมัติ
รออนุมัติ