Class case retrieval method and system based on collaborative fusion of laws and affairs

By constructing single-case factual graphs and global case legal graphs using large language models and heterogeneous graph neural networks, we have achieved accurate matching between the internal logical structure of a case and the semantic associations across cases. This solves the problems of insufficient case factual semantic analysis and insufficient cross-case semantic associations in existing technologies, and improves the accuracy and legal consistency of case retrieval.

CN121833923AActive Publication Date: 2026-04-10SHANDONG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-23
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

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.

Method used

By introducing a large language model for semantic analysis of case fact descriptions and crime prediction, a single-case factual graph and a global case legal graph are constructed. A heterogeneous graph neural network is used to achieve bidirectional fusion of local and global information, thereby realizing accurate matching between the internal logical structure of a case and the semantic associations across cases.

Benefits of technology

It improves the accuracy and automation of case semantic modeling, significantly enhances the hierarchy and interpretability of case representation, solves the problem of lack of global semantic constraints in independent case coding in existing technologies, and ensures semantic consistency and the stability of legal logic.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121833923A_ABST
    Figure CN121833923A_ABST
Patent Text Reader

Abstract

The invention relates to a class case retrieval method and system based on collaborative fusion of laws and affairs. The method comprises the following steps: ST1, performing crime name prediction on fact description of a case to be retrieved; sT2, based on the fact description of the to-be-retrieved case, constructing a single-case matter graph comprising event nodes, key fact nodes and law article element nodes; sT3, constructing a global case law diagram comprising case nodes, crime name nodes and law article nodes; sT4, for the to-be-retrieved case and the candidate case, carrying out fusion operation on the local semantic representation learned by the single-case affair graph and the semantic representation which absorbs the global information and is learned by the global case law graph to generate the final comprehensive representation of the case; and ST5, sorting the candidate cases of the query case according to the comprehensive similarity score, and outputting the first K most similar reference cases. According to the method, cases are accurately matched and retrieved in a semantic, structural and legal constraint three-dimensional space.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of artificial intelligence and intelligent justice, and particularly relates to a case search method and system based on fusion of single-case fact logic graph and global case law logic graph. BACKGROUND

[0002] Case search is one of the core basic tasks in the intelligent justice system, and its goal is to automatically search for the most similar reference cases from a large-scale historical judgment document library given the fact description of the case to be judged, to provide judgment reference and legal application basis for judges, prosecutors and lawyers. Case search plays an important role in the judicial scenes such as "case similarity judgment", "case law interpretation" and "discretion supervision", and is one of the key technologies to promote the standardization, intelligentization and fairness of the judgment results.

[0003] The current case search methods are mainly divided into two categories: traditional information retrieval methods and neural network methods based on deep semantic representation. The traditional information retrieval method takes term matching as the core, such as keyword matching algorithm based on TF-IDF, BM25 or language model (LMIR). This kind of method has good retrieval efficiency in large-scale legal documents, but its representation ability is limited to the word frequency level, and it cannot effectively capture the semantic relationship and legal logic of the case facts, resulting in similar results in text but deviating in legal application. With the development of deep learning, more and more researchers try to use pre-trained language models to model the semantics of legal case texts. Representative works include Legal-BERT, Caseformer, SAILER and DELTA, etc. These models encode case texts into vector representations and calculate cosine similarity to realize semantic-level case search. However, due to the long length, complex structure and multiple nested logic of legal documents, the existing semantic embedding-based models often have information truncation or semantic drift problems when facing "multi-behavior, multi-charge, multi-article" cases, making it difficult to ensure the accuracy of fact matching and the consistency of legal interpretation.

[0004] In addition, some researchers begin to introduce graph neural networks to model the internal structure of legal texts in order to capture the logical relationships between case elements. Although these methods have enhanced the structured representation ability of cases to some extent, there are still the following significant deficiencies: most methods only model the graph structure within a single case, lacking semantic alignment and global constraints with other cases; global graph models can capture the potential relationship between cases, but often ignore the fine-grained fact structure within a single case, resulting in insufficient representation information; existing models generally use fixed node extraction templates, which are difficult to cover diverse fact structures under different charges or complex behavior chains.

[0005] In summary, the main deficiencies of the prior art in case retrieval are as follows: (1) the case fact semantic analysis capability is insufficient, and there is a lack of high-quality element extraction mechanism; (2) the unified fusion of single case structure modeling and cross-case semantic association is not achieved; (3) the case similarity calculation only relies on the semantic embedding of case documents, and ignores legal knowledge. SUMMARY

[0006] To overcome the deficiencies of the prior art, the present application proposes a case retrieval method and system based on the fusion of single case fact graph and global case law graph.

[0007] Specifically, by introducing a pre-trained large language model, the present application realizes the prediction of charges and the extraction of facts for case fact descriptions, and further determines the key facts and related article requirements; further, a heterogeneous graph neural network is used to construct a single case fact graph to capture the multi-level logical structure and fact association within the case; at the same time, a case-charge-article graph structure is established at the global level to explicitly model the cross-case semantic and legal association information. By designing a global-local bidirectional fusion mechanism, the fusion of local fine-grained semantics and global group consistency is realized, so as to accurately match and retrieve cases in the three-dimensional space of semantics, structure and legal constraints.

[0008] Terminology explanation: 1. Case retrieval refers to the process of automatically retrieving the most similar cases in terms of fact, legal application and judgment result from a large-scale decided case database given the fact description or text content of the case to be judged. Case retrieval aims to provide referenceable judicial precedents for judges, prosecutors and lawyers to achieve "case similarity" and "case law interpretation". The core technologies include case semantic modeling, case similarity calculation and result sorting. The case retrieval method of the present application introduces structured case graphs and cross-case association modeling on the basis of traditional text semantic matching to improve the accuracy and legal consistency of the retrieval results.

