Abstract
With the continuous progress of digitization in Chinese judicial institutions, a substantial amount of electronic legal document information has been accumulated. To unlock its potential value, entity and relation extraction for legal documents has emerged as a crucial task. However, existing methods often lack domain-specific knowledge and fail to account for the unique characteristics of the judicial domain. In this paper, we propose an entity and relation extraction algorithm based on hypergraph neural network (Legal-KAHRE) for drug-related judgment documents. Firstly, we design a candidate span generator based on neighbor-oriented packing strategy and biaffine mechanism, which identifies spans likely to contain entities. Secondly, we construct a legal dictionary with judicial domain knowledge and integrate it into text encoding representation using multi-head attention. Additionally, we incorporate domain-specific cases like joint crimes and combined punishment for multiple crimes into the hypergraph structure design. Finally, we employ a hypergraph neural network for higher-order inference via message passing. Experimental results on the CAIL2022 information extraction dataset demonstrate that our method significantly outperforms existing baseline models.
Introduction
Extracting structured information—specifically triples in the form of [Subject, Relation, Object]—from legal documents is a cornerstone of modern judicial digitization. However, legal text presents unique challenges: it is dense with professional jargon and characterized by complex, overlapping relationships that general-purpose models often fail to capture.
Existing Entity and Relation Extraction (ERE) models typically struggle with two major issues in the legal domain. First, they lack the domain-specific semantic knowledge required to interpret specialized terminology. Second, they rely on standard graph structures that model binary relationships, whereas legal scenarios like "joint crimes" (multiple subjects, one act) or "combined punishments" (one subject, multiple acts) involve higher-order dependencies. To address these gaps, we introduce Legal-KAHRE (Knowledge Augmented Hypergraph Relation Extraction), a framework that integrates judicial domain knowledge and hypergraph neural networks to model complex legal logic.
Methodology
The Legal-KAHRE framework is structured into four primary stages designed to bridge the gap between general language models and the specific requirements of judicial text.
1. Candidate Span Generator
To improve efficiency and boundary detection, we employ a candidate span generator. This module utilizes a "neighbor-oriented packing" strategy combined with a biaffine mechanism. By identifying potential text spans that likely contain entities before performing full relation extraction, the model focuses its computational resources on high-probability boundaries.
2. Legal Feature-Augmented Encoder
To resolve the "jargon gap," we constructed a specialized dictionary of drug-related legal terms. This knowledge is integrated into the text encoding process via a mask matrix and multi-head attention. This mechanism allows the model to dynamically weigh the importance of legal terms based on context, effectively "reminding" the pre-trained encoder of specific judicial definitions during the reading process.
3. Hypergraph Neural Network (HGNN) Module
The core innovation of Legal-KAHRE lies in its use of hypergraphs. Unlike standard graphs where an edge connects exactly two nodes, a hyperedge can connect any number of nodes simultaneously. We designed three specific hyperedge types to mirror legal logic:
soredges: Represent the fundamental Subject-Object-Relation triplet.jc(Joint Crime) edges: Connect multiple subjects who share the same criminal object.cp(Combined Punishment) edges: Connect a single subject involved in multiple distinct criminal acts.
4. Higher-Order Inference
Through message passing across these specialized hyperedges, the HGNN module performs higher-order inference. This allows the representation of one entity or relation to be refined by the context of related crimes within the same document, leading to more accurate extraction in complex scenarios.
Experimental Results
We evaluated Legal-KAHRE on the CAIL2022 (Challenge of AI in Law) Information Extraction dataset, which contains 1,763 Chinese drug-related criminal judgment documents. The dataset includes five entity types and four relation types, focusing on trafficking, possession, and venue provision.
Legal-KAHRE consistently outperformed strong baselines such as UniRE and PL-Marker. Using an ELECTRA_legal encoder, the model achieved an F1-score of 91.7 for NER and 83.8 for Relation Extraction. Ablation studies confirmed the necessity of both core components: removing the HGNN module resulted in a 1.7-point drop in Relation Extraction F1, while removing the legal dictionary caused a 1.8-point drop. Notably, the custom jc and cp hyperedges significantly improved performance in the most complex relational scenarios.
Conclusion
Legal-KAHRE demonstrates that hypergraph neural networks are uniquely suited to the N-ary relational logic inherent in judicial documents. By combining structural innovation with domain-specific semantic augmentation, the model sets a new state-of-the-art for legal information extraction. Future work will focus on generalizing these hypergraph structures and dictionaries to broader judicial domains beyond drug-related offenses.
Summary updated