Intelligent law case generation method and system based on large model fine tuning

By fine-tuning the legal field on the large language model and combining vector search and knowledge graph search services, relevant legal entities are recalled to adjust prompt words, the problems of low language professionalism and hallucination phenomena in the generation of the big model in the bill are solved, and the problem of low language professionalism and hallucination phenomena are realized. Generate bills that meet legislative standards and are accurate.

CN119474400APending Publication Date: 2025-02-18SHANGHAI BIG DATA INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411522255.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-29
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

The existing large language model has problems such as low language professionalism, poor command compliance and hallucination in the field of bill generation, which is difficult to ensure the standardization and consistency of writing standards, and it is difficult to avoid the illusion of output content.

Method used

By constructing semantic vectors and knowledge graphs in the legal field, fine-tuning of the big model, and combining vector search services and knowledge graph search services, recall matching legal and regulatory provision entities and associated division of responsibilities and legal responsibility entities, adjust the prompt words to generate Draft legislation.

Benefits of technology

It improves the language professionalism of the big model in the generation of bills, enhances the ability to follow instructions, reduces hallucinations, and ensures that the generated bills meet legislative writing standards and are accurately based on facts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119474400A_ABST
    Figure CN119474400A_ABST
Patent Text Reader

Abstract

The invention provides an intelligent law case generation method and system based on large model fine tuning, and the method comprises the steps: constructing a semantic vector and a law and regulation knowledge graph of original law and regulation data, carrying out the automatic marking of law and regulation target data based on a predetermined large model, and carrying out the fine tuning of the large model according to an automatic marking result. Using a fine-tuning large model to generate initial data of a second legislation element according to data input by a user, constructing a basic cue word, and recalling matched law and regulation article entities and related responsibility division entities and legal responsibility entities based on vector retrieval and graph retrieval; and forming an enhanced cue word, and automatically generating a legislation draft based on the enhanced cue word input fine-tuning large model. The law generated by the fine-tuning large model conforms to the legislation text standard ability, the illusion is reduced, the fact basis is met, and the inference cognitive ability is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of bill generation and large language models, and in particular to a method and system for intelligently generating bills based on large model fine-tuning. Background Art

[0002] Although the large language model (LLM) has outstanding performance in various general capabilities, its underlying technical architecture limits its performance in professional domain knowledge. Currently, there is no solution that effectively combines the fine-tuning of the large language model with the search enhancement solution. Especially in the field of smart legislation, the existing large language models generally have the following problems:

[0003] 1. Non-standardized writing standards: Since the training of general large language models generally uses massive corpus data from forums, web pages, encyclopedias and other fields, the model has a wide and unfixed tone and writing characteristics. In fields such as smart legislation that have extremely high standards for writing, existing solutions are difficult to ensure the standardization and consistency of writing standards.

[0004] 2. The problem of hallucination of output content: The hallucination phenomenon of large language models refers to the phenomenon of generating content that is inconsistent with user input, contradictory to previously generated content, or inconsistent with known world knowledge. Hallucinations are unacceptable in scenarios such as the medical field and the financial field where accuracy is very high. Among the closest similar inventions, there is no method that combines fine-tuning of large language models with fact retrieval enhancement at the same time, which makes it difficult to avoid poor performance of large language models in vertical field question and answering, or the inability to update and maintain field knowledge in a timely manner during actual application, which inevitably leads to hallucinations in the output content.

[0005] 3. Complex instructions are difficult to follow: When the prompt words received by the large model contain relatively complex instruction content, the existing large language model often has poor performance. Specifically, the task details maintained by the user in the prompt words, the format requirements for the output content, the content restrictions, and the specified reference content, etc., are too complex for the large model to guarantee full compliance. Summary of the invention

[0006] Based on the above content, the present invention provides a method and system for intelligent bill generation based on large model fine-tuning, which aims to solve many problems in the prior art such as low language professionalism, poor instruction-following ability, and the existence of hallucinations in the field of bill generation of large language models.

[0007] The present invention provides a method for intelligently generating bills based on large model fine-tuning, comprising:

[0008] Step A1, constructing semantic vectors of original legal and regulatory data and storing them in a legislative data semantic database, and constructing a legal and regulatory knowledge graph using the original legal and regulatory data;

[0009] Step A2, obtaining target data from the original legal and regulatory data, and automatically annotating the target data according to the first legislative element based on a predetermined macro model to obtain an automatic annotation result;

[0010] Step A3, constructing fine-tuning annotation data based on the automatic annotation results, and constructing a fine-tuning dataset based on the fine-tuning annotation data;

[0011] Step A4, fine-tuning the predetermined large model according to the fine-tuning data set to obtain the fine-tuned large model;

[0012] Step A5, obtaining user input data, and using the fine-tuned large model to generate initial data of the second legislative element according to the user input data;

