A judgment prediction method based on dynamic legal knowledge graph and sequence-dependent multi-task learning
By employing a dynamic legal knowledge graph and a sequence-dependent multi-task learning approach, the problems of static knowledge graph lag and task logic chain breakage are solved, improving the accuracy and interpretability of judgment prediction, adapting to the dynamic changes in the legal system, reducing the false judgment rate, and enhancing the credibility of the model.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- QILU UNIVERSITY OF TECHNOLOGY (SHANDONG ACADEMY OF SCIENCES)
- Filing Date
- 2026-04-14
- Publication Date
- 2026-06-23
AI Technical Summary
Existing legal judgment prediction methods suffer from problems such as outdated static knowledge graphs, broken task logic chains, low differentiation of easily confused crimes, and insufficient interpretability. This results in prediction results that are out of touch with the latest judicial practices, a high rate of misjudgment, and a lack of transparency.
This paper adopts a dynamic legal knowledge graph and sequence-dependent multi-task learning approach. By constructing a dynamic legal knowledge graph, crime and sentence logic gating units, combined with temporal attention mechanism and multilayer perceptron, the legal knowledge is dynamically updated, the judicial logic chain is explicitly modeled, and the contrastive learning loss function is used to improve the accuracy and interpretability of the model.
It significantly improves the accuracy and compliance of judgment prediction, enhances the timeliness and credibility of the model, reduces the false judgment rate, provides clear legal reasoning explanations, and is adaptable to different types of legal judgment tasks.
Smart Images

