Law case generation method and device based on large model driving

Through a big model-driven legal case generation method, combined with specific elements and legal definitions, the generated case text solves the problems of insufficient samples and insufficient diversity, achieving higher accuracy and efficiency.

CN119719462APending Publication Date: 2025-03-28中国司法大数据研究院有限公司

Patent Information

Application Number
CN202411799931.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-09
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

When generating legal case texts, the existing technology faces the problems of insufficient samples and insufficient diversity, resulting in insufficient rich texts and insufficient practical application value.

Method used

A big-model-driven legal case generation method is adopted, and the target case text is generated by obtaining specific elements and case names that need to be generated, and the relevant background case texts and legal definitions are retrieved, and the target case texts are generated by combining the big language model.

Benefits of technology

The generated case texts are richer and more diverse, which can better reflect the actual judicial scenarios and significantly improve the accuracy and efficiency of legal text generation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119719462A_ABST
    Figure CN119719462A_ABST
Patent Text Reader

Abstract

The invention discloses a law case generation method and device based on large model driving, and belongs to the technical field of law case generation. The method comprises the steps of obtaining specific elements and cause names of a case needing to be generated, wherein the specific elements are determined based on basic features and legal key points of the case needing to be generated; retrieving a background case text related to the specific element and the cause name; retrieving legal definitions and related legal clauses related to the specific elements; and embedding the specific elements, the background case text and the legal definitions and related legal clauses of the specific elements into a first legal case generation prompt template, and generating a target case text based on a large language model. According to the method, the case text which is rich in content and is close to an actual judicial scene can be automatically generated under the condition of sample scarcity, so that the accuracy and diversity of legal text generation are enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of legal case generation, and in particular to a method and device for generating legal case based on large model drive. Background Art

[0002] In the judicial field, the accuracy and completeness of case texts are crucial to the effectiveness of algorithm models. Any lack of case information will not only limit the comprehensiveness of model training, but may also weaken the model's prediction and decision-making capabilities in actual judicial scenarios, thereby adversely affecting the accuracy and efficiency of legal services.

[0003] Traditional methods of supplementing and improving case samples mainly rely on manual collection and organization of existing cases, or the use of basic data augmentation technology. However, these traditional methods have several significant limitations: on the one hand, the manual collection process is not only costly and inefficient, but also limited by manpower, making it difficult to fully cover the characteristic details of all case types, resulting in limited richness and representativeness of the sample library; on the other hand, basic data augmentation methods, such as simple copying, pasting or slight modification, often fail to create case texts with sufficient diversity and practical application value, making the generated samples obviously insufficient in reflecting real judicial situations and lacking sufficient practicality and generalization capabilities. Summary of the invention

[0004] The present invention proposes a method and device for generating legal case information driven by a large model. By using a large model to assist in improving the data requirements of a small model, the method and device can automatically generate case texts that are rich in content and close to actual judicial scenarios when samples are scarce, thereby enhancing the accuracy and diversity of legal text generation.

[0005] To achieve the above-mentioned object of the invention, the technical solution of the present invention includes the following contents.

[0006] A method for generating legal case information based on a large model drive, the method comprising:

[0007] Obtaining specific elements and a case name of a case to be generated, wherein the specific elements are determined based on basic features and legal points of the case to be generated;

[0008] Retrieve the background case text related to the specific elements and case name;

[0009] Search for legal definitions and relevant legal provisions involving the specific elements;

[0010] Specific elements, background case text, and the legal definitions and relevant legal clauses of the specific elements are embedded into a first legal case generation prompt template, and a target case text is generated based on a large language model.

[0011] Furthermore, the search involves the background case text of the specific elements and the case name, including:

[0012] Expanding the specific elements using a large language model to obtain keywords;

[0013] Based on the keyword, a multi-dimensional search is performed in the local knowledge base to obtain a case sample based on the keyword search;

[0014] Performing a web search based on the keyword and the specific element to generate a case sample generated by summarizing the web search content;

[0015] According to the case name, the cases in the case knowledge base are divided into concurrent cases and non-concurrent cases, and in the case knowledge base, case samples of concurrent cases and case samples of non-concurrent cases are extracted based on the specific element;

[0016] Based on the case samples retrieved based on keywords, the case samples generated by summarizing the contents of a network search, the case samples of concurrent cases and the case samples of non-concurrent cases, a background case text involving the specific elements is obtained.

