A judicial case retrieval method and system based on course learning
Through a course-based learning approach, a judicial case matching model was constructed using the ChatGLM model and graph convolutional neural network, which solved the problem of low semantic relevance in judicial case retrieval and achieved higher retrieval accuracy.
Patent Information
- Application Number
- CN202411135988.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-19
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2044-08-19
AI Technical Summary
In existing judicial case retrieval technologies, the semantic relevance of texts is not high, resulting in insufficient retrieval accuracy.
A curriculum-based learning approach is adopted, and the ChatGLM model is used to extract the key elements of judicial cases, construct graph structure data, and train them through the BERT model and graph convolutional neural network. Combined with the K-core algorithm, multi-level curriculum learning is performed to enhance the training of the case matching model and capture the semantic relationship between cases.
It improves the accuracy of judicial case retrieval, can more accurately understand the semantic correlation of text information, and achieve more accurate retrieval of similar cases.
Smart Images

Figure CN119128076B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of natural language processing, and in particular relates to a judicial case retrieval method and system based on course learning. Background Art
[0002] During civil, criminal, and administrative trials, judicial personnel must review a variety of materials, such as indictment documents, evidence materials, and prosecutorial documents, to understand case information. During this process, judicial personnel often rely on personal experience and search and analyze specific case types. This is not only inefficient but also susceptible to subjective judgment. Faced with a vast database of similar cases, technical personnel need a data retrieval tool that can quickly and accurately locate similar cases.
[0003] With the continuous advancement of technologies such as natural language processing and big data analysis, relevant technicians have developed some tools that can realize judicial case retrieval. This provides convenience for judicial personnel. For example, Chinese invention patent application publication number CN117493382A provides a large-scale model-based people's mediation case retrieval system and retrieval method. This method uses a preprocessing module to clean existing similar case data, remove low-quality data, extract similar case summary information using large-scale model technology, and establish a vector summary knowledge base and index library. The large-scale model is further used to process and analyze the similar case text entered by the user, extract summary information and generate a keyword list. Finally, combined with semantic similarity calculation of the vector summary knowledge base and keyword-based index library retrieval, similar cases are recalled, deduplicated, and sorted, and a list of similar cases is finally output. Although this solution can realize natural language recognition and content retrieval, it only considers the similarity between the keywords extracted from the similar case library and the keywords of the similar case entered by the user, and does not consider the semantic relevance between the entire text.
[0004] Therefore, how to provide a new technology to effectively process large-scale similar case data and identify the text semantic relevance of different judicial cases, thereby improving the accuracy of retrieval, has become a technical problem that technical personnel in this field urgently need to solve. Summary of the Invention
[0005] In order to solve the technical problems of low text semantic relevance and low retrieval accuracy in existing similar case retrieval technology, the present invention provides a judicial similar case retrieval method and system based on course learning.
[0006] The technical solutions provided by the present invention are as follows:
[0007] A judicial case retrieval method based on course learning is used to retrieve several candidate cases similar to the query case from a judicial database. The judicial case retrieval method includes the following steps:
[0008] S1: Obtain a judicial database containing a large number of judicial decision cases and extract five key elements of each judicial case in the judicial database; the key elements include case facts, court decisions, legal provisions, crimes and topics.
[0009] S2: The judicial database is converted into the corresponding graph G, with the key elements of each judicial case as nodes and the relationship between elements as edges. n . And for graph G n Each node in the is marked with the corresponding judicial case information.
[0010] S3: Use various judicial cases in the judicial database to perform basic training on a case matching model; the case matching model includes the BERT model and graph convolutional neural network.
[0011] In the case matching model, the BERT model is used to generate an initial graph feature vector for each judicial case. A graph convolutional neural network is used to output the final vector representation and adjacency matrix of the judicial case based on the input initial graph feature vector.
[0012] S4: Use the K-core algorithm to sort the graph G according to a smaller K value n The division is performed to obtain multiple first-level subgraphs, and multiple judicial case pairs that meet the rules and belong to different first-level subgraphs are used as primary course training case pairs, and the primary course case pairs are used to perform primary training of the case matching model based on course learning.
[0013] S5: Use the K-core algorithm to further divide each first-level subgraph in the previous step into second-level subgraphs according to a higher K value, and use multiple judicial case pairs that meet the rules and belong to different second-level subgraphs as advanced course training case pairs, and use the advanced course case pairs to perform advanced training on the case matching model based on course learning.
[0014] S6: Input the query case to be matched into the case matching model that has completed advanced training, and the recognition model generates an adjacency matrix of the query case; the cases included in the adjacency matrix are regarded as candidate cases similar to the query case.
[0015] S7: Calculate the similarity between the query case and each candidate case, sort the candidate cases in descending order of similarity, and use the result as the return value of the user's search result.
[0016] As a further improvement of the present invention, in step S1, each judicial case in the judicial database is first preprocessed to remove irrelevant information, and the case content is converted into a standardized text format, and then the five key elements in the judicial case are extracted through the ChatGLM model constructed based on the heuristic method.
[0017] As a further improvement of the present invention, in step S2, the five relationship edges of each judicial case are recorded as r1, r2, r3, r4, and r5. The converted graph G n Expressed as: G n =(V n , E n ), where V n is the set of key element nodes in each judicial case, E n is the set of edges between nodes.
[0018] As a further improvement of the present invention, in step S3, the primary training process of the case matching model is as follows:
[0019] S31: Initialize node vectors using the BERT model.
[0020] S32: The initial node vector in the graph Input to the graph convolutional neural network, use the graph convolutional neural network to encode the graph G n .
[0021] S33: Iteratively generate graph G n Vector representation of midpoints at each layer And get the final vector e i , the final node vector size is k.
[0022] S34: Determine the encoded graph G n Is there an edge r between any pair of nodes in i , and determine the existence of edge r i Type; then we get graph G n The adjacency matrix M of each node in .
[0023] S35: Use negative sampling and cross-entropy loss function to train graph convolutional neural networks so that the scores of observed node pairs are higher than negative samples.
[0024] As a further improvement of the present invention, the cross entropy loss function L1 used in step S3 is:
[0025]
[0026] In the above formula, ω is the number of negative samples; T represents the set of all positive and negative samples; f(·) represents the scoring function; y represents the indicator function, which is used to map the output of the scoring function to between 0 and 1 through the sigmoid logic function; when y = 1, it represents a positive sample, and y = 0, it represents a negative sample; h, γ, and t represent the head entity, relationship type, and tail entity in the semantics of any element, respectively.
[0027] As a further improvement of the present invention, the transfer function between layers in the graph convolutional neural network is:
[0028]
[0029] In the above formula, is the representation of node i at layer l; is the representation of node j at layer l; is the learnable weight matrix of relation r at layer l; is the initial weight matrix; σ(·) represents the nonlinear activation RELU function, represents the set of neighbor indices of node i under relation r; r∈R; d i,r represents the in-degree of node i in relation r.
[0030] As a further improvement of the present invention, in step S4 or S5, the process of advanced training based on course learning is as follows:
[0031] (1) According to the preset K value, the graph G n Divide into multiple first-level subgraphs or second-level subgraphs.
[0032] (2) According to any set of case pairs (C i , C j ) Generate the corresponding course learning case pair (C a , C b );
[0033] (C a , C b )=min{dist((C i , C j ), (C a , C b ))|F a,b =1-F i,j}
[0034] dist((C i , C j ), (C a , C b ))=||e i -e a||2-||e j -e b ||2-||e j -e b ||2
[0035] In the above formula, dist(·) represents the distance function, which is used to calculate the distance between two legal case pairs; min{·} represents the minimum function, which is used to return the minimum value in a set of values; F i,j represents an element in the processing matrix, where i and j represent the numbers of the legal case pair; e i Indicates judicial case C i The final vector of j Indicates judicial case C j The final vector of a Indicates judicial case C a The final vector of b Indicates judicial case C b The final vector of .
[0036] (3) According to each case (C i , C j ) generates the corresponding actual adjacency matrix M and processing matrix F; and according to the course learning case (C a , C b ) Generate the corresponding course learning adjacency matrix M c and the curriculum learning processing matrix F c .
[0037] (4) When no course learning case pair is found in step S2, the course learning adjacency matrix M is updated by the following formula c and the curriculum learning processing matrix F c :
[0038]
[0039] In the above formula, F a,b represents the elements in the course learning process matrix, which is used to represent the case pairs (C a , C b ) of the treated variables and the original case pairs (C i , C j ) are considered to have been processed; M a,b Indicates the case pair (C a , C b ) connection status between; F i,j represents an element in the processing matrix, which is used to represent the legal case pair (C i , C j ) whether it has accepted the designated treatment; Mi,j Indicates the case pair (C i , C j ) between the connection status; It represents an element in the course learning processing matrix, which is used to indicate the legal case pair (C a , C b ) whether it has received any specified treatment; Table 1 Case pair in the graph representation of legal case retrieval (C a , C b ) between the two devices.
[0040] (5) The generated M, F, M c and F c Input to the graph convolutional neural network for retraining and output the correlation prediction matrix Correlation prediction matrix The update equation is as follows:
[0041]
[0042] As a further improvement of the present invention, in the advanced training process of steps S4 and S5, the loss function L is used. F for:
[0043]
[0044] In the above formula, L P The loss function for training graph convolutional neural networks using actual cases in course learning; L C is the loss function of training graph convolutional neural network using course learning cases in course learning; α is L F Used to adjust L P and L C The fine-tuning coefficient of the weight; and It's M i,j and The prediction matrix.
[0045] As a further improvement of the present invention, in step S7, the calculation formula of the similarity Sim between the query case and any candidate case K value is as follows:
[0046]
[0047] In the above formula, Lcan(C i ,C j ) is used to calculate C i ,C j The nearest neighbor common ancestor node, e i and e jrepresent the information amount of query cases and candidate cases respectively.
[0048] The present invention also includes a curriculum-based judicial case retrieval system, comprising a memory, a processor, and a computer program stored in the memory. When the processor executes the computer program, it implements the steps of the curriculum-based judicial case retrieval method described above, thereby retrieving from the judicial database several candidate cases with similar circumstances to the query case.
[0049] The technical solution provided by the present invention has the following beneficial effects:
[0050] This paper uses the ChatGLM model to extract elements from a standard legal case set, thereby more accurately capturing the five key elements in the legal text, namely case facts, court decisions, legal provisions, crimes and themes. It also uses these five elements to convert the text data of judicial cases into graph structured data, making it easier for graph convolutional neural networks to understand and capture the semantic relationships and intrinsic connections between different cases.
[0051] The present invention uses the BERT model and graph convolutional neural network to construct the required case matching model, and introduces the K-core algorithm and curriculum learning strategy into the training of the case matching model. The case matching model is first trained as a whole using the graph feature vectors of judicial cases. Then, the K-core algorithm is used to divide the graph structure data of the judicial dataset, and the case matching model is subjected to curriculum learning-style enhanced training using curriculum learning cases on subgraphs of different scales. This enables the system to more accurately capture the connections between cases and improve the accuracy of similar case retrieval.
[0052] Compared with existing solutions, the solution of the present invention can accurately understand the semantics of text information in judicial cases and achieve more accurate retrieval of similar cases. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1 This is a flowchart of the steps of the judicial case retrieval method based on course learning provided in Example 1 of the present invention.
[0054] Figure 2 This is a functional principle diagram of the case matching model provided in Example 1 of the present invention.
[0055] Figure 3 This is a flowchart of the steps of the basic training process of the case matching model in Example 1 of the present invention.
[0056] Figure 4 This is a flowchart of the steps of the primary training process of the case matching model in Example 1 of the present invention. DETAILED DESCRIPTION
[0057] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0058] Example 1
[0059] This embodiment provides a judicial case retrieval method based on curriculum learning, which is used to retrieve several candidate cases similar to the query case from the judicial database. The main idea of this solution is: first, the standard legal case in the judicial database is heuristically extracted through the ChatGLM model to accurately capture the five key elements in the legal text, and the text data of the judicial case is converted into corresponding graph structure data according to the five key elements of each judicial case. Finally, the case matching model containing the BERT model and the graph convolutional neural network is trained for multiple rounds using the graph structure data, so that the network model can fully learn and understand the semantic relevance of each judicial case. The present invention also adopts a learning strategy based on curriculum learning when training the case matching model, and uses the K-CORE algorithm to divide the graph of judicial cases, and then enhances the graph convolutional neural network through multi-level curriculum learning, so that the case matching model can capture the connection between cases more finely and improve the accuracy of retrieval.
[0060] In detail, such as Figure 1 As shown, the judicial case retrieval method provided in this embodiment includes the following steps:
[0061] S1: Obtain a judicial database containing a large number of judicial decision cases, and extract the five key elements of each judicial case in the judicial database. The key elements include case facts, court decisions, legal provisions, crimes, and topics.
[0062] To fully understand the semantics of judicial cases, this embodiment divides the key information in a judicial case into five categories: case facts, court judgments, legal provisions, offenses, and themes. Case facts refer to the detailed records of the case during the trial process, including statements from the parties, witness testimony, and interviews with the parties. Documentary evidence, physical evidence, audio-visual materials, electronic data, and other materials clearly demonstrate the various actions taken during the case. Court judgments refer to the substantive judgments made by the People's Court on the actions of the parties based on the facts, laws, regulations, and reference to rules. Legal provisions refer to the relevant legal provisions cited by the court when adjudicating a case. The offense refers to the type of crime constituted by the actions of the parties, as determined by laws and regulations. The theme refers to the type of case to which the current judicial case belongs. For example, in practice, the themes of judicial cases can be categorized into civil litigation, administrative litigation, and criminal litigation, based on the laws involved. Furthermore, taking civil litigation as an example, the themes of judicial cases can be further categorized into contract disputes, tort disputes, marital and family disputes, and other topics based on the circumstances of the case.
[0063] In order to accurately extract the five key elements of a case, this embodiment first preprocesses each judicial case in the judicial database, removes irrelevant information, and converts the case content into a standardized text format. Then, the five key elements of the judicial case are extracted through the ChatGLM model constructed based on the heuristic method.
[0064] The ChatGLM model is a Transformer-based language model developed by the Google Machine Learning Research Team. Unlike GPT and BERT, the ChatGLM model learns from a large corpus of conversations during training, enabling it to better understand and generate human language. Tests on numerous public datasets have demonstrated that the ChatGLM model achieves state-of-the-art results in conversation generation and understanding tasks. This example utilizes the ChatGLM model to learn from each judicial case in the judicial database, and then outputs the refined five key elements.
[0065] S2: The judicial database is converted into the corresponding graph G, with the key elements of each judicial case as nodes and the relationship between elements as edges. n , and is the graph G n Each node in the is marked with the corresponding judicial case information.
[0066] The essence of similar cases is that they share or are similar in key elements. Therefore, this embodiment converts cases containing multiple key elements into graph-structured data. A trained graph convolutional neural network understands the case semantics and determines the degree of similarity between different cases based on the connectivity graph formed by each case in the judicial database.
[0067] Specifically, in this embodiment, the five relationship edges of each judicial case are recorded as r1, r2, r3, r4, and r5. The converted graph G n Expressed as: G n =(V n , E n ), where V n is the set of key element nodes in each judicial case, E n is the set of edges between nodes.
[0068] S3: Use various judicial cases in the judicial database to perform basic training on a case matching model; the case matching model includes the BERT model and graph convolutional neural network.
[0069] like Figure 2 As shown in the figure, in the case matching model, the BERT model is used to generate the initialization graph feature vector of each judicial case. The graph convolutional neural network is used to output the final vector representation and adjacency matrix of the judicial case based on the input initialization graph feature vector of the judicial case. In this embodiment, the transfer function between each layer in the graph convolutional neural network is:
[0070]
[0071] In the above formula, is the representation of node i at layer l; is the representation of node j at layer l; is the learnable weight matrix of relation r at layer l; is the initial weight matrix; σ(·) represents the nonlinear activation RELU function, represents the set of neighbor indices of node i under relation r; r∈R; d i,r represents the in-degree of node i in relation r.
[0072] In this embodiment, in order to enable the case matching model to accurately understand the semantic information of judicial cases and identify the relevance between different judicial cases, this embodiment performs basic training on the case matching model. Figure 3 As shown in Figure 2, the basic training process of the case matching model is as follows:
[0073] S31: Initialize node vectors using the BERT model.
[0074] S32: The initial node vector in the graph Input to the graph convolutional neural network, use the graph convolutional neural network to encode the graph G n .
[0075] S33: Iteratively generate graph G n Vector representation of midpoints at each layer And get the final vector e i , the final node vector size is k.
[0076] S34: Determine the encoded graph G n Is there an edge r between any pair of nodes in i , and determine the existence of edge r i Type; then we get graph G n The adjacency matrix M of each node in .
[0077] S35: Use negative sampling and cross entropy loss function to train the graph convolutional neural network so that the score of the observed node pairs is higher than the negative samples. The cross entropy loss function L1 used in this embodiment is:
[0078]
[0079] In the above formula, ω is the number of negative samples; T represents the set of all positive and negative samples; f(·) represents the scoring function; y represents the indicator function, which is used to map the output of the scoring function to between 0 and 1 through the sigmoid logic function; when y = 1, it represents a positive sample, and y = 0, it represents a negative sample; h, γ, and t represent the head entity, relationship type, and tail entity in the semantics of any element, respectively.
[0080] The expression of the score function f(·) is as follows:
[0081]
[0082] In the above formula, Represents the vector representation of the head entity; R r is the vector representation of the relationship type; e t A vector representation of the tail entity.
[0083] S4: Use the K-core algorithm to sort the graph G according to a smaller K value n The division is performed to obtain multiple first-level subgraphs. Any two judicial cases belonging to different first-level subgraphs are used as primary course learning case pairs, and the primary course learning case pairs are used to perform primary training of the case matching model based on course learning.
[0084] Specifically, the primary training process in this embodiment is as follows:
[0085] S41: According to the preset K value, the graph G n Specifically, the first-level subgraphs divided in this embodiment are recorded as m-core graphs, where m is the K value in the K-core algorithm.
[0086] S42: According to any set of case pairs (C i , C j ) Generate the corresponding course learning case pair (C a , C b );
[0087] (C a , C b )=min{dist((C i , C j ), (C a , C b ))|F a,b =1-F i,j}
[0088] dist((C i , C j ), (C a , C b ))=||e i -e a ||2-||e j -e b ||2-||e j -e b ||2
[0089] In the above formula, dist(·) represents the distance function, which is used to calculate the distance between two legal case pairs; min{·} represents the minimum function, which is used to return the minimum value in a set of values; e i Indicates judicial case C i The final vector of j Indicates judicial case C j The final vector of a Indicates judicial case C a The final vector of b Indicates judicial case C b The final vector of .
[0090] F x,y is defined as a treatment variable, when (C x ,C y ) In this case, when the same subgraph is used, F x,y =1. When (C x ,C y ) In this case, when the pairs are not in the same subgraph, F x,y =0. The above formula Fa,b =1-F i,j , that is, when the original case (C i , C j ) In the same subgraph, F i , j =1, then F a,b = 0, the corresponding course learning case pair (C a ,C b ) must be in different subgraphs. When the original case (C i , C j ) are not in the same subgraph, F i , j =0, then F a,b =1, that is, the course learning case is (C a ,C b ) must be in the same subgraph. Therefore, the above condition F a,b =1-F i,j , refers to: (C i , C j ) and (C a ,C b ) Two case pairs cannot appear in the same subgraph at the same time, which is called (C i , C j ) and (C a ,C b )These two cases must be handled differently.
[0091] Specifically, in this embodiment, the generation rule satisfies: C a =C i or C b =C j , and ||e i -e a ||2<β and ||e j -e b ||2<β; represents the preset distance threshold.
[0092] S43: According to each case (C i , C j ) generates the corresponding actual adjacency matrix M and processing matrix F; and according to the course learning case (C a , C b ) Generate the corresponding course learning adjacency matrix M c and the curriculum learning processing matrix F c .
[0093] The actual adjacency matrix M represents the connection relationship between legal cases in the graph, and represents the actual correlation between legal case pairs. i , C j) is marked as having a certain degree of correlation, then in the adjacency matrix M i, M j The positions are filled with the corresponding correlation scores, where 0 indicates no correlation, 1 indicates perfect correlation, and intermediate values indicate partial correlation.
[0094] Course learning adjacency matrix M c It also represents the connection relationship between legal cases in the graph, indicating the actual correlation between legal case pairs. i , C j ), find the corresponding course learning case pair (C a , C b ), so that (C i , C j ) and (C a , C b ) are different in the processing variable F, that is, after the k-core subgraph is divided, they do not belong to the same subgraph. i , C j ) similar method to estimate the course learning case pair (C a , C b ), which can be achieved by calculating the similarity of their node representation vectors, and filling the calculated course learning case pair correlation value into M c In the case study, the corresponding course is (C a , C b ) location.
[0095] The processing matrix F indicates whether a case pair belongs to the same subgraph. For each pair of legal cases (C i , C j ), check if they belong to the same subgraph, if so, then F i,j Set to 1; otherwise, set to 0, traverse all legal case pairs and fill the F matrix according to whether they belong to the same subgraph.
[0096] Course learning processing matrix F C It also indicates whether the case pair belongs to the same subgraph. For each pair of legal cases (C i , C j ), find the most similar course learning case pair (C a , C b ), is generated by learning case pair rules in the course. If the original case pair (C i , C j ) in F has a treatment status of 1, that is, they belong to the same treatment group, then the corresponding course learning case pair (C a , C b) should be 0, and vice versa, the calculated course learning case pair processing status is filled in F C In the matrix, corresponding to the course learning case pair (C a , C b ) location.
[0097] S44: When no course learning case pair is found in step S2, the course learning adjacency matrix M is updated by the following formula c and the curriculum learning processing matrix F c :
[0098]
[0099] In the above formula, F a,b Represents an element in the course learning processing matrix, namely F a,b =1-F i,j , that is (C i , C j ) and (C a ,C b ) Two case pairs cannot appear in the same subgraph at the same time, which is called (C i , C j ) and (C a ,C b ) These two cases must be handled differently; M a,b Indicates the connection state between case a and case b in the graph representation of legal case retrieval, F i,j It represents an element in the original treatment matrix, which is used to indicate whether the legal case pair (i, j) has received a certain treatment or condition; M i,j represents the connection state between case i and case j in the graph representation of legal case retrieval; Represents an element in the course learning treatment matrix, which is used to indicate whether the legal case pair (a, b) receives a specific treatment or condition; Represents the connection state between case a and case b in the graph representation of legal case retrieval.
[0100] S45: The generated M, F, M c and F c Input to the graph convolutional neural network for retraining and output the correlation prediction matrix Correlation prediction matrix The update equation is as follows:
[0101]
[0102] S5: Use the K-core algorithm to further divide each first-level subgraph into multiple second-level subgraphs according to a higher K value. Any two judicial cases belonging to different second-level subgraphs are used as advanced course learning case pairs, and the case matching model is trained based on advanced course learning using the advanced course learning case pairs.
[0103] Specifically, if Figure 4 As shown, the high-level training process in this embodiment is as follows:
[0104] S51: further dividing the first-level subgraph into multiple second-level subgraphs according to a preset K value. Specifically, the second-level subgraphs divided in this embodiment are recorded as n-core graphs, where n is the preset K value in this round of K-core algorithm, and n>m.
[0105] S52: According to any set of case pairs (C i , C j ) Generate the corresponding course learning case pair (C a , C b );
[0106] (C a , C b )=min{dist((C i , C j ), (C a , C b ))|F a,b =1-F i,j}
[0107] dist((C i , C j ), (C a , C b ))=||e i -e a ||2-||e j -e b ||2-||e j -e b ||2
[0108] In the above formula, dist(·) represents the distance function, which is used to calculate the distance between two legal case pairs; min{·} represents the minimum function, which is used to return the minimum value in a set of values; e i Indicates judicial case C i The final vector of j Indicates judicial case C j The final vector of a Indicates judicial case C a The final vector of b Indicates judicial case Cb The final vector of .
[0109] Specifically, in this embodiment, the generation rule satisfies: C a =C i or C b =C j , and ||e i -e a ||2<β and ||e j -e b ||2<β; represents the preset distance threshold.
[0110] S53: According to each case (C i , C j ) generates the corresponding actual adjacency matrix M and processing matrix F; and according to the course learning case (C a , C b ) Generate the corresponding course learning adjacency matrix M c and the curriculum learning processing matrix F c .
[0111] S54: When no course learning case pair is found in step S2, the course learning adjacency matrix M is updated by the following formula c and the curriculum learning processing matrix F c :
[0112]
[0113] In the above formula, F a,b represents an element in the course learning processing matrix, F a,b =1-F i,j , that is (C i , C j ) and (C a ,C b ) Two case pairs cannot appear in the same subgraph at the same time, which is called (C i , C j ) and (C a ,C b ) These two cases must be handled differently, M a,b Represents case pairs in the graph representation for legal case retrieval (C a , C b ) connection status, F i,j represents an element in the original processing matrix, which is used to indicate the legal case pair (C i , C j ) whether it has received certain treatment or conditions; i,j Represents case pairs in the graph representation for legal case retrieval (C i , Cj ) between the connection status; It represents an element in the course learning processing matrix, which is used to indicate the legal case pair (C a , C b ) whether they have received certain treatments or conditions; Represents case pairs in the graph representation for legal case retrieval (C a , C b ) between the two devices.
[0114] S55: The generated M, F, M c and F c Input to the graph convolutional neural network for retraining and output the correlation prediction matrix Correlation prediction matrix The update equation is as follows:
[0115]
[0116] In the advanced training process of steps S4 and S5, the loss function L used in this embodiment is F Both are:
[0117]
[0118] In the above formula, L P The loss function for training graph convolutional neural networks using actual cases in course learning; L C is the loss function of training graph convolutional neural network using course learning cases in course learning; α is L F Used to adjust L P and L C The fine-tuning coefficient of the weight; and It's M i,j and The prediction matrix.
[0119] S6: Input the query case to be matched into the case matching model that has completed advanced training, and the recognition model generates an adjacency matrix of the query case; and the cases included in the adjacency matrix are regarded as candidate cases similar to the query case.
[0120] S7: Calculate the similarity between the query case and each candidate case, sort the candidate cases in descending order of similarity, and use the result as the return value of the user's search result.
[0121] In this embodiment, the calculation formula of the similarity Sim between the query case and any candidate case K value is as follows:
[0122]
[0123] In the above formula, Lcan(C i ,C j ) is used to calculate C i ,C j The nearest neighbor common ancestor node, e i and e j represent the information amount of query cases and candidate cases respectively.
[0124] Example 2
[0125] Based on the solution in Example 1, this embodiment further provides a course-based judicial case retrieval system, comprising a memory, a processor, and a computer program stored in the memory. When the processor executes the computer program, it implements the steps of the course-based judicial case retrieval method in Example 1, thereby retrieving from the judicial database several candidate cases with similar circumstances to the query case.
[0126] The course-based judicial case retrieval system provided in this embodiment is essentially a computer device. The computer device provided in this embodiment can take various forms, such as a program-executing smart terminal, tablet computer, laptop computer, desktop computer, rack-mounted server, blade server, tower server, or cabinet-mounted server (including a standalone server or a server cluster consisting of multiple servers). The computer device in this embodiment includes at least, but is not limited to, a memory and a processor that can be interconnected via a system bus.
[0127] In this embodiment, the memory (i.e., readable storage medium) includes a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., an SD or DX memory), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory may be an internal storage unit of a computer device, such as a hard disk or memory of the computer device.
[0128] In other embodiments, the memory may also be an external storage device of the computer device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a flash memory card, etc., equipped with the computer device. Of course, the memory may also include both the internal storage unit of the computer device and its external storage device. In this embodiment, the memory is generally used to store the operating system and various application software installed on the computer device. In addition, the memory may also be used to temporarily store various types of data that have been output or are about to be output.
[0129] In some embodiments, the processor may be a central processing unit (CPU), a graphics processing unit (GPU), a controller, a microcontroller, a microprocessor, or other data processing chip. The processor is generally used to control the overall operation of the computer device. In this embodiment, the processor is used to run program code stored in the memory or process data.
[0130] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention shall be included within the scope of protection of the present invention. For example, the order of the various steps in the scheme described in the above embodiment is only one way to implement the scheme. The scheme of the present invention can also be implemented by using the same steps in a different order, and such modified embodiments still fall within the scope of protection of the present invention.
Claims
1. A judicial case retrieval method based on course learning, characterized by: It is used to retrieve several candidate cases similar to the query case from the judicial database. The judicial case retrieval method includes the following steps: S1: obtaining a judicial database containing a large number of judicial decision cases, and extracting five key elements of each judicial case in the judicial database, wherein the key elements include case facts, court decisions, legal provisions, crimes, and themes; S2: The judicial database is converted into the corresponding graph G, with the key elements of each judicial case as nodes and the relationships between elements as edges. n , and is the graph G n Each node in the is marked with corresponding judicial case information; S3: Performing basic training on a case matching model using each judicial case in the judicial database; the case matching model includes a BERT model and a graph convolutional neural network; In the case matching model, the BERT model is used to generate an initialization graph feature vector for each judicial case; the graph convolutional neural network is used to output the final vector representation and adjacency matrix of the judicial case based on the input initialization graph feature vector of the judicial case; S4: Use the K-core algorithm to sort the graph G according to a smaller K value n Dividing the graphs into multiple first-level subgraphs, using multiple judicial case pairs that meet the rules and belong to different first-level subgraphs as primary course training case pairs, and using the primary course case pairs to perform primary training on the case matching model based on course learning; S5: Using the K-core algorithm to further divide each first-level subgraph into second-level subgraphs according to a higher K value, multiple judicial case pairs that meet the rules and belong to different second-level subgraphs are used as advanced course training case pairs, and the case matching model is trained based on course learning using the advanced course case pairs; S6: Inputting the query case to be matched into the case matching model that has completed advanced training, and generating an adjacency matrix of the query case by the recognition model; taking the cases included in the adjacency matrix as candidate cases similar to the query case; S7: Calculate the similarity between the query case and each candidate case, sort the candidate cases in descending order of similarity, and use the result as the return value of the user search result.
2. The judicial case retrieval method based on course learning according to claim 1 is characterized by: In step S1, each judicial case in the judicial database is preprocessed to remove irrelevant information and convert the case content into a standardized text format. Then, the five key elements of the judicial case are extracted through the ChatGLM model constructed based on the heuristic method.
3. The judicial case retrieval method based on course learning according to claim 2 is characterized by: In step S2, the five relationship edges of each judicial case are recorded as r1, r2, r3, r4, and r5. The converted graph G n Expressed as: G n =(V n , E n ), where V n is the set of key element nodes in each judicial case, E n is the set of edges between nodes.
4. The judicial case retrieval method based on course learning according to claim 1 is characterized in that: In step S3, the primary training process of the case matching model is as follows: S31: Initialize node vector using BERT model; S32: The initial node vector in the graph Input to the graph convolutional neural network, use the graph convolutional neural network to encode the graph G n ; S33: Iteratively generate graph G n Vector representation of midpoints at each layer And get the final vector e i , the final node vector size is k; S34: Determine the encoded graph G n Is there an edge r between any pair of nodes in i , and determine the existence of edge r i Type, and then get graph G n The adjacency matrix M of each node in; S35: Use negative sampling and cross-entropy loss function to train graph convolutional neural networks so that the scores of observed node pairs are higher than negative samples.
5. The judicial case retrieval method based on course learning according to claim 4 is characterized in that: The cross entropy loss function L1 used in step S3 is: In the above formula, ω is the number of negative samples; T represents the set of all positive and negative samples; f(·) represents the scoring function; y represents the indicator function, which is used to map the output of the scoring function to between 0 and 1 through the sigmoid logic function; when y = 1, it represents a positive sample, and y = 0, it represents a negative sample; h, γ, and t represent the head entity, relationship type, and tail entity in the semantics of any element, respectively.
6. The judicial case retrieval method based on course learning according to claim 4 is characterized by: The transfer function between layers in the graph convolutional neural network is: In the above formula, is the representation of node i at layer l; is the representation of node j at layer l; is the learnable weight matrix of relation r at layer l; is the initial weight matrix; σ(·) represents the nonlinear activation RELU function, represents the set of neighbor indices of node i under relation r; r∈R; d i,r represents the in-degree of node i in relation r.
7. The judicial case retrieval method based on course learning according to claim 1 is characterized in that: In step S4 or S5, the process of advanced training based on curriculum learning is as follows: (1) According to the preset K value, the graph G n Divide into multiple first-level subgraphs or second-level subgraphs; (2) According to any set of case pairs (C i , C j ) Generate the corresponding course learning case pair (C a , C b ); (C a ,C b )=min{dist((C i ,C j ),(C a ,C b ))|F a,b =1-F i,j } dist((C i ,C j ),(C a ,C b ))=||e i -e a ||2-|||e j -e b ||2-||e j -e b ||2 In the above formula, dist(·) represents the distance function, which is used to calculate the distance between two legal case pairs; min{·} represents the minimum function, which is used to return the minimum value in a set of values; F i,j Represents the elements in the processing matrix; F a,b represents the elements in the course learning processing matrix; e i Indicates judicial case C i The final vector of j Indicates judicial case C j The final vector of a Indicates judicial case C a The final vector of b Indicates judicial case C b The final vector of (3) According to each case (C i , C j ) Generate the corresponding actual adjacency matrix M and processing matrix F; and generate the corresponding course learning adjacency matrix M according to the course learning case c and the curriculum learning processing matrix F c ; (4) When no course learning case pair is found in step S2, the course learning adjacency matrix M is updated by the following formula c and the curriculum learning processing matrix F c : In the above formula, F a,b represents the elements in the course learning process matrix, which is used to represent the case pairs (C a , C b ) of the treated variables and the original case pairs (C i , C j ) are considered to have been processed; M a,b Indicates the case pair (C a , C a ) connection status between; F i,j represents an element in the processing matrix, which is used to represent the legal case pair (C i , C j ) whether it has accepted the designated treatment; M i,j Indicates the case pair (C i , C j ) between the connection status; It represents an element in the course learning processing matrix, which is used to indicate the legal case pair (C a , C b ) whether it has received any specified treatment; Table 1 Case pair in the graph representation of legal case retrieval (C a , C b ) between the connection status; (5) The generated M, F, M c and F c Input to the graph convolutional neural network for retraining and output the correlation prediction matrix Correlation prediction matrix The update equation is as follows:
8. The judicial case retrieval method based on course learning according to claim 7 is characterized by: During the advanced training process of steps S4 and S5, the loss function L is used. F for: In the above formula, L P The loss function for training graph convolutional neural networks using actual cases in course learning; L C is the loss function for training graph convolutional neural networks using course learning cases in course learning; α is L F Used to adjust L P and L C The fine-tuning coefficient of the weight; and It's M i,j and The prediction matrix.
9. The judicial case retrieval method based on course learning according to claim 7 is characterized in that: In step S7, the similarity Sim between the query case and any candidate case K value is calculated as follows: In the above formula, Lcan(C i ,C j ) is used to calculate C i ,C j The nearest neighbor common ancestor node, e i and e j represent the information amount of query cases and candidate cases respectively.
10. A judicial case retrieval system based on course learning, comprising a memory, a processor, and a computer program stored in the memory, characterized in that: When the processor executes the computer program, it implements the steps of the judicial case retrieval method based on course learning as described in any one of claims 1 to 9, and then retrieves several candidate cases similar to the query case from the judicial database.
Citation Information
Patent Citations
Large model-based people mediation case retrieval system and retrieval method thereof
CN117493382A
Reverse optimal transportation model-based interpretable judicial case matching method and system
CN114818648A
BERT-based two-stage sorting class case retrieval method
CN117076659A