Figure CN122047651B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence prediction technology, specifically to a judgment prediction method based on dynamic legal knowledge graphs and sequence-dependent multi-task learning. Background Technology
[0002] With the deepening application of artificial intelligence technology in the legal field, Legal Judgment Prediction (LJP) has become a core research direction in the construction of smart justice. This task aims to automatically predict the corresponding crime, legal provision, and sentence based on the factual description of a case. Existing LJP methods mainly rely on deep learning models, such as Convolutional Neural Networks (CNN), Long Short-Term Memory Networks (LSTM), and Transformer architectures, to predict judgments through end-to-end learning of case features. However, these methods still have several fundamental shortcomings in practical applications.
[0003] First, traditional methods largely rely on static legal knowledge graphs. These graphs are typically built upon historical legal provisions and cannot capture in real time the dynamic revisions of legal provisions, updates to judicial interpretations, and adjustments to judicial policies. The legal system has a significant time-sensitive characteristic; for example, old laws become invalid after the promulgation of a new law, or the Supreme Court issues new sentencing guidelines, leading to changes in the sentencing standards for similar cases. Static knowledge graphs struggle to adapt to such dynamic changes, resulting in predictions that are out of touch with the latest judicial practices. Although some studies have attempted to update the graphs through rules or models, they often fail to systematically consider the complex relationships between legal provisions and their changing validity over time. For instance, the promulgation of a new law may alter the validity of many old laws, and this cross-document relationship is often overlooked in existing technologies.
[0004] Secondly, existing models generally overlook the inherent logical sequence in judicial decisions. Judges in actual trials follow a strict logical chain of "fact finding → charge determination → legal citation → sentence determination." However, most LJP models treat charge, legal citation, and sentence prediction as independent or simply parameter-sharing tasks, failing to explicitly model this topological dependency. For example, when determining the sentence, judges strictly adhere to the sentencing range stipulated by the established charge and legal citation. While some studies have attempted multi-task learning, they often lack effective supervision and verification of the accuracy of upstream task predictions, leading to the propagation and accumulation of errors between tasks and compliance issues such as mismatches between legal citations and charges. Although some studies have proposed task dependency masking mechanisms or process supervision, they still fall short in terms of dynamic filtering of dependency information and deep integration of logical constraints.
[0005] Third, the poor interpretability of the models severely restricts their application value in judicial practice. The "black box" nature of deep learning models makes the prediction results lack transparency and verifiability, making it difficult for judges to understand and trust the model's reasoning process. Although some works have introduced attention mechanisms to locate key text fragments or attempted to generate judgment reasons, these explanations are often superficial and fail to clearly demonstrate the legal logic-based reasoning path within the model. In particular, they cannot explain how the model considers the differences in the first-instance and second-instance courts' understanding of the facts of the case in scenarios such as second instance trials.
[0006] Finally, for semantically similar and easily confused crimes, existing models suffer from a high misjudgment rate due to a lack of guidance from in-depth legal features and effective differentiation mechanisms. Although some studies have attempted to utilize legal attributes or keyword information, they have failed to fundamentally solve the semantic confusion problem. Furthermore, sentence prediction tasks are often simply treated as classification or regression problems, failing to effectively utilize the sentencing range information inherent in legal provisions for refined modeling, resulting in large fluctuations and insufficient rationality in prediction results.
[0007] Therefore, there is an urgent need for a new method for predicting judgments that can integrate dynamic legal knowledge, strictly follow the sequence of judicial logic, and provide strong interpretability. Summary of the Invention
[0008] To overcome the shortcomings of the above technologies, this invention provides a judgment prediction method based on dynamic legal knowledge graphs and sequence-dependent multi-task learning, which effectively solves the problems of static lag in knowledge graphs, broken task logic chains, low differentiation of easily confused crimes, and insufficient interpretability in existing technologies, and significantly improves the accuracy and compliance of judgment prediction.
[0009] The technical solution adopted by this invention to overcome its technical problems is:
[0010] A judgment prediction method based on dynamic legal knowledge graph and sequence dependency multi-task learning includes:
[0011] S1. Constructing a legal knowledge graph , , For a collection of entities, , For the first One entity, , For the number of entities, , For the first individual entities In timestamp Embedded vector at time;
[0012] S2. Obtain the facts of the currently entered case. Using the facts of the current case For the first individual entities In timestamp Embedded vector at time Dynamically update to obtain time Embedded vector All updated embedding vectors constitute time Legal knowledge graph ;
[0013] S3. From Legal Knowledge Graphs Search for legal constraint vectors related to the case. ;
[0014] S4. Construct a crime prediction gating unit, utilizing legal constraint vectors. The gated output is obtained through the crime prediction gated unit. Utilizing gated output Get hidden state update ;
[0015] S5. Construct a legal logic gating unit and utilize hidden state updates. Gating output is obtained through the legal logic gating unit. and probability distribution of crime prediction Utilizing gated output Get hidden state update ;
[0016] S6. Construct a sentence-based logic gating unit and utilize hidden state updates. The gated output is obtained through the sentence-term logic gate unit. and the probability distribution of candidate legal provisions Utilizing gated output Get hidden state update Update using hidden state Obtain the probability distribution of predicted sentence duration .
[0017] Furthermore, in step S1, an LLM large language model is used to extract from legal documents. Each entity includes legal provisions, crimes, penalties, sentencing factors, legal principles, and terminology.
[0018] Furthermore, in step S1, Natural Language Processing (NLP) is used to extract data from civil, criminal, and administrative judgment documents. Each entity includes parties, actions, objects, amounts and quantities, time and place, tools and means, results and consequences, and evidence.
[0019] Furthermore, in step S1, the TransE model is pre-trained on legal documents and judgment cases, and the pre-trained TransE model is used to obtain the first... individual entities corresponding embedding vector .
[0020] Furthermore, step S2 includes the following steps:
[0021] S2-1. Enter the currently input case facts. The input is given to the BERT model, and the output is the overall representation vector. ;
[0022] S2-2. Through formula The time decay factor was calculated. In the formula, For the attenuation hyperparameter, , For the first individual entities The last update time of the relevant legal information;
[0023] S2-3. Using the formula The case-substance relevance weights were calculated. In the formula, For trainable parameters, , For the real number space, As a dimension, , For transpose, For trainable parameters, , For trainable parameters, ;
[0024] S2-4. Using the formula Calculated time Embedded vector In the formula, It is a multilayer perceptron. Embedded vector Overall representation vector Time decay factor Perform the splicing operation.
[0025] Furthermore, step S3 includes the following steps:
[0026] S3-1. Through formula Calculate the intermediate parameters In the formula, To calculate cosine similarity, For the first individual entities time Embedded vector, ;
[0027] S3-2. Using the formula Calculate the legal constraint vector related to the case. .
[0028] Furthermore, step S4 includes the following steps:
[0029] S4-1. Through formula The gated output of the crime prediction gating unit is calculated. In the formula, For the Sigmoid function, For the gated trainable weight matrix, , For the bias term of the gating, , , for Overall representation vector Legal constraint vector Perform the splicing operation;
[0030] S4-2. Through formula Hidden state update calculated In the formula, the probability distribution of crime prediction It is the identity matrix. For GRU networks, For element-wise multiplication, This is for splicing operations.
[0031] Furthermore, step S5 includes the following steps:
[0032] S5-1. Through formula The gated output of the legal logic gated unit is calculated. In the formula, Update for hidden state Overall representation vector Legal constraint vector Perform the splicing operation;
[0033] S5-2. Through formula Hidden state update calculated In the formula, , For the softmax function, , These are all task parameters.
[0034] Furthermore, step S6 includes the following steps:
[0035] S6-1. Through formula The gated output of the sentence-term logic gate unit is calculated. In the formula, Update for hidden state Overall representation vector Legal constraint vector Perform the splicing operation;
[0036] S6-2. Through formula Hidden state update calculated In the formula, ;
[0037] S6-3. Through formula The probability distribution of predicted sentence duration was calculated. .
[0038] Furthermore, it also includes:
[0039] S7-1. Through formula The total loss was calculated. In the formula, For cross-entropy loss, To compare learning loss;
[0040] S7-2. Using the Adam optimizer to utilize total loss Train LLM large language models or natural language processing (NLP), TransE models, BERT models, and GRU networks.
[0041] The beneficial effects of this invention are as follows: By dynamically updating the legal knowledge graph through a temporal attention mechanism, the model can adapt to changes in legal revisions and judicial policies, overcoming the lag problem of static knowledge graphs and significantly improving the timeliness and accuracy of predictions. The legal logic gating unit explicitly models the judicial judgment logic chain of "crime → legal provision → sentence". The gating weights clearly reflect the model's dependence on upstream task information during decision-making, providing an intuitive and credible legal reasoning explanation for the prediction results, enhancing the model's credibility and acceptability in judicial practice. The use of a contrastive learning loss function to widen the distance between easily confused crime cases in the feature space enhances the model's ability to perceive subtle differences in legal facts, significantly reducing the misjudgment rate. The entire model adopts end-to-end learning, requiring no complex manual feature engineering, and possesses good versatility and scalability, enabling it to adapt to different types of legal judgment prediction tasks. Attached Figure Description
[0042] Figure 1 This is a flowchart of the method of the present invention. Detailed Implementation
[0043] The following is in conjunction with the appendix Figure 1 The present invention will be further described below.
[0044] A judgment prediction method based on dynamic legal knowledge graph and sequence dependency multi-task learning includes:
[0045] S1. Constructing a legal knowledge graph , , It is a collection of entities, encompassing core concepts, examples, and elements in the legal field. , For the first One entity, , For the number of entities, , For the first individual entities In timestamp The embedding vector at that time.
[0046] S2. Obtain the facts of the currently entered case. Using the facts of the current case For the first individual entities In timestamp Embedded vector at time Dynamically update to obtain time Embedded vector All updated embedding vectors constitute time Legal knowledge graph .
[0047] S3. From Legal Knowledge Graphs Search for legal constraint vectors related to the case. .
[0048] S4. Construct a crime prediction gating unit, utilizing legal constraint vectors. The gated output is obtained through the crime prediction gated unit. Utilizing gated output Get hidden state update ;
[0049] S5. Construct a legal logic gating unit and utilize hidden state updates. Gating output is obtained through the legal logic gating unit. and probability distribution of crime prediction Utilizing gated output Get hidden state update ;
[0050] S6. Construct a sentence-based logic gating unit and utilize hidden state updates. The gated output is obtained through the sentence-term logic gate unit. and the probability distribution of candidate legal provisions Utilizing gated output Get hidden state update Update using hidden state Obtain the probability distribution of predicted sentence duration .
[0051] By dynamically updating the legal knowledge graph through a temporal attention mechanism, the model can adapt to changes in legal revisions and judicial policies. A sequence-dependent multi-task learning module is designed to sequentially predict crimes, legal provisions, and sentences through legal logic gating units. This effectively solves problems in existing technologies such as static lag of knowledge graphs, broken task logic chains, low differentiation of easily confused crimes, and insufficient interpretability, significantly improving the accuracy and compliance of judgment predictions.
[0052] In one embodiment of the present invention, step S1 uses an LLM (Large Language Model) to extract from legal documents. Each entity includes legal provisions, crimes, penalties, sentencing factors, legal principles, and terminology.
[0053] In one embodiment of the present invention, natural language processing (NLP) is used in step S1 to extract from civil, criminal, and administrative judgment documents. Each entity includes parties, actions, objects, amounts and quantities, time and place, tools and means, results and consequences, and evidence.
[0054] In one embodiment of the present invention, step S1 involves pre-training the TransE model on legal documents and judgment cases, and using the pre-trained TransE model to obtain the first... individual entities corresponding embedding vector .
[0055] In one embodiment of the present invention, step S2 includes the following steps:
[0056] S2-1. Enter the currently input case facts. The input is given to the BERT model, and the output is the overall representation vector. . (Including parties, actions, objects, time and place, tools and means, amount and quantity, results and consequences, and evidence), d=768, and the entity set. They have the same dimensions.
[0057] S2-2. Through formula The time decay factor was calculated. In the formula, For the attenuation hyperparameter, , For the first individual entities The last update time of the relevant legal information. It is an exponential function with the real number e (e≈2.71828) as its base.
[0058] S2-3. Using the formula The case-substance relevance weights were calculated. In the formula, For trainable parameters, , For the real number space, As a dimension, , For transpose, For trainable parameters, , For trainable parameters, .
[0059] S2-4. When new laws are enacted, old laws are revised, or a large number of new cases emerge, entity embeddings need to be updated, specifically through formulas. Calculated time Embedded vector In the formula, It is a multilayer perceptron. Embedded vector Overall representation vector Time decay factor Perform the data concatenation operation. Case-entity relevance weighting. A higher value indicates a closer connection between the case and the entity.
[0060] In one embodiment of the present invention, step S3 includes the following steps:
[0061] S3-1. Through formula Calculate the intermediate parameters In the formula, To calculate cosine similarity, For the first individual entities time Embedded vector, .
[0062] S3-2. Using the formula Calculate the legal constraint vector related to the case. .
[0063] In one embodiment of the present invention, step S4 includes the following steps:
[0064] S4-1. Through formula The gated output of the crime prediction gating unit is calculated. In the formula, For the Sigmoid function, For the gated trainable weight matrix, , For the bias term of the gating, , , for Overall representation vector Legal constraint vector Perform the splicing operation. (Hidden state) It carries the basic semantic information of the case and serves as the starting point for sequential reasoning. Subsequent states of the hidden state are updated through a Gated Recurrent Unit (GRU).
[0065] S4-2. Through formula Hidden state update calculated In the formula, the probability distribution of crime prediction It is the identity matrix. For GRU networks, For element-wise multiplication, This is for splicing operations.
[0066] In one embodiment of the present invention, step S5 includes the following steps:
[0067] S5-1. Through formula The gated output of the legal logic gated unit is calculated. In the formula, Update for hidden state Overall representation vector Legal constraint vector Perform the splicing operation.
[0068] S5-2. Through formula Hidden state update calculated In the formula, , For the softmax function, , These are all task parameters.
[0069] In one embodiment of the present invention, step S6 includes the following steps:
[0070] S6-1. Through formula The gated output of the sentence-term logic gate unit is calculated. In the formula, Update for hidden state Overall representation vector Legal constraint vector Perform the splicing operation.
[0071] S6-2. Through formula Hidden state update calculated In the formula, .
[0072] S6-3. Through formula The probability distribution of predicted sentence duration was calculated. .
[0073] In one embodiment of the present invention, it further includes:
[0074] S7-1. Through formula The total loss was calculated. In the formula, For cross-entropy loss, To compare learning loss.
[0075] S7-2. Using the Adam optimizer to utilize total loss Train LLM large language models or natural language processing (NLP), TransE models, BERT models, and GRU networks.
[0076] Finally, it should be noted that the above descriptions are merely preferred embodiments of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A judgment prediction method based on dynamic legal knowledge graph and sequence dependency multi-task learning, characterized in that, include: S1. Constructing a legal knowledge graph , , For a collection of entities, , For the first One entity, , For the number of entities, , For the first individual entities timestamp Embedded vector at time; S2. Obtain the facts of the currently entered case. Using the facts of the current case For the individual entities timestamp Embedded vector at time Dynamically update to obtain time Embedded vector All updated embedding vectors constitute time Legal knowledge graph ; S3. From Legal Knowledge Graphs Searching for legal constraint vectors related to the case ; S4. Construct a crime prediction gating unit, utilizing legal constraint vectors. The gated output is obtained through the crime prediction gated unit. Utilizing gated output Get hidden state update ; S5. Construct a legal logic gating unit and utilize hidden state updates. Gating output is obtained through the legal logic gating unit. and probability distribution of crime prediction Utilizing gated output Get hidden state update ; S6. Construct a sentence-based logic gating unit and utilize hidden state updates. The gated output is obtained through the sentence-term logic gate unit. and the probability distribution of candidate legal provisions Utilizing gated output Get hidden state update Update using hidden state Obtain the probability distribution of predicted sentence duration ; Step S2 includes the following steps: S2-1. Enter the currently input case facts The input is given to the BERT model, and the output is the overall representation vector. ; S2-2. Through formula The time decay factor was calculated. In the formula, For the attenuation hyperparameter, , For the first individual entities The last update time of the relevant legal information; S2-3. Using the formula The case-substance relevance weights were calculated. In the formula, For trainable parameters, , For the real number space, As a dimension, , For transpose, For trainable parameters, , For trainable parameters, ; S2-4. Using the formula Calculated time Embedded vector In the formula, It is a multilayer perceptron. Embedded vector Overall representation vector Time decay factor Perform the splicing operation.
2. The judgment prediction method based on dynamic legal knowledge graph and sequence dependency multi-task learning according to claim 1, characterized in that: Step S1 uses an LLM large language model to extract from legal documents. Each entity includes legal provisions, crimes, penalties, sentencing factors, legal principles, and terminology.
3. The judgment prediction method based on dynamic legal knowledge graph and sequence dependency multi-task learning according to claim 1, characterized in that: Step S1 uses Natural Language Processing (NLP) to extract from civil, criminal, and administrative judgment documents. Each entity includes parties, actions, objects, amounts and quantities, time and place, tools and means, results and consequences, and evidence.
4. The judgment prediction method based on dynamic legal knowledge graph and sequence dependency multi-task learning according to claim 2 or 3, characterized in that: In step S1, the TransE model is pre-trained on legal documents and judgment cases, and the pre-trained TransE model is used to obtain the first... individual entities corresponding embedding vector .
5. The judgment prediction method based on dynamic legal knowledge graph and sequence dependency multi-task learning according to claim 1, characterized in that, Step S3 includes the following steps: S3-1. Through formula Calculate the intermediate parameters In the formula, To calculate cosine similarity, For the first individual entities time Embedded vector, ; S3-2. Using the formula Calculate the legal constraint vector related to the case. .
6. The judgment prediction method based on dynamic legal knowledge graph and sequence dependency multi-task learning according to claim 1, characterized in that, Step S4 includes the following steps: S4-1. Through formula The gated output of the crime prediction gating unit is calculated. In the formula, For the Sigmoid function, For the gating trainable weight matrix, , For the bias term of the gating, , , for Overall representation vector Legal constraint vector Perform the splicing operation; S4-2. Through formula Hidden state update calculated In the formula, the probability distribution of crime prediction It is the identity matrix. For GRU networks, For element-wise multiplication, This is for splicing operations.
7. The judgment prediction method based on dynamic legal knowledge graph and sequence dependency multi-task learning according to claim 1, characterized in that, Step S5 includes the following steps: S5-1. Through formula The gated output of the legal logic gated unit is calculated. In the formula, Update for hidden state Overall representation vector Legal constraint vector Perform the splicing operation; S5-2. Through formula Hidden state update calculated In the formula, , For the softmax function, , These are all task parameters.
8. The judgment prediction method based on dynamic legal knowledge graph and sequence dependency multi-task learning according to claim 1, characterized in that, Step S6 includes the following steps: S6-1. Through formula The gated output of the sentence-term logic gate unit is calculated. In the formula, Update for hidden state Overall representation vector Legal constraint vector Perform the splicing operation; S6-2. Through formula Hidden state update calculated In the formula, ; S6-3. Through formula The probability distribution of predicted sentence duration was calculated. .
9. The judgment prediction method based on dynamic legal knowledge graph and sequence dependency multi-task learning according to claim 6, characterized in that, Also includes: S7-1. Through formula The total loss was calculated. In the formula, For cross-entropy loss, To compare learning loss; S7-2. Using the Adam optimizer to utilize total loss Train LLM large language models or natural language processing (NLP), TransE models, BERT models, and GRU networks.