Class case retrieval data augmentation method and device

Through the large language model, the entity name anonymization processing of key facts and part-of-speech annotation tool is extracted, and combined with auxiliary information to match similar cases, a training data set for case search is constructed, which solves the problems of asymmetric search and data sparseness of case search, and improves performance And reduce the labeling cost.

CN119046402AActive Publication Date: 2024-11-29TSINGHUA UNIVERSITY

Patent Information

Application Number
CN202410880454.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-02
Publication Date
2024-11-29
Estimated Expiration
2044-07-02

AI Technical Summary

Technical Problem

Similar case search faces the problems of asymmetric search and sparse data. The existing methods do not adapt to user query habits and have high labeling costs, resulting in suboptimal performance.

Method used

Key facts are extracted through large language models, and entity names are anonymously processed using part-of-speech annotation tool. Combined with auxiliary information, match similar cases from the sample case library, build a similar case search training data set, and use deep neural network training model to achieve data increase Broad He model training.

Benefits of technology

It realizes the construction of case search data that adapts to user query habits, reduces labeling costs, improves performance, and the generated data set is large-scale and close to real-world scenarios, supporting the training of dense vector search models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119046402A_ABST
    Figure CN119046402A_ABST
Patent Text Reader

Abstract

The invention provides a category case retrieval data augmentation method and device, and the method comprises the steps: carrying out the key fact extraction of to-be-processed fact data based on a large language model, and obtaining a case description; performing entity name anonymization processing on the case description by utilizing a part-of-speech tagging tool to obtain query data, and forming a query-candidate pair according to the query data and the to-be-processed fact data; extracting auxiliary information in sample cases in a pre-constructed sample case library, and for the query-candidate pair, matching the sample cases with the to-be-processed fact data according to the auxiliary information to obtain similar cases; and taking the similar cases as keys and the query data as queries to obtain class case retrieval training data. According to the method, the to-be-processed fact data is summarized by means of a part-of-speech tagging tool, the tagging cost is low, and meanwhile, knowledge-driven data augmentation is carried out by utilizing auxiliary information, so that the method is closer to a daily use scene of a common user.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of similar case retrieval, and in particular to a method and device for augmenting similar case retrieval data. Background Art

[0002] Legal case retrieval aims to search for similar cases in history based on a given factual description. This task can help legal professionals, such as judges and lawyers, improve their work efficiency by providing past cases as references for current judgments. Therefore, it plays a key role in promoting judicial fairness and prompting similar cases to receive similar judgments.

[0003] Unlike open-domain search, similar case search requires a complex understanding of case details and a model equipped with legal knowledge to generate knowledge-rich case representations. Figure 1 As shown in Figure 2, in this example, the model needs to recognize that the severity of the injury is more important than the location of the injury when evaluating the key factor of the relevance of a given candidate to the query. In recent years, scholars have made significant efforts to improve the performance of similar case retrieval, including introducing additional knowledge features and designing pre-training objectives for similar case retrieval.

[0004] However, despite these advances, the application of similar case retrieval still faces two major challenges: asymmetric retrieval and data sparsity. On the one hand, existing methods mainly focus on symmetric retrieval settings, where both queries and candidates have lengthy factual descriptions. However, in the real world, user queries usually only contain a few sentences describing key details. This inconsistency between application scenarios and training scenarios can easily lead to suboptimal performance. On the other hand, since legal data annotation often requires professional and experienced annotators, the annotation process is time-consuming and labor-intensive, resulting in limited data scale, which further leads to suboptimal performance.

[0005] In summary, the similar case retrieval data in the prior art has the problems of not adapting to user query habits and having high annotation costs. Summary of the invention

[0006] The present invention provides a method and device for augmenting similar case retrieval data, which are used to solve the defects of the prior art that the data are not adapted to user query habits and have high annotation costs, and realize the construction of similar case retrieval data that is adapted to user query habits and has low annotation costs, thereby improving performance.

[0007] The present invention provides a method for augmenting similar case retrieval data, comprising the following steps: Based on the large language model, key facts are extracted from the factual data to be processed to obtain the case description; Anonymize the entity names of the case description using a part-of-speech tagging tool to obtain query data, and form a query-candidate pair based on the query data and the fact data to be processed; Extract auxiliary information from sample cases in a pre-built sample case database, and for the query-candidate pair, match the sample case with the to-be-processed factual data according to the auxiliary information to obtain similar cases; wherein the auxiliary information includes the applicable laws and judgments of the case; The similar cases are used as keys and the query data is used as queries to obtain similar case retrieval training data.

