Course learning-based judicial case retrieval method and system
By constructing a case matching model of graph structure data and multi-level course learning training, the problem of insufficient semantic correlation in judicial case search in the existing technology is solved, and the accuracy and accuracy of the search is improved.
Patent Information
- Application Number
- CN202411135988.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-19
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2044-08-19
Smart Images

Figure CN119128076A_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 the trial of civil, criminal and administrative cases, judicial staff need to consult a variety of materials, such as prosecution documents, evidence materials, and prosecutorial documents, to understand case information. In this process, judicial staff often rely on personal experience and search and analyze specific types of cases, which is not only inefficient but also easily affected by personal subjective judgment. Faced with a huge number of similar case libraries, technicians need a data retrieval tool that can quickly and accurately locate similar cases to the current situation.
[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 staff. For example, China Invention Patent Application Publication No. CN117493382A provides a people's mediation case retrieval system based on a large model and a retrieval method thereof. The method uses a preprocessing module to clean the existing case data, remove low-quality data, extract the summary information of the case using the large model technology, and establish a vector summary knowledge base and index library. The large model is further used to process and analyze the case text input by the user, extract the summary information and generate a keyword list. Finally, the semantic similarity calculation of the vector summary knowledge base and the keyword-based index library retrieval are combined to recall, remove duplicates and sort the case, and finally output the case list. Although this scheme can realize natural language recognition and content retrieval, it only considers the similarity between the keywords extracted from the case library and the keywords of the case input by the user, and does not consider the semantic relevance between the overall text.
[0004] Therefore, how to provide a new technology to effectively process large-scale similar case data and identify the text semantic correlation of different judicial cases, so as to improve 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 the existing similar case retrieval technology, the present invention provides a judicial similar case retrieval method and system based on course learning.
[0006] The technical solution provided by the present invention is 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 themes.
[0009] S2: The judicial database is converted into the corresponding graph G, with the key elements of each judicial case as nodes and the associations 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 each judicial case in the judicial database to perform basic training on a case matching model; the case matching model includes the BERT model and the graph convolutional neural network.
[0011] 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.
[0012] S4: Use the K-core algorithm to sort 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. The primary course case pairs are used to perform primary training on 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 in 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; and use the cases included in the adjacency matrix 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 them 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 vector using 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 The type of graph G n The adjacency matrix M of each node in .
[0023] S35: Train graph convolutional neural networks using negative sampling and cross-entropy loss functions so that the scores of observed node pairs are higher than negative samples.
[0024] As a further improvement of the present invention, the loss function L1 of the cross entropy loss adopted in step S3 is:
[0025]
[0026] In the above formula, ω is the number of negative samples; T represents the set of all positive samples and negative samples, f(·) represents the score function; y represents the indicator function, which is used to map the output of the score function to between 0 and 1 through the sigmoid logic function; when y=1, it represents a positive sample, and y=0 represents a negative sample; h, γ, 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 indexes 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 sub-graphs or second-level sub-graphs.
[0032] (2) According to any set of case pairs (C i , C j ) Generate the corresponding course learning case pair according to the following formula (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 processing matrix, which is used to characterize 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 treated; M a,b In the graph representation of legal case retrieval, case pairs (C a , C b ) connection status between; F i,j represents an element in the processing matrix, which is used to characterize the legal case pair (C i , C j ) whether the designated treatment has been accepted;i,j In the graph representation of legal case retrieval, case pairs (C i , C j ) between the two devices; 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 certain designated 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 used is 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 is 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 common ancestor node of i and e jRepresent the information amount of query case and candidate case respectively.
[0048] The present invention also includes a judicial case retrieval system based on course learning, which includes a memory, a processor, and a computer program stored in the memory. When the processor executes the computer program, the steps of the judicial case retrieval method based on course learning are implemented as described above, and then several candidate cases similar to the query case are retrieved from the judicial database.
[0049] The technical solution provided by the present invention has the following beneficial effects:
[0050] The present invention uses the ChatGLM model to extract elements from the standard legal case set, thereby more accurately capturing the five key elements of case facts, court decisions, legal provisions, crimes and themes in the legal text, and uses the five elements to convert the text data of judicial cases into graph structured data, which makes it easier for the graph convolutional neural network to understand and capture the semantic relationships and internal connections between different cases.
[0051] The present invention utilizes 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 the judicial case. Then the K-core algorithm is used to divide the graph structure data of the judicial data set, and the case matching model is trained in a curriculum learning manner 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 schematic 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 solution and advantages of the present invention more clearly understood, the present invention is 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 used 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 scheme 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 including 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 the judicial case, and then enhances the graph convolutional neural network through multi-level curriculum learning, so that the case matching model can more finely capture the connection between cases and improve the accuracy of retrieval.
[0060] In detail, 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 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] In order to fully understand the semantics of judicial cases, the scheme of this embodiment divides the key information in a judicial case into five categories, namely, case facts, court judgments, legal provisions, crimes and themes. Among them, the case facts are the detailed case process recorded in the judicial case during the trial process, which records the statements of the parties, the testimony of witnesses, and the visits and investigations of the parties; documentary evidence, physical evidence, audio-visual materials, electronic data and other materials can clearly show the various behaviors implemented by each behavior during the case process. The court judgment refers to the substantive judgment made by the people's court on the behavior of the parties based on facts, laws, regulations, and regulations. Legal provisions refer to the provisions of the relevant laws cited by the law when judging the case. Crimes refer to the types of crimes constituted by the behavior of the parties identified in laws and regulations. The theme refers to the type of the current judicial case. For example, in actual applications, the themes of judicial cases can be divided into civil litigation, administrative litigation, and criminal litigation according to the laws involved. Further, taking civil litigation as an example, the themes of judicial cases can be further divided into contract disputes, tort disputes, marriage and family disputes and other themes according to the case.
[0063] In order to achieve accurate extraction of the five key elements of a case, this embodiment first pre-processes each judicial case in the judicial database, removes irrelevant information, and converts the case content into a standardized text format, and then extracts the five key elements of the judicial case through the ChatGLM model constructed based on the heuristic method.
[0064] The ChatGLM model is a language model based on the Transformer structure developed by the Google Machine Research Team. Unlike GPT and BERT, the ChatGLM model learns a large number of dialogue corpora during training, which enables it to better understand and generate human language. Tests on many public datasets have shown that the ChatGLM model has achieved state-of-the-art results in dialogue generation and understanding tasks. This embodiment uses the ChatGLM model to learn each judicial case in the judicial database, and then the ChatGLM model 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 associations between elements as edges. n , and for graph G n Each node in the is marked with the corresponding judicial case information.
[0066] The essence of the similar cases under consideration refers to the cases in which the key elements are the same or similar. Therefore, this embodiment converts the cases containing multiple key elements into graph-structured data, uses a trained graph convolutional neural network to understand the case semantic information, and judges the 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 each judicial case in the judicial database to perform basic training on a case matching model; the case matching model includes the BERT model and the graph convolutional neural network.
[0069] like Figure 2 As shown, 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 indexes 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 the figure, the basic training process of the case matching model is as follows:
[0073] S31: Initialize node vector using 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 The type of 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 observable node pairs is higher than that of 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 samples and negative samples, f(·) represents the score function; y represents the indicator function, which is used to map the output of the score function to between 0 and 1 through the sigmoid logic function; when y=1, it represents a positive sample, and y=0 represents a negative sample; h, γ, 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 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 on 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 Divide into multiple first-level subgraphs. Specifically, the first-level subgraph divided in this embodiment is recorded as an m-core graph, 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 according to the following formula (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 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, called (C i , C j ) and (C a ,C b )These two cases must be treated 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, indicating 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 relevance scores, where 0 indicates no relevance, 1 indicates complete relevance, and intermediate values indicate partial relevance.
[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 ) is similar to the method used 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, corresponding to the course learning case pair (C a , C b )’s location.
[0095] The processing matrix F indicates whether a case pair belongs to the same subgraph. For each legal case pair (C i , C j ), check if they belong to the same subgraph, if so, then 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 generation 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 )’s 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, 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 certain 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 in the previous step into multiple second-level subgraphs according to a higher K value. Take any two judicial cases belonging to different second-level subgraphs as advanced course learning case pairs, and use the advanced course learning case pairs to perform advanced training on the case matching model based on course learning.
[0103] Specifically, Figure 4 As shown, the high-level training process in this embodiment is as follows:
[0104] S51: further divide the primary subgraph into multiple secondary subgraphs according to the preset K value. Specifically, the secondary 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 according to the following formula (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, called (C i , C j ) and (C a ,C b ) These two cases must be handled differently, M a,b Represents a case pair in the graph representation of 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 a certain treatment or condition; i,j Represents a case pair in the graph representation of legal case retrieval (C i , Cj ) between the two devices; 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 a case pair in the graph representation of 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 is 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 used 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 them 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 common ancestor node of i and e j Represent the information amount of query case and candidate case respectively.
[0124] Example 2
[0125] Based on the solution in Example 1, this embodiment further provides a judicial case retrieval system based on course learning, which includes a memory, a processor, and a computer program stored in the memory. When the processor executes the computer program, the steps of the judicial case retrieval method based on course learning in Example 1 are implemented, and then several candidate cases similar to the query case are retrieved from the judicial database.
[0126] The judicial case retrieval system based on course learning provided in this embodiment is essentially a computer device. The computer device provided in this embodiment can take various forms, such as a smart terminal that can execute a program, a tablet computer, a laptop computer, a desktop computer, a rack server, a blade server, a tower server or a cabinet server (including an independent server, or a server cluster composed of multiple servers), etc. The computer device of this embodiment includes at least but is not limited to: a memory and a processor that can communicate with each other through a system bus.
[0127] In this embodiment, the memory (i.e., readable storage medium) includes flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, 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 card, etc., equipped on 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 data that have been output or are to be output.
[0129] The processor may be a central processing unit (CPU), a graphics processing unit (GPU), a controller, a microcontroller, a microprocessor, or other data processing chips in some embodiments. The processor is generally used to control the overall operation of a computer device. In this embodiment, the processor is used to run program codes stored in a memory or process data.
[0130] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modification, equivalent replacement and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention. For example, the sequence of each step in the scheme introduced in the above embodiment is only one way to implement the scheme. The scheme of the present invention can also be implemented by adopting the same actions in different sequences. Such modified embodiments still belong to the protection scope of the present invention.
Claims
1. A judicial case retrieval method based on course learning, characterized in that: 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 associations between elements as edges. n , and for graph G n Each node in the is marked with corresponding judicial case information; S3: using each judicial case in the judicial database to perform basic training on a case matching model; 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 a final vector representation and an adjacency matrix of the judicial case according to the input initialization graph feature vector of the judicial case; S4: Use the K-core algorithm to sort graph G according to a smaller K value n Dividing the graph 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 in the previous step into second-level subgraphs according to a higher K value, using multiple judicial case pairs that meet the rules and belong to different second-level subgraphs as advanced course training case pairs, and using the advanced course case pairs to perform advanced training on the case matching model based on course learning; 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 them as the return value of the user's search result.
2. The judicial case retrieval method based on course learning as claimed in claim 1 is characterized by: In step S1, each judicial case in the judicial database is first preprocessed to remove irrelevant information and convert the case content into a standardized text format, and 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 as claimed in 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 as claimed in 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 The type of graph G n The adjacency matrix M of each node in; S35: Train graph convolutional neural networks using negative sampling and cross-entropy loss functions so that the scores of observed node pairs are higher than negative samples.
5. The judicial case retrieval method based on course learning as claimed in claim 4 is characterized by: The loss function L1 of the cross entropy loss used in step S3 is: In the above formula, ω is the number of negative samples; T represents the set of all positive samples and negative samples, f(·) represents the score function; y represents the indicator function, which is used to map the output of the score function to between 0 and 1 through the sigmoid logic function; when y=1, it represents a positive sample, and y=0 represents a negative sample; h, γ, 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 as claimed in claim 4 is characterized by: The transfer function between the 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 indexes 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 as claimed in claim 1 is characterized by: 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 according to the following formula (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 processing matrix, which is used to characterize 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 treated; M a,b In the graph representation of legal case retrieval, case pairs (C a , C a ) connection status between; F i,j represents an element in the processing matrix, which is used to characterize the legal case pair (C i , C j ) whether the designated treatment has been accepted; i,j In the graph representation of legal case retrieval, case pairs (C i , C j ) between the two devices; 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 certain designated treatment; Table 1 Case pair in the graph representation of legal case retrieval (C a , C b ) between the two devices; (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 as claimed in claim 7 is characterized by: In the high-level 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 of training graph convolutional neural network with 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 is M i,j and The prediction matrix.
9. The judicial case retrieval method based on course learning as claimed in claim 7 is characterized by: In step S7, the calculation formula of the similarity Sim between the query case and any candidate case K value is as follows: In the above formula, Lcan(C i ,C j ) is used to calculate C i ,C j The nearest common ancestor node of i and e j Represent the information amount of query case and candidate case 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 curriculum 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
Reverse optimal transportation model-based interpretable judicial case matching method and system
CN114818648A
BERT-based two-stage sorting class case retrieval method
CN117076659A
Knowledge graph-based case retrieval method, device and equipment, and storage medium
US20220121695A1
Cited By
Determination method of legal event and training method of legal event detection model
CN119398055A
