Method and apparatus for augmenting case retrieval data
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-02
- Publication Date
- 2026-08-14
AI Technical Summary
[0006]本发明提供一种类案检索数据增广方法和装置,用以解决现有技术中不适应用户查询习惯以及标注成本高的缺陷,实现适应用户查询习惯、标注成本低的类案检索数据的构建,进而提高性能
[0017]本发明提供的类案检索数据增广方法和装置,通过基于大语言模型对待处理事实数据进行关键事实提取,得到案件描述;利用词性标注工具对所述案件描述进行实体名匿名化处理,得到查询数据,根据所述查询数据和所述待处理事实数据组成查询-候选对;提取预先构建的样本案件库内的样本案件中的辅助信息,对于所述查询-候选对,根据所述辅助信息将所述样本案件和所述待处理事实数据进行匹配,得到相似案件;其中,所述辅助信息包括案件适用的法条和判决结果;将所述相似案件作为键,将所述查询数据作为查询,得到类案检索训练数据。本发明借助和词性标注工具对待处理事实数据进行概括,标注成本低,无需人工参与,方便快速扩充,同时,利用辅助信息进行知识驱动的数据增广,得到的相似案件作为键,从而实现数据查询与键非对称的类案检索训练数据,更加贴近普通用户日常使用场景,进一步提升性能。
Smart Images

