Vietnamese Legal GraphRAG is an AI system designed to navigate the massive and complex Vietnamese legal framework (over 350,000 documents). It mitigates LLM hallucinations and outdated legal references by combining semantic search with a structural legal knowledge graph within an autonomous agentic loop.
Highlights
- Agentic Workflow (ReAct): Orchestrated by a LangChain ReAct Agent that autonomously reasons and routes queries to specific tools (
retrieval_search,graph_validate,web_find_source_link) in a multi-step loop. The agent systematically gathers evidence and validates it through a safety net before constructing the final response. - Hybrid RAG & Reranking: Implemented a robust retrieval pipeline combining Dense kNN (using
vnlegal-lalembeddings) and Sparse BM25 via Elasticsearch. Results are fused using Reciprocal Rank Fusion (RRF) and re-ranked with a Cross-Encoder (bge-reranker-v2-m3) for maximum precision. - Legal Knowledge Graph: Modeled legal relationships (amendments, replacements, guidelines, citations) in Neo4j using a LightRAG-inspired architecture, allowing the system to expand context accurately without relying on LLM guesswork.
- Contract Risk Analysis: Integrated Google Cloud Vision API for high-accuracy OCR on complex Vietnamese contract layouts, enabling LLMs to automatically scan and flag disadvantageous clauses.
- Transparent & Safe LLM Generation: Deployed with Open WebUI, the system forces LLMs (e.g., Qwen3.6 27B, Llama 3.3 70B) to strictly cite verifiable legal sources and safely refuse answers when evidence is insufficient, achieving high citation validity.