[0017] Furthermore, the multi-dimensional search is performed in the local knowledge base based on the keyword to obtain case samples based on the keyword search, including:

[0018] Obtaining a preset number of samples based on keyword retrieval and preset weights of different local knowledge bases to obtain the number of samples selected from each local knowledge base;

[0019] Based on the keyword, a search is performed in different local knowledge bases, and combined with the number of samples selected from the corresponding local knowledge base, a case sample based on keyword search is obtained.

[0020] Furthermore, the network search based on the keyword and the specific element is performed to generate a case sample generated by summarizing the network search content, including:

[0021] Generate a query based on the keyword and the specific element, and embed the query into a plurality of preset query templates;

[0022] Use the query retrieval template to search the Internet and obtain web page information related to the case;

[0023] The web page information related to the case and the specific elements are embedded into a second legal case generation prompt template, and a case sample generated by summarizing the network search content is obtained based on a large language model.

[0024] Furthermore, in the case cause knowledge base, case samples of concurrent cases and case samples of non-concurrent cases are extracted based on the specific element, including:

[0025] Generate similar elements of a specific element;

[0026] ranking the case sample based on the number of specific elements and / or similar elements of the specific elements in the case sample;

[0027] Extract case samples of concurrent cases according to the set number of samples to be extracted; when the length of the case samples of the concurrent cases exceeds the maximum set length, summarize the case samples of the concurrent cases using a large language model.

[0028] Furthermore, the generating of similar elements of a specific element includes:

[0029] By querying the case knowledge base, other elements of the same level as the specific element under the same case, and sub-elements of elements under different cases, are obtained; wherein the element has the same category as the specific element;

[0030] The other elements at the same level and / or the sub-element are judged based on the large language model to obtain similar elements of the specific element.

[0031] Furthermore, based on the case samples retrieved based on keywords, the case samples generated by summarizing the network search content, the case samples of concurrent cases, and the case samples of non-concurrent cases, a background case text involving the specific elements is obtained, including:

[0032] Clustering the case samples based on keyword retrieval, the case samples generated by summarizing the network search content, the case samples of concurrent cases, and the case samples of non-concurrent cases, and when the number of texts in the cluster is greater than a first preset threshold, performing deduplication processing on the background case samples according to the similarity of the texts in the cluster;

[0033] For the background case sample after deduplication processing, the large language model is used to calculate the fitness of the background case sample with each specific element, and when the fitness of the background case sample with all specific elements is greater than a second preset threshold, the background case sample is determined to be a background case text involving the specific element.

[0034] Furthermore, after generating the target case text based on the large language model, the method further includes:

[0035] Embedding the target case text and specific elements into the evaluation prompt template, and calculating the evaluation score of the target case text using the large language model;

[0036] When the evaluation score is greater than the third preset threshold, the target case text is retained.

[0037] A legal case generation device based on big model driving, the device comprising:

[0038] An element acquisition module, used to acquire specific elements and case names of the case to be generated, wherein the specific elements are determined based on the basic characteristics and legal points of the case to be generated;

[0039] The first search module is used to search for background case texts involving the specific elements and the case name;

[0040] The second search module is used to search for legal definitions and related legal clauses related to the specific elements;

[0041] The case generation module is used to embed specific elements, background case text, and the legal definitions and relevant legal clauses of the specific elements into the first legal case generation prompt template, and generate the target case text based on the large language model.

[0042] An electronic device comprises: a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, the method for generating legal case based on large model drive described in any one of the above is implemented.

[0043] Compared with the prior art, the present invention has at least the following beneficial effects.

[0044] The invention integrates key judicial elements and background case texts to generate rich and diverse case texts. This method effectively solves the problem of insufficient samples faced by the model in an environment with scarce data, ensuring that the generated content is more in line with actual legal scenarios, thereby significantly improving the performance and adaptability of the small model.

[0045] Compared with traditional manual data supplementation and simple enhancement technology, this invention uses a large model to assist in the generation of case texts, significantly improving the efficiency and quality of text generation. Under resource-constrained conditions, this method overcomes the limitations of traditional technology through intelligent processing, ensuring that the generated case texts are more representative and practical, providing more reliable support for legal services. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] Figure 1 This is a flowchart of the legal case generation method driven by a big model. DETAILED DESCRIPTION

[0047] The technical solutions in the embodiments of the present invention will be fully described below in conjunction with the accompanying drawings in the implementation of the present invention.