[0008] According to a similar case retrieval data augmentation method provided by the present invention, the similar case is used as a key and the query data is used as a query to obtain similar case retrieval training data, and then the method further includes: Using a large amount of similar case retrieval training data to build a similar case retrieval training data set; The case retrieval model is trained based on the deep neural network using the similar case retrieval training data set.

[0009] According to a similar case retrieval data augmentation method provided by the present invention, for the query-candidate pair, the sample case and the to-be-processed fact data are matched according to the auxiliary information to obtain similar cases, specifically including: Select sample cases whose main legal provisions applicable to the case match the factual data to be processed, and whose auxiliary legal provisions applicable to the case and judgment results are similar to the factual data to be processed as similar cases to the factual data to be processed in the query-candidate pair.

[0010] According to a similar case retrieval data augmentation method provided by the present invention, the method of training a case retrieval model based on a deep neural network using the similar case retrieval training data set specifically includes: Use the pre-trained language model as a base model; Encoding the similar case retrieval training data based on the base model to obtain a vector representation of the similar case retrieval training data; Calculate the similarity score of each pair of the similar case retrieval training data according to the vector representation, and set the cosine similarity between the negative example samples having the same auxiliary information as the query to negative infinity; wherein the negative example samples are positive example samples of other queries in the same batch as the query, and the positive example samples are the keys corresponding to the query; The model is trained until the preset end condition is reached to obtain a case retrieval model.

[0011] According to a similar case retrieval data augmentation method provided by the present invention, the entity name of the case description is anonymized by using a part-of-speech tagging tool to obtain query data, specifically including: Using a part-of-speech tagging tool to perform part-of-speech tagging on the case description to obtain a part-of-speech tagging result; The entity names of the preset categories in the part-of-speech tagging results are searched, and the entity names are replaced with equivalent anonymous contents to obtain query data.

[0012] According to a similar case retrieval data augmentation method provided by the present invention, the key facts are extracted from the fact data to be processed based on the large language model to obtain the case description, which specifically includes: Inputting the to-be-processed fact data into the large language model; The pre-set task description and examples are used to guide the large language model to generate content that only retains key facts from the fact data to be processed, so as to obtain a case description.

[0013] The present invention also provides a similar case retrieval data augmentation device, comprising the following modules: A compression unit, which is used to extract key facts from the fact data to be processed based on a large language model to obtain a case description; An anonymous unit, used for performing entity name anonymization processing on the case description by using a part-of-speech tagging tool to obtain query data, and forming a query-candidate pair according to the query data and the fact data to be processed; A matching unit, configured to extract auxiliary information from a sample case in a pre-constructed sample case database, and for the query-candidate pair, match the sample case with the to-be-processed fact data according to the auxiliary information to obtain similar cases; wherein the auxiliary information includes the applicable legal provisions and judgment results of the case; A construction unit is used to use the similar cases as keys and the query data as queries to obtain similar case retrieval training data.

[0014] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method for augmenting similar case retrieval data as described above is implemented.

[0015] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the above-described similar case retrieval data augmentation methods.

[0016] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements any of the above-mentioned similar case retrieval data augmentation methods.

[0017] The method and device for augmenting data for similar case retrieval provided by the present invention extract key facts from the fact data to be processed based on a large language model to obtain a case description; use a part-of-speech tagging tool to anonymize the entity name of the case description to obtain query data, and form a query-candidate pair based on the query data and the fact data to be processed; extract auxiliary information from the sample case in the pre-constructed sample case library, and for the query-candidate pair, match the sample case with the fact data to be processed according to the auxiliary information to obtain a similar case; wherein the auxiliary information includes the applicable laws and judgment results of the case; use the similar case as a key and the query data as a query to obtain similar case retrieval training data. The present invention summarizes the fact data to be processed with the help of a part-of-speech tagging tool, has low tagging cost, does not require manual participation, and is convenient and fast to expand. At the same time, auxiliary information is used for knowledge-driven data augmentation, and the obtained similar cases are used as keys, thereby realizing similar case retrieval training data with asymmetric data query and key, which is closer to the daily use scenarios of ordinary users and further improves performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0019] Figure 1 This is one of the flow charts of the similar case retrieval data augmentation method provided by the present invention.

[0020] Figure 2 This is the second flow chart of the similar case retrieval data augmentation method provided by the present invention.

[0021] Figure 3 It is a structural schematic diagram of the similar case retrieval data augmentation device provided by the present invention.

[0022] Figure 4 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0023] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0024] Combine the following Figure 1-Figure 2 Describe the similar case retrieval data augmentation method of the present invention, Figure 1 is one of the flow charts of the method for augmenting similar case retrieval data provided by the present invention, such as Figure 1 As shown, the method includes steps 110 to 140.