[0013] Step A6, forming integrated data based on the initial data of the second legislative element, and constructing a basic prompt word based on the integrated data;

[0014] Step A7, based on the integrated data, the legislative semantic database and the legal and regulatory knowledge graph, recall the matched legal and regulatory provision entities and the associated division of responsibilities entities and legal liability entities;

[0015] Step A8, adjusting the basic prompt words according to the recall legal and regulatory provisions and the associated division of responsibilities entities and legal liability entities to form enhanced prompt words;

[0016] In step A9, the enhanced prompt words are used as input data for fine-tuning the large model so as to automatically generate a legislative draft using the fine-tuning large model.

[0017] Furthermore, the first legislative element includes the legislative outline element;

[0018] In step A2, the automatic labeling process of legislative outline elements based on the predetermined macro model includes:

[0019] Step C1, segmenting each file in the target data according to chapters to obtain chapter segmentation results;

[0020] Step C2, generating chapter highlights for each chapter in the chapter segmentation result;

[0021] Step C3, splicing the chapter highlights generated for each chapter to form an automatic annotation result of the legislative outline elements of each file in the target data;

[0022] In step A3, the annotation content of the legislative outline elements is formed according to the automatic annotation results and included in the fine-tuning annotation data. The annotation content of the legislative outline elements serves as the input part of the fine-tuning data set.

[0023] Furthermore, the first legislative element includes the legislative clause element;

[0024] In step A2, the automatic annotation process of legislative clause elements based on the predetermined macro model includes:

[0025] Step D1, summarizing the clause contents of each file in the target data to obtain the clause titles;

[0026] Step D2, adding the summarized clause titles to the corresponding clause contents to form an automatic annotation result of the legislative clause elements of each file in the target data;

[0027] In the step A3, the annotation content of the legislative clause elements is formed according to the automatic annotation results and included in the fine-tuning annotation data, and the annotation content of the legislative clause elements serves as the output part of the fine-tuning data set.

[0028] Furthermore, the first legislative element includes the legislative purpose element, the legislative outline element, the legislative basis element and the legislative clause element;

[0029] In step A3, a fine-tuning annotation result is formed according to the automatic annotation result of each document in the target data, and the fine-tuning annotation data is composed of a plurality of fine-tuning annotation results, each of which includes the annotation content of the legislative purpose element, the annotation content of the legislative outline element, the annotation content of the legislative basis element, and the annotation content of the legislative clause element;

[0030] In step A3, the annotation contents of legislative purpose elements are deleted from some of the fine-tuning annotation results in the fine-tuning annotation data, the annotation contents of legislative outline elements are deleted from some of the fine-tuning annotation results in the fine-tuning annotation data, the annotation contents of legislative basis elements are deleted from some of the fine-tuning annotation results in the fine-tuning annotation data, and all the annotation contents in the remaining fine-tuning annotation results in the fine-tuning annotation data are retained to form a fine-tuning data set.

[0031] Furthermore, in step A5, a legislative basis is provided for the user input data based on the legal and regulatory knowledge graph;

[0032] In step A6, integrated data is constructed based on the initial data of the second legislative element and the legislative basis.

[0033] Furthermore, the second legislative element includes the legislative outline element and the legislative purpose element.

[0034] Further, step A7 includes:

[0035] Step A71, using a vector search service to recall legal and regulatory text entities that are semantically similar to the integrated data based on the legislative semantic database;

[0036] Step A72, selecting at least one legal and regulatory provision entity with a high semantic similarity from the recalled legal and regulatory provision entities;

[0037] Step A73, based on the knowledge graph search service, searches the legal and regulatory knowledge graph for the division of responsibilities entities and legal liability entities associated with the screened legal and regulatory provision entities.

[0038] The present invention also provides a bill intelligent generation system based on large model fine-tuning, which is used to implement the aforementioned bill intelligent generation method based on large model fine-tuning, including:

[0039] Vector construction module, used to construct semantic vectors of original legal and regulatory data and store them in the legislative data semantic database;

[0040] A graph construction module is used to construct a legal and regulatory knowledge graph of original legal and regulatory data and store it in a knowledge graph library;

[0041] An automatic labeling module, used to obtain target data from original legal and regulatory data, and automatically label the target data according to the first legislative element based on a predetermined large model to obtain an automatic labeling result;

[0042] A fine-tuning data module is connected to the automatic annotation module and is used to construct fine-tuning annotation data based on the automatic annotation results, and to construct a fine-tuning data set based on the fine-tuning annotation data;

[0043] A fine-tuning training module, connected to the fine-tuning data module, is used to fine-tune the predetermined large model according to the fine-tuning data set to obtain a fine-tuned large model;

[0044] A legislative input module, used to obtain user input data and generate initial data of the second legislative element based on the user input data using a fine-tuned large model;