[0009] 2. Large language model refers to a language model pre-trained through large-scale corpus and having semantic understanding, knowledge reasoning and generation capabilities. The large language model can automatically complete task instructions, semantic extraction or classification generation according to the input text context. The present application uses a large language model fine-tuned by legal corpus to perform semantic analysis, charge prediction and case fact extraction on case fact descriptions, realizes the structured modeling of case semantic information, and serves as the core semantic engine for fact graph construction and retrieval.

[0010] 3. Heterogeneous graph is a graph structure containing more than one type of node and edge. For a node type set and an edge type set The graph G is called a heterogeneous graph if m > 1 or n > 1. Compared with the isomorphic graph, the heterogeneous graph can distinguish the semantic categories of nodes and relationships, and is suitable for describing multi-dimensional information interaction. The heterogeneous graph in the present application is used to model the internal structure of a case, the nodes include event, key fact and legal provision requirements, and the edge relationships include time sequence relationship, causal relationship and citation relationship, thereby describing the multi-layered connection between the logic of case facts and legal provisions.

[0011] 4. Graph neural network refers to a neural network model for feature learning and information propagation on graph structure data. By aggregating the feature vectors of neighbor nodes and performing nonlinear transformation, the graph neural network can learn the high-order representation of nodes while maintaining the topological structure. The present application uses a heterogeneous graph neural network to set independent parameter matrices and attention weights for different node types and relationship types, thereby realizing the joint representation and feature aggregation of multi-semantic elements within a case.

[0012] 5. The generative language model based on the Transformer architecture refers to a deep learning model that uses the Transformer neural network structure to learn the representation of input sequences through the self-attention (Self-Attention) mechanism, and automatically generates text output based on this. This type of model is usually composed of an encoder (Encoder) and a decoder (Decoder) module, or only a decoder. The model is pre-trained on a large-scale text corpus to learn the statistical rules and semantic structure of language. In application, it can automatically generate natural language text that meets the grammar and semantics according to the input content, such as summary generation, question and answer generation, text continuation, semantic understanding and reasoning, etc.

[0013] 6. Supervised fine-tuning (Supervised Fine-Tuning, SFT) refers to a method of further training model parameters based on a pre-trained language model using labeled data with explicit input-output pairs. By minimizing the difference between the model-generated output and the target output, the model learns the mapping relationship of specific tasks, thereby maintaining the general language understanding ability while obtaining the domain task ability.

[0014] 7、Heterogeneous graph neural network: is the existing basic model in the field of graph neural network. Its design goal is to process heterogeneous graph data containing multiple types of nodes and edges. The single-layer network mainly contains two core operations: heterogeneous graph convolution: using graph attention mechanism (GAT) for message passing. For each relationship type existing in the graph, an independent graph attention layer is used to process the message passing under this relationship. For a center node, it will interact with its different neighbor sets according to different relationship types. Node-level attention aggregation: after obtaining the neighbor information under each relationship through heterogeneous convolution, the importance weight of different relationship neighbors to the center node is automatically learned through attention mechanism, and weighted aggregation is performed to update the feature representation of each node.

[0015] 8、GATConv: is a graph convolutional neural network layer based on graph attention network architecture. Unlike traditional graph convolutional network (GCN), GATConv introduces 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 the invention, GATConv is used as the core feature extraction module. It is used to process the complex relationships between cases, charges and laws in the global graph (such as similar_to, has_charge, has_law). Through the multi-head attention mechanism of GATConv, the model can dynamically learn the importance of neighbor nodes to the target node under different relationships, and realize the weighted aggregation and update of node features.

[0016] 9、Bert: a pre-trained language representation model. Based on the bidirectional encoder structure of Transformer, through unsupervised pre-training (including mask language model MLM and next sentence prediction NSP tasks) on massive text corpus, it can capture deep contextual semantic information and syntactic features in text. The BERT model can convert variable-length natural language text into fixed-dimensional dense vector representation.

[0017] In order to achieve the above purpose, the technical scheme adopted by the present application is as follows: In a first aspect, the present application provides a case retrieval method based on the cooperation and fusion of legal principles and principles, comprising: ST1: predicting the charge of the fact description of the case to be searched, and obtaining the charge label corresponding to the case; wherein the charge prediction is based on a pre-trained language model that is efficiently fine-tuned by parameters, and the pre-trained language model realizes semantic mapping between case fact description and charge label through an instructional generation task; ST2: Construct a single-case fact graph including event nodes, key fact nodes and legal requirement nodes based on the fact description of the case to be searched; wherein, the node types include event nodes, key fact nodes and legal requirement nodes, and the edge types include the time sequence relationship between events, the causal relationship between events and key facts, and the citation relationship between key facts and legal requirements; after the single-case fact graph is constructed, 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 weights and fuses node information based on the attention weights of different types of edges to capture the fine-grained semantics and logical associations within the case; ST3: Construct a global case law graph including case nodes, charge nodes and legal provision nodes, which is used to represent the semantic association, charge association and legal provision association across cases; wherein, the case nodes are used to represent different case texts, the charge nodes are used to represent the charge categories of the cases, and the legal provision nodes are used to represent the relevant legal provisions; the edges in the global case law 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 with commonly cited legal provisions; a global case graph neural network is used to model the structured semantic information between cases in a global range by performing attention mechanism-based message propagation on the global case law graph; ST4: For the case to be searched and the candidate cases, the local semantic representation learned by the single-case fact graph is fused with the semantic representation learned by the global case law graph after absorbing global information to generate the final comprehensive representation of the case; the fusion operation is in the form of vector splicing to simultaneously retain the fine-grained logical information within the case and the global association information outside the case; ST5: According to the comprehensive similarity score, the candidate cases of the query case are sorted, and the most similar case result to the query case is output; in the sorting process, the candidate cases are arranged from high to low according to the comprehensive similarity score, and the top K most similar reference cases are output.

