Leverage Knowledge Graph and Large Language Model for Law Article Recommendation: A Case Study of Chinese Criminal Law

Yongming Chen, Miner Chen, Ye Zhu, Juan Pei, Siyu Chen, Yu Zhou, Yi Wang, Yifan Zhou, Hao Li, Songan ZhangarXiv 2024 · DOI

Introduction

In modern jurisprudence, the efficiency of the judicial process is directly linked to the quality of justice. However, many legal systems face significant challenges, including massive case backlogs and a lack of intelligent tools to assist judges in navigating complex statutes. While Large Language Models (LLMs) have shown promise in automating legal tasks, their application in high-stakes domains is hindered by "hallucinations"—the tendency to generate plausible but legally inaccurate or non-existent citations.

Traditional machine learning approaches, such as BERT or Convolutional Neural Networks (CNNs), often treat law recommendation as a standard text-classification problem. These "black box" models struggle with the imbalanced nature of legal datasets and fail to capture the deep, structural relationships between statutes and historical precedents. This paper introduces CLAKG-RAG, a framework that integrates a Case-Enhanced Law Article Knowledge Graph (CLAKG) with LLMs to provide grounded, verifiable, and accurate legal recommendations.

Methodology

The CLAKG-RAG framework utilizes a "closed-loop" system that combines structured legal knowledge with the generative capabilities of LLMs. The methodology consists of four primary components:

1. Case-Enhanced Law Article Knowledge Graph (CLAKG)

Unlike standard legal databases, the CLAKG links law articles to "key information" nodes and historical case data. This structure captures the "macro-semantics" of the law—mapping how specific articles relate to factual patterns. The graph was constructed by using LLMs to automate the extraction of subject-predicate-object triples from legal texts, which were then verified by legal experts.

2. Graph Embeddings via RGCN

To process the structured data, the authors employed Relational Graph Convolutional Networks (RGCN). This allows the system to create sophisticated graph embeddings, enabling the calculation of mathematical similarity between the facts of a new case and the existing nodes within the knowledge graph.

3. Graph-Grounded Retrieval-Augmented Generation (RAG)

When a user inputs a new case, the system does not rely solely on the LLM’s internal weights. Instead, it retrieves the most relevant law articles and historical precedents from the CLAKG. This retrieved data serves as a "verifiable context" for the LLM, forcing the model to reason within the specific bounds of established legal evidence and reducing the risk of hallucination.

4. Human-in-the-Loop (HITL) Feedback

The framework incorporates a feedback mechanism where legal experts review the system's recommendations. If a correction is made, the CLAKG is updated with the new case-to-law link, allowing the knowledge graph to evolve and improve its accuracy over time.

Experimental Setup

The study focused on Chinese Criminal Law, utilizing the following data sources:

  • Statutes: 452 articles from Amendment (XI) to the Criminal Law of the PRC.
  • Case Data: 1,170 case records sourced from China Judgments Online for cases adjudicated after March 2021.
  • Data Split: The dataset was divided into 997 records for initial graph construction and training, with 173 records reserved for testing.

Results and Discussion

The CLAKG-RAG framework demonstrated superior performance compared to both traditional classifiers and generic RAG pipelines:

  • Accuracy Improvements: The proposed method achieved an accuracy of 0.694, significantly outperforming a vanilla LLM baseline (GPT-4), which scored 0.549.
  • Comparison with Traditional Models: Traditional models like BERT (0.289) and DPCNN (0.495) struggled significantly with the imbalanced nature of the legal dataset, highlighting the limitations of treating law recommendation as a simple classification task.
  • Specialized vs. Generic RAG: The system also outperformed generic graph-based methods such as Graph-RAG (0.179) and Light-RAG (0.636). This suggests that a manually designed, task-oriented legal schema is more effective for professional applications than generic document-to-graph approaches.

Key Insights

  1. Structure Over Scale: While general-purpose LLMs possess vast knowledge, they lack the precision required for niche legal tasks. Providing "guardrails" through a task-specific Knowledge Graph is essential for professional reliability.
  2. Analogical Reasoning: By incorporating historical cases into the graph, the system can perform reasoning based on precedent, identifying how similar factual patterns were handled in the past to recommend the correct article today.
  3. Mitigating Bias: Because the framework relies on structured retrieval rather than pattern matching, it is better equipped to handle the "long tail" of rare law articles that traditional classifiers often ignore.

Limitations and Future Work

Despite its success, the framework faces challenges regarding data scarcity due to the limited availability of public criminal judgments. Additionally, while LLMs automate much of the graph construction, the process still requires expert oversight to prune noisy links. Future research will explore the use of LLMs to generate synthetic cases to improve training on rare statutes and investigate the portability of this schema to common-law jurisdictions, where judicial precedent plays an even more central role.

Summary updated

BibTeX
@misc{chen2024leverage,
  author = {Yongming Chen and Miner Chen and Ye Zhu and Juan Pei and Siyu Chen and Yu Zhou and Yi Wang and Yifan Zhou and Hao Li and Songan Zhang},
  title = {{Leverage Knowledge Graph and Large Language Model for Law Article Recommendation: A Case Study of Chinese Criminal Law}},
  year = {2024},
  eprint = {2410.04949},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2410.04949},
}
Figure