[0025] Step 110: Extract key facts from the fact data to be processed based on the large language model to obtain a case description.

[0026] It should be noted that the similar case retrieval mentioned in the present invention particularly includes legal case retrieval. For the convenience of explanation, the embodiment of the present invention is explained by taking legal case retrieval as an example, but this does not represent a limitation to the present invention.

[0027] On this basis, the factual data to be processed are the legal cases / legal facts collected for generating similar case search data. It should be noted that the factual data to be processed can be collected from the China Judgment Documents Network, or can be legal cases / legal facts collected from other channels, and the present invention does not limit this.

[0028] It should be pointed out that, in general, case documents related to the factual data to be processed are written manually by judges, so these documents contain many details, such as the name of each case participant, the relationship between them, and the court's detailed discussion of each event. Most of these details are lengthy and not very helpful for retrieval. Furthermore, considering the user's unfamiliarity with legal knowledge, in the actual retrieval process, the query entered by the user usually only includes key factual events. In order to obtain short queries like real-world user queries, key information is extracted from the collected legal case facts.

[0029] Based on this, in step 110 , the fact data to be processed is processed, and key facts are extracted using a large-scale generative language model to obtain a case description including only key facts.

[0030] It should be emphasized that in this embodiment, the key facts include the legal key elements necessary for locating and retrieving data, and the embodiment of the present invention does not limit its actual specific content. On this basis, the role of the large language model is to summarize the factual data to be processed on the basis of retaining the legal key elements, and obtain a concise case description that includes the legal key elements, thereby realizing efficient, automated and large-scale processing of the factual data to be processed.

[0031] In addition, the present invention does not limit the selected large language model. In a specific embodiment, the large language model selects GPT-4.

[0032] Step 120: Use a part-of-speech tagging tool to anonymize the entity name of the case description to obtain query data, and form a query-candidate pair based on the query data and the fact data to be processed.

[0033] The case description generated using step 110 still contains a large number of entity names, such as names of people, places, dates, etc. These entities are usually irrelevant to key events and will not affect the final judgment of the case.

[0034] In addition, similar case retrieval training data containing entity names may mislead the model. Specifically, the same entity names between the query and the candidate cases may provide a shortcut for model reasoning, causing the model trained on this data to be more inclined to search for candidate cases with the same entity names and ignore key legal events.

[0035] Based on this, the embodiment of the present invention provides a strategy for anonymizing these entities, using a part-of-speech tagging tool to identify the entity name and anonymize it to obtain query data. Through key fact extraction and anonymization, a relevant query can be generated for each fact data to be processed.

[0036] It should be noted that in order to ensure the consistency of the query data, the anonymized query data can be optimized using a large language model. Alternatively, the key fact extraction in step 110 and the anonymization in step 120 are performed simultaneously based on the large model, and then, based on the anonymous key facts, the large language model is required to generate a brief and coherent description of the case, which is the query data and is regarded as the search query in the retrieval pair in the dataset.

[0037] Furthermore, the fact data to be processed is used as a candidate case, and the query data is used as a query to form a query-candidate pair. The obtained query-candidate pair can be used as training data for a similar case retrieval model. Through this method, a large-scale query-candidate pair containing the same key facts can be constructed. However, in practical applications, it is usually impossible to find a case that is exactly the same as the query. Therefore, in order to enable the model to handle diversified queries in real-world scenarios, the present invention further proposes a knowledge-driven data augmentation method.

[0038] Step 130: extract auxiliary information from the sample case in the pre-constructed sample case library, and for the query-candidate pair, match the sample case with the to-be-processed factual data according to the auxiliary information to obtain similar cases; wherein the auxiliary information includes the applicable laws and judgment results of the case.

[0039] Therefore, in order to perform data augmentation on query-candidate pairs containing the same key facts, cases similar to the factual data to be processed are extracted from the sample case library as enhanced positive candidates.

[0040] It is important to understand that, unlike open domain information retrieval, in the field of similar case retrieval, it is inappropriate to judge whether two cases are similar based solely on the factual details of the cases. The legal provisions and judgment results applicable to the case are also important.

[0041] Based on this, in the actual operation process, the auxiliary information of the sample cases in the sample case library is first extracted, and the sample cases and the pending factual data are matched using the auxiliary information including the legal provisions and judgment results of the cases to obtain similar cases to the pending factual data.