[0048] The legal case generation method based on big model driving provided by the present invention aims to solve the existing problems of missing data and insufficient sample diversity. The present invention uses the core judicial elements of the case and combines big model generation technology to automatically generate case texts that conform to actual scenarios. This method effectively avoids the limitations of manual collection and simple data enhancement, can generate diversified case texts in the absence of data, improve the applicability and performance of small models in complex legal situations, and thus optimize the quality and efficiency of legal services.

[0049] like Figure 1 The legal case generation method based on big model driving of the present invention includes steps 1 to 4.

[0050] Step 1: Obtain the specific elements and case name for which the case needs to be generated.

[0051] The present invention first clarifies the specific elements of the case that need to be generated. These specific elements are determined based on the basic characteristics of the case and the legal points. At the same time, the case name related to the specific elements is determined based on the expected case sample type, laying the foundation for the subsequent generation of the case text. Among them, the specific elements can be not only a single element under the same case, but also multiple elements under the case.

[0052] Step 2: Retrieve background case text involving the specific element and case name.

[0053] The background case text can more accurately guide the large model to generate the case. The generation process of the background case text includes the following steps 2.1 to 2.5.

[0054] Step 2.1: Expand the specific elements using a large language model to obtain keywords.

[0055] The present invention utilizes a large language model to expand specific elements of the initial input to generate multiple possible variants or extended keywords. These expanded keywords will form multi-dimensional retrieval queries to more comprehensively cover possible scenarios related to the case.

[0056] Step 2.2: Perform a multi-dimensional search in the local knowledge base based on the keyword to obtain case samples based on keyword retrieval.

[0057] The present invention conducts multi-dimensional keyword retrieval in local knowledge bases (such as legal document bases, judgment case bases, academic bases, etc.), combines the weights of different knowledge bases, selects relevant samples and summarizes them. These samples will serve as case texts based on keyword retrieval.

[0058] In one embodiment, obtaining case samples based on keyword retrieval includes: searching the search query in local knowledge bases such as legal document databases, academic article case bases, and judgment case bases, multiplying the preset weights of different knowledge bases by the preset number of samples based on keyword retrieval to select a corresponding number of samples, and finally, aggregating the samples in different knowledge bases to obtain complete case samples based on keyword retrieval.

[0059] Step 2.3: Conduct a web search based on the keyword and the specific element, and generate a case sample generated by summarizing the web search content.

[0060] In one embodiment, the present invention obtains case samples generated by summarizing network search content, including: first using keywords and specific elements as retrieval queries, and embedding the retrieval queries into multiple preset retrieval query templates; then, using the retrieval query templates to conduct a network search to obtain web page information related to the case; then, combining this web page information with the specific elements in the retrieval query to form a second legal case generation prompt template; finally, using the second legal case generation prompt template to input into the case generation model to generate multiple case samples, and aggregating the generated multiple case samples into case samples generated by summarizing network search content.

[0061] Step 2.4: Classify the cases in the case cause knowledge base into concurrent cases and non-concurrent cases according to the case cause names, and extract case samples of concurrent cases and case samples of non-concurrent cases based on the specific elements in the case cause knowledge base.

[0062] In one embodiment, the present invention first divides the causes of action in the knowledge base into concurrent causes of action and non-concurrent causes of action based on the names of the causes of action, then obtains concurrent causes of action related to the cause of action from the cause of action knowledge base, and extracts case samples corresponding to the specific element, or obtains case texts corresponding to elements similar to the specific element, and further screens to obtain case texts of concurrent causes of action, and finally obtains case texts of the same or similar elements under other causes of action (non-concurrent causes of action) based on the specific element, thereby further expanding the diversity of case samples and ensuring that the generated case texts can cover more legal scenarios.

[0063] Among them, screening out case texts of concurrent causes includes: first, sorting the screened case samples by the number of elements in the case samples, and selecting samples above the median for screening. If the total number of samples is small, you can consider retaining all samples. In the end, the number of selected samples does not exceed the preset maximum value (SAMPLE_max). For case samples whose text exceeds the maximum length, the large language model is used to summarize it to ensure that its length meets the preset threshold (L). Obtaining similar elements of specific elements includes: similar elements of specific elements can be other elements of the same level under the same cause, or sub-elements of the same category under different causes. Similar elements are screened out through queries in the knowledge base and combined with the auxiliary judgment of the large language model.

[0064] The case samples for non-concurrent cases are similar to the case texts for concurrent cases and will not be repeated here.