[0018] According to the application, in step ST1, the pre-trained language model is a generative language model based on the Transformer architecture, which is realized by efficient parameter fine-tuning on a legal corpus; The pre-trained language model inputs the case fact text , is the nth word piece in the case fact text, and n is the total length of the word piece of the case fact text X; Output charge label sequence , is the mth charge label in the output charge label sequence, and m is the total length of the charge label sequence Y. The generation probability is defined as: ; 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. .

[0019] According to a preferred embodiment of the present invention, a single-case reasoning diagram is constructed using a large language model.

[0020] 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: ; 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; is a ReLU activation function with leakage; is the feature vector of node i; is the feature vector of node j; is the weight matrix corresponding to the relationship type r; k is is any one neighbor node in the set, used to traverse all neighbors of node i under relationship r; is an exponential function with base e; A case node is introduced, which is a node connecting all nodes in the graph. The feature vector of the case node in the last layer is the final global semantic representation of the case , and the formula is: ; wherein, is the feature vector of the case node in the last layer of the heterogeneous graph neural network; , which is the local semantic representation of the single case.

[0021] Further preferably, the heterogeneous graph neural network is trained using a listwise ranking loss learning algorithm, and the loss function is: ; wherein, is the total loss calculated for a query sample q, and 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 first to the nth candidate is traversed, is the target probability distribution, representing the ideal relevance probability of the jth candidate sample with respect to the current query; is the probability distribution predicted by the heterogeneous graph neural network, representing the probability of the jth candidate sample being ranked in the front; is the penalty term coefficient, is the weight coefficient of the L2 regularization term, which is a hyperparameter, is the set of all learnable parameters in the heterogeneous neural network.

[0022] According to the present application, the heterogeneous graph neural network weights and fuses node information based on the attention weight of different types of edges, capturing the fine-grained semantics and logical association within the case; including: Different node types are subjected to linear mapping to obtain a unified dimensional node vector representation; the relationship types include the aggregation relationship between the case node and each node, the temporal relationship between events, the causal relationship between events and key facts, the citation relationship between key facts and legal requirements, and the attention score of the connected node pair (i, j) under each relationship type r in the single case logic graph is calculated as follows: ; wherein, is an attention vector of the relation type, || represents a vector concatenation operation; is a ReLU activation function with leakage; represents a feature vector of node i; is a feature vector of node j; is a weight matrix corresponding to the relation type r; k is any one neighbor node in the set, used to traverse all neighbors of node i under the relation r; is an exponential function with base e; the attention score describes the importance of node j to node i under the relation type r; Softmax normalization is performed on the attention score, and the attention weight 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 weighted and summed; so that the node can obtain: the temporal dependence of the event chain, the causal relationship between the fact and the key fact, and the citation relationship between the key fact and the legal requirements; form a node representation with legal logic structure, that is, the fine-grained semantics and logical association within the case.

[0023] According to the application, in step ST3, the case node, the charge node and the law node jointly form a legal graph structure wherein , V is a node set, E is an edge set, Vcase is a case node, Vcharge is a charge node, Vlaw is a law node, the initial feature of Vcase is the charge vector obtained by the encoder; Vlaw is the law vector obtained by the encoder; is a similar edge between cases, is a subordinate edge between a case and a charge, is a subordinate edge between a case and a law; different linear projection matrices are specified for different types of nodes to map the original features to a unified hidden space dimension, for each 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 charge, indicating that the case is this charge, has_law is the subordinate relation between a case and a law, indicating that the case refers to this law; The first layer convolution uses a multi-head graph attention mechanism to process three types of edge relationships respectively, and outputs an average strategy aggregation after ELU activation; The second layer convolution further compresses the feature dimension to generate the final node embedding OUT_DIM; the importance of different relationships is dynamically learned through the weighted sum of multi-head attention and cross-relationship average aggregation. The global case graph neural network is trained using a contrastive learning method, and the global case graph neural network includes a first layer convolution and a second layer convolution; the loss function is: ; Wherein, s() is a similarity function, is a graph structure enhanced representation of the query case, is a graph structure enhanced representation of the positive example candidate document of the query case, is a negative sample, is a temperature parameter.

[0024] According to the application, the structured semantic information between cases in the global range is modeled by message propagation based on the attention mechanism of the global case legal graph, including: Each type of node in the global case legal graph includes a case node, a charge node, and a legal provision node, which has an initial feature vector: the initial feature vector of the case node comes from the encoding output of the single case legal 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 a text encoder; The initial feature vectors of the case node, the charge node, and the legal provision node constitute the input of the global case legal graph, in the global case legal graph, a case node is connected to the charge nodes involved in the judgment and the legal provision nodes cited, the same charge node is connected to multiple similar case nodes, and the same legal provision node is connected to a large number of case nodes citing the provision, therefore, the neighborhood of each node includes a plurality of node sets having legal semantic association with the 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, for any node i and its neighbor node j on an edge, calculating an attention coefficient, the attention coefficient reflects the influence strength of the neighbor node j on the node i; each node receives weighted information from its neighborhood nodes, and automatically identifies more important legal relationships.

[0025] According to the application, the specific implementation process of step ST4 includes: Obtain the local semantic representation of the case to be searched from step ST2, denoted as vector That is 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.