[0042] Further, the extraction of auxiliary information is described. In some embodiments, primary and auxiliary legal provisions are extracted from the "reasons" section of the case, where the primary legal provisions refer to legal provisions that detail specific charges. For example, Article 133 of the Criminal Law of the People's Republic of China stipulates the penalty standards for traffic accident crimes, and auxiliary legal provisions refer to legal provisions that outline the impact of certain facts on the verdict; for example, Article 67 of the Criminal Law of the People's Republic of China defines surrender and how surrender affects the verdict. In addition, the final judgment result is extracted from the "verdict" section, including charges and specific penalties, such as death penalty and fixed-term imprisonment, etc., and these extracted auxiliary information are used as the basis for positive example augmentation.

[0043] In addition, it should be noted that the present invention is not limited by the method of extracting auxiliary information, and regular expressions can be used to extract auxiliary information.

[0044] Step 140: Use the similar cases as keys and the query data as queries to obtain similar case retrieval training data.

[0045] After obtaining similar cases of the pending factual data, the query data including the summary of the pending factual data case is used as the query, and the similar cases are used as the key to construct similar case retrieval training data. The constructed similar case retrieval training data can adapt to the diverse queries in real-world scenarios, and the model trained in this way can still retrieve relevant cases when the key facts are not completely consistent.

[0046] It is understood that most retrieval methods rely heavily on neural models that require a large amount of data, that is, constructing large-scale, high-quality legal retrieval data becomes the key to improving the performance of similar case retrieval. The similar case retrieval data augmentation method provided by the present invention can construct similar case retrieval training data through an efficient, large-scale, and automated data construction method, which can effectively alleviate the problem of data sparsity in the field of similar case retrieval. Benefiting from the efficient construction method, the data can be easily expanded to a larger scale and a wider range. At the same time, the constructed similar case retrieval training data belongs to an asymmetric query-candidate pair, which is close to the usage scenario of daily users.

[0047] In some embodiments, the process of using the similar cases as keys and the query data as queries to obtain similar case retrieval training data further includes: Using a large amount of similar case retrieval training data to build a similar case retrieval training data set; The case retrieval model is trained based on the deep neural network using the similar case retrieval training data set.

[0048] Specifically, steps 110 - 140 are repeated to obtain a large amount of similar case retrieval training data, and a large amount of similar case retrieval training data is used to form a large-scale similar case retrieval training data set.

[0049] In order to further illustrate the method for augmenting similar case retrieval data provided by the present invention, a specific embodiment is given. Figure 2 As shown, in this embodiment, 6.6 million criminal cases were collected from the China Judgment Documents Network, and criminal rulings (containing only content related to commutation of sentence) were first excluded, and only criminal judgment documents were retained. Subsequently, cases with a fact length of less than 100 Chinese characters were filtered out (because most criminal cases are longer than 100 Chinese characters). Regular expressions were then used to match and extract auxiliary information such as charges, legal provisions, and specific penalties from the cases, and cases where such content could not be extracted through rules were excluded. In the end, about 2 million cases were retained. From this pool, 100,000 cases were randomly selected as pending fact data, and queries were generated for each charge based on the pending fact data. Then, for each of the 100,000 cases, the most similar cases were searched from the initial 2 million cases using charges, legal provisions, and specific penalties as criteria to add new positive examples, thereby obtaining a similar case retrieval training data set.

[0050] Further, as shown in Table 1, Table 1 shows the main statistical indicators of the similar case retrieval training data set obtained in the embodiment of the present invention and other widely used similar case retrieval data sets. From the results, it can be seen that the similar case retrieval training data set obtained in the embodiment of the present invention is currently the largest similar case retrieval data set, which is hundreds of times larger than the largest data set currently available, and can support the training of dense vector retrieval models with large existing data requirements. In addition, the similar case retrieval training data set obtained in the embodiment of the present invention is currently the only data set used for asymmetric retrieval, which can better serve real-world scenarios. In addition, due to the flexibility of the construction method provided by the embodiment of the present invention, it can be extended to any accusation and case.

[0051] Table 1 Comparison of data set statistics

[0052] Afterwards, the case retrieval model is trained using the constructed similar case retrieval training data set. In more detail, in some embodiments, model training is performed based on the pre-trained language model under the in-batch negative example setting.

[0053] Furthermore, the method of training the case retrieval model based on the deep neural network using the similar case retrieval training data set specifically includes: Use the pre-trained language model as a base model; Encoding the similar case retrieval training data based on the base model to obtain a vector representation of the similar case retrieval training data; Calculate the similarity score of each pair of the similar case retrieval training data according to the vector representation, and set the cosine similarity between the negative example samples having the same auxiliary information as the query to negative infinity; wherein the negative example samples are positive example samples of other queries in the same batch as the query, and the positive example samples are the keys corresponding to the query; The model is trained until the preset end condition is reached to obtain a case retrieval model.