[0065] Step 2.5: Based on the case samples retrieved based on keywords, the case samples generated by summarizing the contents of network searches, the case samples of concurrent cases, and the case samples of non-concurrent cases, the background case text involving the specific elements is obtained.

[0066] In one embodiment, case samples based on keyword retrieval, case samples generated by summarizing online search content, case samples of concurrent cases, and case samples of non-concurrent cases are first clustered and deduplicated, and after redundant text is eliminated based on similarity, a large model is used to assist in determining the compatibility of specific elements with the background case, and background cases that meet the requirements are screened according to preset thresholds.

[0067] Among them, clustering and deduplication include: using the K-Means clustering algorithm, clustering with one-fifth of the number of samples as the number of clusters. If the number of texts in a cluster is less than the preset threshold, all case samples are retained. If it exceeds the threshold, the similarity of the texts in the cluster is calculated, and samples with higher similarity are deleted.

[0068] The method of using a large model to assist in determining the degree of compatibility between a specific element and the background case includes: when there is only one specific element, a fitness calculation is performed by specifying a prompt template, and samples greater than a preset threshold are retained; when there are multiple specific elements, a fitness calculation is performed by specifying a prompt template, and if one or more fitness values ​​of the specific element are higher than the preset threshold, the background sample and the corresponding adapted specific element are retained.

[0069] Step 3: Retrieve the legal definitions and relevant legal provisions involving the specific elements.

[0070] To further ensure the accuracy of the generated case, the present invention also combines the local knowledge base and online search to obtain the legal definition of the specific elements and related legal terms.

[0071] Step 4: Embed specific elements, background case text, and the legal definitions and relevant legal clauses of the specific elements into the first legal case generation prompt template, and generate the target case text based on the large language model.

[0072] The four parts of specific elements, background case text, legal definitions of specific elements and their corresponding legal clauses are integrated into the first legal case generation prompt template, and the final case text containing specific elements is generated using the large language model in the legal field. Then, the specific elements are embedded in the evaluation prompt template, and the generated case text is evaluated for keyword matching, legal feature consistency and plot relevance through the evaluation prompt template, and the evaluation model (model-X) is used to give an evaluation score. Only when the score of the case text is higher than the preset threshold will it be retained as the final case text.

[0073] In summary, the present invention not only significantly improves the adaptability and accuracy of the small model when samples are missing in certain legal situations, but also greatly enhances the quality and diversity of the generated text, providing more solid data support and decision-making assistance for judicial practice. The main application scenarios include but are not limited to case feature recognition, case classification and other tasks.

[0074] Based on the same concept, the present invention also provides a legal case generation device based on large model drive, comprising:

[0075] An element acquisition module, used to acquire specific elements and case names of the case to be generated, wherein the specific elements are determined based on the basic characteristics and legal points of the case to be generated;

[0076] The first search module is used to search for background case texts involving the specific elements and the case name;

[0077] A second search module is used to search for the legal definition and relevant legal clauses of the specific element;

[0078] The case generation module is used to embed the specific elements, background case text, and the legal definitions and relevant legal clauses of the specific elements into the first legal case generation prompt template, and generate the target case text based on the large language model.

[0079] Based on the same concept, the present invention also provides an electronic device, characterized in that the electronic device includes: a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, the above-mentioned legal case generation method driven by a large model is implemented.

[0080] The present invention also provides a computer-readable storage medium on which a computer program is stored, and the computer program implements the steps of the above method when executed by a processor.

[0081] It should be clear that the specific implementation and drawings of the present invention disclosed above are intended to help understand the content of the present invention and implement it accordingly. For those of ordinary skill in the art, it can be understood that various substitutions, changes and modifications are within the scope of the present invention without departing from the principles and spirit of the present invention, and the scope of the present invention is defined by the attached claims and their equivalents.

Claims

1. A method for generating legal cases based on a large model, characterized in that: The method comprises: Obtaining specific elements and a case name of a case to be generated, wherein the specific elements are determined based on basic features and legal points of the case to be generated; Retrieve the background case text related to the specific elements and case name; Search for legal definitions and relevant legal provisions involving the specific elements; Specific elements, background case text, and the legal definitions and relevant legal clauses of the specific elements are embedded into a first legal case generation prompt template, and a target case text is generated based on a large language model.