[0026] 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.

[0027] Secondly, the present invention provides a case retrieval system based on the synergistic integration of legal and factual reasoning, comprising: 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.

[0028] 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.

[0029] The global case legal principle graph construction module is configured to construct a global case legal principle graph including case nodes, charge nodes and legal provision nodes, the global case legal principle graph being used to represent semantic association, charge association and legal provision association across cases; wherein the case nodes are used to represent different case texts, the charge nodes are used to represent charge categories to which the cases belong, and the legal provision nodes are used to represent relevant legal provisions; edges in the global case legal principle graph include case-case edges, case-charge edges and case-legal provision edges, which are respectively used to model semantic similarity between cases, group consistency of cases of the same charge and legal association of cases of common cited legal provisions; the global case graph neural network is used to model structured semantic information between cases in a global range by performing attention mechanism-based message propagation on the global case legal principle graph; The representation fusion module is configured to, for the case to be retrieved and the candidate cases, fuse the local semantic representation learned by the single-case legal principle graph with the semantic representation after absorbing global information learned by the global case legal principle graph to generate a final comprehensive representation of the case; the fusion operation is in the form of vector splicing to simultaneously retain fine-grained logical information inside the case and global association information outside the case; The retrieval, ranking and result output module is configured to calculate semantic similarity between the case to be retrieved and each candidate case as a comprehensive similarity score based on the final comprehensive representation of the case to be retrieved and each candidate case; and rank the candidate cases according to the comprehensive similarity score and output the top K most similar reference cases.

[0030] In a third aspect, the present application provides an electronic device, comprising a memory and a processor, and computer instructions stored in the memory and running on the processor, when the computer instructions are run by the processor, the method of the first aspect is completed.

[0031] In a fourth aspect, the present application provides a computer readable storage medium for storing computer instructions, when the computer instructions are executed by a processor, the method of the first aspect is completed.

[0032] In a fifth aspect, the present application provides a computer program product comprising a computer program, when the computer program is executed by a processor, the method of the first aspect is completed.

[0033] The above one or more technical solutions have the following beneficial effects: 1. The present application realizes automatic semantic analysis and charge prediction of case fact description by introducing a large language model, which can deeply mine the logical correspondence between behavior elements, key facts and legal provision requirements in case texts. Compared with traditional keyword retrieval or shallow semantic matching methods, the present application can structurally understand the case from the semantic level, effectively improving the accuracy and automation degree of case semantic modeling.

[0034] 2. The application constructs a single case fact graph of a heterogeneous graph structure on the basis of semantic parsing, accurately depicts the causal relationship, time sequence relationship and legal application chain inside the case through the multi-type information fusion of event nodes, key fact nodes and article nodes. The introduction of the heterogeneous graph neural network enables the legal logic inside the case to be explicitly modeled in the form of a graph, significantly enhancing the hierarchy and interpretability of the case representation, and providing a more structurally meaningful feature basis for subsequent case similarity evaluation.

[0035] 3. The application further constructs a case-charge-article graph at the global level to uniformly represent the semantic commonality and legal relevance across cases. Through a global-local bidirectional information fusion mechanism, the mutual fusion of single case fine-grained semantics and global case group features is realized, thereby maintaining the local case differences while ensuring semantic consistency and global discriminability. This mechanism effectively solves the problem of "case independent coding and lack of global semantic constraints" in the prior art, making the model have higher stability and generalization in semantic understanding and legal logic maintenance. BRIEF DESCRIPTION OF DRAWINGS

[0036] Figure 1 is a realization architecture diagram of the case retrieval method based on the coordination and fusion of legal principles and rationales according to the application; Figure 2 is a schematic diagram of the single case fact graph construction according to the application; Figure 3 is a schematic diagram of the global case legal graph construction according to the application. DETAILED DESCRIPTION

[0037] It should be noted that the following detailed description is exemplary and is intended to provide further explanation of the application. Unless otherwise indicated, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which the application belongs.

[0038] It should be noted that the terms used herein are only for the purpose of describing the specific embodiments and are not intended to limit the exemplary embodiments according to the application.

[0039] In the case of no conflict, the embodiments in the application and the features in the embodiments can be combined with each other.

[0040] Embodiment 1 In a first aspect, the application provides a case retrieval method based on the coordination and fusion of legal principles and rationales, as shown in Figure 1 , comprising: ST1: Crime name prediction is performed on the fact description of the case to be searched, and the corresponding crime name label of the case is obtained; wherein the crime name prediction is based on a pre-trained language model that is efficiently fine-tuned by parameters, and the pre-trained language model realizes semantic mapping between the fact description of the case and the crime name label through an instruction generation task; in order to enhance the legal relevance of the semantic representation of the case; specifically including: inputting the fact description text of the query case into the fine-tuned large language model. The model understands the text semantics through the instruction generation task, and outputs one or more possible crime name labels. This process is formally represented as: given an input sequence X, the model generates a crime name label sequence Y, and is optimized by minimizing the cross-entropy loss to ensure the accuracy of crime name prediction, providing a legal semantic framework for subsequent processing.