[0054] Specifically, in some embodiments, a pre-trained language model Lawformer is used as a base model, and training is performed under an intra-batch negative example setting. In the intra-batch negative example setting, for each query in N training pairs in each batch, the negative example is a positive example of other queries in the same batch, that is, N-1 negative examples.

[0055] It can be understood that when using newly identified positive examples in the data set, some negative examples may share the same accusation, legal provisions or specific penalties (i.e., auxiliary information) as the positive examples, resulting in false negative examples that will affect model training. To solve this problem, during training, the negative examples of each similar case retrieval training data in the round of training are first determined, and then the negative examples with the same accusation are extracted, and the similarity scores between the negative examples with the same accusation are set to negative infinity, which is equivalent to removing these negative examples from the negative example set. Using this method to remove negative examples and training with a data set constructed by the method proposed by the present invention can improve the effect of similar case retrieval.

[0056] It should be noted that, in a specific embodiment, cosine similarity is used as the similarity score.

[0057] Furthermore, a specific embodiment of using the trained case retrieval model for retrieval is given: The user inputs query information, and the case retrieval model calculates the similarity score between the query information and similar case retrieval training data, and outputs multiple candidate cases.

[0058] During the retrieval process, the present invention mainly focuses on dense vector retrieval of legal cases. Specifically, a dual encoder architecture is adopted, that is, the data used for query and similar cases in the similar case retrieval training data are respectively encoded using a base model to obtain vector representations of query cases and candidate cases, and the similarity scores between them are calculated, and multiple cases with higher similarity scores are output.

[0059] The query entered is: A person (1) injures another person, causing multiple injuries to the head and chest, and is assessed as (2) minor and moderate injuries; Candidate Case 1: …During a fight, Bob punched Charlie, causing him to fracture the lower part of his right ulna…Charlie’s injuries were classified as moderate injuries; Candidate Case 2: …During the fight, Bob stabbed Charlie in the head and chest…Charlie’s injuries were classified as serious injuries; Similarity score: Candidate case 1 > Candidate case 2.

[0060] The key fact extraction in step 110 is described below. In some embodiments, the key fact extraction based on the large language model on the fact data to be processed to obtain the case description specifically includes: Inputting the to-be-processed fact data into the large language model; The pre-set task description and examples are used to guide the large language model to generate content that only retains key facts from the fact data to be processed, so as to obtain a case description.

[0061] Specifically, during the generation process, the model is required to compress the case facts in the provided factual data to be processed into a concise case description, retaining only necessary legal events. In order to guide the model, a task description and two examples are provided in the interaction with the model to ensure the effectiveness and accuracy of query generation.

[0062] The anonymization process in step 120 is described below. In some embodiments, the process of anonymizing the entity name of the case description using a part-of-speech tagging tool to obtain query data specifically includes: Using a part-of-speech tagging tool to perform part-of-speech tagging on the case description to obtain a part-of-speech tagging result; The entity names of the preset categories in the part-of-speech tagging results are searched, and the entity names are replaced with equivalent anonymous contents to obtain query data.

[0063] Specifically, the case description is first tagged with a part-of-speech tagging tool to obtain the part-of-speech tagging results, and then specific entity name information in the part-of-speech tagging results, such as personal names, company names, places and times, is queried and replaced with semantically equivalent anonymous content, thereby obtaining anonymized query data.

[0064] In more detail, the replacement of equivalent anonymous content is further explained. For example, in a specific embodiment, two different names are replaced by "A" and "B". The similar case retrieval data obtained by anonymizing the entity name can enable the model to better grasp the relationship between the query case and key information, thereby improving the effectiveness of the retrieval and improving the performance of the model.

[0065] The following is an explanation of the matching of the sample case and the fact data to be processed in step 130. In some embodiments, for the query-candidate pair, the sample case and the fact data to be processed are matched according to the auxiliary information to obtain similar cases, specifically including: Select sample cases whose main legal provisions applicable to the case match the factual data to be processed, and whose auxiliary legal provisions applicable to the case and judgment results are similar to the factual data to be processed as similar cases to the factual data to be processed in the query-candidate pair.

[0066] Specifically, for each candidate case (factual data to be processed), it is necessary to identify at least one related sample case as a similar case, wherein the main legal provisions of the similar case match the original candidate case (factual data to be processed), and the auxiliary legal provisions and the judgment results are as similar as possible to the original candidate case (factual data to be processed).

[0067] It needs to be further explained that each case has applicable main legal provisions and auxiliary legal provisions, which can be extracted using regular expressions. The main legal provision matching mentioned in the above embodiment includes that the main legal provisions of the similar case are completely consistent with the original candidate case.

