An Integrated Framework of Prompt Engineering and Multidimensional Knowledge Graphs for Legal Dispute Analysis

Mingda Zhang, Na Zhao, Jianglong Qing, Qing xu, Kaiwen Pan, Ting LuoarXiv 2025 · DOI · arXiv

Introduction

Legal dispute analysis represents one of the most complex cognitive challenges for artificial intelligence. While Large Language Models (LLMs) have demonstrated significant potential in natural language understanding, they frequently encounter three critical "walls" in the legal domain: shallow conceptual understanding, reasoning inconsistency, and citation hallucinations. Simply increasing model parameters often yields diminishing returns while increasing computational overhead.

This paper proposes a shift from "bigger models" to "smarter structures." The researchers introduce a hybrid framework that integrates three-stage hierarchical prompt engineering with three-layer multidimensional knowledge graphs (KGs). By implementing a closed-loop system of iterative prompt optimization, the framework achieves substantial improvements in legal reasoning sensitivity and citation accuracy.

The Proposed Framework

The core of the system is a dual-core architecture designed to ground LLM reasoning in verified legal knowledge while providing structured guidance for complex analysis.

Comprehensive Legal Dispute Diagnosis Framework

Three-Stage Hierarchical Prompting

To move beyond flat, one-size-fits-all prompts, the framework utilizes a structured hierarchy:

  1. Task Definition: Employs a matching algorithm to align user queries with specific legal task templates, ensuring the model adopts the correct professional persona.
  2. Knowledge Background: Injects context-relevant legal concepts retrieved dynamically from the knowledge graph.
  3. Reasoning Guidance: Provides "professional path templates" (such as the IRAC framework—Issue, Rule, Analysis, Conclusion) to guide the model through logical steps.

Three-Layer Multidimensional Knowledge Graph

The knowledge graph is organized into three distinct layers to capture the complexity of legal systems:

  • Ontology Layer: Defines abstract legal concepts and their interrelationships.
  • Representation Layer: Maps how these concepts are expressed within formal legal texts.
  • Instance Layer: Contains specific case applications and precedents, providing concrete examples for the model to reference.

Iterative Optimization Loop

A standout feature of this framework is its dynamic feedback mechanism. Rather than a one-shot generation process, the system evaluates the quality of the initial LLM response against multi-dimensional standards, including logic, accuracy, and citation validity.

Iterative Optimization Loop for Legal Analysis

If the initial output is deemed unsatisfactory, the Adaptive Prompt Adjustment Module modifies the prompt based on the identified deficiencies. This refined prompt is then processed by the Legal Knowledge Fusion Optimizer, which re-queries the KG to provide better-aligned context. This loop continues until the response meets the required quality threshold, ensuring a high-fidelity final legal analysis.

Experimental Results and Insights

The framework was rigorously tested using the DeepSeek-R1-Distill-Qwen-32B and Qwen/QwQ-32B models across datasets like COLIEE and LexGLUE. The "Complete" configuration yielded impressive results:

  • Sensitivity: Increased by 11.1%–11.3%, indicating a superior ability to identify relevant legal issues.
  • Citation Accuracy: Improved by 29.5%–39.7%, significantly reducing hallucinations of non-existent laws.
  • Specificity: Improved by 5.4%–6.0%, helping the model exclude irrelevant legal noise.

Knowledge Fusion vs. Stacking

A critical finding of the research was the distinction between "knowledge stacking" and "knowledge fusion." Traditional Retrieval-Augmented Generation (RAG) often leads to stacking, where the model cites laws correctly but its reasoning degrades due to data overload. In fact, basic KG integration without hierarchical prompting sometimes caused models to perform worse than the baseline. The proposed framework achieves true "knowledge fusion," where the model understands how to apply the retrieved laws within a professional reasoning structure.

Conclusion

By combining structured thinking spaces with multidimensional knowledge retrieval, this framework addresses the core weaknesses of LLMs in legal analysis. While future work is needed to address multimodal evidence and cross-jurisdictional support, this research provides a robust blueprint for high-stakes AI applications where accuracy and professional reasoning are non-negotiable.

Summary updated

BibTeX
@misc{zhang2025integrated,
  author = {Mingda Zhang and Na Zhao and Jianglong Qing and Qing xu and Kaiwen Pan and Ting Luo},
  title = {{An Integrated Framework of Prompt Engineering and Multidimensional Knowledge Graphs for Legal Dispute Analysis}},
  year = {2025},
  eprint = {2507.07893},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2507.07893},
}
Figure