[0045] An instruction collection module, connected to the legislation input module, is used to form integrated data based on the initial data of the second legislation element, and to construct basic prompt words based on the integrated data;

[0046] The entity search module is connected to the instruction collection module, the legislative data semantic database and the knowledge graph database, and is used to recall the matched legal and regulatory text entities and the associated division of responsibilities entities and legal liability entities based on the integrated data, the legislative semantic database and the legal and regulatory knowledge graph;

[0047] The instruction enhancement module is connected to the instruction collection module and the entity search module respectively, and is used to adjust the basic prompt words according to the recalled legal and regulatory provisions entity and the associated division of responsibilities entity and legal liability entity to form enhanced prompt words;

[0048] The bill generation module is connected to the instruction enhancement module, which is used to use the enhanced prompt words as input data of the fine-tuned large model to automatically generate legislative drafts using the fine-tuned large model.

[0049] Furthermore, the first legislative element includes the legislative outline element, the legislative purpose element and the legislative clause element;

[0050] The second legislative element includes the legislative outline element and the legislative purpose element.

[0051] The beneficial technical effect of the present invention is that the present invention uses legal data in the legal field for annotation and then uses it to fine-tune the big model. According to the fine-tuned big model, some legislative elements are first generated, and reference legal documents are searched out in combination with the vector search service and the knowledge graph search service. The prompt words are enhanced according to the reference legal documents to generate a big language model. Because the big model is fine-tuned by the legal field, the bills generated by the big model meet the legislative writing standard capabilities. The constructed legal and regulatory knowledge graph and legislative material semantic library are used as references for draft generation, which reduces hallucinations, conforms to factual basis, and improves its reasoning and cognitive capabilities. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] Figure 1-4 A flowchart of the steps of a method for intelligently generating bills based on fine-tuning of a large model according to the present invention;

[0053] Figure 5 A schematic diagram of a module for model fine-tuning of a bill intelligent generation system based on large model fine-tuning according to the present invention;

[0054] Figure 6 This is a module diagram of model reasoning for an intelligent bill generation system based on large model fine-tuning of the present invention. DETAILED DESCRIPTION

[0055] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only 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.

[0056] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.

[0057] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments, but they are not intended to limit the present invention.

[0058] See also Figure 1 The present invention provides a method for intelligently generating bills based on large model fine-tuning, comprising:

[0059] Step A1, constructing a legal document semantic vector based on the original legal and regulatory data and storing it in a legislative data semantic library, and constructing a legal and regulatory knowledge graph based on the original legal and regulatory data;

[0060] Step A2, obtaining target data from the original legal and regulatory data, and automatically annotating the target data according to the first legislative element based on a predetermined macro model to obtain an automatic annotation result;

[0061] Step A3, constructing fine-tuning annotation data based on the automatic annotation results, and constructing a fine-tuning dataset based on the fine-tuning annotation data;

[0062] Step A4, fine-tuning the predetermined large model according to the fine-tuning data set to obtain the fine-tuned large model;

[0063] Step A5, obtaining user input data, and using the fine-tuned large model to generate initial data of the second legislative element according to the user input data;

[0064] Step A6, forming integrated data based on the initial data of the second legislative element, and constructing a basic prompt word based on the integrated data;

[0065] Step A7, based on the integrated data, the legislative semantic database and the legal and regulatory knowledge graph, recall the matched legal and regulatory provision entities and the associated division of responsibilities entities and legal liability entities;

[0066] Step A8, adjusting the basic prompt words according to the recall legal and regulatory provisions and the associated division of responsibilities entities and legal liability entities to form enhanced prompt words;

[0067] In step A9, the enhanced prompt words are used as input data for fine-tuning the large model so as to automatically generate a legislative draft using the fine-tuning large model.

[0068] The present invention uses the legal data in the legal field to mark and then fine-tune the big model. According to the fine-tuned big model, some legislative elements are first generated, and the reference legal documents are searched out in combination with the vector search service and the knowledge graph search service. The prompt words are enhanced according to the reference legal documents, thereby generating a large language model. Because the big model is fine-tuned with the legal field, the bill generated by the big model meets the legislative writing standard capabilities. The constructed legal knowledge graph and legislative data semantic library are used as references for draft generation, reducing hallucinations, conforming to factual basis, and improving its reasoning and cognitive ability. The laws of the present invention include laws, regulations, and rules, which are formal documents with legal effect formulated and issued by legislative organs, administrative organs or judicial organs. Regulations are, for example, administrative regulations and local regulations. The original legal and regulatory data contains legal documents such as laws, regulations, and rules.

[0069] Specifically, the present invention focuses on drafting local regulations, so the target data can be local regulatory documents, and the fine-tuning large model is more suitable for drafting local regulatory documents. Therefore, as a preferred embodiment, the target data can be local regulatory documents in the original legal and regulatory data, etc.