[0041] ST2: Based on the fact description of the case to be searched, a single case fact graph including event nodes, key fact nodes and article requirement nodes is constructed; wherein the node types include event nodes, key fact nodes and article requirement nodes, and the edge types include temporal relationship between events, causal relationship between events and key facts, and citation relationship between key facts and article requirements; after the single case fact graph is constructed, 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 weights and fuses node information based on the attention weights of different types of edges to capture the fine-grained semantics and logical associations within the case; specifically including: 1) node extraction and construction: the model automatically identifies and extracts event nodes in the case, describes specific behaviors or states in the development process of the case, and calculates the similarity according to the structured article requirements to obtain key fact nodes. The initial feature vector of each node can be encoded by a domain pre-trained language model. 2) Edge relationship establishment: according to the internal logic of the case, different types of edges are established: "temporal relationship" edges are established between event nodes with chronological order; "causal relationship" edges are established between event nodes and key fact nodes triggered by them; "citation relationship" edges are established between key fact nodes and article requirement nodes satisfied by them. The constructed single case fact graph is input into the heterogeneous graph neural network. The network sets independent parameters for different node types and relationship types, aggregates neighbor node information through multiple layers of relationship attention-based message passing. Finally, a graph-level pooling function is used to obtain the local semantic representation vector of the query case .

[0042] ST3: Construct a global case jurisprudence graph including case nodes, charge nodes and law node, and the global case jurisprudence graph is used to represent the semantic association, charge association and law association across cases; wherein, the case node is used to represent different case texts, the charge node is used to represent the charge category to which the case belongs, and the law node is used to represent the relevant legal provisions; the edges in the global case jurisprudence graph include case-case edges, case-charge edges and case-law 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 with commonly cited laws; the global case graph neural network is used to model the structured semantic information between cases in the global range by performing message propagation on the global case jurisprudence graph based on the attention mechanism; specifically including: 1. Node and edge definition: the graph contains three types of nodes: case nodes (representing individual cases), charge nodes and law nodes. The "case-case" edge is established based on the semantic similarity between cases, the "case-charge" edge is established based on the charge label, and the "case-law" edge is established based on the law citation. The global graph is modeled using a graph convolutional network. Each case node can integrate the semantic information of its associated charge group and law co-occurrence group, thereby obtaining a case representation vector rich in context and global knowledge .

[0043] ST4: For the case to be searched and the candidate cases, the local semantic representation learned by the single-case jurisprudence graph is fused with the semantic representation after absorbing global information learned by the global case jurisprudence graph to generate the final comprehensive representation of the case; the fusion operation is in the form of vector splicing to simultaneously retain the fine-grained logical information inside the case and the global association information outside the case; ST5: According to the comprehensive similarity score, the candidate cases of the query case are sorted, and the most similar case results to the query case are output; in the sorting process, the candidate cases are arranged from high to low according to the comprehensive similarity score, and the top K most similar reference cases are output. It is used in the scenes of judicial auxiliary search, case interpretation and intelligent legal recommendation.

[0044] Embodiment 2 The difference of the case retrieval method based on the coordination and fusion of jurisprudence and common sense according to Embodiment 1 is: In step ST1, the pre-trained language model is a generative language model based on the Transformer architecture, which is realized by efficient parameter fine-tuning on a legal corpus; The pre-trained language model inputs the case fact text , is the nth token in the case fact text, and n represents the total length of the tokens of the case fact text X; Output charge label sequence , is the m-th crime name label in the output crime name label sequence, m is the total length of the crime name label sequence (i.e. the number of predicted crime names) The generation probability is defined as: ; wherein, is the input case fact text sequence; is the output crime name label sequence, m is the label sequence length; is the t-th predicted label; refers to the crime name label that the model predicts to generate at time step t, given the case fact X and the previously generated labels ; is the probability that the pre-trained language model generates the entire crime name sequence under the input case text condition; is the conditional probability of the t-th label given the input text and the previously generated labels ; is the previously generated label sequence, which is a sequence, refers to the set of all crime name labels that the model has autoregressively predicted and generated before time step t: ; The pre-trained language model is trained by minimizing the cross-entropy loss function to achieve semantic mapping between case semantics and legal labels; In the training process, the teacher forcing strategy is adopted, that is, the true label of the previous time step is used as the input condition of the current time step: ; wherein, is the cross-entropy loss function in the crime name prediction stage, used for parameter learning; is the true crime name label at the t-th time step; is the complete true label sequence before time step t .

[0045] For the crime name prediction task of case fact text, a generative language model based on the Transformer architecture is trained through supervised fine-tuning. The training data contains case fact text and its corresponding target output format, where the target output adopts a structured JSON representation to express one or more crime name labels. The training data is as follows:

[0046]

Input

[0047] {"charges": ["robbery"]} The generative language model learns to generate outputs that conform to the predefined JSON structure based on the input text during the fine-tuning process. The model can generate structured results in the following format: {"charges": ["fraud", "aiding information network criminal activities"]}, where the "charges" field is an array of crime labels. When the array length is 1, it indicates a single crime name prediction; when the array length is greater than 1, it indicates multiple crime name predictions. Through this structured output format, the invention can uniformly handle single and multiple crime name scenarios and simplify subsequent parsing and information extraction processes.

