AI Legal Council
An offline courtroom simulator where an AI judge, opposing counsel and client train Vietnamese law students.
AI engineer · LLM fine-tuning, RAG and the AI backend · team Newbie-Coding · 2025 · Live
01 · The problem
The problem
Law training in Vietnam is heavy on theory and short on practice. Existing tools either send sensitive case data to the cloud or stop at static multiple-choice questions, so students rarely rehearse the back-and-forth of a real hearing.
02 · The data
The data
Vietnamese precedents, decrees and circulars from official sources: about 100,000 legal documents cleaned from Word and PDF into instruction, input and output JSON, with 10,000 samples used for supervised fine-tuning.
03 · The approach
The approach
A desktop app (Electron) talks to a FastAPI gateway and a local LLM served by Ollama: Qwen2.5 3B Instruct fine-tuned on Vietnamese legal text, with retrieval from a vector database of statutes. An AI council of six agents plays judge, opposing counsel, client and more, while a hard-coded rule engine based on the 2015 Civil Procedure Code keeps them procedurally correct. Strict system prompts force JSON output and make the model ask back instead of inventing facts.
04 · The results
The results
3rd place at the IU AI Competition 2025 with team Newbie-Coding. The fine-tuned model runs fully offline on an ordinary laptop without a dedicated GPU and reached about 75% accuracy in manual testing; the simulated judge pushes back on weak arguments instead of only quoting the law.
05 · Why it matters
Why it matters
Shows a privacy-first LLM system built for low-resource settings, where the guardrails matter as much as the model.
Gallery
Through the DABM lens
- DData
- ~100,000 Vietnamese legal documents · 10,000 fine-tuning samples
- AAgent
- law students rehearsing hearings without a real courtroom
- BBehavior
- arguments the opposing side and the judge would challenge
- MModeling
- fine-tuned local LLM · retrieval · rule engine · multi-agent council
Stack
- Python
- Qwen2.5
- Ollama
- FastAPI
- Electron
- RAG
A fuller case study for this project is coming soon.