A case-based retrieval method and system based on the coordination and fusion of legal principles and reason
By constructing single-case factual graphs and global case legal graphs using large language models and heterogeneous graph neural networks, accurate case matching and retrieval are achieved. This solves the problems of insufficient case factual semantic analysis capabilities and insufficient cross-case semantic association fusion in existing technologies, and improves the accuracy of similar case retrieval and the consistency of legal logic.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHANDONG UNIV
- Filing Date
- 2025-12-23
- Publication Date
- 2026-07-21
AI Technical Summary
Existing case retrieval methods lack the ability to analyze case facts semantically, lack a high-quality element extraction mechanism, fail to achieve unified integration of single-case structural modeling and cross-case semantic association, and neglect legal knowledge.
A large language model is used for semantic parsing of case fact descriptions and crime prediction. A single-case fact graph and a global case jurisprudential graph are constructed. A heterogeneous graph neural network is used to perform bidirectional fusion of local fine-grained and global semantics to achieve accurate case matching and retrieval.
It improves the accuracy and automation of case semantic modeling, significantly enhances the hierarchy and interpretability of case representation, solves the problems of independent case coding and lack of global semantic constraints in existing technologies, and ensures semantic consistency and the stability of legal logic.
Smart Images

Figure CN121833923B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of artificial intelligence and judicial intelligence, and in particular to a method and system for case retrieval based on the fusion of single-case case reasoning diagrams and global case legal reasoning diagrams. Background Technology
[0002] Case retrieval is one of the core foundational tasks of an intelligent judicial system. Its goal is to automatically retrieve the most similar reference cases from a large-scale historical judgment database, given a factual description of a case to be adjudicated, providing judges, prosecutors, and lawyers with references for judgment and a basis for legal application. Case retrieval plays a crucial role in judicial scenarios such as "equal judgment in similar cases," "legal interpretation through cases," and "supervision of discretionary power," and is one of the key technologies for promoting the standardization, intelligence, and fairness of judgments.
[0003] Current case retrieval methods are mainly divided into two categories: traditional information retrieval methods and neural network methods based on deep semantic representation. Traditional information retrieval methods are centered on term matching, such as keyword matching algorithms based on TF-IDF, BM25, or language models (LMIR). These methods have good retrieval efficiency in large-scale legal documents, but their representational ability is limited to the word frequency level and cannot effectively capture the semantic relationships and legal logic of case facts, resulting in results that are similar in text but deviate in legal application. With the development of deep learning, more and more researchers are trying to use pre-trained language models to semantically model legal case texts. Representative works include Legal-BERT, Caseformer, SAILER, and DELTA. These models achieve semantic-level case retrieval by encoding case text into vector representations and calculating cosine similarity. However, because legal documents are usually long, complex in structure, and contain multiple layers of nested logic, existing models based on semantic embedding often suffer from information truncation or semantic drift when facing cases with "multiple acts, multiple charges, and multiple legal provisions," making it difficult to guarantee the accuracy of fact matching and the consistency of legal interpretation.
[0004] Furthermore, some researchers have begun to introduce graph neural networks to model the internal structure of legal texts in order to capture the logical relationships between case elements. While these methods have enhanced the ability to represent cases in a structured way to some extent, they still have the following significant shortcomings: most methods only model the graph structure within a single case, lacking semantic alignment and global constraints with other cases; although global graph models can capture potential relationships between cases, they often ignore the fine-grained factual structure within a single case, resulting in insufficient representation information; existing models generally use fixed node extraction templates, making it difficult to cover the diverse factual structures under different charges or complex behavioral chains.
[0005] In summary, the main shortcomings of existing technologies in case retrieval are as follows: (1) Insufficient semantic analysis capability of case facts and lack of high-quality element extraction mechanism; (2) Failure to achieve unified integration of single case structure modeling and cross-case semantic association; (3) Case similarity calculation relies only on the semantic embedding of case documents and ignores legal knowledge. Summary of the Invention
[0006] To overcome the shortcomings of the existing technology, this invention proposes a case retrieval method and system based on the fusion of single-case case reasoning diagrams and global case legal reasoning diagrams.
[0007] Specifically, this invention introduces a pre-trained large language model to predict the charge and extract facts from the description of case facts, thereby identifying key facts and relevant legal provisions. Furthermore, it employs a heterogeneous graph neural network to construct a single-case factual graph to capture the multi-layered logical structure and factual connections within the case. Simultaneously, it establishes a case-charge-legal provision graph structure at the global level, explicitly modeling cross-case semantic and legal relationship information. By designing a global-local bidirectional fusion mechanism, it achieves the fusion of fine-grained local semantics and global group consistency, thereby enabling precise matching and retrieval of cases in the three-dimensional space of semantics, structure, and legal constraints.
[0008] Terminology Explanation:
[0009] 1. Case retrieval refers to the process of automatically retrieving cases most similar to those in terms of factual details, applicable law, and judgment from a large database of adjudicated cases, given a factual description or textual content of a case to be adjudicated. Case retrieval aims to provide judges, prosecutors, and lawyers with referable judicial precedents to achieve "consistent judgments in similar cases" and "legal interpretation through cases." Its core technologies include case semantic modeling, case similarity calculation, and result ranking. This invention's case retrieval method, based on traditional text semantic matching, introduces a structured case graph and cross-case association modeling to improve the accuracy and legal consistency of the retrieval results.
[0010] 2. Large language models refer to language models pre-trained on large-scale corpora that possess semantic understanding, knowledge reasoning, and generation capabilities. Large language models can automatically complete tasks such as task instructions, semantic extraction, or classification generation based on the context of the input text. This invention utilizes a large language model fine-tuned with legal corpora to perform semantic parsing, crime prediction, and case fact extraction on case fact descriptions, achieving structured modeling of case semantic information and serving as the core semantic engine in the construction and retrieval stages of the case logic graph.
[0011] 3. A heterogeneous graph is a graph structure that contains more than one type of node and edge. For a set of node types... and edge type set A graph G is called a heterogeneous graph if m>1 or n>1. Compared with homogeneous graphs, heterogeneous graphs can distinguish the semantic categories of nodes and relationships, making them suitable for describing multi-dimensional information interactions. The heterogeneous graph in this invention is used to model the internal structure of a case. Nodes include types such as events, key facts, and legal provisions, while edge relationships include temporal relationships, causal relationships, and citation relationships, thereby depicting the multi-layered connections between the factual logic of the case and the legal provisions.
[0012] 4. Graph Neural Networks (GNNs) refer to neural network models that perform feature learning and information propagation on graph-structured data. By aggregating the feature vectors of neighboring nodes and performing nonlinear transformations, GNNs can learn higher-order representations of nodes while preserving the topological structure. This invention employs heterogeneous GNNs, setting independent parameter matrices and attention weights for different node types and relationship types to achieve joint representation and feature aggregation of multiple semantic elements within a case.
[0013] 5. Generative language models based on the Transformer architecture refer to deep learning models that utilize the Transformer neural network structure to learn representations of input sequences through a self-attention mechanism, and then automatically generate text output based on this. These models typically consist of encoder and decoder modules, or only a decoder. The model is pre-trained on large-scale text corpora to learn the statistical regularities and semantic structure of language. In applications, it can automatically generate grammatically and semantically correct natural language text based on the input content, such as summarization, question answering, text continuation, semantic understanding and reasoning, etc.
[0014] 6. Supervised Fine-Tuning (SFT): This refers to a method of further training the model parameters using labeled data with explicit input-output pairs, building upon a pre-trained language model. By minimizing the difference between the model's generated output and the target output, the model learns the mapping relationship for a specific task, thereby acquiring domain-specific task capabilities while maintaining general language understanding.
[0015] 7. Heterogeneous Graph Neural Networks: This is a foundational model in the field of graph neural networks. Its design goal is to handle heterogeneous graph data containing various types of nodes and edges. This single-layer network mainly includes two core operations: Heterogeneous Graph Convolution: Utilizes Graph Attention (GAT) for message passing. For each type of relationship in the graph, a separate graph attention layer is used to handle message passing within that relationship. For a central node, it interacts with different sets of neighbors depending on the relationship type. Node-level Attention Aggregation: After obtaining neighbor information for each relationship through heterogeneous convolution, the attention mechanism automatically learns the importance weights of neighbors in different relationships for the central node and performs weighted aggregation to update the feature representation of each node.
[0016] 8. GATConv: A graph convolutional neural network layer based on a graph attention network architecture. Unlike traditional graph convolutional networks (GCNs), GATConv introduces an attention mechanism, allowing nodes to adaptively assign different weights (i.e., attention coefficients) to different neighbor nodes when aggregating neighbor information. In the global case graph neural network of this invention, GATConv is used as the core feature extraction module. It is used to handle complex relationships (such as similar_to, has_charge, has_law) between cases, charges, and legal provisions in the global graph. Through GATConv's multi-head attention mechanism, the model can dynamically learn the importance of neighbor nodes to the target node under different relationships, realizing weighted aggregation and updating of node features.
[0017] 9. BERT: A pre-trained language representation model. Based on the Transformer bidirectional encoder structure, this model captures deep contextual semantic information and syntactic features in text through unsupervised pre-training on massive text corpora (including masked language model MLM and next sentence prediction NSP tasks). The BERT model can transform variable-length natural language text into a fixed-dimensional dense vector representation.
[0018] To achieve the above objectives, the present invention adopts the following technical solution:
[0019] Firstly, this invention provides a case retrieval method based on the synergistic integration of legal and factual reasoning, including:
[0020] ST1: Predict the crime based on the factual description of the case to be retrieved, and obtain the crime label corresponding to the case; wherein, the crime prediction is based on a pre-trained language model with efficient parameter fine-tuning, which realizes the semantic mapping between the factual description of the case and the crime label through an imperative generation task;
[0021] ST2: Based on the factual description of the case to be retrieved, a single-case factual graph is constructed, including event nodes, key fact nodes, and legal provision nodes. Node types include event nodes, key fact nodes, and legal provision nodes; edge types include temporal relationships between events, causal relationships between events and key facts, and citation relationships between key facts and legal provisions. After constructing the single-case factual graph, a heterogeneous graph neural network is used to aggregate node information to obtain a local semantic representation of the single case. The heterogeneous graph neural network performs weighted fusion of node information based on the attention weights of different edge types to capture fine-grained semantics and logical connections within the case.
[0022] ST3: Construct a global case jurisprudential graph, including case nodes, charge nodes, and legal provision nodes. The global case jurisprudential graph is used to represent the semantic associations, charge associations, and legal provision associations across cases. Case nodes represent different case texts, charge nodes represent the charge category to which a case belongs, and legal provision nodes represent relevant legal provisions. The edges in the global case jurisprudential graph include case-case edges, case-charge edges, and case-legal provision edges, which are used to model the semantic similarity between cases, the group consistency of cases with the same charge, and the legal association of cases that cite the same legal provision, respectively. A global case graph neural network is used to model the structured semantic information between cases globally by performing message propagation based on an attention mechanism on the global case jurisprudential graph.
[0023] ST4: For the cases to be retrieved and candidate cases, the local semantic representation learned from the single case jurisprudence graph is fused with the semantic representation learned from the global case jurisprudence graph after absorbing global information to generate the final comprehensive representation of the case; the fusion operation is presented in the form of vector concatenation to simultaneously retain the fine-grained logical information inside the case and the global relational information outside.
[0024] ST5: Sort the candidate cases of the query case according to the comprehensive similarity score, and output the case results that are most similar to the query case; the sorting process arranges the candidate cases from high to low according to the comprehensive similarity score, and outputs the top K most similar reference cases.
[0025] According to a preferred embodiment of the present invention, in step ST1, the pre-trained language model is a generative language model based on the Transformer architecture, which is achieved by efficiently fine-tuning the parameters on a legal corpus;
[0026] The pre-trained language model takes case fact text as input. , It is the nth word in the case fact text, where n refers to the total length of words in the case fact text X;
[0027] Output the sequence of crime labels , This refers to the m-th crime label in the output crime label sequence, where m is the total length of the crime label sequence Y. The generation probability is defined as follows:
[0028] ;
[0029] in, The input is a sequence of case fact texts; The output is a sequence of crime labels, where m is the length of the label sequence; Let t be the predicted label; The probability of a pre-trained language model generating the entire sequence of charges given the input case text; To provide the input text and previously generated tags Given the condition, the conditional probability of the t-th label; For the previously generated label sequence, ;
[0030] By minimizing the cross-entropy loss function The pre-trained language model is used to achieve semantic mapping between case semantics and legal labels. During training, a teacher-mandated strategy is adopted, that is, the real labels of the previous time step are used as the input conditions for the current time step.
[0031] ;
[0032] in, It is the cross-entropy loss function used in the crime prediction stage for parameter learning; The true crime label at time step t; This refers to the complete sequence of true labels before time step t. .
[0033] According to a preferred embodiment of the present invention, a single-case reasoning diagram is constructed using a large language model.
[0034] According to a preferred embodiment of the present invention, in step ST2, a heterogeneous graph neural network is used to aggregate node information; for each layer of the heterogeneous graph neural network, the node update process of each layer is expressed as follows:
[0035] ;
[0036] in, Represents a node In the The feature vector of the layer; It is a non-linear activation function; A set of relation types; For nodes In relation types The set of neighbors below; This is the weight matrix of the l-th layer corresponding to relation type r; The attention weight of node j to node i under relation type r is defined as:
[0037] ;
[0038] in, This is an attention vector of relation type, where || represents the vector concatenation operation; It is a leaky ReLU activation function; Represents the feature vector of node i; Let j be the feature vector of node j; It is the weight matrix corresponding to the relation type r; k is Given any neighbor node in the set, it is used to traverse all neighbors of node i under relation r; It refers to an exponential function with base e;
[0039] Introducing a case node, which is a node connecting all nodes in the graph, the feature vector of this case node at the last layer is the final global semantic representation of the case. The formula is:
[0040] ;
[0041] in, This represents the feature vector of the case node in the last layer of the heterogeneous graph neural network. That is, the local semantic representation of a single case.
[0042] A further preferred approach is to train the heterogeneous graph neural network using a list-based ranking loss learning algorithm, with the loss function being:
[0043] ;
[0044] in, Let n be the total loss calculated for a query sample q, and let j be the index of the candidate sample in the list. The goal is to minimize the total loss by optimizing the parameters of the heterogeneous graph neural network. n is the total number of candidate samples corresponding to the current query q, and j is the index of the candidate sample in the list. The algorithm iterates from the 1st to the nth candidate. Let be the target probability distribution, representing the ideal relevance probability of the j-th candidate sample relative to the current query; Let be the probability distribution predicted by the heterogeneous graph neural network, representing the probability that the j-th candidate sample is ranked first. The coefficient for the penalty term. The weight coefficients for the L2 regularization term are hyperparameters. This is the set of all learnable parameters in a heterogeneous neural network.
[0045] According to a preferred embodiment of the present invention, a heterogeneous graph neural network performs weighted fusion of node information based on attention weights of different types of edges to capture fine-grained semantics and logical connections within a case; including:
[0046] Different node types are linearly mapped to obtain a node vector representation with a unified dimension. Relationship types include the aggregation relationship between case nodes and each node, the temporal relationship between events, the causal relationship between events and key facts, and the citation relationship between key facts and legal provisions. Attention scores are calculated for the node pairs (i,j) connected under each relationship type r in the single case fact graph, as shown below:
[0047] ;
[0048] in, This is an attention vector of relation type, where || represents the vector concatenation operation; It is a leaky ReLU activation function; Represents the feature vector of node i; Let j be the feature vector of node j; It is the weight matrix corresponding to the relation type r; k is Given any neighbor node in the set, it is used to traverse all neighbors of node i under relation r; It refers to an exponential function with base e; this attention score characterizes the importance of node j to node i under relation type r.
[0049] The attention scores are Softmax normalized, and the attention weights are obtained after Softmax normalization. Under each relation type, the target node receives weighted information from its neighbor nodes and performs feature fusion. Then, the aggregation results of all relation types are summed with weights.
[0050] This allows nodes to simultaneously acquire: the temporal dependence of the event chain, the causal relationship between facts and key facts, and the citation relationship between key facts and legal provisions; forming a node representation with a legal logical structure, namely, fine-grained semantics and logical connections within the case.
[0051] According to a preferred embodiment of the present invention, in step ST3, the case node, the charge node, and the legal provision node together form a legal diagram structure. ,in , V is the set of nodes, E is the set of edges, Vcase is the case node, Vcharge is the charge node, Vlaw is the legal provision node, and the initial characteristics of Vcase are in ST2. Vcharge is the crime vector obtained from the encoder; Vlaw is the legal provision vector obtained from the encoder. These are similarity edges between cases. It is the subordinate side between the case and the charge. It is the subordinate aspect between the case and the legal provision;
[0052] Different linear projection matrices are assigned to different types of nodes to map the original features to a unified latent space dimension. For each type of relation r∈{similar_to,has_charge,has_law}, similar_to is the similarity relation between cases, has_charge is the subordinate edge between a case and a crime, indicating that the case is this crime, and has_law is the subordinate relation between a case and a legal provision, indicating that the case refers to this law.
[0053] The first convolutional layer uses a multi-head graph attention mechanism to handle the three types of edge relationships respectively, and the output is aggregated using the mean strategy after being activated by ELU.
[0054] The second convolutional layer further compresses the feature dimension, generating the final node embedding OUT_DIM; through weighted summation of multi-head attention and cross-relation mean aggregation, the importance of different relations is dynamically learned;
[0055] A contrastive learning approach is used to train the global case graph neural network, which consists of a first convolutional layer and a second convolutional layer; the loss function is... for:
[0056] ;
[0057] Where s() is the similarity function, To enhance the representation of the graph structure for query cases. An enhanced graph structure representation of positive candidate documents for query cases. For negative samples, This refers to the temperature parameter.
[0058] According to a preferred embodiment of the present invention, structured semantic information between cases is modeled globally by performing attention-based message propagation on the global case jurisprudence graph; including:
[0059] All types of nodes in the global case jurisprudence graph, including case nodes, crime nodes, and legal provision nodes, have initial feature vectors: the initial feature vector of the case node comes from the encoded output of the single case jurisprudence graph in step ST2, the initial feature vector of the crime node is its semantic embedding, and the initial feature vector of the legal provision node is obtained by the text encoder.
[0060] The initial feature vectors of case nodes, crime nodes, and legal provision nodes constitute the input of the global case jurisprudential graph. In the global case jurisprudential graph, a case node connects the crime node involved in the judgment with the legal provision node cited. The same crime node is connected to multiple similar case nodes, and the same legal provision node is connected to a large number of case nodes that cite that provision. Therefore, the neighborhood of each node includes a set of multiple nodes that have legal semantic association with that node.
[0061] The graph attention mechanism is introduced, including: learning an independent linear transformation for each type of node, mapping all nodes to a unified feature space, calculating the attention coefficient for any node i and its neighbor node j on a certain edge, the attention coefficient reflecting the influence strength of neighbor node j on node i; each node receives weighted information from its neighboring nodes and automatically identifies the more important legal relationships.
[0062] According to a preferred embodiment of the present invention, the specific implementation process of step ST4 includes:
[0063] The local semantic representation of the case to be retrieved is obtained from step ST2, denoted as a vector. Right now The global structured semantic representation of the case to be retrieved after absorbing global information is obtained from step ST3, and is denoted as a vector. , will vector sum vector The data is then pieced together to generate the final comprehensive representation of the case. The calculation formula is: =[ || ], where || represents the vector concatenation operation.
[0064] According to a preferred embodiment of the present invention, in step ST5, calculating the comprehensive similarity score between cases specifically involves: based on the final comprehensive representation of the case to be retrieved and the candidate cases obtained in step ST4, calculating the cosine similarity between the case to be retrieved and the candidate cases as the comprehensive similarity score; assuming the final comprehensive representation of the query case, i.e., the case to be retrieved, is... The final comprehensive representation of a candidate case is: The combined similarity score between the two is Score(q,c), calculated using the formula: Score(q,c) = cos( , )= , where * denotes the dot product operation of vectors. The L2 norm of the vector is represented. The closer the score is to 1, the more similar the query case and the candidate case are. All candidate cases are sorted from high to low according to the comprehensive similarity score, and the top K most similar reference cases are output.
[0065] Secondly, the present invention provides a case retrieval system based on the synergistic integration of legal and factual reasoning, comprising:
[0066] The crime-aware module is configured to: predict the crime based on the factual description of the case to be retrieved, and obtain the crime label corresponding to the case; wherein, the crime prediction is based on a pre-trained language model with efficient parameter fine-tuning. The pre-trained language model realizes the semantic mapping between the factual description of the case and the crime label through an imperative generation task, so as to enhance the legal relevance of the semantic representation of the case.
[0067] The single-case fact-finding graph construction module is configured to: construct a single-case fact-finding graph based on the factual description of the case to be retrieved, including event nodes, key fact nodes, and legal provision nodes; wherein, the node types include event nodes, key fact nodes, and legal provision nodes, and the edge types include temporal relationships between events, causal relationships between events and key facts, and citation relationships between key facts and legal provisions; after constructing the single-case fact-finding graph, a heterogeneous graph neural network is used to aggregate the node information to obtain the local semantic representation of the single case; the heterogeneous graph neural network performs weighted fusion of node information based on the attention weights of different types of edges to capture the fine-grained semantics and logical connections within the case.
[0068] The global case jurisprudential graph construction module is configured to: construct a global case jurisprudential graph including case nodes, charge nodes, and legal provision nodes. The global case jurisprudential graph is used to represent the semantic association, charge association, and legal provision association across cases. Case nodes represent different case texts, charge nodes represent the charge category to which a case belongs, and legal provision nodes represent relevant legal provisions. The edges in the global case jurisprudential graph include case-case edges, case-charge edges, and case-legal provision edges, which are used to model the semantic similarity between cases, the group consistency of cases with the same charge, and the legal association of cases that jointly cite legal provisions, respectively. A global case graph neural network is used to model the structured semantic information between cases globally by performing message propagation based on an attention mechanism on the global case jurisprudential graph.
[0069] The fusion module is configured to: for the case to be retrieved and the candidate cases, perform a fusion operation on the local semantic representation learned from the single case jurisprudence graph and the semantic representation after absorbing global information learned from the global case jurisprudence graph to generate the final comprehensive representation of the case; the fusion operation is presented in the form of vector concatenation to simultaneously retain the fine-grained logical information inside the case and the global relational information outside.
[0070] The retrieval ranking and result output module is configured to: calculate the semantic similarity between cases as a comprehensive similarity score based on the final comprehensive representation of the case to be retrieved and each candidate case; rank the candidate cases according to the comprehensive similarity score and output the top K most similar reference cases.
[0071] Thirdly, the present invention provides an electronic device including a memory and a processor, and computer instructions stored in the memory and running on the processor, wherein the computer instructions, when executed by the processor, perform the method described in the first aspect.
[0072] Fourthly, the present invention provides a computer-readable storage medium for storing computer instructions, which, when executed by a processor, perform the method described in the first aspect.
[0073] Fifthly, the present invention provides a computer program product, including a computer program that, when executed by a processor, implements the method described in the first aspect.
[0074] The above one or more technical solutions have the following beneficial effects:
[0075] 1. This invention, by introducing a large language model, achieves automatic semantic parsing and crime prediction of case fact descriptions, enabling in-depth mining of the logical correspondence between behavioral elements, key facts, and legal provisions in case texts. Compared with traditional keyword retrieval or shallow semantic matching methods, this invention can achieve a structured understanding of cases at the semantic level, effectively improving the accuracy and automation of case semantic modeling.
[0076] 2. This invention constructs a heterogeneous graph structure for single-case case reasoning based on semantic parsing. By fusing multiple types of information—event nodes, key fact nodes, and legal provision nodes—it accurately depicts the causal relationships, temporal relationships, and legal application chains within a case. The introduction of heterogeneous graph neural networks allows for explicit modeling of the legal logic within a case in graph form, significantly enhancing the hierarchy and interpretability of the case representation and providing a more structurally meaningful feature foundation for subsequent case similarity assessment.
[0077] 3. This invention further constructs a case-charge-legal provision diagram at the global level to uniformly represent the semantic commonalities and legal relevance across cases. Through a global-local bidirectional information fusion mechanism, it achieves the mutual integration of fine-grained semantics of individual cases and the characteristics of the global case group, thereby ensuring semantic consistency and global discriminative power while maintaining the differences between local cases. This mechanism effectively solves the problem of "independent case encoding and lack of global semantic constraints" in existing technologies, making the model more stable and generalizable in both semantic understanding and legal logic preservation. Attached Figure Description
[0078] Figure 1 This is a diagram illustrating the implementation architecture of a case retrieval method based on the synergistic integration of legal and factual reasoning, as described in this invention.
[0079] Figure 2 This is a schematic diagram illustrating the construction of a single-case case logic diagram according to the present invention;
[0080] Figure 3 This is a schematic diagram illustrating the construction of the global case legal diagram of this invention. Detailed Implementation
[0081] It should be noted that the following detailed descriptions are exemplary and intended to provide further illustration of the invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.
[0082] It should be noted that the terminology used herein is for the purpose of describing particular implementations only and is not intended to limit the exemplary implementations of the present invention.
[0083] Where there is no conflict, the embodiments and features in the embodiments of the present invention can be combined with each other.
[0084] Example 1
[0085] Firstly, this invention provides a case retrieval method based on the synergistic integration of legal and factual reasoning, such as... Figure 1 As shown, it includes:
[0086] ST1: The process involves predicting the crime based on the factual description of the case to be retrieved, obtaining the corresponding crime label. This crime prediction is based on a pre-trained language model with highly efficient parameter fine-tuning. This pre-trained language model achieves semantic mapping between the case's factual description and crime labels through an imperative generation task, enhancing the legal relevance of the case's semantic representation. Specifically, this includes inputting the factual description text of the queried case into the fine-tuned large language model. The model understands the text semantics through an imperative generation task and outputs one or more possible crime labels. This process can be formally represented as follows: Given an input sequence X, the model generates a sequence of crime labels Y, and optimizes this by minimizing the cross-entropy loss to ensure the accuracy of the crime prediction, providing a legal semantic framework for subsequent processing.
[0087] ST2: Based on the factual description of the case to be retrieved, a single-case factual graph is constructed, including event nodes, key fact nodes, and legal provision nodes. Node types include event nodes, key fact nodes, and legal provision nodes; edge types include temporal relationships between events, causal relationships between events and key facts, and citation relationships between key facts and legal provisions. After constructing the single-case factual graph, a heterogeneous graph neural network is used to aggregate node information to obtain a local semantic representation of the single case. The heterogeneous graph neural network performs weighted fusion of node information based on the attention weights of different edge types to capture fine-grained semantics and logical connections within the case. Specifically, this includes: 1) Node extraction and construction: The model automatically identifies and extracts event nodes from the case, describing specific behaviors or states in the case development process, and calculates similarity based on structured legal provisions to obtain key fact nodes. The initial feature vectors of each node can be encoded by a domain-pre-trained language model. 2) Edge Relationship Establishment: Based on the inherent logic of the case, different types of edges are established: "temporal relationship" edges are established between event nodes with a chronological order; "causal relationship" edges are established between event nodes and key fact nodes they trigger; and "citation relationship" edges are established between key fact nodes and the legal requirement nodes they satisfy. The constructed single-case case logic graph is input into a heterogeneous graph neural network. The network sets independent parameters for different node types and relationship types, and aggregates neighbor node information through multi-layer message passing based on relationship attention. Finally, a graph-level pooling function is used to obtain the local semantic representation vector of the queried case. .
[0088] ST3: Construct a global case jurisprudential graph including case nodes, charge nodes, and legal provision nodes. This graph represents the semantic, charge, and legal provision relationships across cases. Case nodes represent different case texts, charge nodes represent the charge category to which a case belongs, and legal provision nodes represent relevant legal provisions. Edges in the global case jurisprudential graph include case-case edges, case-charge edges, and case-legal provision edges, used to model semantic similarity between cases, group consistency of cases with the same charge, and legal relationships of cases jointly citing legal provisions, respectively. A global case graph neural network is used to model the structured semantic information between cases globally by performing attention-based message propagation on the global case jurisprudential graph. Specifically, this includes: 1. Node and edge definition: The graph contains three types of nodes: case nodes (representing a single case), charge nodes, and legal provision nodes. Case-case edges are established based on semantic similarity between cases, case-charge edges are established based on charge labels, and case-legal provision edges are established based on legal provision citation. A graph convolutional network is used to model the global graph. This allows each case node to integrate semantic information from its associated crime groups and legal provision co-occurrence groups, thereby obtaining a case representation vector rich in context and global knowledge. .
[0089] ST4: For the cases to be retrieved and candidate cases, the local semantic representation learned from the single case jurisprudence graph is fused with the semantic representation learned from the global case jurisprudence graph after absorbing global information to generate the final comprehensive representation of the case; the fusion operation is presented in the form of vector concatenation to simultaneously retain the fine-grained logical information inside the case and the global relational information outside.
[0090] ST5: Sorts candidate cases based on their comprehensive similarity scores and outputs the most similar cases to the query case. The sorting process ranks candidate cases from highest to lowest based on their comprehensive similarity scores and outputs the top K most similar reference cases. This is used in scenarios such as judicial auxiliary retrieval, case-based legal interpretation, and intelligent legal recommendation.
[0091] Example 2
[0092] The difference between the case retrieval method based on the synergistic integration of legal and factual reasoning as described in Example 1 and the following is:
[0093] In step ST1, the pre-trained language model is a generative language model based on the Transformer architecture, which is achieved by efficiently fine-tuning the parameters on a legal corpus.
[0094] The pre-trained language model takes case fact text as input. , It is the nth token in the case fact text, where n refers to the total length of tokens in the case fact text X;
[0095] Output the sequence of crime labels , This refers to the m-th crime label in the output crime label sequence, where m is the total length of the crime label sequence Y (i.e., the number of predicted crimes). The generation probability is defined as:
[0096] ;
[0097] in, The input is a sequence of case fact texts; The output is a sequence of crime labels, where m is the length of the label sequence; Let t be the predicted label; it refers to the label that the model has generated at time step t, given the facts of the case X and t. Under the given conditions, predict the generated crime labels; The probability of a pre-trained language model generating the entire sequence of charges given the input case text; To provide the input text and previously generated tags Given the condition, the conditional probability of the t-th label; This refers to the previously generated label sequence, which is the set of all crime labels that the model has autoregressively predicted and generated up to time step t. ;
[0098] By minimizing the cross-entropy loss function The pre-trained language model is used to achieve semantic mapping between case semantics and legal labels. During training, a teacher-mandated strategy is adopted, that is, the real labels of the previous time step are used as the input conditions for the current time step.
[0099] ;
[0100] in, It is the cross-entropy loss function used in the crime prediction stage for parameter learning; The true crime label at time step t; This refers to the complete sequence of true labels before time step t. .
[0101] For the task of predicting charges from case fact texts, a generative language model based on the Transformer architecture is trained through supervised fine-tuning. The training data includes case fact texts and their corresponding target output formats. The target output uses structured JSON representation to express one or more charge labels. The training data is as follows:
[0102] [Input]: Please predict the charge corresponding to this legal document: "On July 10, 2012, at approximately 2:00 AM, the defendant Yang Moumou, together with Wang Moulin, ... after finding the victim Li Mouxia walking alone near Xiaochang Street in a certain district of a certain city, forcibly abducted her into their vehicle, ... demanding a ransom of 20,000 yuan. Wang Moulin was arrested by the police at approximately 1:00 PM that same day."
[0103] Output: {"charges": ["Robbery"]}. During fine-tuning, the generative language model learns to automatically generate output conforming to a predefined JSON structure based on the input text. The model can generate structured results in the following format: {"charges": ["Fraud", "Aiding and Abetting Cybercrime"]}, where the "charges" field is an array of crime labels. An array length of 1 indicates a single crime prediction; an array length greater than 1 indicates a multi-crime prediction. Through this structured output format, this invention can uniformly handle single-crime and multi-crime scenarios and simplify subsequent parsing and information extraction processes.
[0104] Construct a single-case reasoning graph using a large language model. For example... Figure 2As shown. In step ST2, a large language model is used to extract the case text. The extraction prompt is as follows: "You are a legal text analysis expert. Please extract the event chain from the criminal case fact description I have provided. Extraction requirements: 1. Represent events with verbs or verb-object phrases to ensure conciseness and action, such as: 'driving under the influence,' 'accepting inspection,' 'taking a blood sample,' and 'voluntarily surrendering.' 2. Retain procedural events related to conviction, characterization, and sentencing (such as: surrendering, being brought to justice, confessing, compensation, expert evaluation, etc.), and do not omit them. 3. Output according to the order of the case text, and restore the order of events according to the context if necessary. 4. Remove irrelevant modifying verbs (such as 'conduct,' 'able to,' etc.), and only retain the actual behavioral events. 5. Note quantities in parentheses, such as the amount stolen and the blood alcohol content of the driver under the influence. 6." The output is in array form. Input text: {text} Output example: [driving, reversing, collision, injury, unsuccessful rescue, death, compensation]”. For each crime, the legal provisions are processed using a requirement-based method (the part about punishment is removed from the original legal provisions, only the description of the crime is retained). For example, the legal text for the crime of abusing subordinates states, “Abusing one’s power, abusing subordinates, where the circumstances are egregious, causing serious injury or other serious consequences, shall be sentenced to fixed-term imprisonment of not more than five years or criminal detention; where death is caused, the sentence shall be fixed-term imprisonment of not less than five years.” After requirement-based processing, it becomes: “abuse of power, abusing subordinates, causing serious injury, causing other serious consequences.” The facts extracted by the Big Prophecy model and the legal provisions are encoded using a language encoder, and the cosine similarity of the encoding is calculated. A threshold > 0.5 is considered a key fact. Ultimately, the construction of a single-case case logic diagram includes: edges between fact nodes (temporal relationships), edges between fact nodes and key fact nodes (reflecting the correspondence between facts and key facts), and edges between key fact nodes and legal requirement nodes (reflecting the correspondence between key facts and legal requirements). Simultaneously, a global case node (initially represented as the case text code) is introduced, connected to the fact nodes, key fact nodes, and legal requirement nodes. For example... Figure 2 As shown.
[0105] In step ST2, a heterogeneous graph neural network is used to aggregate node information. For each layer of the heterogeneous graph neural network, the case graph encoder is a deep network model composed of multiple stacked heterogeneous graph attention layers, and its workflow is as follows:
[0106] Node Feature Projection Layer: This layer maps the original features of different types of nodes (events, key events, legal elements) in a case to a unified implicit semantic space via a linear layer.
[0107] The multi-layer feature aggregation model consists of multiple heterogeneous graph attention network layers connected sequentially. The output of each layer serves as the input of the next layer, enabling multi-level and multi-hop propagation and fusion of information in the graph.
[0108] Case Readout Representation Layer: Extract the "case" type of representation vector from the node representation of the final layer to obtain a single, fixed-dimensional vector representation of the entire case;
[0109] The update process of each layer of the neural network node is represented as follows:
[0110] ;
[0111] in, Represents a node In the The feature vector of the layer; It is a non-linear activation function; This is a set of relationship types, such as key facts, citations, and other case-related relationships. For nodes In relation types The set of neighbors below; This is the weight matrix of the l-th layer corresponding to relation type r; The attention weight of node j to node i under relation type r is defined as:
[0112] ;
[0113] in, This is an attention vector of relation type, where || represents the vector concatenation operation; It is a leaky ReLU activation function; Represents the feature vector of node i; Let j be the feature vector of node j; It is the weight matrix corresponding to the relation type r; k is Given any neighbor node in the set, it is used to traverse all neighbors of node i under relation r; It refers to an exponential function with base e;
[0114] In the process of multi-layer heterogeneous graph aggregation, a special case node is introduced (as the core hub of the case, connecting all other nodes in the logic graph). The case node is a node that connects all nodes in the graph, and the feature vector of the case node in the last layer is the final global semantic representation of the case. The formula is:
[0115] ;
[0116] in, The feature vector of the case node in the last layer (Lth layer) of the heterogeneous graph neural network; as the central connection point of the case, the features of the case node will automatically integrate the information of all related nodes (events, key facts, legal provisions, etc.) during the aggregation process of each layer. Therefore, its final layer features naturally contain the logical relationship of the entire case.
[0117] That is, the local semantic representation of a single case.
[0118] The heterogeneous graph neural network is trained using a list-based sorting loss learning algorithm, with the loss function being:
[0119] ;
[0120] in, Let n be the total loss calculated for a query sample q, and let j be the index of the candidate sample in the list. The goal is to minimize the total loss by optimizing the parameters of the heterogeneous graph neural network. n is the total number of candidate samples corresponding to the current query q, and j is the index of the candidate sample in the list. The algorithm iterates from the 1st to the nth candidate. Let be the target probability distribution, representing the ideal relevance probability of the j-th candidate sample relative to the current query; Let be the probability distribution predicted by the heterogeneous graph neural network, representing the probability that the j-th candidate sample is ranked first. The coefficient for the penalty term. The weight coefficients (weight decay strength) of the L2 regularization term are hyperparameters. This is the set of all learnable parameters in a heterogeneous neural network.
[0121] Heterogeneous graph neural networks weight and fuse node information based on attention weights for different types of edges to capture fine-grained semantics and logical connections within a case; including:
[0122] Different node types are linearly mapped to obtain a unified-dimensional node vector representation, which is used for subsequent graph message propagation. Relationship types include aggregation relationships between case nodes and individual nodes, temporal relationships between events, causal relationships between events and key facts, and citation relationships between key facts and legal provisions. Attention scores are calculated for each node pair (i,j) connected under each relationship type r in the single-case case graph, as shown below:
[0123] ;
[0124] in, This is an attention vector of relation type, where || represents the vector concatenation operation; It is a leaky ReLU activation function; Represents the feature vector of node i; Let j be the feature vector of node j; It is the weight matrix corresponding to the relation type r; k is Given any neighbor node in the set, it is used to traverse all neighbors of node i under relation r; It refers to an exponential function with base e; this attention score characterizes the importance of node j to node i under relation type r.
[0125] Attention scores are Softmax normalized, resulting in attention weights. This method ensures that neighbors of different relationship types have varying impacts on nodes. For each relationship type, the target node receives weighted information from its neighbors and performs feature fusion. Subsequently, the aggregated results for all relationship types are weighted and summed. The specific implementation process includes:
[0126] Target node i first checks all its neighbors under each relation type r. Receive weighted information to obtain the aggregate vector under relation type r; subsequently, apply this to all relation types. The aggregation results are fused (summed) and then passed through a nonlinear activation function. The node features have been updated as follows:
[0127] ;
[0128] in, Represents a node In the The feature vector of the layer; It is a non-linear activation function; This is a set of relationship types, such as key facts, citations, and other case-related relationships. For nodes In relation types The set of neighbors below; This is the weight matrix of the l-th layer corresponding to relation type r; Let be the attention weight of node j to node i under relation type r;
[0129] This approach enables nodes to simultaneously acquire: the temporal dependency of event chains, the causal relationship between facts and key facts, and the citation relationship between key facts and legal requirements. Through weighted fusion based on attention weights of different edge types, node features simultaneously obtain multiple logical connections within the case. Temporal dependency of event chains: Under the temporal relationship of events, node feature updates focus on events that are closely connected in time, capturing the chronological order of events. Causal relationship between facts and key facts: Under the causal relationship between facts and key facts, feature updates focus on key facts that directly lead to or are caused by them, modeling the causal chain and reasoning logic of facts in the case. Citation relationship between key facts and legal requirements: Under the citation relationship between key facts and legal requirements, feature updates integrate the information on the satisfaction of legal requirements by the facts of the case, realizing the modeling of legal reasoning logic. Regarding the temporal dependency between events (relationship type r-temporal), when the target node i is an event node, the attention weights between it and all temporal relationship neighbors j are calculated, i.e., the aforementioned... In The model learns through training and assigns higher priority to preceding events j that are closely connected to or directly trigger i in time. The final updated event node features not only contain information about the event itself, but also incorporate its temporal context, encoding the event's position and dependencies within the entire case development chain. This forms a node representation with a legal logical structure, namely, fine-grained semantics and logical connections within the case.
[0130] like Figure 3 As shown, the process of constructing a global case jurisprudential diagram is illustrated in the following example:
[0131] Suppose there are three cases: Case A: Driving under the influence of alcohol, constituting the crime of "dangerous driving," citing Article 133-1 of the Criminal Law; Case B: Driving without a license and while intoxicated, constituting the crime of "dangerous driving," citing Article 133-1 of the Criminal Law; Case C: Fabricating facts to defraud others of property, constituting the crime of "fraud," citing Article 266 of the Criminal Law. The crime nodes are: Charge1: Dangerous driving; Charge2: Fraud. The legal provisions nodes are: Law1: Article 133-1 of the Criminal Law; Law2: Article 266 of the Criminal Law. Case A and Case B are connected to Charge1. Case A and Case B are connected to Law1. The edges connecting cases are based on semantic similarity. The cosine similarity between Case A and all cases is calculated (using the final semantic representation of the single-case graph), and the top-5 edges are used to connect them.
[0132] In step ST3, the case node, the charge node, and the legal provision node together form the legal diagram structure. ,in , V is the set of nodes, E is the set of edges, Vcase is the case node, Vcharge is the charge node, Vlaw is the legal provision node, and the initial characteristics of Vcase are in ST2. Vcharge is the crime vector obtained by the encoder; Vlaw is the legal provision vector obtained by the encoder; the crime predicted in ST1 is the crime of this case. Based on the document content, the crime is predicted and encoded. To construct the global graph structure, the crime and legal provision, which are independent nodes, need to be initialized with features. Since these nodes represent legal knowledge ontology, their initial feature vectors (i.e., crime vector and legal provision vector) are obtained by encoding the corresponding text through a text encoder. A pre-trained text encoding model (BERT) is used as the encoder, which can map natural language text to a fixed-dimensional semantic vector space. The legal text involved in this case is also encoded, and the document is encoded using BERT as the legal provision vector. These are similarity edges between cases. It is the subordinate side between the case and the charge. It is the subordinate aspect between the case and the legal provision;
[0133] A global case graph neural network is used to receive the jurisprudential graph structure constructed in ST3. Furthermore, through information transmission and aggregation between nodes, the features of case nodes, crime nodes, and legal provision nodes are optimized and refined to obtain the final embedding for similarity calculation.
[0134] Different linear projection matrices are assigned to different types of nodes to map the original features to a unified latent space dimension. For each type of relation r∈{similar_to,has_charge,has_law}, similar_to is the similarity relation between cases, has_charge is the subordinate edge between a case and a crime, indicating that the case is this crime, and has_law is the subordinate relation between a case and a legal provision, indicating that the case refers to this law.
[0135] The first convolutional layer uses a multi-head graph attention mechanism (such as GATConv) to handle the three types of edge relationships respectively, and the output is aggregated by the mean strategy after being activated by ELU.
[0136] The first convolutional layer is responsible for aggregating node features from the initial dimension to the hidden layer dimension HID_DIM. For each edge relation r∈{similar_to,has_charge,has_law} in the global graph, a relation-specific GATConv model is used for information aggregation. The target node i receives weighted information from its neighboring nodes j to generate a relation-specific aggregated feature vector. The aggregation process can be uniformly represented as:
[0137] ;
[0138] in, It is the initial feature after the projection of neighbor node j; It is the first-level weight matrix corresponding to relation r. Let be the attention coefficient of node j to node i.
[0139] The attention coefficient The attention score is used to quantify the contribution weight of node j to target node i under relation r.
[0140] ;
[0141] in, This is an attention vector of relation type, where || represents the vector concatenation operation; It is a leaky ReLU activation function; Represents the feature vector of node i; Let j be the feature vector of node j; It is the weight matrix corresponding to the relation type r; k is Given any neighbor node in the set, it is used to traverse all neighbors of node i under relation r; This refers to an exponential function with base e. It should be noted that the weight matrix used to calculate the attention coefficient... It plays the role of feature projection, and in practice, it is usually the same set of learnable parameters to ensure that feature transformation and attention weight calculation are completed in the same semantic space.
[0142] Finally, aggregate the results under all relations r. The fusion is performed using a mean-based strategy, and the result is obtained by passing the ELU activation function to obtain the output of the first convolutional layer. :
[0143] ;
[0144] in, Let {similar_to, has_charge, has_law} be the set of relation types.
[0145] The second convolutional layer further compresses the feature dimension, generating the final node embedding OUT_DIM; through weighted summation of multi-head attention and cross-relation mean aggregation, the importance of different relations is dynamically learned;
[0146] The second convolution takes the output of the first convolution as input and performs aggregation operations similar to the first convolution, but its core function is to reduce the node features from the hidden layer dimension to the final embedding dimension OUT_DIM.
[0147] For each type of edge relation r∈{similar_to,has_charge,has_law} in the global graph, the target node i receives weighted information from its neighbor node j to generate a relation-specific aggregated feature vector. The aggregation process can be uniformly represented as:
[0148] ;
[0149] in, It is the feature vector of neighbor node j after the first convolution. This is the second-layer weight matrix corresponding to relation r, used to reduce the dimensionality of node features from the hidden layer dimension to the final embedding dimension OUT_DIM. Finally, the relation-specific aggregated feature vector is generated. The mean fusion strategy is used to fuse the data to obtain the convolutional output of the second layer. :
[0150] ;
[0151] This vector is the final embedding of node i, also represented as That is, the global semantic representation of a node.
[0152] A contrastive learning approach is used to train a global case graph neural network, which consists of a first convolutional layer and a second convolutional layer. These two convolutional layers together, combined with graph attention, globally associate discrete case, crime, and legal provision information within a unified semantic space. Loss function... for:
[0153] ;
[0154] Where s() is the similarity function (such as cosine similarity). To enhance the representation of the graph structure for query cases. An enhanced graph structure representation of positive candidate documents for query cases. For negative samples, The temperature parameter is used. This loss function aims to bring query cases closer to their positive candidate documents in the representation space, while widening the distance between query documents and negative candidate documents.
[0155] By performing attention-based message propagation on the global case jurisprudence graph, structured semantic information between cases is modeled globally; including:
[0156] All nodes in the global case jurisprudential graph, including case nodes, charge nodes, and legal provision nodes, have initial feature vectors: the initial feature vector of a case node comes from the encoded output of the single case jurisprudential graph in step ST2 ( The initial feature vector of the crime node is its semantic embedding (encoding the predicted crime using BERT), and the initial feature vector of the legal provision node is obtained by the text encoder (encoding the legal document using BERT).
[0157] The initial feature vectors of case nodes, crime nodes, and legal provision nodes constitute the input of the global case jurisprudential graph. In the global case jurisprudential graph, a case node connects the crime node involved in the judgment with the legal provision node cited. The same crime node is connected to multiple similar case nodes, and the same legal provision node is connected to a large number of case nodes that cite that provision. Therefore, the neighborhood of each node includes a set of multiple nodes that have legal semantic association with that node.
[0158] To differentiate the importance of different neighboring nodes to the target node, a graph attention mechanism is introduced, including: learning an independent linear transformation for each type of node, mapping all nodes to a unified feature space, calculating an attention coefficient for any node i and its neighboring node j on a certain edge, the attention coefficient reflecting the strength of the influence of neighboring node j on node i; each node receives weighted information from its neighboring nodes, automatically identifying more important legal relationships. Cases with the same crime as case A have a stronger influence on the representation of A; cases connected to nodes with the same legal provisions contribute more to the jurisprudential features of A, while the weight of irrelevant cases naturally decreases. Message propagation crosses case groups; a case can be represented through: case → crime node → similar cases, case → legal provision node → cases citing the same legal provision. This achieves cross-case legal semantic clustering. The structured semantic information between cases in the final model refers to: absorbing neighbor information to provide a richer representation of the case, i.e. .
[0159] In step ST4, the single-case graph representation generated in ST2 and the representation generated in ST3 after incorporating information from all cases are fused, specifically using vector concatenation. The fusion process for each case is as follows: The specific implementation process of step ST4 includes:
[0160] The local semantic representation of the case to be retrieved is obtained from step ST2, denoted as a vector. Right now The global structured semantic representation of the case to be retrieved after absorbing global information is obtained from step ST3, and is denoted as a vector. , will vector sum vector The data is then pieced together to generate the final comprehensive representation of the case. The calculation formula is: =[ || ], where || represents the vector concatenation operation.
[0161] In step ST5, the comprehensive similarity score between cases is calculated, specifically: based on the final comprehensive representation of the case to be retrieved and the candidate cases obtained in step ST4, the cosine similarity between the case to be retrieved and the candidate cases is calculated as the comprehensive similarity score; let the final comprehensive representation of the query case, i.e., the case to be retrieved, be... The final comprehensive representation of a candidate case is: The combined similarity score between the two is Score(q,c), calculated using the formula: Score(q,c) = cos( , )= , where * denotes the dot product operation of vectors. The L2 norm of the vector is represented. The closer the score is to 1, the more similar the query case and the candidate case are. All candidate cases are sorted from high to low according to the comprehensive similarity score, and the top K most similar reference cases are output.
[0162] In the experiments, the LeCaRD dataset was used to test traditional methods and deep learning encoders, and the test results of the method proposed in this patent were presented:
[0163] Table 1
[0164]
[0165] Example 3
[0166] A case retrieval system based on the synergistic integration of legal and factual reasoning includes:
[0167] The crime-aware module is configured to: predict the crime based on the factual description of the case to be retrieved, and obtain the crime label corresponding to the case; wherein, the crime prediction is based on a pre-trained language model with efficient parameter fine-tuning. The pre-trained language model realizes the semantic mapping between the factual description of the case and the crime label through an imperative generation task, so as to enhance the legal relevance of the semantic representation of the case.
[0168] The single-case fact-finding graph construction module is configured to: construct a single-case fact-finding graph based on the factual description of the case to be retrieved, including event nodes, key fact nodes, and legal provision nodes; wherein, the node types include event nodes, key fact nodes, and legal provision nodes, and the edge types include temporal relationships between events, causal relationships between events and key facts, and citation relationships between key facts and legal provisions; after constructing the single-case fact-finding graph, a heterogeneous graph neural network is used to aggregate the node information to obtain the local semantic representation of the single case; the heterogeneous graph neural network performs weighted fusion of node information based on the attention weights of different types of edges to capture the fine-grained semantics and logical connections within the case.
[0169] The global case jurisprudential graph construction module is configured to: construct a global case jurisprudential graph including case nodes, charge nodes, and legal provision nodes. The global case jurisprudential graph is used to represent the semantic association, charge association, and legal provision association across cases. Case nodes represent different case texts, charge nodes represent the charge category to which a case belongs, and legal provision nodes represent relevant legal provisions. The edges in the global case jurisprudential graph include case-case edges, case-charge edges, and case-legal provision edges, which are used to model the semantic similarity between cases, the group consistency of cases with the same charge, and the legal association of cases that jointly cite legal provisions, respectively. A global case graph neural network is used to model the structured semantic information between cases globally by performing message propagation based on an attention mechanism on the global case jurisprudential graph.
[0170] The fusion module is configured to: for the case to be retrieved and the candidate cases, perform a fusion operation on the local semantic representation learned from the single case jurisprudence graph and the semantic representation after absorbing global information learned from the global case jurisprudence graph to generate the final comprehensive representation of the case; the fusion operation is presented in the form of vector concatenation to simultaneously retain the fine-grained logical information inside the case and the global relational information outside.
[0171] The retrieval ranking and result output module is configured to: calculate the semantic similarity between cases as a comprehensive similarity score based on the final comprehensive representation of the case to be retrieved and each candidate case; rank the candidate cases according to the comprehensive similarity score; and output the top K most similar reference cases. This is used in scenarios such as judicial auxiliary retrieval, case-based legal interpretation, and intelligent legal recommendation.
[0172] Example 4
[0173] An electronic device includes a memory and a processor, as well as computer instructions stored in the memory and running on the processor. When the computer instructions are executed by the processor, they perform a case retrieval method based on the fusion of legal and factual reasoning as described in any of Embodiments 1-3.
[0174] It should be understood that in this embodiment, the processor can be a central processing unit (CPU), or it can be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor, etc.
[0175] Memory may include read-only memory and random access memory, and provides instructions and data to the processor. A portion of memory may also include non-volatile random access memory. For example, memory may also store information about the device type.
[0176] Example 5
[0177] A computer-readable storage medium for storing computer instructions, which, when executed by a processor, perform a case retrieval method based on the fusion of legal and factual reasoning as described in any of Embodiments 1-3.
[0178] The method of this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor. The software modules can reside in readily available storage media in the field, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method. To avoid repetition, detailed descriptions are omitted here.
[0179] Example 6
[0180] A computer program product includes a computer program that, when executed by a processor, implements a case retrieval method based on the synergistic integration of legal and factual reasoning as described in any of Embodiments 1-3.
[0181] The present invention also provides at least one computer program product tangibly stored on a non-transitory computer-readable storage medium. The computer program product includes computer-executable instructions, such as instructions included in program modules, which execute in a device on a target real or virtual processor to perform the processes / methods described above. Typically, program modules include routines, programs, libraries, objects, classes, components, data structures, etc., that perform specific tasks or implement specific abstract data types. In various embodiments, the functionality of program modules can be combined or divided among program modules as needed. The machine-executable instructions for the program modules can execute within a local or distributed device. In a distributed device, the program modules can reside in both local and remote storage media.
[0182] The computer program code used to implement the methods of the present invention may be written in one or more programming languages. This computer program code may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the computer or other programmable data processing device, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a computer, partially on a computer, as a stand-alone software package, partially on a computer and partially on a remote computer, or entirely on a remote computer or server.
[0183] In the context of this invention, computer program code or related data may be carried by any suitable carrier to enable a device, apparatus, or processor to perform the various processes and operations described above. Examples of carriers include signals, computer-readable media, and the like. Examples of signals may include electrical, optical, radio, sound, or other forms of propagation signals, such as carrier waves, infrared signals, etc.
[0184] Those skilled in the art will recognize that the units and algorithm steps described in conjunction with the embodiments herein can be implemented in electronic hardware or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0185] While the specific embodiments of the present invention have been described above in conjunction with the accompanying drawings, this is not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art without creative effort based on the technical solutions of the present invention are still within the scope of protection of the present invention.
Claims
1. A case retrieval method based on the synergistic integration of legal and factual reasoning, characterized in that, include: ST1: Predict the crime based on the factual description of the case to be retrieved, and obtain the crime label corresponding to the case; wherein, the crime prediction is based on a pre-trained language model with efficient parameter fine-tuning, which realizes the semantic mapping between the factual description of the case and the crime label through an imperative generation task; ST2: Based on the factual description of the case to be retrieved, a single-case factual graph is constructed, including event nodes, key fact nodes, and legal provision nodes. Node types include event nodes, key fact nodes, and legal provision nodes; edge types include temporal relationships between events, causal relationships between events and key facts, and citation relationships between key facts and legal provisions. After constructing the single-case factual graph, a heterogeneous graph neural network is used to aggregate node information to obtain a local semantic representation of the single case. The heterogeneous graph neural network performs weighted fusion of node information based on the attention weights of different edge types to capture fine-grained semantics and logical connections within the case. ST3: Construct a global case jurisprudential graph, including case nodes, charge nodes, and legal provision nodes. The global case jurisprudential graph is used to represent the semantic, charge, and legal provision relationships across cases. Case nodes represent different case texts, charge nodes represent the charge category to which a case belongs, and legal provision nodes represent relevant legal provisions. The edges in the global case jurisprudential graph include case-case edges, case-charge edges, and case-legal provision edges, which are used to model the semantic similarity between cases, the group consistency of cases with the same charge, and the legal relationship of cases that cite the same legal provision, respectively. A global case graph neural network is used to model the structured semantic information between cases globally by performing message propagation based on an attention mechanism on the global case jurisprudential graph. ST4: For the cases to be retrieved and candidate cases, the local semantic representation learned from the single case jurisprudence graph is fused with the semantic representation learned from the global case jurisprudence graph after absorbing global information to generate the final comprehensive representation of the case; the fusion operation is presented in the form of vector concatenation to simultaneously retain the fine-grained logical information inside the case and the global relational information outside. ST5: Sort the candidate cases of the query case according to the comprehensive similarity score, and output the case results that are most similar to the query case; the sorting process arranges the candidate cases from high to low according to the comprehensive similarity score, and outputs the top K most similar reference cases; In step ST1, the pre-trained language model is a generative language model based on the Transformer architecture, which is achieved by efficiently fine-tuning the parameters on a legal corpus. The pre-trained language model takes case fact text as input. , It is the nth word in the case fact text, where n refers to the total length of words in the case fact text X; Output the sequence of crime labels , This refers to the m-th crime label in the output crime label sequence, where m is the total length of the crime label sequence Y. The generation probability is defined as follows: ; in, The input is a sequence of case fact texts; The output is a sequence of crime labels, where m is the length of the label sequence; Let t be the predicted label; The probability of a pre-trained language model generating the entire sequence of charges given the input case text; To provide the input text and previously generated tags Given the condition, the conditional probability of the t-th label; For the previously generated label sequence, ; By minimizing the cross-entropy loss function The pre-trained language model is used to achieve semantic mapping between case semantics and legal labels. During training, a teacher-mandated strategy is adopted, that is, the real labels of the previous time step are used as the input conditions for the current time step. ; in, It is the cross-entropy loss function used in the crime prediction stage for parameter learning; The true crime label at time step t; This refers to the complete sequence of true labels before time step t. .
2. The case retrieval method based on the synergistic integration of legal and factual reasoning as described in claim 1, characterized in that, Construct a single-case reasoning diagram using a large language model; In step ST2, a heterogeneous graph neural network is used to aggregate node information; for each layer of the heterogeneous graph neural network, the node update process of each layer is represented as follows: ; in, Represents a node In the The feature vector of the layer; It is a non-linear activation function; A set of relation types; For nodes In relation types The set of neighbors below; This is the weight matrix of the l-th layer corresponding to relation type r; The attention weight of node j to node i under relation type r is defined as: ; in, This is an attention vector of relation type, where || represents the vector concatenation operation; It is a leaky ReLU activation function; Represents the feature vector of node i; Let j be the feature vector of node j; It is the weight matrix corresponding to the relation type r; k is Given any neighbor node in the set, it is used to traverse all neighbors of node i under relation r; It refers to an exponential function with base e; Introducing a case node, which is a node connecting all nodes in the graph, the feature vector of this case node at the last layer is the final global semantic representation of the case. The formula is: ; in, This represents the feature vector of the case node in the last layer of the heterogeneous graph neural network. That is, the local semantic representation of a single case; The heterogeneous graph neural network is trained using a list-based sorting loss learning algorithm, with the loss function being: ; in, Let n be the total loss calculated for a query sample q, and let j be the index of the candidate sample in the list. The goal is to minimize the total loss by optimizing the parameters of the heterogeneous graph neural network. n is the total number of candidate samples corresponding to the current query q, and j is the index of the candidate sample in the list. The algorithm iterates from the 1st to the nth candidate. Let be the target probability distribution, representing the ideal relevance probability of the j-th candidate sample relative to the current query; Let be the probability distribution predicted by the heterogeneous graph neural network, representing the probability that the j-th candidate sample is ranked first. The coefficient for the penalty term. The weight coefficients for the L2 regularization term are hyperparameters. This is the set of all learnable parameters in a heterogeneous neural network.
3. The case retrieval method based on the synergistic integration of legal and factual reasoning as described in claim 1, characterized in that, Heterogeneous graph neural networks use attention weights of different types of edges to weight and fuse node information, capturing fine-grained semantics and logical connections within a case. include: Different node types are linearly mapped to obtain a node vector representation with a unified dimension. Relationship types include the aggregation relationship between case nodes and each node, the temporal relationship between events, the causal relationship between events and key facts, and the citation relationship between key facts and legal provisions. Attention scores are calculated for the node pairs (i,j) connected under each relationship type r in the single case fact graph, as shown below: ; in, This is an attention vector of relation type, where || represents the vector concatenation operation; It is a leaky ReLU activation function; Represents the feature vector of node i; Let j be the feature vector of node j; It is the weight matrix corresponding to the relation type r; k is Given any neighbor node in the set, it is used to traverse all neighbors of node i under relation r; It refers to an exponential function with base e; this attention score characterizes the importance of node j to node i under relation type r. The attention scores are Softmax normalized, and the attention weights are obtained after Softmax normalization. Under each relation type, the target node receives weighted information from its neighbor nodes and performs feature fusion. Then, the aggregation results of all relation types are summed with weights. This allows nodes to simultaneously acquire: the temporal dependence of the event chain, the causal relationship between facts and key facts, and the citation relationship between key facts and legal provisions; forming a node representation with a legal logical structure, namely, fine-grained semantics and logical connections within the case.
4. The case retrieval method based on the synergistic integration of legal and factual reasoning as described in claim 1, characterized in that, In step ST3, the case node, the charge node, and the legal element node together form the legal diagram structure. ,in , V is the set of nodes, E is the set of edges, Vcase is the case node, Vcharge is the charge node, Vlaw is the legal element node, and the initial characteristics of Vcase are in ST2. Vcharge is the crime vector obtained from the encoder; Vlaw is the legal provision vector obtained from the encoder. These are similarity edges between cases. It is the subordinate side between the case and the charge. It is the subordinate aspect between the case and the legal provision; Different linear projection matrices are assigned to different types of nodes to map the original features to a unified latent space dimension. For each type of relation r∈{similar_to,has_charge,has_law}, similar_to is the similarity relation between cases, has_charge is the subordinate edge between a case and a crime, indicating that the case is this crime, and has_law is the subordinate relation between a case and a legal provision, indicating that the case refers to this law. The first convolutional layer uses a multi-head graph attention mechanism to handle the three types of edge relationships respectively, and the output is aggregated using the mean strategy after being activated by ELU. The second convolutional layer further compresses the feature dimension, generating the final node embedding OUT_DIM; through weighted summation of multi-head attention and cross-relation mean aggregation, the importance of different relations is dynamically learned; A contrastive learning approach is used to train the global case graph neural network, which consists of a first convolutional layer and a second convolutional layer; the loss function is... for: ; Where s() is the similarity function, An enhanced representation of the graph structure for query cases. An enhanced graph structure representation of positive candidate documents for query cases. For negative samples, For temperature parameters; By performing attention-based message propagation on the global case jurisprudence graph, structured semantic information between cases is modeled globally; including: All types of nodes in the global case jurisprudence graph, including case nodes, charge nodes, and legal provision nodes, have initial feature vectors: the initial feature vector of the case node comes from the encoded output of the single case jurisprudence graph in step ST2, the initial feature vector of the charge node is its semantic embedding, and the initial feature vector of the legal provision node is obtained by the text encoder. The initial feature vectors of case nodes, crime nodes, and legal provision requirement nodes constitute the input of the global case jurisprudential graph. In the global case jurisprudential graph, a case node connects the crime node involved in the judgment with the legal provision requirement node cited. The same crime node is connected to multiple similar case nodes, and the same legal provision requirement node is connected to a large number of case nodes that cite that provision. Therefore, the neighborhood of each node includes a set of multiple nodes that have legal semantic association with that node. The graph attention mechanism is introduced, including: learning an independent linear transformation for each type of node, mapping all nodes to a unified feature space, calculating the attention coefficient for any node i and its neighbor node j on a certain edge, the attention coefficient reflecting the influence strength of neighbor node j on node i; each node receives weighted information from its neighboring nodes and automatically identifies the more important legal relationships.
5. The case retrieval method based on the synergistic integration of legal and factual reasoning as described in claim 1, characterized in that, The specific implementation process of step ST4 includes: The local semantic representation of the case to be retrieved is obtained from step ST2, denoted as a vector. Right now The global structured semantic representation of the case to be retrieved after absorbing global information is obtained from step ST3, and is denoted as a vector. , will vector sum vector The data is then pieced together to generate the final comprehensive representation of the case. The calculation formula is: =[ || ], where || represents the vector concatenation operation; In step ST5, the comprehensive similarity score between cases is calculated, specifically: based on the final comprehensive representation of the case to be retrieved and the candidate cases obtained in step ST4, the cosine similarity between the case to be retrieved and the candidate cases is calculated as the comprehensive similarity score; let the final comprehensive representation of the query case, i.e., the case to be retrieved, be... The final comprehensive representation of a candidate case is: The combined similarity score between the two is Score(q,c), calculated using the formula: Score(q,c) = cos( , )= , where * denotes the dot product operation of vectors. The L2 norm of the vector is represented. The closer the score is to 1, the more similar the query case and the candidate case are. All candidate cases are sorted from high to low according to the comprehensive similarity score, and the top K most similar reference cases are output.
6. A case retrieval system based on the synergistic integration of legal and factual reasoning, characterized in that, include: The crime-aware module is configured to: predict the crime based on the factual description of the case to be retrieved, and obtain the crime label corresponding to the case; wherein, the crime prediction is based on a pre-trained language model with efficient parameter fine-tuning, which realizes the semantic mapping between the factual description of the case and the crime label through an imperative generation task; The single-case fact-finding graph construction module is configured to: construct a single-case fact-finding graph based on the factual description of the case to be retrieved, including event nodes, key fact nodes, and legal provision nodes; wherein, the node types include event nodes, key fact nodes, and legal provision nodes, and the edge types include temporal relationships between events, causal relationships between events and key facts, and citation relationships between key facts and legal provisions; after constructing the single-case fact-finding graph, a heterogeneous graph neural network is used to aggregate the node information to obtain the local semantic representation of the single case; the heterogeneous graph neural network performs weighted fusion of node information based on the attention weights of different types of edges to capture the fine-grained semantics and logical connections within the case; The global case jurisprudential graph construction module is configured to: construct a global case jurisprudential graph including case nodes, charge nodes, and legal provision requirement nodes. The global case jurisprudential graph is used to represent the semantic association, charge association, and legal provision association across cases. Case nodes represent different case texts, charge nodes represent the charge category to which the case belongs, and legal provision requirement nodes represent relevant legal provisions. The edges in the global case jurisprudential graph include case-case edges, case-charge edges, and case-legal provision edges, which are used to model the semantic similarity between cases, the group consistency of cases with the same charge, and the legal association of cases that jointly cite legal provisions, respectively. A global case graph neural network is used to model the structured semantic information between cases globally by performing message propagation based on an attention mechanism on the global case jurisprudential graph. The fusion module is configured to: for the case to be retrieved and the candidate cases, perform a fusion operation on the local semantic representation learned from the single case jurisprudence graph and the semantic representation after absorbing global information learned from the global case jurisprudence graph to generate the final comprehensive representation of the case; the fusion operation is presented in the form of vector concatenation to simultaneously retain the fine-grained logical information inside the case and the global relational information outside. The retrieval ranking and result output module is configured to: calculate the semantic similarity between cases as a comprehensive similarity score based on the final comprehensive representation of the case to be retrieved and each candidate case; rank the candidate cases according to the comprehensive similarity score and output the top K most similar reference cases; The pre-trained language model is a generative language model based on the Transformer architecture, which is achieved through efficient fine-tuning of parameters on a legal corpus; The pre-trained language model takes case fact text as input. , It is the nth word in the case fact text, where n refers to the total length of words in the case fact text X; Output the sequence of crime labels , This refers to the m-th crime label in the output crime label sequence, where m is the total length of the crime label sequence Y. The generation probability is defined as follows: ; in, The input is a sequence of case fact texts; The output is a sequence of crime labels, where m is the length of the label sequence; Let t be the predicted label; The probability of a pre-trained language model generating the entire sequence of charges given the input case text; To provide the input text and previously generated tags Given the condition, the conditional probability of the t-th label; For the previously generated label sequence, ; By minimizing the cross-entropy loss function The pre-trained language model is used to achieve semantic mapping between case semantics and legal labels. During training, a teacher-mandated strategy is adopted, that is, the real labels of the previous time step are used as the input conditions for the current time step. ; in, It is the cross-entropy loss function used in the crime prediction stage for parameter learning; The true crime label at time step t; This refers to the complete sequence of true labels before time step t. .
7. An electronic device comprising a memory and a processor, and computer instructions stored in the memory and running on the processor, characterized in that, When the computer instructions are executed by the processor, they complete the case retrieval method based on the synergistic integration of legal and factual reasoning as described in any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, Used to store computer instructions, which, when executed by a processor, complete the case retrieval method based on the synergistic integration of legal and factual reasoning as described in any one of claims 1-5.
9. A computer program product, characterized in that, The method includes a computer program that, when executed by a processor, implements the case retrieval method based on the synergistic integration of legal and factual reasoning as described in any one of claims 1-5.