[0048] Using a large language model to construct a single case event graph. As shown in Figure 2 Step ST2, use a large language model to extract from the case text, extract prompt as follows: "You are a legal text analysis expert. Please extract the event chain from the criminal case fact description I provide. Extraction requirements: 1. Use "verbs" or "dative phrases" to represent events, ensuring brevity and action, such as "drunk driving" "accept inspection" "extract blood sample" "voluntary surrender". 2. Keep procedural events related to sentencing, such as surrender, arrest, confession, compensation, and identification, and do not ignore them. 3. Output in chronological order according to the case, and restore the event sequence if necessary based on the context. 4. Remove irrelevant adverbs (such as "perform" "can" etc.), and only keep the true behavior events. 5. Quantities are noted in parentheses, such as the amount of stolen money, alcohol content of drunk driving, etc. 6. The output is in array form. Input text: {text} Output example: [drive, reverse, collide, injured, rescue ineffective, death, compensation]", process the law articles for each crime name (remove the part about punishment from the original law article, and only keep the crime description part), such as the law article text of "abuse of power, mistreat subordinates, and cause serious consequences, such as causing serious injury or other serious consequences, for five years or less in prison or detention; if death occurs, five years or more in prison." After the requirement processing: "abuse of power, mistreat subordinates, cause serious injury, cause other serious consequences", encode the facts extracted by the large prediction model and the law article requirements using a language encoder, calculate the cosine similarity of the encoding, and if the threshold is > 0.5, it is determined as a key fact. Finally, when constructing a single case event graph, it includes: fact nodes and edges between fact nodes (temporal relationship), edges between fact nodes and key fact nodes (reflecting the correspondence between facts and key facts), and edges between key fact nodes and law requirement nodes (reflecting the correspondence between key facts and legal requirements). At the same time, a global case node (initially represented as case text encoding) is introduced, connected to fact nodes, key fact nodes, and law requirement nodes.Figure 2 As shown.

[0049] 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: 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. 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.

[0050] 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; The update process of each layer of the neural network node is represented as follows: ; 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: ; 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; 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: ; 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.

[0051] That is, the local semantic representation of a single case.

[0052] 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 (weight decay strength) of the L2 regularization term are hyperparameters. This is the set of all learnable parameters in a heterogeneous neural network.

[0053] 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: 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:

[0054] ; where, is the attention vector of the relation type, || denotes the vector concatenation operation; is the ReLU activation function with leakage; denotes the feature vector of node i; denotes the feature vector of node j; is the weight matrix corresponding to the relation type r; k is is any one of the neighbor nodes in the set, used to traverse all neighbors of node i under the relation r; is the exponential function with base e; this attention score characterizes the importance of node j to node i under the relation type r; Softmax normalization is performed on the attention score, and the attention weight obtained after Softmax normalization; in this way, the neighbors under different relation types have different influences on the node. 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 weighted and summed; the specific implementation process includes:

[0055] The target node i first receives weighted information from all its neighbors under each relation type r, to obtain the aggregation vector under the relation type r; then, the aggregation results of all relation types are fused (summed) and passed through a nonlinear activation function to update the node features, as follows: ; where, denotes the feature vector of node at the l-th layer; denotes the feature vector of node at the l-th layer; is a nonlinear activation function; is a set of relation types, such as key facts, cited cases, etc. case relationship; is the neighbor set of node under the relation type is the l-th layer weight matrix corresponding to the relation type r; is the attention weight of node j to node i under the relation type r; The node obtains the timing dependency of the event chain, the causal relationship between the fact and the key fact, and the citing relationship between the key fact and the legal provision requirement at the same time. Through the weighted fusion based on the attention weight of different types of edges, the node feature obtains multiple logical association information in the case. Timing dependency of event chain: under the event timing relationship, the node feature update focuses on the events closely connected in time sequence, capturing the time sequence of event occurrence. Causal relationship between fact and key fact: under the causal relationship between fact and key fact, the feature update focuses on the key fact directly leading to or triggered by it, modeling the causal chain and reasoning logic of the case. Citing relationship between key fact and legal provision requirement: under the citing relationship between key fact and legal provision requirement, the feature update integrates the satisfaction information of case fact to legal requirement, realizing the modeling of legal reasoning logic. In terms of the timing dependency between events (the relationship type is r timing), when the target node i is an event node, the attention weight between it and all the timing relationship neighbors j is calculated, that is, Through training, the model gives higher to the predecessor event j that is closely connected or directly triggers i in time, and finally updates the event node feature, which not only contains the event itself information, but also integrates its timing context, encoding the position and dependency of the event in the whole case development chain. Form a node representation with legal logic structure, that is, the fine-grained semantics and logical association in the case.

[0056] As shown in Figure 3 , regarding the construction process of the global case legal graph, an example is as follows: Suppose there are three cases: case A: drunk driving of motor vehicle, constituting "dangerous driving crime", citing "Criminal Law" Article 133; case B: driving without a license and drunk driving, constituting "dangerous driving crime", citing "Criminal Law" Article 133; case C: fabricating facts to defraud property, constituting "fraud crime", citing "Criminal Law" Article 266. Charge nodes are: Charge1: dangerous driving crime; Charge2: fraud crime. Legal provision nodes are: Law1: "Criminal Law" Article 133, Law2: "Criminal Law" Article 266. Then case A and case B are connected to Charge1. Case A and case B are connected to Law1. The connection between cases is based on semantic similarity, calculating the cosine similarity of case A and all cases (using the final semantic representation of single case graph to calculate), and taking the top-5 connection edges.