Figure CN119046402B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of case retrieval technology, and in particular to a method and apparatus for augmenting case retrieval data. Background Technology
[0002] Legal case retrieval aims to search for similar historical cases based on a given description of facts. This task helps legal professionals, such as judges and lawyers, improve efficiency by providing past cases as references for current judgments. Therefore, it plays a crucial role in promoting judicial fairness, ensuring that similar cases receive similar judgments.
[0003] Unlike open-domain search, case retrieval requires a complex understanding of case details and necessitates models equipped with legal knowledge to generate knowledge-rich case representations. For example... Figure 1 As shown, in this example, the model needs to recognize that when evaluating key factors for the relevance of a given candidate to a query, the severity of the harm is more important than the location of the harm. In recent years, scholars have made significant efforts to improve the performance of case retrieval, including introducing additional knowledge features and designing pre-training objectives for case retrieval.
[0004] However, despite these advances, the application of case retrieval still faces two major challenges: asymmetric retrieval and data sparsity. On the one hand, existing methods primarily focus on symmetric retrieval settings, where both queries and candidates have lengthy factual descriptions. However, in the real world, user queries typically contain only a few sentences describing key details. This inconsistency between the application scenario and the training scenario easily leads to suboptimal performance. On the other hand, legal data annotation often requires professional and experienced annotators, a time-consuming and labor-intensive process that limits data size, further contributing to suboptimal performance.
[0005] In summary, existing case retrieval data suffers from problems such as not being adapted to user query habits and high annotation costs. Summary of the Invention
[0006] This invention provides a method and apparatus for augmenting case retrieval data, which addresses the shortcomings of existing technologies such as being unsuitable for user query habits and having high annotation costs. It enables the construction of case retrieval data that is adapted to user query habits and has low annotation costs, thereby improving performance.
[0007] This invention provides a method for augmenting similar case retrieval data, comprising the following steps: Based on a large language model, key facts are extracted from the factual data to be processed to obtain a case description; The case description is anonymized using part-of-speech tagging tools to obtain query data. Query-candidate pairs are then formed based on the query data and the factual data to be processed. Auxiliary information is extracted from sample cases in a pre-built sample case database. For the query-candidate pair, the sample case and the factual data to be processed are matched according to the auxiliary information to obtain similar cases. The auxiliary information includes the applicable legal provisions and judgment results of the cases. Using the similar cases as keys and the query data as queries, we obtain training data for similar case retrieval.
[0008] According to a method for augmenting similar case retrieval data provided by the present invention, the method further includes using the similar cases as keys and the query data as queries to obtain similar case retrieval training data, and then further comprising: A case retrieval training dataset was constructed using a large amount of case retrieval training data. The case retrieval model is trained using the aforementioned case retrieval training dataset based on a deep neural network.
[0009] According to a method for augmenting similar case retrieval data provided by the present invention, the step of matching the sample case and the factual data to be processed based on the auxiliary information to obtain similar cases for the query-candidate pair specifically includes: Sample cases whose main applicable legal provisions match the factual data to be processed, and whose auxiliary applicable legal provisions and judgment results are similar to the factual data to be processed, are selected as similar cases to the factual data to be processed in the query-candidate pair.
[0010] According to the present invention, a method for augmenting case retrieval data, wherein training a case retrieval model based on a deep neural network using the case retrieval training dataset specifically includes: Use a pre-trained language model as a base model; The case retrieval training data is encoded based on the base model to obtain a vector representation of the case retrieval training data. The similarity score of each pair of the case retrieval training data is calculated based on the vector representation, and the cosine similarity between negative samples with the same auxiliary information as the query is set to negative infinity; wherein, the negative sample is a positive sample of other queries in the same batch as the query, and the positive sample is the key corresponding to the query; The model is trained until the preset termination condition is met, resulting in a case retrieval model.
[0011] According to a method for augmenting case retrieval data provided by the present invention, the step of using a part-of-speech tagging tool to anonymize the entity names of the case descriptions to obtain query data specifically includes: The case description was tagged with part-of-speech tags using a part-of-speech tagging tool to obtain the tagging results. Query the entity names of the preset categories in the part-of-speech tagging results, replace the entity names with equivalent anonymous content, and obtain the query data.
[0012] According to the present invention, a method for augmenting case retrieval data, wherein the key fact extraction based on a large language model to obtain a case description specifically includes: The factual data to be processed is input into the large language model; The large language model is guided by a pre-set task description and examples to generate a case description by retaining only the key facts from the factual data to be processed.
[0013] The present invention also provides a case retrieval data augmentation device, comprising the following modules: The compression unit is used to extract key facts from the factual data to be processed based on a large language model, so as to obtain a case description. Anonymous unit is used to anonymize the entity name of the case description using part-of-speech tagging tool to obtain query data, and to form query-candidate pairs based on the query data and the fact data to be processed. The matching unit is used to extract auxiliary information from sample cases in a pre-built sample case database. For the query-candidate pair, the sample case and the factual data to be processed are matched according to the auxiliary information to obtain similar cases. The auxiliary information includes the applicable legal provisions and judgment results of the case. The 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, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the case retrieval data augmentation method as described above.
[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 the case retrieval data augmentation method as described above.
[0016] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the case retrieval data augmentation method as described above.
[0017] The present invention provides a method and apparatus for augmenting case retrieval data. This method extracts key facts from the factual data to be processed based on a large language model to obtain a case description. It then uses part-of-speech tagging to anonymize the entity names of the case description, obtaining query data. Query-candidate pairs are formed based on the query data and the factual data to be processed. Auxiliary information is extracted from sample cases in a pre-built sample case database. For each query-candidate pair, the sample cases and the factual data to be processed are matched based on the auxiliary information to obtain similar cases. The auxiliary information includes applicable legal provisions and judgment results. The similar cases are used as keys, and the query data is used as queries to obtain case retrieval training data. This invention uses part-of-speech tagging to summarize the factual data to be processed, resulting in low tagging costs, no manual intervention, and convenient and rapid expansion. Simultaneously, it utilizes auxiliary information for knowledge-driven data augmentation, using the obtained similar cases as keys, thereby achieving asymmetric case retrieval training data between data queries and keys. This is more closely aligned with the daily usage scenarios of ordinary users and further improves performance. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0019] Figure 1 This is one of the flowcharts illustrating the similarity retrieval data augmentation method provided by the present invention.
[0020] Figure 2 This is the second flowchart of the similar case retrieval data augmentation method provided by the present invention.
[0021] Figure 3 This is a schematic diagram of the structure of the case retrieval data augmentation device provided by the present invention.
[0022] Figure 4 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0023] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0024] The following is combined with Figures 1-2 The present invention describes a method for augmenting similar case retrieval data. Figure 1 This is one of the flowcharts illustrating the case retrieval data augmentation method provided by the present invention, such as... Figure 1 As shown, the method includes steps 110-140.
[0025] Step 110: Extract key facts from the factual data to be processed based on the large language model to obtain a case description.
[0026] It should be noted that the case retrieval mentioned in this invention specifically includes legal case retrieval. For ease of explanation, the embodiments of this invention are illustrated using legal case retrieval as an example, but this does not imply any limitation on the invention.
[0027] Based on this, the factual data to be processed consists of legal cases / legal facts collected for generating similar case retrieval data. It should be noted that the factual data to be processed can be collected from the China Judgments Online website, or from other channels; this invention does not impose any restrictions on this.
[0028] It should be noted that, generally, case documents related to the factual data to be processed are handwritten by judges. Therefore, these documents contain numerous details, such as the names of each participant in the case, their relationships, and the court's detailed discussions of each event. These details are often quite lengthy and not very helpful for retrieval. Furthermore, considering users' unfamiliarity with legal knowledge, in actual retrieval processes, user queries typically only include key factual events. To obtain concise queries similar to those of real-world users, key information needs to be extracted from the collected legal case facts.
[0029] Based on this, in step 110, the factual data to be processed is processed, and a large-scale generative language model is used to extract key facts to obtain a case description that includes only key facts.
[0030] It should be emphasized that, in this embodiment, key facts include essential legal elements necessary for locating and retrieving data, and this embodiment does not limit their specific content. Based on this, the role of the large language model is to summarize the factual data to be processed while retaining the essential legal elements, resulting in a concise case description that includes these elements, thereby achieving efficient, automated, and large-scale processing of the factual data to be processed.
[0031] Furthermore, this invention does not impose restrictions on the large language model used. In one specific embodiment, GPT-4 is selected as the large language model.
[0032] Step 120: Use part-of-speech tagging tools to anonymize the entity names of the case description to obtain query data, and form query-candidate pairs 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, locations, and dates. These entities are generally irrelevant to the key events and do not affect the final judgment of the case.
[0034] Furthermore, training data containing entity names in case retrieval can mislead the model. Specifically, identical entity names between queries and candidate cases may provide a shortcut for model inference, causing models trained on this data to be more inclined to search for candidate cases with the same entity names, ignoring key legal events.
[0035] Based on this, embodiments of the present invention provide a strategy for anonymizing these entities. Part-of-speech tagging is used to identify entity names and then anonymize them to obtain query data. Through key fact extraction and anonymization, a relevant query can be generated for each piece of factual data to be processed.
[0036] It is important to note that, to ensure the coherence of the query data, the anonymized query data can be optimized using a large language model. Alternatively, based on the large model, both the key fact extraction in step 110 and the anonymization in step 120 can be performed simultaneously. Then, based on the anonymized key facts, the large language model is required to generate a concise and coherent description of the case. This description constitutes the query data and is considered the search query in the centralized retrieval pair of the data set.
[0037] Furthermore, by using the factual data to be processed as candidate cases and the query data as queries, query-candidate pairs are formed, which can then be used as training data for the case retrieval model. This method allows for the construction of large-scale query-candidate pairs containing the same key facts. However, in practical applications, it is often impossible to find cases that are completely identical to the query. Therefore, to enable the model to handle diverse queries in real-world scenarios, this invention further proposes a knowledge-driven data augmentation method.
[0038] Step 130: Extract auxiliary information from sample cases in the pre-built sample case database. For the query-candidate pair, match the sample case and the factual data to be processed according to the auxiliary information to obtain similar cases. The auxiliary information includes the applicable legal provisions and judgment results of the case.
[0039] Therefore, in order to augment query-candidate pairs containing the same key facts, cases similar to the fact 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 case retrieval, it is inappropriate to judge whether two cases are similar based solely on the factual details of the cases. The applicable legal provisions and judgment results are also very important.
[0041] Based on this, in actual operation, the auxiliary information of sample cases in the sample case database is first extracted, and the sample cases and the factual data to be processed are matched using the auxiliary information including the legal provisions and judgment results of the cases to obtain similar cases of the factual data to be processed.
[0042] Furthermore, the extraction of auxiliary information is explained. In some embodiments, primary and secondary legal provisions are extracted from the "Reasons" section of the case. Primary legal provisions refer to those detailing the specific charges. For example, Article 133 of the Criminal Law of the People's Republic of China stipulates the penalties for the crime of causing a traffic accident, while secondary legal provisions outline the impact of certain facts on the judgment. Another example is Article 67 of the Criminal Law of the People's Republic of China, which defines surrender and how it affects the judgment. Additionally, the final judgment, including charges and specific penalties such as death penalty and imprisonment, is extracted from the "Judgment" section. This extracted auxiliary information serves as the basis for positive example augmentation.
[0043] Additionally, it should be noted that this invention does not restrict the extraction method of auxiliary information; 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 to the factual data to be processed, query data including a summary of the cases to be processed is used as the query, and similar cases are used as the key to construct training data for case retrieval. The constructed training data for case retrieval can adapt to diverse queries in real-world scenarios, and the model trained in this way can still retrieve relevant cases even when the key facts are not completely identical.
[0046] It is understood that most retrieval methods heavily rely on neural models that require large amounts of data. Therefore, constructing large-scale, high-quality legal retrieval data is crucial for improving the performance of similar case retrieval. The similar case retrieval data augmentation method provided by this invention can construct similar case retrieval training data through an efficient, large-scale, and automated data construction method, effectively alleviating 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. Simultaneously, the constructed similar case retrieval training data consists of asymmetric query-candidate pairs, closely resembling the usage scenarios of everyday users.
[0047] In some embodiments, the step of using the similar cases as keys and the query data as queries to obtain similar case retrieval training data further includes: A case retrieval training dataset was constructed using a large amount of case retrieval training data. The case retrieval model is trained using the aforementioned case retrieval training dataset based on a deep neural network.
[0048] Specifically, repeat steps 110-140 to obtain a large amount of case retrieval training data, and use the large amount of case retrieval training data to form a large-scale case retrieval training dataset.
[0049] To further illustrate the method for augmenting similar case retrieval data provided by this invention, a specific embodiment is given. For example... Figure 2 As shown, in this embodiment, 6.6 million criminal cases were collected from the China Judgments Online website. First, criminal rulings (containing only content related to sentence reduction) were excluded, retaining only criminal judgment documents. Then, cases with fewer than 100 Chinese characters in length were filtered out (because most criminal cases are longer than 100 characters). Next, regular expressions were used to match and extract auxiliary information such as charges, legal provisions, and specific penalties from the cases, excluding cases where such content could not be extracted using rules. Ultimately, approximately 2 million cases remained. From this pool, 100,000 cases were randomly selected as the pending factual data. A query was generated for each charge based on the pending factual data. Then, for each of the 100,000 cases, using charges, legal provisions, and specific penalties as criteria, the most similar cases were searched from the initial 2 million cases to add new positive examples, thus obtaining a training dataset for case retrieval.
[0050] Furthermore, as shown in Table 1, which presents the main statistical indicators of the case retrieval training dataset obtained in this embodiment of the invention and other widely used case retrieval datasets, it can be seen from the results that the case retrieval training dataset obtained in this embodiment of the invention is currently the largest case retrieval dataset, several hundred times larger than the largest currently available dataset, and can support the training of dense vector retrieval models with large data requirements. In addition, the case retrieval training dataset obtained in this embodiment of the invention is currently the only dataset used for asymmetric retrieval, which can better serve real-world scenarios. Furthermore, due to the flexibility of the construction method provided in this embodiment of the invention, it can be extended to any charge and case.
[0051] Table 1 Comparison of Statistical Data from Datasets
[0052] Subsequently, the case retrieval model is trained using the constructed case retrieval training dataset. More specifically, in some embodiments, the model is trained based on a pre-trained language model under an in-batch negative example setting.
[0053] Furthermore, the step of training the case retrieval model using the case retrieval training dataset based on a deep neural network specifically includes: Use a pre-trained language model as a base model; The case retrieval training data is encoded based on the base model to obtain a vector representation of the case retrieval training data. The similarity score of each pair of the case retrieval training data is calculated based on the vector representation, and the cosine similarity between negative samples with the same auxiliary information as the query is set to negative infinity; wherein, the negative sample is a positive sample of other queries in the same batch as the query, and the positive sample is the key corresponding to the query; The model is trained until the preset termination condition is met, resulting in a case retrieval model.
[0054] Specifically, in some embodiments, a pre-trained language model, Lawformer, is used as the base model. Training is performed under an in-batch negative example setting. In the in-batch negative example setting, for each query in the N training pairs in each batch, the negative example is the positive example of other queries in the same batch, i.e., N-1 negative examples.
[0055] It is understood that when using newly identified positive examples in the dataset, some negative examples may share the same charges, legal provisions, or specific penalties (i.e., auxiliary information) as the positive examples. These false negatives can negatively impact model training. To address this issue, during training, negative example samples from the training data for each case retrieval round are first identified. Then, negative examples with the same charges are extracted, and the similarity score between these examples is set to negative infinity. This is equivalent to removing these negative examples from the negative example set. Using this method to remove negative examples and training with the dataset constructed using the method proposed in this invention can improve the effectiveness of case retrieval.
[0056] It should be noted that, in one specific embodiment, cosine similarity is used as the similarity score.
[0057] Furthermore, a specific implementation example of using a pre-trained case retrieval model is given: The user inputs query information, and the case retrieval model calculates the similarity score between the query information and the training data of the case retrieval, and outputs multiple candidate cases.
[0058] During the retrieval process, this invention mainly focuses on dense vector retrieval of legal cases. Specifically, it adopts a dual encoder architecture, that is, it encodes similar cases in the data used for querying and the training data for case retrieval using a base model to obtain vector representations of query cases and candidate cases, calculates the similarity score between them, and outputs multiple cases with high similarity scores.
[0059] The input query is: A person (1) injured another person, causing multiple injuries to the head and chest, and was assessed as (2) minor and moderate injuries; Candidate Case 1: ...During the fight, Bob punched Charlie, causing a fracture of the lower segment of his right ulna... Charlie's injury was classified as a moderate injury; Candidate Case Two: ...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 following describes the key fact extraction in step 110. In some embodiments, the key fact extraction based on the large language model to obtain the case description specifically includes: The factual data to be processed is input into the large language model; The large language model is guided by a pre-set task description and examples to generate a case description by retaining only the key facts from the factual data to be processed.
[0061] Specifically, during the generation process, the model is required to compress the case facts in the provided factual data into a concise case description, retaining only the necessary legal events. To guide the model, a task description and two examples are provided during the interaction with the model to ensure the effectiveness and accuracy of the generated query.
[0062] The anonymization process in step 120 is described below. In some embodiments, the part-of-speech tagging tool is used to anonymize the entity names of the case description to obtain query data, specifically including: The case description was tagged with part-of-speech tags using a part-of-speech tagging tool to obtain the tagging results. Query the entity names of the preset categories in the part-of-speech tagging results, replace the entity names with equivalent anonymous content, and obtain the query data.
[0063] Specifically, the case description is first tagged with part-of-speech tags using a part-of-speech tagging tool to obtain the tagging results. Then, specific entity name information, such as personal names, company names, locations, and times, is queried from the tagging results and replaced with semantically equivalent anonymous content, thus obtaining anonymized query data.
[0064] More specifically, the replacement of equivalent anonymous content is further explained. For example, in one specific embodiment, two different personal names are replaced with "A" and "B" respectively. Anonymizing entity names to obtain case retrieval data allows the model to better grasp the relationship between query cases and key information, thereby improving retrieval effectiveness and model performance.
[0065] The following describes the matching of sample cases and factual data to be processed in step 130. In some embodiments, for the query-candidate pair, matching the sample cases and the factual data to be processed according to the auxiliary information to obtain similar cases specifically includes: Sample cases whose main applicable legal provisions match the factual data to be processed, and whose auxiliary applicable legal provisions and judgment results are similar to the factual data to be processed, are selected 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), at least one related sample case needs to be identified as a similar case. The main legal provisions of the similar case should match the original candidate case (factual data to be processed), while the auxiliary legal provisions and judgment results should be as similar as possible to the original candidate case (factual data to be processed).
[0067] It needs further explanation that each case has applicable primary and secondary legal provisions, which can be extracted using regular expressions. The primary legal provision matching mentioned in the above embodiments includes cases where the primary legal provisions of similar cases are completely identical to those of the original candidate cases.
[0068] Since a case typically applies multiple auxiliary legal provisions (or secondary legal provisions), an edit distance is defined to determine the similarity between similar cases and the auxiliary legal provisions of the original candidate cases. The sample case with the smallest edit distance is selected as the similar case to the original candidate case.
[0069] The following describes edit distance. First, three editing operations are defined: 1) inserting a legal provision; 2) deleting a legal provision; and 3) replacing a legal provision. Edit distance is used to statistically determine the number of editing operations required to move from the auxiliary legal provision applicable to a sample case to the auxiliary legal provision applicable to the original candidate case.
[0070] To further explain the edit distance, a specific example is given. For instance, if Case 1 is governed by Articles [A1, A2, A3] of the criminal law, and Case 2 is governed by [A1, A2], then the minor legal provision distance between these two cases is 1. That is, if Case 1 deletes one of A3, it will be identical to Case 2. Similarly, if it is [A1, A2, A4] or [A1, A2, A3, A5], the edit distance between these 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. If they are exactly the same, the edit distance is 0.
[0071] Furthermore, regarding the similarity of judgments, if the judgment includes a sentence, similarity is defined as the dates of detention / imprisonment being as close as possible. If the judgment is not guilty, the priority order in matching similar cases is as follows: first, match with other not guilty judgments; if none are found, then match with detention sentences of xx days, from smallest to largest. If the judgment is life imprisonment, the priority order in matching similar cases is as follows: first, match with other life imprisonment judgments; if none are found, then match with imprisonment sentences of xx days, from largest to smallest. If the judgment is death penalty, the priority order in matching similar cases is as follows: first, match with death penalty judgments; if none are found, then match with life imprisonment judgments; if none are found, then match with imprisonment sentences of xx days, from largest to smallest.
[0072] To further explain the matching of similar cases, a specific retrieval process is given: First, find those cases that have the same charges (e.g., dangerous driving) as the case being queried (factual data to be processed). Then, filter out those cases with the same charges and the same main legal provisions. Next, find those cases with the most similar secondary legal provisions (e.g., several cases with equal and minimum edit distances). If there are more than one such case, find those cases with the closest sentences. If there are still more than one such case, randomly select one as a similar case to the case being queried.
[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, it ensures that there is no overlap in factual details.
[0074] The case retrieval data augmentation method provided by this invention extracts key facts from the factual data to be processed based on a large language model to obtain a case description; anonymizes the case description using part-of-speech tagging to obtain query data; and forms query-candidate pairs based on the query data and the factual data to be processed; it extracts auxiliary information from sample cases in a pre-built sample case database, and matches the sample cases and the factual data to be processed based on the auxiliary information to obtain similar cases; wherein, the auxiliary information includes the applicable legal provisions and judgment results of the cases; and uses the similar cases as keys and the query data as queries to obtain case retrieval training data. This invention uses part-of-speech tagging to summarize the factual data to be processed, resulting in low tagging costs, no need for manual intervention, and convenient and rapid expansion. Simultaneously, it utilizes auxiliary information for knowledge-driven data augmentation, using the obtained similar cases as keys, thereby achieving case retrieval training data with asymmetric data queries and keys, which is closer to the daily usage scenarios of ordinary users and further improves performance.
[0075] The following describes the analogy retrieval data augmentation device provided by the present invention. The analogy retrieval data augmentation device described below can be referred to in correspondence with the analogy retrieval data augmentation method described above. For example... Figure 3 As shown, the device includes the following modules: Compression unit 310 is used to extract key facts from the factual data to be processed based on a large language model to obtain a case description; Anonymous unit 320 is used to anonymize the entity name of the case description using a part-of-speech tagging tool to obtain query data, and to form query-candidate pairs based on the query data and the fact data to be processed. The matching unit 330 is used to extract auxiliary information from sample cases in a pre-built sample case database. For the query-candidate pair, the sample case and the factual data to be processed are matched according to the auxiliary information to obtain similar cases. The auxiliary information includes the applicable legal provisions 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 step of obtaining similar case retrieval training data by using the similar cases as keys and the query data as queries, further includes: A case retrieval training dataset was constructed using a large amount of case retrieval training data. The case retrieval model is trained using the aforementioned case retrieval training dataset based on a deep neural network.
[0077] According to a similar case retrieval data augmentation device provided by the present invention, the step of matching the sample case and the factual data to be processed based on the auxiliary information to obtain similar cases for the query-candidate pair specifically includes: Sample cases whose main applicable legal provisions match the factual data to be processed, and whose auxiliary applicable legal provisions and judgment results are similar to the factual data to be processed, are selected as similar cases to the factual data to be processed in the query-candidate pair.
[0078] According to the present invention, a case retrieval data augmentation device is provided, wherein the step of training a case retrieval model based on a deep neural network using the case retrieval training dataset specifically includes: Use a pre-trained language model as a base model; The case retrieval training data is encoded based on the base model to obtain a vector representation of the case retrieval training data. The similarity score of each pair of the case retrieval training data is calculated based on the vector representation, and the cosine similarity between negative samples with the same auxiliary information as the query is set to negative infinity; wherein, the negative sample is a positive sample of other queries in the same batch as the query, and the positive sample is the key corresponding to the query; The model is trained until the preset termination condition is met, resulting in a case retrieval model.
[0079] According to the present invention, a case retrieval data augmentation device is provided, wherein the step of using a part-of-speech tagging tool to anonymize the entity names of the case description to obtain query data specifically includes: The case description was tagged with part-of-speech tags using a part-of-speech tagging tool to obtain the tagging results. Query the entity names of the preset categories in the part-of-speech tagging results, replace the entity names with equivalent anonymous content, and obtain the query data.
[0080] According to the present invention, a case retrieval data augmentation device, wherein the key fact extraction based on a large language model of the factual data to be processed to obtain a case description specifically includes: The factual data to be processed is input into the large language model; The large language model is guided by a pre-set task description and examples to generate a case description by retaining only the key facts from the factual data to be processed.
[0081] The case retrieval data augmentation device provided by this invention extracts key facts from the factual data to be processed based on a large language model to obtain a case description; it then uses part-of-speech tagging to anonymize the entity names of the case description to obtain query data; a query-candidate pair is formed based on the query data and the factual data to be processed; auxiliary information is extracted from sample cases in a pre-built sample case database; for the query-candidate pair, the sample cases and the factual data to be processed are matched based on the auxiliary information to obtain similar cases; wherein, the auxiliary information includes the applicable legal provisions and judgment results of the cases; using the similar cases as keys and the query data as queries, case retrieval training data is obtained. This invention uses part-of-speech tagging to summarize the factual data to be processed, resulting in low tagging costs, no need for manual intervention, and convenient and rapid expansion. Simultaneously, it utilizes auxiliary information for knowledge-driven data augmentation, using the obtained similar cases as keys, thereby achieving asymmetric case retrieval training data between data queries and keys, which is closer to the daily usage scenarios of ordinary users and further improves performance.
[0082] Figure 4 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 4 As shown, the electronic device may include a processor 410, a communications interface 420, a memory 430, and a communication bus 440, wherein the processor 410, communications interface 420, and memory 430 communicate with each other via the communication bus 440. The processor 410 can call logical instructions in the memory 430 to execute a case retrieval data augmentation method. This method includes: extracting key facts from the factual data to be processed based on a large language model to obtain a case description; anonymizing the case description using part-of-speech tagging to obtain query data; forming query-candidate pairs based on the query data and the factual data to be processed; extracting auxiliary information from sample cases in a pre-built sample case database; matching the sample cases and the factual data to be processed based on the auxiliary information for the query-candidate pairs to obtain similar cases; wherein the auxiliary information includes applicable legal provisions and judgment results; and using the similar cases as keys and the query data as queries to obtain case retrieval training data.
[0083] Furthermore, the logical instructions in the aforementioned memory 430 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0084] On the other hand, the present invention also provides a computer program product, which includes a computer program that 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 case retrieval data augmentation method provided by the above methods. The method includes: extracting key facts from the factual data to be processed based on a large language model to obtain a case description; anonymizing the entity names of the case description using a part-of-speech tagging tool to obtain query data; forming query-candidate pairs based on the query data and the factual data to be processed; extracting auxiliary information from sample cases in a pre-built sample case database; matching the sample cases and the factual data to be processed based on the auxiliary information for the query-candidate pairs to obtain similar cases; wherein the auxiliary information includes the applicable legal provisions and judgment results of the cases; and using the similar cases as keys and the query data as queries to obtain case retrieval training data.
[0085] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements the method for augmenting case retrieval data provided by the above methods. The method includes: extracting key facts from factual data to be processed based on a large language model to obtain a case description; anonymizing the case description using part-of-speech tagging tools to obtain query data; forming query-candidate pairs based on the query data and the factual data to be processed; extracting auxiliary information from sample cases in a pre-constructed sample case database; matching the sample cases and the factual data to be processed based on the auxiliary information for the query-candidate pairs to obtain similar cases; wherein the auxiliary information includes applicable legal provisions and judgment results for the cases; and using the similar cases as keys and the query data as queries to obtain case retrieval training data.
[0086] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0087] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments 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, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for augmenting case retrieval data, characterized in that, include: Based on a large language model, key facts are extracted from the factual data to be processed to obtain a case description; The case description is anonymized using part-of-speech tagging tools to obtain query data. Query-candidate pairs are then formed based on the query data and the factual data to be processed. Auxiliary information is extracted from sample cases in a pre-built sample case database. For the query-candidate pair, the sample case and the factual data to be processed are matched according to the auxiliary information to obtain similar cases. The auxiliary information includes the applicable legal provisions and judgment results of the cases. Using the similar cases as keys and the query data as queries, we obtain training data for similar case retrieval.
2. The method for augmenting similar case retrieval data according to claim 1, characterized in that, The process of using the similar cases as keys and the query data as queries to obtain similar case retrieval training data further includes: A case retrieval training dataset was constructed using a large amount of case retrieval training data. The case retrieval model is trained using the aforementioned case retrieval training dataset based on a deep neural network.
3. The method for augmenting similar case retrieval data according to claim 1, characterized in that, For the query-candidate pair, matching the sample case and the factual data to be processed based on the auxiliary information to obtain similar cases specifically includes: Sample cases whose main applicable legal provisions match the factual data to be processed, and whose auxiliary applicable legal provisions and judgment results are similar to the factual data to be processed, are selected as similar cases to the factual data to be processed in the query-candidate pair.
4. The method for augmenting similar case retrieval data according to claim 2, characterized in that, The process of training a case retrieval model using the case retrieval training dataset based on a deep neural network specifically includes: Use a pre-trained language model as a base model; The case retrieval training data is encoded based on the base model to obtain a vector representation of the case retrieval training data. The similarity score of each pair of the case retrieval training data is calculated based on the vector representation, and the cosine similarity between negative samples with the same auxiliary information as the query is set to negative infinity; wherein, the negative sample is a positive sample of other queries in the same batch as the query, and the positive sample is the key corresponding to the query; The model is trained until the preset termination condition is met, resulting in a case retrieval model.
5. The method for augmenting similar case retrieval data according to claim 1, characterized in that, The process of using part-of-speech tagging tools to anonymize the entity names of the case description to obtain query data specifically includes: The case description was tagged with part-of-speech tags using a part-of-speech tagging tool to obtain the tagging results. Query the entity names of the preset categories in the part-of-speech tagging results, replace the entity names with equivalent anonymous content, and obtain the query data.
6. The method for augmenting similar case retrieval data according to claim 1, characterized in that, The process of extracting key facts from the factual data to be processed based on a large language model to obtain a case description specifically includes: The factual data to be processed is input into the large language model; The large language model is guided by a pre-set task description and examples to generate a case description by retaining only the key facts from the factual data to be processed.
7. A case retrieval data augmentation device, characterized in that, include: The compression unit is used to extract key facts from the factual data to be processed based on a large language model, so as to obtain a case description. Anonymous unit is used to anonymize the entity name of the case description using part-of-speech tagging tool to obtain query data, and to form query-candidate pairs based on the query data and the fact data to be processed. The matching unit is used to extract auxiliary information from sample cases in a pre-built sample case database. For the query-candidate pair, the sample case and the factual data to be processed are matched according to the auxiliary information to obtain similar cases. The auxiliary information includes the applicable legal provisions and judgment results of the case. The 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, characterized in that, When the processor executes the program, it implements the case retrieval data augmentation method as described in any one of claims 1 to 6.
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, it implements the case retrieval data augmentation method as described in any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the case retrieval data augmentation method as described in any one of claims 1 to 6.