[0070] Make the bills generated by the big model meet the legislative writing standards. For example, the bills of local regulations generally cover four parts: general provisions, detailed rules, legal responsibilities, and annexes. The general provisions need to clarify the purpose and divide the responsibilities of each committee and office. The detailed rules need to be divided into chapters according to different businesses. Legal responsibilities need to be divided into administrative penalties, civil, and criminal, and the overall content needs to be detailed and solid.

[0071] In the overall text of the bill, the division of responsibilities of commissions and offices in the general provisions, the clauses in the management rules, and the rationality and authenticity of the related statements of legal responsibilities all put forward low hallucination requirements for the big model. The division of responsibilities of commissions and offices and legal responsibilities can be searched and enhanced in the form of legal and regulatory knowledge graphs RAG to reduce hallucinations and improve their reasoning and cognitive abilities. To address the hallucination problem of the big model, we use the technical solution of the retrieval enhancement engine (RAG), which uses vector search services at the bottom layer to recall legal and regulatory text entities, and uses knowledge graph retrieval services to recall entities such as reference legal responsibilities and division of responsibilities of commissions and offices, so as to enhance the prompt words of the big model.

[0072] Specifically, in step A1, original legal and regulatory data is obtained from a national legal and regulatory database, a national regulations database, or the like.

[0073] Specifically, in step A2, when the target data is obtained from the original legal and regulatory data for fine-tuning the large model, the target data is cleaned and the data that does not meet the data quality standards is removed. For example, if only the legislative draft of local regulations is generated, the following data is removed:

[0074] Non-local regulations, that is, regulations at the national level or other levels that do not belong to the local level;

[0075] Irregular chapter and article structure, that is, regulations that do not follow the traditional chapter, section, article, and clause structure;

[0076] The chapter title is inaccurate, that is, the title content is inconsistent with the chapter text;

[0077] Regulation type mismatch: The regulation type stated in the regulation does not match its actual type.

[0078] The target data obtained after cleaning is combined with the training data generation solution of instruction set semi-supervised annotation to achieve fine-tuning of all parameters of the large model. The fine-tuned model has the ability to output high-quality legal and regulatory texts from the bottom up.

[0079] The writing standards for the legislative draft generation of the present invention may include:

[0080] (1) General Provisions: generally include the purpose of legislation, legislative basis, definition and interpretation of the subject matter, scope of application, division of responsibilities of various commissions and offices, and basic principles.

[0081] (2) Management details: This part specifies various systems and measures. It is usually divided into multiple chapters according to the actual business situation. The relevant chapters are not only rich and detailed in terms of content, but may also be broken down to specific items.

[0082] (3) Legal liability: This section specifies the legal consequences of violations of regulations. This section should clearly define the specific legal liabilities, including civil, administrative and criminal liabilities, to ensure the enforcement and binding force of the regulations.

[0083] Further, in step A2, the first legislative element includes a legislative purpose element;

[0084] In step A3, the annotation content of the legislative purpose element is formed according to the automatic annotation result of the legislative purpose element, and the fine-tuning annotation data includes the annotation content of the legislative purpose element;

[0085] The annotation content of the legislative purpose elements serves as the input of the fine-tuning dataset.

[0086] See also Figure 2 , further, the first legislative element includes the legislative outline element;

[0087] In step A2, the automatic labeling process of legislative outline elements based on the predetermined macro model includes:

[0088] Step C1, segmenting each file in the target data according to chapters to obtain chapter segmentation results;

[0089] Step C2, generating chapter highlights for each chapter in the chapter segmentation result;

[0090] Step C3, splicing the chapter highlights generated for each chapter to form an automatic annotation result of the legislative outline elements of each document in the target data;

[0091] In step A3, the annotation content of the legislative outline elements is formed according to the automatic annotation results and included in the fine-tuning annotation data. The annotation content of the legislative outline elements serves as the input part of the fine-tuning data set.

[0092] Specifically, when the target data is a local regulation, the file in the target data refers to an original local regulation.

[0093] The legislative outline extracted by the big model includes the text structure information such as chapters, sections, articles, and clauses. Then, according to the chapter segmentation of the document, the content of each chapter is generated into key points through the big model. The key point information is used to prompt the main content that needs to be involved in the chapter content generated by the big model. Subsequently, the above content is spliced ​​and organized to form the automatic annotation result of the legislative outline elements. When fine-tuning, the prompt word input is, for example: "The current task goal is: generate a legislative draft. Please conceive an article: Labor Contract Regulations of a Certain Province, the legislative framework includes: Chapter 1 General Provisions 1. Key Point 1 2. Key Point 2... Chapter 4 Legal Liability 1. Key Point 1 2. Key Point 2 3. Key Point 3".

[0094] See also Figure 3 , further, the first legislative element includes the legislative clause element;

[0095] In step A2, the automatic annotation process of legislative clause elements based on the predetermined macro model includes:

[0096] Step D1, summarizing the clause contents of each file in the target data to obtain the clause titles;

[0097] Step D2, adding the summarized clause titles to the corresponding clause contents to form an automatic annotation result of the legislative clause elements;

[0098] In step A3, the annotation content of the legislative clause elements is formed according to the automatic annotation results and included in the fine-tuning annotation data, and the annotation content of the legislative clause elements serves as the output part of the fine-tuning data set.

[0099] The macro model summarizes the content of each clause paragraph to form a clause title (referred to as clause title). For example, for a certain bill fragment: "Article 2 Employment and employment promotion related activities within the administrative area of ​​this city shall be subject to this regulation." The annotation content after the clause title is generated is: "Article 2 (Scope of application of the law) Employment and employment promotion related activities within the administrative area of ​​this city shall be subject to this regulation." Adding clause titles allows the macro model to be able to summarize the legal clauses after fine-tuning.

[0100] A possible automatic annotation prompt word instruction text of the present invention is as follows: "Your task is to generate legal provisions according to user prompts. Now you have three types of tasks, namely generating legislative purposes, generating legislative outlines, and generating legislative drafts. The first task is to generate legislative purposes, which indicates the purpose of writing the bill. The second task is to generate legislative outlines, which refers to the outline generated by the entire bill and must be generated strictly in accordance with the outline. The third task is to generate legislative drafts. Note: The legislative draft needs to include the following parts: 1. Legislative outline, which refers to the outline generated by the entire bill. 2. Legislative purpose, which indicates the purpose of writing the bill. 3. Legislative basis, which indicates the superior legal basis of the bill, which is reflected in the first article in the general provisions."

[0101] User prompts are, for example, the type of legislation to be extracted. For example, in the large model generated by fine-tuning the application of local regulations, the type of legislation extracted is local regulations. According to the automatic annotation prompts, specific types of target data are extracted from the original legal and regulatory data, and the extraction of the three tasks is continued, namely, the legislative purpose, legislative outline, and legislative clauses.

[0102] In addition, the first legislative element also includes the legislative basis element. The legislative basis element in the target data is directly extracted for annotation, and the legislative basis is integrated into the fine-tuning data set to ensure that the legislative draft intelligently generated by the fine-tuned large model complies with the provisions of the superior law.

[0103] Furthermore, the first legislative element includes the legislative purpose element, the legislative outline element, the legislative basis element and the legislative clause element;

[0104] In step A3, the automatic annotation results of each document in the target data form a fine-tuning annotation result, and the fine-tuning annotation data is composed of a plurality of fine-tuning annotation results, each of which includes the annotation content of the legislative purpose element, the annotation content of the legislative outline element, the annotation content of the legislative basis element, and the annotation content of the legislative clause element;

[0105] In step A3, the annotation contents of legislative purpose elements are deleted from some of the fine-tuning annotation results in the fine-tuning annotation data, the annotation contents of legislative outline elements are deleted from some of the fine-tuning annotation results in the fine-tuning annotation data, the annotation contents of legislative basis elements are deleted from some of the fine-tuning annotation results in the fine-tuning annotation data, and all the annotation contents in the remaining fine-tuning annotation results in the fine-tuning annotation data are retained to construct a fine-tuning dataset.

[0106] In order to prevent the large model from overfitting to the text format after fine-tuning, we use partial masking to delete some chapters or legislative purposes from a small part of the regulatory text used for fine-tuning training, so as to enhance the generalization performance of the model. Deletion refers to deletion of all, and reduction refers to subtracting some content.

[0107] Specifically, each set of fine-tuned annotation data also includes the legislative basis for inclusion.

[0108] Preferably, in step A3, each piece of fine-tuned annotation data corresponds to an original document, and the legal and regulatory provisions entity, responsibility division entity, and legal division entity of the corresponding original document are added to the fine-tuned annotation data, with the purpose of allowing the large model to associate with a small amount of relevant information after training. In the actual reasoning process, that is, in step A7, multiple legal and regulatory provision entities can be recalled, and then the graph searches for the responsibility division entity and legal liability entity associated with multiple legal and regulatory provision entities, and the input prompt words are strengthened, so that the large model will have a better performance in associating and generating legislative drafts.

[0109] Specifically, in step A3, some of the fine-tuning annotation results in the fine-tuning annotation data are deleted in the form of legal and regulatory text entities, responsibility division entities, and legal division entities, so as to enhance the generalization performance of the model.

[0110] The present invention uses a large model fine-tuning instruction set automatic annotation method based on semi-supervised technology to automatically annotate from the original national legal and regulatory corpus and other data to construct an instruction training set containing legislative purpose, legislative basis, and legislative outline. The present invention combines the instruction text, the input text enhanced with entity information, and the clause text with the addition of clause labels into the training set data (fine-tuning data set) to fully fine-tune the large language model. The fine-tuned large model will have the ability to follow a variety of complex instructions.