[0057] In step ST3, the case node, the charge node and the legal provision node jointly form the legal graph structure , , ​, V is a node set, E is an edge set, Vcase is a case node, Vcharge is a charge node, Vlaw is a law node, the initial feature of Vcase is the charge vector obtained by the encoder in ST2 , Vcharge is the charge vector obtained by the encoder; Vlaw is the law vector obtained by the encoder; the charge predicted in ST1 is the charge of this case, the charge is predicted according to the content of the document, and the predicted charge is encoded. In order to construct the global graph structure, the features of the charges and laws as independent nodes need to be initialized. Since these nodes represent the legal knowledge ontology, their initial feature vectors (i.e. charge vector and law 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 texts involved in this case are also encoded, and the encoding of the document by Bert is used as the law vector; is a similar edge between cases, is a subordinate edge between a case and a charge, is a subordinate edge between a case and a law;

[0058] The global case graph neural network is used to receive the legal graph structure constructed in ST3 , and through information transmission and aggregation between nodes, the features of case nodes, charge nodes and law nodes are optimized and refined to obtain the final embedding for similarity calculation.

[0059] Different linear projection matrices are specified for different types of nodes to map the original features to a unified hidden space dimension, and for each type of relationship r∈{similar_to,has_charge,has_law}, similar_to is the similarity relationship between cases, has_charge is the subordinate edge between a case and a charge, indicating that the case is this charge, and has_law is the subordinate relationship between a case and a law, indicating that the case refers to this law; The first layer of convolution uses a multi-head graph attention mechanism (such as GATConv) to process the three types of edge relationships respectively, and outputs the features after ELU activation and aggregation by the mean strategy; The first layer of convolution is responsible for aggregating node features from the initial dimension to the hidden layer dimension HID_DIM. For each type of edge relationship r∈{similar_to,has_charge,has_law} in the global graph, a GATConv model specific to the relationship type is used for information aggregation, and the target node i receives weighted information from its neighbor nodes j to generate a relationship-specific aggregated feature vector , the aggregation process of which can be uniformly represented as:

[0060] ; wherein, is the initial feature of the neighbor node j after projection; is the first layer weight matrix corresponding to the relationship r, is the attention coefficient of the node j to the node i, the attention coefficient is used to quantify the contribution weight of the node j to the target node i under the relationship r, and the attention score is: ; wherein, is the attention vector of the relationship type, and || represents the vector splicing operation; is a ReLU activation function with leakage; represents the feature vector of the node i; is the feature vector of the node j; is the weight matrix corresponding to the relationship type r; k is any one neighbor node in the set, used to traverse all neighbors of the node i under the relationship r; is an exponential function with base e. It should be noted that the weight matrix plays a feature projection role, and in actual implementation, it is usually the same set of learnable parameters, ensuring that the transformation of the feature and the calculation of the attention weight are completed in the same semantic space.

[0061] Finally, the aggregation results of all relationships r are fused by using the mean strategy and are subjected to an ELU activation function to obtain the output of the first layer convolution : ; wherein, is the relationship type set {similar_to, has_charge, has_law}.

[0062] The second layer convolution further compresses the feature dimension to generate the final node embedding OUT_DIM; the importance of different relationships is dynamically learned through the weighted summation of multi-head attention and cross-relationship mean aggregation. The second layer convolution takes the output of the first layer convolution as input and performs similar aggregation operations as the first layer convolution, but its core function is to reduce the node feature from the hidden layer dimension to the final embedding dimension OUT_DIM.

[0063] For each type of edge relationship 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 relationship-specific aggregation feature vector , the aggregation process of which can be uniformly represented as: ; wherein, is the feature vector of the neighbor node j after the first layer convolution, is the second layer weight matrix corresponding to the relationship r, used to reduce the node feature from the hidden layer dimension to the final embedding dimension OUT_DIM. Finally, the relationship-specific aggregated feature vector is obtained by adopting the mean fusion strategy to fuse, and the convolution output of the second layer is :

[0064] ; The vector is the final embedding of the node i, also denoted as , that is, the global semantic representation of the node The global case graph neural network is trained using a contrastive learning method, and the global case graph neural network includes a first layer convolution and a second layer convolution; the two convolution networks are jointly constructed, and the discrete case, charge and article information is globally associated in a unified semantic space by using a graph attention mechanism. The loss function is:

[0065] ; wherein, s() is a similarity function (such as cosine similarity), is the graph structure enhanced representation of the query case, is the graph structure enhanced representation of the positive example candidate document of the query case, is the negative example sample, is a temperature parameter. The loss function aims to reduce the distance between the query case and its positive example candidate document in the representation space, while increasing the distance between the query document and the negative example candidate document.

[0066] The structured semantic information between cases in the global range is modeled by message propagation based on the attention mechanism of the global case legal graph, including: Each type of node in the global case legal graph, including the case node, the charge node and the article node, has an initial feature vector: the initial feature vector of the case node comes from the encoding output of the single-case legal graph in step ST2 ( ), the initial feature vector of the charge node is its semantic embedding (using Bert to encode the predicted charge), and the initial feature vector of the article node is obtained by a text encoder (using Bert to encode the legal documents); The initial feature vectors of the case node, the charge node, and the law article node constitute the input of the global case legal graph. In the global case legal graph, a case node is connected to the charge node involved in the judgment and the law article node cited, the same charge node is connected to multiple similar case nodes, and the same law article node is connected to a large number of case nodes citing the article. Therefore, the neighborhood of each node includes a plurality of node sets having a legal semantic association with the node. In order to distinguish the importance of different neighbor nodes to the target node, a graph attention mechanism is introduced, including: learning an independent linear transformation for each type of node to map all nodes to a unified feature space, calculating an attention coefficient for any node i and its neighbor node j on a certain edge, and the attention coefficient reflects the influence strength of the neighbor node j on the node i; each node receives weighted information from its neighborhood nodes, and automatically identifies more important legal relationships. Cases with the same charges as case A have a stronger influence on the representation of A; cases connected to the same law article node have a greater contribution to the legal characteristics of A, and cases irrelevant to A naturally have a lower weight. Message propagation across case groups: a case can be connected to similar cases through: case → charge node → similar case, and case → law article node → case citing the same law article. Legal semantic clustering across cases is achieved. The structured semantic information between cases finally modeled is to absorb neighbor information, and a more comprehensive representation of the case is obtained, that is, .

[0067] In step ST4, the representation of the single-case graph generated in ST2 and the representation after absorbing the global case information generated in ST3 are fused for each case, which is realized by vector splicing. For each case, the fusion process is as follows: the specific implementation process of step ST4 includes:

[0068] The local semantic representation of the case to be searched is obtained from step ST2, denoted as vector That is, The global structured semantic representation of the case to be searched after absorbing the global information is obtained from step ST3, denoted as vector Vector and vector are spliced to generate the final comprehensive representation of the case , and the calculation formula is: [ || ], where || represents the vector splicing operation.

[0069] In step ST5, the comprehensive similarity score between cases is calculated, specifically: based on the final comprehensive representation of the case to be searched and the candidate case obtained in step ST4, the cosine similarity between the case to be searched and the candidate case is calculated as the comprehensive similarity score; let the final comprehensive representation of the query case, i.e., the case to be searched, be , and the final comprehensive representation of a certain candidate case be , then the comprehensive similarity score between the two is Score(q, c), and the calculation formula is: Score(q, c) = cos( , ) , where * represents the inner product operation of the vector, , Score is closer to 1, representing that the query case and the candidate case are more similar; all candidate cases are sorted according to the comprehensive similarity score from high to low, and the top K most similar reference cases are output.

[0070] In the experiment, the LeCaRD dataset is used to test the traditional method and the deep learning encoder, and the test results of the method proposed in the patent are shown: Table 1

[0071] Embodiment 3 A case-based retrieval system based on the collaborative fusion of legal principles and justice, comprising: The crime awareness module is configured to predict the crime of the fact description of the case to be searched, and obtain the crime label corresponding to the case; wherein the crime prediction is based on a pre-trained language model that is efficiently fine-tuned by parameters, and the pre-trained language model realizes the semantic mapping between the fact description of the case and the crime label through the instruction generation task, so as to enhance the legal relevance of the semantic representation of the case.

[0072] The single-case event graph construction module is configured to construct a single-case event graph including event nodes, key fact nodes and statute requirement nodes based on the fact description of the case to be searched; wherein the node types include event nodes, key fact nodes and statute nodes, and the edge types include temporal relationship between events, causal relationship between events and key facts, and citation relationship between key facts and statute requirements; after the single-case event graph is constructed, 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 weights and fuses node information based on the attention weights of different types of edges to capture the fine-grained semantics and logical associations within the case.

[0073] The global case law graph construction module is configured to construct a global case law graph including case nodes, charge nodes and law node, the global case law graph is used to represent semantic association, charge association and law association across cases; wherein, the case node is used to represent different case texts, the charge node is used to represent the charge category to which the case belongs, and the law node is used to represent the relevant legal provisions; the edges in the global case law graph include case-case edges, case-charge edges and case-law 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 with commonly cited laws; the global case graph neural network is used to model the structured semantic information between cases in the global range by performing attention mechanism-based message propagation on the global case law graph. The representation fusion module is configured to fuse the local semantic representation learned by the single-case law graph with the semantic representation after absorbing global information learned by the global case law graph for the case to be retrieved and the candidate cases, and generate the final comprehensive representation of the case; the fusion operation is in the form of vector splicing, so as to simultaneously retain the fine-grained logical information inside the case and the global association information outside the case. The retrieval, ranking and result output module is configured to calculate the semantic similarity between the case to be retrieved and each candidate case 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. It is used in the scenes of judicial auxiliary retrieval, case interpretation and intelligent legal recommendation.

[0074] Embodiment 4 An electronic device includes a memory and a processor, and computer instructions stored on the memory and running on the processor, when the computer instructions are run by the processor, complete the case retrieval method based on the law and reason collaborative fusion of any one of embodiments 1-3.

[0075] It should be understood that in the embodiments, the processor can be a central processing unit CPU, and the processor can also be other general-purpose processors, digital signal processors DSPs, application-specific integrated circuits ASICs, ready-to-program gate arrays FPGA or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc.

[0076] The memory can include read-only memory and random access memory, and provide instructions and data to the processor, a part of the memory can also include non-volatile random access memory. For example, the memory can also store device type information.

[0077] Embodiment 5 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.

[0078] 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.

[0079] Example 6 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.

[0080] 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.

[0081] 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.

[0082] In the context of the present application, the computer program code or related data can be carried by any suitable carrier to enable the 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 can include electrical, optical, radio, sound or other forms of propagated signals, such as carrier waves, infrared signals, and the like.

[0083] Those skilled in the art can understand that the units and algorithm steps of the examples described in combination with the present embodiment can be realized by electronic hardware or a combination of electronic hardware and computer software. Whether the functions are realized in hardware or software manner depends on the specific application and design constraints of the technical solution. The skilled person can use different methods to realize the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0084] Although the specific embodiments of the present application are described above in combination with the drawings, it is not a limitation on the scope of protection of the present application. Those skilled in the art should understand that various modifications or variations made by those skilled in the art on the basis of the technical solutions of the present application without creative labor are still within the scope of protection of the present application.

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 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. 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.

2. The case retrieval method based on the synergistic integration of legal and factual reasoning as described in claim 1, characterized in that, 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. .

3. 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; 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: ; 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.

4. 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.

5. 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 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 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; A further preferred embodiment involves modeling structured semantic information between cases globally by performing attention-based message propagation on the global case jurisprudence graph; including: 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. 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. 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.

6. 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; Further preferably, in step ST5, the comprehensive similarity score between cases is calculated as follows: 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.

7. 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 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. 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.

8. 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-6.

9. 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-6.

10. A computer program product, characterized in that, The method 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 one of claims 1-6.

Citation Information

Patent Citations

  • Class case semantic retrieval method and system, electronic equipment and storage medium

    CN116361414A

  • Class case recommendation method based on deep understanding

    CN120492612A