A method for recommending legal provisions based on causal relationships
By constructing case fact-legal directed bipartite graphs and using a bilayer graph convolution neural network model to capture high-order structural information and potential causal relationships, the problems of insufficient utilization of semantic features and neglecting low-frequency law in the existing law recommendation technology are solved, and high-quality and interpretable law recommendations are achieved.
Patent Information
- Application Number
- CN202510082874.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-20
- Publication Date
- 2025-04-15
- Estimated Expiration
- 2045-01-20
AI Technical Summary
The existing legal recommendation technology has problems in insufficient semantic features utilization and low-frequency legal regulations ignore, resulting in low-quality recommendations.
By constructing a directed bipartite graph of case facts-legal articles, and using a bilayer graph convolutional neural network model to capture higher-order structural information and potential causal relationships, we realize the legal recommendation of causality and interpretability.
It improves the success rate and interpretability of legal recommendations, and ensures the legal logical rationality and semantic accuracy of the recommendation results.
Smart Images

Figure CN119493884B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of legal provision recommendation, and in particular to a legal provision recommendation method combining causal relationships. Background Art
[0002] Legal article recommendation is to select and recommend relevant legal articles based on the description of the case and the knowledge of legal articles in the judicial field. In the process of legal judgment, it is very important to find all the legal articles related to the case. Omitting or wrongly recommending any legal article will affect the judgment result and hinder judicial justice. Accurate recommendation of legal articles can greatly save the time and effort required to study legal issues and improve the quality and accessibility of legal services.
[0003] Legal article recommendation is mainly used for case similarity analysis, legal outcome prediction, automatic summary of case facts, automatic generation of legal documents, etc. These tasks use the legal information provided by legal article recommendation to further assist legal practitioners in making more accurate judgments and decisions in case handling, and also help legal researchers conduct more in-depth legal analysis. For example, case similarity analysis can help lawyers find precedents similar to the current case, legal outcome prediction can predict the possible ruling of the case based on historical data, and automatic summary of case facts can quickly extract key information from case files. Automatic generation of legal documents can automatically generate legal documents such as contracts and complaints based on existing legal information and templates.
[0004] At present, there are two main models for recommending legal provisions. One is to adopt the idea of classification, taking a limited number of legal provisions as category labels, and classifying them into relevant legal provisions according to the case description of the legal document. This method is to convert the legal provision recommendation task into a text classification task. Its main implementation process is as follows: first, the case description is converted into a numerical representation using feature extraction technology, and then the legal provisions are used as class labels, and a classifier is constructed in combination with the case description. The predicted category is the recommended legal provision. Some researchers also adopt a step-by-step approach, using SVM (feature selection) for initial classification, and then re-ranking the results using features and co-occurrence tendencies to modify the recommendation results to a certain extent; the second is based on the idea of matching, treating the legal provision recommendation task as a semantic matching task, calculating the matching degree between the case description and the legal provision, and recommending according to the matching degree. Its main implementation process is as follows: both the case description and the legal provision are converted into numerical representations through a vector model, and then the two are matched through a matching model, and the matching probability is calculated from high to low by calculating the similarity, which is the recommended legal provision. However, both of the above methods have the following problems: For the first technology using text classification: Legal provisions are the textual expression form of legal norms. Text classification methods simply use them as index numbers of category labels, and insufficiently utilize the semantic information of legal provisions, resulting in a lack of deep semantic information in semantic features, making it difficult to distinguish similar legal provisions, and thus affecting the quality of recommendation; For the second technology using text matching: Text data in the legal field is often unbalanced and missing, and this technology is very likely to ignore low-frequency legal provisions. Since low-frequency legal provisions appear less frequently during training, when recommending, the model will give priority to recommending legal provisions with higher frequency. In existing technologies, there is a situation where low-frequency legal provisions are removed to obtain a higher accuracy rate. Ignoring the recommendation of low-frequency legal provisions lacks rationality in real scenarios; Therefore, there is an urgent need for a legal provision recommendation method that combines causal relationships to overcome the problems existing in existing technologies. Summary of the invention
[0005] The purpose of the present invention is to provide a method for recommending legal provisions in combination with causal relationships. First, a directed bipartite graph of case facts and legal provisions is constructed based on the description of case facts and the specific content of legal provisions. Then, a graph neural network is used to capture and learn the high-order structural information and potential semantic information of the description of case facts and the specific content of legal provisions. At the same time, the potential causal relationship between case facts and corresponding legal provisions is modeled, mined and learned, thereby realizing legal provision recommendation with causal relationships and explainability.
[0006] To achieve the above object, the present invention provides a method for recommending legal provisions in combination with causal relationships, comprising the following steps:
[0007] Step 1: Construct a directed bipartite graph of case facts and legal provisions; treat the case facts as a node set , the law is another node set , n represents the characteristics of the nth case facts, m represents the characteristics of the mth legal provision, and the edge between the two represents the association between the case facts and the legal provision. If there is an association, it is represented as 1, otherwise, it is represented as 0;
[0008] Step 2: Build a two-layer graph convolutional neural network model. Generally speaking, the effect achieved by shallow GCN is often better than that of deep GCN without residual blocks. The number of GCN network layers represents the farthest distance that node features can reach, so in this solution, a two-layer GCN is built;
[0009] Step 3: Train the two-layer graph convolutional neural network model constructed in step 2;
[0010] Step 4: After the training process is completed, evaluate the model performance through precision, accuracy, recall, and F1 score. Based on the evaluation results, adjust the model hyperparameters (such as learning rate, number of layers, number of hidden units, etc.) to improve performance.
[0011] Preferably, the process of step 2 is as follows:
[0012] S21. Convert the case facts-legal provisions directed bipartite graph constructed in step 1 into an adjacency matrix represented as , if there is an edge between node i and node j, then , otherwise 0;
[0013] S22. Take the adjacency matrix as input and construct a two-layer graph convolutional neural network model. The expression is as follows:
[0014] ;
[0015] In the formula, Represents the constructed two-layer graph convolutional neural network model, represents the feature matrix, and , each row of which represents the characteristics of a node (case facts / legal provisions). represents a set of real numbers, n represents the characteristics of the nth case facts, m represents the characteristics of the mth legal provision, and d represents the characteristic dimension of each node. represents the adjacency matrix corresponding to the constructed bipartite graph, represents the adjacency matrix after row and column normalization in order to solve the gradient explosion or gradient disappearance problem. ,in, is the degree matrix, It is the adjacency matrix A plus the self-connected identity matrix I, which is used to take over the current node information and balance the feature importance of the central node and the neighboring nodes. represents the weight matrix of the first layer, represents the second layer weight matrix, It refers to the following string of functions. It means it is a function. Represents the activation function. The convolution operation of each layer is essentially a weighted average of the features of neighboring nodes, so feature aggregation can be regarded as a weighted sum of probabilities, and the weight reflects the probability of each neighbor's influence on the update of the current node's features. The ReLU activation function further processes these aggregated features, increases the level of nonlinear processing, and improves the model's ability to capture complex patterns. This can be seen as a method of introducing a probabilistic decision boundary in the feature space.
[0016] Preferably, the specific process of step 3 is as follows:
[0017] S31. The relationship between case facts and legal provisions is regarded as a state transition process. Assume that there is a previous state S and a next state S', where the previous state S is based on the case facts. Related laws ( , ) indicates that the next state S' is based on the case facts Related laws ( , ) indicates that the two cases are related to the same legal provision. , calculate the dot product between all node pairs in the feature matrix X, and obtain the score matrix ;
[0018] S32, calculate the condition of the next state S', the previous state S is converted to The probability of Indicate the facts of the case Related laws ;
[0019] S33, calculate the output probability of node i for all categories; forward propagation involves passing and updating node features through the graph structure, and finally outputting the prediction result of each node. For the last layer, the softmax function is used to ensure that each node outputs a valid probability distribution;
[0020] S34. Construct prediction loss function , and add a causal consistency regularization term , and obtain the total loss function ;
[0021] S35. Use the back propagation algorithm to update the model parameters, calculate the gradient of each parameter and update it. Usually, the gradient descent optimization algorithm is used. This solution selects the Adam adaptive learning rate optimization algorithm.
[0022] S36, iterative training; repeat the process of forward propagation, loss calculation and back propagation until the preset number of iterations is met or the loss value reaches a convergence state. During the training process, the model gradually learns how to predict the relevant laws based on the node features of the case facts, thereby achieving more accurate matching and recommendation of the case facts.
[0023] Preferably, the score matrix in S31 The calculation expression is as follows:
[0024] ;
[0025] In the formula, represents the feature vector of node i, Represents the transposed feature vector of node j.
[0026] Preferably, in S32, under the condition of the next state S', the previous state S is converted to Probability The calculation expression is as follows:
[0027] .
[0028] Preferably, the calculation expression of the output probability of node i for all categories in S33 is as follows:
[0029] ;
[0030] In the formula, represents the raw score vector of node i from the last layer of GCN, represents the unnormalized prediction score, Indicates the corresponding , Represents the probability distribution of the final output.
[0031] Preferably, the calculation expression of S34 is as follows:
[0032] ;
[0033] ;
[0034] ;
[0035] In the formula, N represents the total number of case facts, C represents the total number of legal provisions, Indicates the true label (0 or 1) of whether the i-th case fact is related to the legal article c. If the sample belongs to this category, it is 1, otherwise it is 0. It represents the probability that the model predicts the association between case fact i and legal provision c, Represents a regulatory factor that is used to balance the importance of predictive performance and causal consistency. In this way, such regularization can help the model reduce general prediction errors while also optimizing the learning of causal relationships.
[0036] Preferably, the accuracy in step 4 , Accuracy , recall rate , F1 score The calculation expressions of , are as follows:
[0037] ;
[0038] ;
[0039] ;
[0040] ;
[0041] Among them, TP represents the number of positive samples predicted as positive, TN represents the number of negative samples predicted as negative, FP represents the number of negative samples predicted as positive, and FN represents the number of positive samples predicted as negative.
[0042] Therefore, the present invention adopts the above-mentioned method of recommending legal provisions in combination with causality, which has the following beneficial effects:
[0043] 1. The success rate of legal article recommendation is improved; traditional text classification and text matching technologies mainly rely on the surface features of the text to recommend relevant legal articles. Although these methods are efficient in processing simple data, they often ignore the deep logic and causal relationship behind the text, and the semantic relationship between case facts and legal articles is not fully utilized. The method of combining graph structure with causal relationship that we proposed, by clearly simulating the causal relationship between case facts and legal articles, not only focuses on the matching of text content, but also pays more attention to the logical structure behind legal provisions. This not only recommends legal articles that are consistent with the surface facts, but also is more reasonable in legal logic;
[0044] 2. The interpretability of recommendations is enhanced. When the logical connection between the recommended legal provisions and the case facts is not obvious, traditional methods can quickly provide results, but they often lack sufficient interpretability. The method of combining graph structure with causal relationships proposed by us can directly point out which legal provisions are caused by which specific facts. This clear causal chain makes the recommendations not only help legal professionals quickly find relevant legal provisions, but also help them understand why these legal provisions are related to the current case, enhancing the credibility and operability of the recommendations and improving the limitations of traditional recommendations based on keywords or simple text matching.
[0045] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 The present invention is an overall flow chart of a method for recommending legal provisions in combination with causal relationships. DETAILED DESCRIPTION
[0047] The following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0048] See also Figure 1 , a method for recommending legal provisions in combination with causal relationships, comprising the following steps:
[0049] Step 1: Construct a directed bipartite graph of case facts and legal provisions; treat the case facts as a node set , the law is another node set , n represents the characteristics of the nth case facts, m represents the characteristics of the mth legal provision, and the edge between the two represents the association between the case facts and the legal provision. If there is an association, it is represented as 1, otherwise, it is represented as 0;
[0050] Step 2: Build a two-layer graph convolutional neural network model. Generally speaking, the effect achieved by shallow GCN is often better than that of deep GCN without residual blocks. The number of GCN network layers represents the farthest distance that node features can reach, so in this solution, a two-layer GCN is built; the specific process is as follows:
[0051] S21. Convert the case facts-legal provisions directed bipartite graph constructed in step 1 into an adjacency matrix represented as , if there is an edge between node i and node j, then , otherwise 0;
[0052] S22. Take the adjacency matrix as input and construct a two-layer graph convolutional neural network model. The expression is as follows:
[0053] ;
[0054] In the formula, Represents the constructed two-layer graph convolutional neural network model, represents the feature matrix, and , each row of which represents the characteristics of a node (case facts / legal provisions). represents a set of real numbers, n represents the characteristics of the nth case facts, m represents the characteristics of the mth legal provision, and d represents the characteristic dimension of each node. represents the adjacency matrix corresponding to the constructed bipartite graph, represents the adjacency matrix after row and column normalization in order to solve the gradient explosion or gradient disappearance problem. ,in, is the degree matrix, It is the adjacency matrix A plus the self-connected identity matrix I, which is used to take over the current node information and balance the feature importance of the central node and the neighboring nodes. represents the weight matrix of the first layer, represents the second layer weight matrix, It refers to the following string of functions. It means it is a function. Represents the activation function. The convolution operation of each layer is essentially a weighted average of the features of neighboring nodes, so feature aggregation can be regarded as a weighted sum of probabilities, and the weight reflects the probability of each neighbor's influence on the update of the current node's features. The ReLU activation function further processes these aggregated features, increases the level of nonlinear processing, and improves the model's ability to capture complex patterns. This can be seen as a method of introducing a probabilistic decision boundary in the feature space.
[0055] Step 3: Train the two-layer graph convolutional neural network model constructed in step 2. The specific process is as follows:
[0056] S31. The relationship between case facts and legal provisions is regarded as a state transition process. Assume that there is a previous state S and a next state S', where the previous state S is based on the case facts. Related laws ( , ) indicates that the next state S' is based on the case facts Related laws ( , ) indicates that the two cases are related to the same legal provision. , calculate the dot product between all node pairs in the feature matrix X, and obtain the score matrix ; Among them, the score matrix The calculation expression is as follows:
[0057] ;
[0058] In the formula, represents the feature vector of node i, represents the transposed feature vector of node j;
[0059] S32, calculate the condition of the next state S', the previous state S is converted to The probability of Indicate the facts of the case Related laws ; The calculation expression is as follows:
[0060] .
[0061] S33, calculate the output probability of node i for all categories; forward propagation involves passing and updating node features through the graph structure, and finally outputting the prediction results of each node. For the last layer, the softmax function is used to ensure that each node outputs a valid probability distribution; the calculation expression of the output probability of node i for all categories is as follows:
[0062] ;
[0063] In the formula, represents the raw score vector of node i from the last layer of GCN, represents the unnormalized prediction score, Indicates the corresponding , Represents the probability distribution of the final output.
[0064] S34. Construct prediction loss function , and add a causal consistency regularization term , and obtain the total loss function ; The specific calculation expression is as follows:
[0065] ;
[0066] ;
[0067] ;
[0068] In the formula, N represents the total number of case facts, C represents the total number of legal provisions, Indicates the true label (0 or 1) of whether the i-th case fact is related to the legal article c. If the sample belongs to this category, it is 1, otherwise it is 0. It represents the probability that the model predicts the association between case fact i and legal provision c, Represents a regulatory factor that is used to balance the importance of predictive performance and causal consistency. In this way, such regularization can help the model reduce general prediction errors while also optimizing the learning of causal relationships.
[0069] S35. Use the back propagation algorithm to update the model parameters, calculate the gradient of each parameter and update it. Usually, the gradient descent optimization algorithm is used. This solution selects the Adam adaptive learning rate optimization algorithm.
[0070] S36, iterative training; repeat the process of forward propagation, loss calculation and back propagation until the preset number of iterations is met or the loss value reaches a convergence state. During the training process, the model gradually learns how to predict the relevant laws based on the node features of the case facts, thereby achieving more accurate matching and recommendation of the case facts.
[0071] Step 4: After the training process is completed, evaluate the model performance through precision, accuracy, recall rate, and F1 score. According to the evaluation results, adjust the model hyperparameters (such as learning rate, number of layers, number of hidden units, etc.) to improve performance. , Accuracy , recall rate , F1 score The calculation expressions of , are as follows:
[0072] ;
[0073] ;
[0074] ;
[0075] ;
[0076] Among them, TP represents the number of positive samples predicted as positive, TN represents the number of negative samples predicted as negative, FP represents the number of negative samples predicted as positive, and FN represents the number of positive samples predicted as negative.
[0077] Therefore, the present invention adopts the above-mentioned method of recommending legal provisions in combination with causal relationships, makes full use of the bipartite graph structure and combines causal relationships, and obtains the probability of the association between case facts and legal provisions under a certain specific state through graph convolutional neural network training. At the same time, the causal relationship between case facts and legal provisions is modeled, thereby inferring the legal provisions related to the case facts, and the legal provisions derived from the causal relationship will be more interpretable. It can be seen from the properties of the graph structure that a case fact can be associated with multiple legal provisions at the same time, and a legal provision can also be associated with multiple case facts at the same time. Therefore, in this solution, by retaining the low-frequency legal provisions and their associated case facts in the training set, and then using the graph convolutional neural network to aggregate the information of neighboring nodes, the feature representation of low-frequency legal provisions is enhanced, so that its semantic information is effectively utilized and the recommendation success rate of low-frequency legal provisions is improved.
[0078] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that they can still modify or replace the technical solution of the present invention with equivalents, and these modifications or equivalent replacements cannot cause the modified technical solution to deviate from the spirit and scope of the technical solution of the present invention.
Claims
1. A method for recommending legal provisions in combination with causal relationships, characterized in that: The following steps are involved: Step 1: Construct a directed bipartite graph of case facts and legal provisions; treat the case facts as a node set , the law is another node set , n represents the characteristics of the nth case facts, m represents the characteristics of the mth legal provision, and the edge between the two represents the association between the case facts and the legal provision. If there is an association, it is represented as 1, otherwise, it is represented as 0; Step 2: Build a two-layer graph convolutional neural network model; Step 3: Train the double-layer graph convolutional neural network model constructed in step 2; Step 4: After the training process is completed, evaluate the model performance through precision, accuracy, recall, and F1 score, and adjust the model hyperparameters based on the evaluation results; The process for step 2 is as follows: S21. Convert the case facts-legal provisions directed bipartite graph constructed in step 1 into an adjacency matrix represented as , if there is an edge between node i and node j, then , otherwise 0; S22. Take the adjacency matrix as input and construct a two-layer graph convolutional neural network model. The expression is as follows: ; In the formula, Represents the constructed two-layer graph convolutional neural network model, represents the feature matrix, and , represents a real number set, n represents the characteristics of the nth case facts, m represents the characteristics of the mth legal provision, and d represents the characteristic dimension of each node. represents the adjacency matrix corresponding to the constructed bipartite graph, represents the adjacency matrix after row and column normalization, ,in, is the degree matrix, represents the adjacency matrix A plus the self-connected identity matrix I, represents the weight matrix of the first layer, represents the second layer weight matrix, represents the activation function; The specific process of step 3 is as follows: S31. The relationship between case facts and legal provisions is regarded as a state transition process. Assume that there is a previous state S and a next state S', where the previous state S is based on the case facts. Related laws Indicates that the next state S' is based on the case facts Related laws ( , ) indicates that the two cases are related to the same legal provision. , calculate the dot product between all node pairs in the feature matrix X, and obtain the score matrix ; S32, calculate the condition of the next state S', the previous state S is converted to The probability of Indicate the facts of the case Related laws ; S33, calculating the output probability of node i for all categories; S34. Construct prediction loss function , and add a causal consistency regularization term , and obtain the total loss function ; S35. Use the back propagation algorithm to update the model parameters, calculate the gradient of each parameter and update it; S36, iterative training; continuously repeat the process of forward propagation, loss calculation and back propagation until the preset number of iterations is met or the loss value reaches a convergence state.
2. The method for recommending legal provisions in combination with causal relationships according to claim 1, characterized in that: S31 score matrix The calculation expression is as follows: ; In the formula, represents the feature vector of node i, Represents the transposed feature vector of node j.
3. The method for recommending legal provisions in combination with causal relationships according to claim 2, characterized in that: In S32, under the condition of the next state S', the previous state S is converted to Probability The calculation expression is as follows: 。 4. The method for recommending legal provisions in combination with causal relationships according to claim 3, characterized in that: The calculation expression of the output probability of node i for all categories in S33 is as follows: ; In the formula, represents the raw score vector of node i from the last layer of GCN, represents the unnormalized prediction score, Indicates the corresponding , Represents the probability distribution of the final output.
5. The method for recommending legal provisions in combination with causal relationships according to claim 4, characterized in that: The calculation expression of S34 is as follows: ; ; ; In the formula, N represents the total number of case facts, C represents the total number of legal provisions, Indicates the true label of whether the i-th case fact is related to the legal article c, It represents the probability that the model predicts the association between case fact i and legal provision c, Represents the adjustment factor.
6. The method for recommending legal provisions in combination with causal relationships according to claim 5, characterized in that: Step 4 Accuracy , Accuracy , recall rate , F1 score The calculation expressions of , are as follows: ; ; ; ; Among them, TP represents the number of positive samples predicted as positive, TN represents the number of negative samples predicted as negative, FP represents the number of negative samples predicted as positive, and FN represents the number of positive samples predicted as negative.
Citation Information
Patent Citations
A legal provision recommendation prediction system and method based on an association graph
CN109919368A
Cultural resource text classification method based on memory network and graph neural network
CN113516198A
Causal medical diagnosis method based on deep learning
CN113808734A
Criminal name prediction method based on graph neural network
CN118484536A
LSTM-SiTGRU model-based plaintext and ciphertext intelligent classification method and system
CN118503826A