[0111] Furthermore, in step A5, a legislative basis is provided for the user input data based on the legal and regulatory knowledge graph;

[0112] In step A6, integrated data is constructed based on the initial data of the second legislative element and the legislative basis.

[0113] Furthermore, the second legislative element includes the legislative outline element and the legislative purpose element.

[0114] Specifically, in step A5, the fine-tuned large language model generates initial data of legislative outline elements and legislative purpose elements based on user input data, and recommends legislative basis using the legal and regulatory knowledge graph. On the application side, users are supported to manually intervene to modify the legislative purpose and initial content of the legislative outline generated by the large model, as well as to modify the legislative basis recommended by the legal and regulatory knowledge graph, so that the fine-tuned large model automatically generates legislative drafts that better meet user expectations.

[0115] See also Figure 4 , further, step A7 comprises:

[0116] Step A71, using a vector search service to recall legal and regulatory text entities that are semantically similar to the integrated data based on the legislative semantic database;

[0117] Step A72, selecting at least one legal and regulatory provision entity with a high semantic similarity from the recalled legal and regulatory provision entities;

[0118] Step A73, based on the knowledge graph search service, searches the legal and regulatory knowledge graph for the division of responsibilities entities and legal liability entities associated with the screened legal and regulatory provision entities.

[0119] In step A1, chapter learning is performed on the original legal and regulatory data, i.e., legislative materials such as laws, regulations, national rules, and local regulations. The content of each document is broken down into sentences, and the titles and clauses are embedded as semantic vectors as legal and regulatory text entities using a vector model. The semantic vectors are stored in the legislative material semantic library in the form of semantic vectors for subsequent vector search service searches. In step A71, when the upstream inputs the basic prompt word instruction, the vector search service recalls the legal and regulatory text entities in the national legal and regulatory library that are highly similar in semantics based on the legislative theme in the prompt word. The legal and regulatory text entities of the present invention refer to the substantive contents such as titles and clauses of laws, regulations, and rules.

[0120] In step A1, entities and relationships are extracted from databases such as the legal and regulatory database and the national regulations database based on a predetermined large language model and prompt word engineering to form nodes and edges of the knowledge graph. The legal and regulatory text entities are used as core nodes, and different relationships (superior laws, equivalent laws, subordinate laws, guidance relationships with commission entities, division of responsibilities, and definition of legal responsibilities, etc.) are represented through edge connections. Thus, a legal and regulatory knowledge graph is constructed. In step A71, after the vector search service recalls the matching legal and regulatory text entities, the knowledge graph retrieval service is used to associate the division of responsibilities of each commission entity with the legal and regulatory text entities, as well as the legal liability entities such as criminal, civil, and administrative penalties that can be referenced.

[0121] In step A8, the recalled legal and regulatory provisions entity, the division of responsibilities entity and the legal liability entity are integrated into the basic prompt words, and the basic prompt words are enhanced to obtain enhanced prompt words to solve the illusion problem caused by the lack of relevant information.

[0122] Specifically, in step A72, during screening, the entities of legal and regulatory provisions may be ranked according to semantic similarity, and the entities of legal and regulatory provisions ranked in the top several in semantic similarity may be extracted.

[0123] Specifically, in step A2, the present invention sets automatic annotation prompt words and uses a predetermined large model to perform information extraction and automatic annotation, obtains automatic annotation results, analyzes the automatic annotation results, screens out automatic annotation results whose annotation quality does not meet the predetermined standards, and then performs manual correction, optimizes the automatic annotation prompt words according to the manual correction results, and realizes automated data set annotation after multiple rounds of iterations.

[0124] Specifically, in step A3, in the process of forming the fine-tuning dataset, in order to ensure that the fine-tuning large model not only has professional text output capabilities in the field of smart legislation but also does not lose normal interaction capabilities, a certain proportion of general fine-tuning expected datasets are additionally added to the fine-tuning dataset.

[0125] See also Figure 5-6 The present invention also provides a bill intelligent generation system based on large model fine-tuning, which is used to execute the aforementioned bill intelligent generation method based on large model fine-tuning, including:

[0126] A vector construction module (1) is used to construct a legal document semantic vector based on the original legal and regulatory data and store it in a legislative document semantic library (2);

[0127] A graph construction module (3) is used to construct a legal and regulatory knowledge graph based on the original legal and regulatory data and store it in a knowledge graph library (4);

[0128] An automatic annotation module (5) is used to obtain target data from the original legal and regulatory data, and automatically annotate each legal document in the target data according to the first legislative element based on a predetermined macro model to obtain an automatic annotation result;

[0129] A fine-tuning data module (6), connected to the automatic annotation module (5), is used to construct fine-tuning annotation data based on the automatic annotation result, and to construct a fine-tuning data set based on the fine-tuning annotation data;