[0068] Since a case is generally applicable to many auxiliary laws (or secondary laws), an edit distance is defined to judge the similarity between similar cases and the auxiliary laws of the original candidate case. The sample case with the smallest edit distance is selected as the similar case of the original candidate case.

[0069] The following describes the edit distance. First, three edit operations are defined: 1) insert a legal provision; 2) delete a legal provision; 3) replace a legal provision. The edit distance is used to count the edit operations that need to be performed from the auxiliary legal provision applicable to the sample case to the auxiliary legal provision applicable to the original candidate case.

[0070] In order to further explain the edit distance, a specific example is given. For example, if case 1 applies to Article [A1.A2.A3] of the Criminal Law, and case 2 applies to [A1.A2], then the distance between the two cases is 1, that is, as long as case 1 deletes A3, it will be the same as case 2. Similarly, if it is [A1.A2.A4], or [A1.A2.A3.A5], the edit distance between these two and [A1.A2.A3] is also 1, because one is a replacement and the other is an insertion. If it is [A1, A2, A4, A5], then the edit distance is 2, and if they are exactly the same, the edit distance is 0.

[0071] Furthermore, for the similarity of the verdict, if the verdict includes the sentence, the similarity is defined as the detention / imprisonment date being as close as possible. If the verdict is not guilty, in the matching process of similar cases, the priority is: first match with the verdict of not guilty, if not, then match with the detention of xx days from small to large. If the verdict is life imprisonment, in the matching process of similar cases, the priority is: first match with the verdict of life imprisonment, if not, then match with the imprisonment of xx days from large to small. If the verdict is death penalty, in the matching process of similar cases, the priority is: first match with the verdict of death penalty, if not, then match with the verdict of life imprisonment, if not, then match with the imprisonment of xx days from large to small.

[0072] In order to further illustrate the matching of similar cases, a specific retrieval process is given: first, find cases with the same charges (for example, dangerous driving) as the query case (pending fact data), then filter out cases with the same main legal provisions from the cases with the same charges, and then find the cases with the most similar secondary legal provisions from the remaining cases (for example, there are several cases with the same edit distance, which are all the smallest). If there are more than one, find the cases with the closest sentences. If there are still more than one at this time, randomly select one as a similar case to the query case.

[0073] The resulting enhanced positive candidates (or positive examples) are legally related to the factual data to be processed, but because they are two completely different cases, there is no overlap in factual details.

[0074] The method for augmenting data for similar case retrieval provided by the present invention extracts key facts from the fact data to be processed based on a large language model to obtain a case description; uses a part-of-speech tagging tool to anonymize the entity name of the case description to obtain query data, and forms a query-candidate pair based on the query data and the fact data to be processed; extracts auxiliary information from sample cases in a pre-constructed sample case library, and for the query-candidate pair, matches the sample case with the fact data to be processed based on the auxiliary information to obtain similar cases; wherein the auxiliary information includes the applicable laws and judgment results of the case; uses the similar case as a key and the query data as a query to obtain similar case retrieval training data. The present invention summarizes the fact data to be processed with the help of a part-of-speech tagging tool, has low tagging cost, does not require manual participation, and is convenient and fast to expand. At the same time, auxiliary information is used for knowledge-driven data augmentation, and the obtained similar cases are used as keys, thereby realizing similar case retrieval training data with asymmetric data query and key, which is closer to the daily use scenarios of ordinary users and further improves performance.

[0075] The following is a description of the similar case retrieval data augmentation device provided by the present invention. The similar case retrieval data augmentation device described below and the similar case retrieval data augmentation method described above can be referred to in correspondence with each other. Figure 3 As shown, the device includes the following modules: A compression unit 310 is used to extract key facts from the fact data to be processed based on the large language model to obtain a case description; Anonymizing unit 320, used to perform entity name anonymization processing on the case description using a part-of-speech tagging tool to obtain query data, and to form a query-candidate pair according to the query data and the fact data to be processed; The matching unit 330 is used to extract auxiliary information from the sample case in the pre-constructed sample case library, and for the query-candidate pair, match the sample case with the to-be-processed fact data according to the auxiliary information to obtain similar cases; wherein the auxiliary information includes the applicable laws and judgment results of the case; The construction unit 340 is used to use the similar cases as keys and the query data as queries to obtain similar case retrieval training data.

[0076] According to a similar case retrieval data augmentation device provided by the present invention, the similar case is used as a key and the query data is used as a query to obtain similar case retrieval training data, and then the device further includes: Using a large amount of similar case retrieval training data to build a similar case retrieval training data set; The case retrieval model is trained based on the deep neural network using the similar case retrieval training data set.