2. The method according to claim 1, characterized in that: The search involves the background case text of the specific elements and the case name, include: Expanding the specific elements using a large language model to obtain keywords; Based on the keyword, a multi-dimensional search is performed in the local knowledge base to obtain a case sample based on the keyword search; Performing a web search based on the keyword and the specific element to generate a case sample generated by summarizing the web search content; According to the case name, the cases in the case knowledge base are divided into concurrent cases and non-concurrent cases, and in the case knowledge base, case samples of concurrent cases and case samples of non-concurrent cases are extracted based on the specific element; Based on the case samples retrieved based on keywords, the case samples generated by summarizing the contents of a network search, the case samples of concurrent cases and the case samples of non-concurrent cases, a background case text involving the specific elements is obtained.

3. The method according to claim 2, characterized in that The multi-dimensional search is performed in the local knowledge base based on the keyword to obtain case samples based on the keyword search, including: Obtaining a preset number of samples based on keyword retrieval and preset weights of different local knowledge bases to obtain the number of samples selected from each local knowledge base; Based on the keyword, a search is performed in different local knowledge bases, and combined with the number of samples selected from the corresponding local knowledge base, a case sample based on keyword search is obtained.

4. The method according to claim 2, characterized in that: The network search is performed based on the keyword and the specific element to generate a case sample generated by summarizing the network search content, including: Generate a query based on the keyword and the specific element, and embed the query into a plurality of preset query templates; Use the query retrieval template to search the Internet and obtain web page information related to the case; The web page information related to the case and the specific elements are embedded into a second legal case generation prompt template, and a case sample generated by summarizing the network search content is obtained based on a large language model.

5. The method according to claim 2, characterized in that: In the case cause knowledge base, case samples of concurrent case causes and case samples of non-concurrent case causes are extracted based on the specific element, including: Generate similar elements of a specific element; ranking the case sample based on the number of specific elements and / or similar elements of the specific elements in the case sample; Extract case samples of concurrent cases according to the set number of samples to be extracted; when the length of the case samples of the concurrent cases exceeds the maximum set length, summarize the case samples of the concurrent cases using a large language model.

6. The method according to claim 5, characterized in that The generating of similar elements of a specific element comprises: By querying the case knowledge base, other elements of the same level as the specific element under the same case, and sub-elements of elements under different cases, are obtained; wherein the element has the same category as the specific element; The other elements at the same level and / or the sub-element are judged based on the large language model to obtain similar elements of the specific element.

7. The method according to claim 2, characterized in that Based on the case samples retrieved based on keywords, the case samples generated by summarizing the network search content, the case samples of concurrent cases, and the case samples of non-concurrent cases, a background case text involving the specific elements is obtained, including: Clustering the case samples based on keyword retrieval, the case samples generated by summarizing the network search content, the case samples of concurrent cases, and the case samples of non-concurrent cases, and when the number of texts in the cluster is greater than a first preset threshold, performing deduplication processing on the background case samples according to the similarity of the texts in the cluster; For the background case sample after deduplication processing, the large language model is used to calculate the fitness of the background case sample with each specific element, and when the fitness of the background case sample with all specific elements is greater than a second preset threshold, the background case sample is determined to be a background case text involving the specific element.

8. The method according to any one of claims 1 to 7, characterized in that: After the target case text is generated based on the large language model, the method further includes: Embedding the target case text and specific elements into the evaluation prompt template, and calculating the evaluation score of the target case text using the large language model; When the evaluation score is greater than the third preset threshold, the target case text is retained.

9. A legal case generation device based on large model drive, characterized in that: The device comprises: An element acquisition module, used to acquire specific elements and case names of the case to be generated, wherein the specific elements are determined based on the basic characteristics and legal points of the case to be generated; The first search module is used to search for background case texts involving the specific elements and the case name; The second search module is used to search for legal definitions and related legal clauses related to the specific elements; The case generation module is used to embed specific elements, background case text, and the legal definitions and relevant legal clauses of the specific elements into the first legal case generation prompt template, and generate the target case text based on the large language model.

10. An electronic device, characterized in that: The electronic device comprises: a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, the method for generating legal cases based on large model drive as described in any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • Similarity calculation method, clustering method, device, storage medium and electronic device

    CN109101620A

  • Knowledge base knowledge retrieval method based on large language model and related device

    CN117851435A

  • Training method and device for generating large model through characters according to facts

    CN118095443A

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

    CN118260391A

  • Retrieval-Augmented Generation Solution System

    KR102732291B1

Cited By

  • Method and device for generating official document based on large model

    CN120031143A

  • A Document Generation Method and Device Based on Large Models

    CN120031143B