[0130] A fine-tuning training module (7), connected to the fine-tuning data module (6), is used to fine-tune the predetermined large model according to the fine-tuning data set to obtain a fine-tuned large model;

[0131] A legislative input module (8), used to obtain user input data and generate initial data of the second legislative element based on the user input data using the deployed fine-tuned large model;

[0132] An instruction collection module (9), connected to the legislation input module (9), is used to form integrated data based on the initial data of the second legislation element, and to construct a basic prompt word based on the integrated data;

[0133] An entity search module (10) is connected to the instruction collection module (9), the legislative data semantic database (2) and the knowledge graph database (4) respectively, and is used to recall the matched legal and regulatory text entities and the associated division of responsibilities entities and legal liability entities based on the integrated data, the legislative semantic database and the legal and regulatory knowledge graph;

[0134] The instruction enhancement module (11) is connected to the instruction collection module (9) and the entity search module (10) respectively, and is used to adjust the basic prompt words according to the recalled legal and regulatory provisions entity and the associated division of responsibilities entity and legal liability entity to form enhanced prompt words;

[0135] The bill generation module (12) is connected to the instruction enhancement module (11) and is used to use the enhanced prompt words as input data for fine-tuning the large model, and the fine-tuning large model automatically generates a legislative draft.

[0136] Furthermore, the first legislative element includes the legislative outline element, the legislative purpose element, the legislative basis element and the legislative clause element;

[0137] The second legislative element includes the legislative outline element and the legislative purpose element.

[0138] Preferably, the present invention is dedicated to the intelligent generation of legislative drafts of local regulations. Therefore, when fine-tuning the large model, local regulations are specifically extracted for automatic annotation to construct a fine-tuning data set. The present invention achieves the effect of "legal language" in the output content of the model through regulatory data cleaning and full data fine-tuning. Specifically, the local regulations output by the model will cover chapters such as general provisions, detailed rules, legal responsibilities, and annexes, and each chapter will be divided into parts such as legislative purpose, legislative basis, business details, criminal or civil liability, etc. The content is detailed and the writing logic is rigorous.

[0139] Through the search enhancement engine, it is possible to build the knowledge base of legislative facts and bill texts respectively through knowledge graph and vector retrieval.

[0140] Through the instruction training set labeling solution, we have solved the problem of the general large language model's weak ability to follow complex instructions in legislative scenarios. After the user manually intervenes in the legislative purpose, legislative basis, legislative outline, and reference documents, the large model still follows the complex instructions and generates content around the legislative outline.

[0141] The above are only preferred embodiments of the present invention, and are not intended to limit the implementation methods and protection scope of the present invention. Those skilled in the art should be aware that all solutions obtained by equivalent substitutions and obvious changes made using the description and illustrations of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for intelligent bill generation based on large model fine-tuning, characterized in that: include: Step A1, constructing semantic vectors of original legal and regulatory data and storing them in a legislative data semantic database, and constructing a legal and regulatory knowledge graph of the original legal and regulatory data; Step A2, extracting target data from the original legal and regulatory data, and automatically annotating the target data according to the first legislative element based on a predetermined macro model to obtain an automatic annotation result; Step A3, constructing fine-tuning annotation data based on the automatic annotation result, and constructing a fine-tuning data set according to the fine-tuning annotation data; Step A4, fine-tuning the predetermined large model according to the fine-tuning data set to obtain a fine-tuned large model; Step A5, obtaining user input data, and using the fine-tuned large model to generate initial data of the second legislative element according to the user input data; Step A6, forming integrated data based on the initial data of the second legislative element, and constructing basic prompt words based on the integrated data; Step A7, based on the integrated data, the legislative semantic database and the legal and regulatory knowledge graph, recall the matched legal and regulatory text entities and the associated division of responsibilities entities and legal liability entities; Step A8, adjusting the basic prompt words according to the recalled legal and regulatory provision entity and the associated division of responsibilities entity and legal liability entity to form enhanced prompt words; Step A9, using the enhanced prompt words as input data of the fine-tuned large model to automatically generate a legislative draft using the fine-tuned large model.

2. The method for intelligently generating bills based on large model fine-tuning according to claim 1, characterized in that: The first legislative elements include legislative outline elements; In the step A2, the automatic labeling process of the legislative outline elements based on the predetermined macro model includes: Step C1, dividing each file in the target data into chapters to obtain a chapter division result; Step C2, generating chapter highlights for each chapter in the chapter segmentation result; Step C3, splicing the chapter highlights generated for each chapter to form an automatic annotation result of the legislative outline elements of each document in the target data; In step A3, the annotation content of the legislative outline elements is formed according to the automatic annotation results and included in the fine-tuning annotation data, and the annotation content of the legislative outline elements serves as the input part of the fine-tuning data set.