[0077] According to a similar case retrieval data augmentation device provided by the present invention, for the query-candidate pair, the sample case and the to-be-processed fact data are matched according to the auxiliary information to obtain similar cases, specifically including: Select sample cases whose main legal provisions applicable to the case match the factual data to be processed, and whose auxiliary legal provisions applicable to the case and judgment results are similar to the factual data to be processed as similar cases to the factual data to be processed in the query-candidate pair.

[0078] According to a similar case retrieval data augmentation device provided by the present invention, the method of training a case retrieval model based on a deep neural network using the similar case retrieval training data set specifically includes: Use the pre-trained language model as a base model; Encoding the similar case retrieval training data based on the base model to obtain a vector representation of the similar case retrieval training data; Calculate the similarity score of each pair of the similar case retrieval training data according to the vector representation, and set the cosine similarity between the negative example samples having the same auxiliary information as the query to negative infinity; wherein the negative example samples are positive example samples of other queries in the same batch as the query, and the positive example samples are the keys corresponding to the query; The model is trained until the preset end condition is reached to obtain a case retrieval model.

[0079] According to a similar case retrieval data augmentation device provided by the present invention, the use of a part-of-speech tagging tool to anonymize the entity name of the case description to obtain query data specifically includes: Using a part-of-speech tagging tool to perform part-of-speech tagging on the case description to obtain a part-of-speech tagging result; The entity names of the preset categories in the part-of-speech tagging results are searched, and the entity names are replaced with equivalent anonymous contents to obtain query data.

[0080] According to a similar case retrieval data augmentation device provided by the present invention, the key facts are extracted from the fact data to be processed based on the large language model to obtain the case description, which specifically includes: Inputting the to-be-processed fact data into the large language model; The pre-set task description and examples are used to guide the large language model to generate content that only retains key facts from the fact data to be processed, so as to obtain a case description.

[0081] The similar case retrieval data augmentation device provided by the present invention extracts key facts from the to-be-processed fact data based on a large language model to obtain a case description; uses a part-of-speech tagging tool to anonymize the entity name of the case description to obtain query data, and forms a query-candidate pair based on the query data and the to-be-processed fact data; extracts auxiliary information from sample cases in a pre-constructed sample case library, and for the query-candidate pair, matches the sample case with the to-be-processed fact data based on the auxiliary information to obtain similar cases; wherein the auxiliary information includes the applicable laws and judgment results of the case; uses the similar case as a key and the query data as a query to obtain similar case retrieval training data. The present invention summarizes the to-be-processed fact data with the help of a part-of-speech tagging tool, has low tagging cost, does not require manual participation, and is convenient and fast to expand. At the same time, the auxiliary information is used for knowledge-driven data augmentation, and the obtained similar cases are used as keys, thereby realizing similar case retrieval training data with asymmetric data query and key, which is closer to the daily use scenarios of ordinary users and further improves performance.

[0082] Figure 4 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 4 As shown, the electronic device may include: a processor 410, a communication interface 420, a memory 430 and a communication bus 440, wherein the processor 410, the communication interface 420 and the memory 430 communicate with each other through the communication bus 440. The processor 410 may call the logic instructions in the memory 430 to execute a similar case retrieval data augmentation method, which includes: extracting key facts from the to-be-processed fact data based on a large language model to obtain a case description; anonymizing the entity name of the case description using a part-of-speech tagging tool to obtain query data, and forming a query-candidate pair based on the query data and the to-be-processed fact data; extracting auxiliary information from a sample case in a pre-constructed sample case library, and matching the sample case with the to-be-processed fact data for the query-candidate pair based on the auxiliary information to obtain a similar case; wherein the auxiliary information includes the applicable legal provisions and judgment results of the case; using the similar case as a key and the query data as a query to obtain similar case retrieval training data.

[0083] In addition, the logic instructions in the above-mentioned memory 430 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0084] On the other hand, the present invention also provides a computer program product, which includes a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the similar case retrieval data augmentation method provided by the above methods, which method includes: extracting key facts from the fact data to be processed based on a large language model to obtain a case description; using a part-of-speech tagging tool to anonymize the entity name of the case description to obtain query data, and forming a query-candidate pair based on the query data and the fact data to be processed; extracting auxiliary information from sample cases in a pre-constructed sample case library, and for the query-candidate pair, matching the sample case with the fact data to be processed based on the auxiliary information to obtain similar cases; wherein the auxiliary information includes the laws and judgment results applicable to the case; using the similar case as a key and the query data as a query to obtain similar case retrieval training data.