3. The method for intelligently generating bills based on large model fine-tuning as claimed in claim 1, characterized in that: The first legislative element includes legislative clause elements; In step A2, the automatic labeling process of the legislative clause elements based on the predetermined macro model includes: Step D1, summarizing the clause contents of each file in the target data to obtain clause titles; Step D2, adding the summarized clause title to the corresponding clause content to form an automatic annotation result of the legislative clause elements; In the step A3, the annotation content of the legislative clause elements is formed according to the automatic annotation result and included in the fine-tuning annotation data, and the annotation content of the legislative clause elements serves as the output part of the fine-tuning data set.

4. The method for intelligently generating bills based on large model fine-tuning according to claim 1, characterized in that: The first legislative elements include legislative purpose elements, legislative outline elements, legislative basis elements and legislative clause elements.

5. The method for intelligently generating bills based on large model fine-tuning as claimed in claim 4, characterized in that: In the step A3, the automatic annotation result of each document in the target data forms a fine-tuning annotation result, and the fine-tuning annotation data is composed of a plurality of the fine-tuning annotation results, each of which includes the annotation content of the legislative purpose element, the annotation content of the legislative outline element, the annotation content of the legislative basis element, and the annotation content of the legislative clause element; In step A3, the annotation content of the legislative purpose element is deleted from part of the fine-tuning annotation results in the fine-tuning annotation data, the annotation content of the legislative outline element is deleted from part of the fine-tuning annotation results in the fine-tuning annotation data, the annotation content of the legislative basis element is deleted from part of the fine-tuning annotation results in the fine-tuning annotation data, and all the annotation contents in the fine-tuning annotation results of the remaining part of the fine-tuning annotation data are retained to construct the fine-tuning dataset.

6. The method for intelligently generating bills based on large model fine-tuning according to claim 1, characterized in that: In the step A5, a legislative basis is also provided for the user input data based on the legal and regulatory knowledge graph; In the step A6, the integrated data is constructed based on the initial data of the second legislative element and the legislative basis.

7. The method for intelligently generating bills based on large model fine-tuning according to claim 1, characterized in that: The second legislative elements include legislative outline elements and legislative purpose elements.

8. The method for intelligently generating bills based on large model fine-tuning according to claim 1, characterized in that: The step A7 comprises: Step A71, using a vector search service to recall legal and regulatory text entities that are semantically similar to the integrated data based on the legislative semantic database; Step A72, selecting at least one legal and regulatory provision entity with a high semantic similarity from the recalled legal and regulatory provision entities; Step A73, based on the knowledge graph search service, searches the legal and regulatory knowledge graph for the division of responsibilities entities and legal liability entities associated with the screened legal and regulatory provision entities.

9. A bill intelligent generation system based on large model fine-tuning, characterized in that: A method for intelligently generating a bill based on large model fine-tuning as described in any one of claims 1 to 8, comprising: Vector construction module, used to construct semantic vectors of original legal and regulatory data and store them in the legislative data semantic database; A graph construction module, used to construct a legal and regulatory knowledge graph of the original legal and regulatory data and store it in a knowledge graph library; An automatic labeling module, used for acquiring target data from the original legal and regulatory data, and automatically labeling the target data according to the first legislative element based on a predetermined macro model to obtain an automatic labeling result; A fine-tuning data module, connected to the automatic annotation module, configured to construct fine-tuning annotation data based on the automatic annotation result, and to construct a fine-tuning data set according to the fine-tuning annotation data; A fine-tuning training module, connected to the fine-tuning data module, used to fine-tune the predetermined large model according to the fine-tuning data set to obtain a fine-tuned large model; A legislation input module, used to obtain user input data, and use the fine-tuned large model to generate initial data of the second legislation element according to the user input data; An instruction collection module, connected to the legislation input module, for forming integrated data based on the initial data of the second legislation element, and constructing basic prompt words based on the integrated data; An entity search module, connected to the instruction collection module, the legislative data semantic database and the knowledge graph database, respectively, for recalling matched legal and regulatory text entities and associated division of responsibilities entities and legal liability entities based on the integrated data, the legislative semantic database and the legal and regulatory knowledge graph; an instruction enhancement module, connected to the instruction collection module and the entity search module respectively, for adjusting the basic prompt words according to the recalled legal and regulatory provision entity and the associated division of responsibilities entity and legal liability entity to form enhanced prompt words; The bill generation module is connected to the instruction enhancement module and is used to use the enhanced prompt words as input data of the fine-tuning large model and automatically generate a legislative draft using the fine-tuning large model.

10. The intelligent bill generation system based on large model fine-tuning as claimed in claim 9, characterized in that: The first legislative elements include legislative outline elements, legislative purpose elements, legislative basis elements and legislative clause elements; The second legislative elements include legislative outline elements and legislative purpose elements.