[0085] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the similar case retrieval data augmentation method provided by the above-mentioned methods, the method comprising: extracting key facts from the fact data to be processed based on a large language model to obtain a case description; using a part-of-speech tagging tool to anonymize the entity name of the case description to obtain query data, and forming a query-candidate pair based on the query data and the fact data to be processed; extracting auxiliary information from sample cases in a pre-constructed sample case library, and for the query-candidate pair, matching the sample case with the fact data to be processed based on the auxiliary information to obtain similar cases; wherein the auxiliary information includes the applicable laws and judgment results of the case; using the similar case as a key and the query data as a query to obtain similar case retrieval training data.

[0086] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0087] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0088] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for augmenting similar case retrieval data, characterized in that: include: Based on the large language model, key facts are extracted from the factual data to be processed to obtain the case description; Anonymize the entity names of the case description using a part-of-speech tagging tool to obtain query data, and form a query-candidate pair based on the query data and the fact data to be processed; Extract auxiliary information from sample cases in a pre-built sample case database, and for the query-candidate pair, match the sample case with the to-be-processed factual data according to the auxiliary information to obtain similar cases; wherein the auxiliary information includes the applicable laws and judgments of the case; The similar cases are used as keys and the query data is used as queries to obtain similar case retrieval training data.

2. The similar case retrieval data augmentation method according to claim 1, characterized in that: The method uses the similar cases as keys and the query data as queries to obtain similar case retrieval training data, and then further includes: Using a large amount of similar case retrieval training data to build a similar case retrieval training data set; The case retrieval model is trained based on the deep neural network using the similar case retrieval training data set.

3. The similar case retrieval data augmentation method according to claim 1, characterized in that: For the query-candidate pair, matching the sample case with the to-be-processed fact data according to the auxiliary information to obtain similar cases specifically includes: Select sample cases whose main legal provisions applicable to the case match the factual data to be processed, and whose auxiliary legal provisions applicable to the case and judgment results are similar to the factual data to be processed as similar cases to the factual data to be processed in the query-candidate pair.

4. The similar case retrieval data augmentation method according to claim 2, characterized in that: The method of training the case retrieval model based on the deep neural network using the similar case retrieval training data set specifically includes: Use the pre-trained language model as a base model; Encoding the similar case retrieval training data based on the base model to obtain a vector representation of the similar case retrieval training data; Calculate the similarity score of each pair of the similar case retrieval training data according to the vector representation, and set the cosine similarity between the negative example samples having the same auxiliary information as the query to negative infinity; wherein the negative example samples are positive example samples of other queries in the same batch as the query, and the positive example samples are the keys corresponding to the query; The model is trained until the preset end condition is reached to obtain a case retrieval model.

5. The similar case retrieval data augmentation method according to claim 1, characterized in that: The method of using a part-of-speech tagging tool to anonymize the entity name of the case description to obtain query data specifically includes: Using a part-of-speech tagging tool to perform part-of-speech tagging on the case description to obtain a part-of-speech tagging result; The entity names of the preset categories in the part-of-speech tagging results are searched, and the entity names are replaced with equivalent anonymous contents to obtain query data.

6. The similar case retrieval data augmentation method according to claim 1, characterized in that: The key facts of the fact data to be processed are extracted based on the large language model to obtain the case description, which specifically includes: Inputting the to-be-processed fact data into the large language model; The pre-set task description and examples are used to guide the large language model to generate content that only retains key facts from the fact data to be processed, so as to obtain a case description.

7. A similar case retrieval data augmentation device, characterized in that: include: A compression unit, which is used to extract key facts from the fact data to be processed based on a large language model to obtain a case description; An anonymous unit, used for performing entity name anonymization processing on the case description by using a part-of-speech tagging tool to obtain query data, and forming a query-candidate pair according to the query data and the fact data to be processed; A matching unit, configured to extract auxiliary information from a sample case in a pre-constructed sample case database, and for the query-candidate pair, match the sample case with the to-be-processed fact data according to the auxiliary information to obtain similar cases; wherein the auxiliary information includes the applicable legal provisions and judgment results of the case; A construction unit is used to use the similar cases as keys and the query data as queries to obtain similar case retrieval training data.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the method for augmenting similar case retrieval data as described in any one of claims 1 to 6 is implemented.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for augmenting similar case retrieval data as described in any one of claims 1 to 6 is implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method for augmenting similar case retrieval data as described in any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Legal document semantic similarity evaluation method and system based on deep learning model

    CN114881043A

  • Method for automatically generating class case retrieval report based on large language model

    CN117574858A

  • Self-updating legal case recommendation system based on large model and rule reasoning

    CN118193716A

  • Class case retrieval system and method based on retrieval enhancement generation technology

    CN118260391A

  • Method and apparatus for retrieving 3D map

    US20240095265A1

Cited By

  • Law assistance method based on large language model

    CN119397297A