Method for training small parameter model for automatic analysis of electric power contract terms and computing device

By converting the power contract data into a standardized paragraph list and using the combination of large language model and small parameter model for automatic analysis, the problems of low accuracy and low efficiency of clause analysis in traditional methods are solved, and efficient and accurate extraction and analysis of power contract clauses are achieved.

CN119830003APending Publication Date: 2025-04-15NANJING LINGSHU INTELLIGENT TECHNOLOGY CO LTD
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202411796359.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-09
Publication Date
2025-04-15

AI Technical Summary

Technical Problem

The traditional method of analyzing power contract terms relies on manual review and matching traditional rules, which has problems such as low accuracy, low efficiency, high cost and difficulty in dealing with complex semantic and non-standardized expressions.

Method used

By obtaining contract data and preprocessing it, it is converted into a standardized paragraph list, using a large language model to analyze the paragraph list, outputting the annotated structured data set as training data, and then fine-tuning the small parameter model to obtain the fine-tuning model for automatically analyzing the contract terms.

Benefits of technology

It improves the accuracy and efficiency of clause extraction, greatly reduces calculation costs, enhances field adaptability, and can quickly adapt to the terms changes and new contract types in the power industry, providing innovative solutions for smart contract management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119830003A_ABST
    Figure CN119830003A_ABST
Patent Text Reader

Abstract

The invention provides a method for training a small parameter model for automatic analysis of electric power contract terms and a computing device, and the method comprises the steps: obtaining contract data, carrying out the preprocessing of the contract data, and converting the contract data into a standardized paragraph list; analyzing the standardized paragraph list through a large language model, and outputting a labeled structured data set as training data; fine tuning training is conducted on the small-parameter model through the training data, the fine-tuned small-parameter model is obtained, and the fine-tuned small-parameter model outputs clause classification labels and extracted clause key fields in the reasoning stage according to the input unlabeled contract paragraph text. According to the technical scheme of the invention, the clause extraction precision and efficiency can be improved, the calculation cost can be greatly reduced, the field adaptability can be enhanced, the clause change and the newly added contract type of the power industry can be quickly adapted, and an innovative solution can be provided for intelligent contract management.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the fields of electric power and artificial intelligence, and in particular to a method and computing device for training a small parameter model for automatic parsing of electric power contract clauses. Background Art

[0002] Power industry contracts are important legal documents that ensure the smooth progress of power transactions, project construction and equipment procurement. Their terms are complex and diverse, covering payment terms, performance guarantees, breach of contract liability and other aspects. Clear interpretation of contract terms and early identification of potential risks are of great significance to reducing corporate legal risks and improving contract management efficiency. However, traditional methods of contract terms interpretation have many shortcomings and are in urgent need of technological innovation.

[0003] At present, the analysis of power contract clauses mainly relies on manual review and traditional rule matching methods. Manual review relies on the experience of legal and business experts. Although it can accurately identify key clauses and potential risks, it has the problems of high cost and low efficiency, and is often unable to cope with massive contracts. The traditional rule matching method uses pre-defined templates and keywords to identify clauses, which makes it difficult to handle complex semantic variants and non-standard expressions in contracts. For example, some contract clauses may use obscure language or industry-specific terms, and traditional methods are prone to omissions or errors.

[0004] To this end, a technical solution is needed that can improve the accuracy and efficiency of clause extraction, significantly reduce computing costs, enhance domain adaptability, quickly adapt to changes in clauses and new contract types in the power industry, and provide innovative solutions for smart contract management. Summary of the invention

[0005] The present invention aims to provide a method and computing equipment for training a small parameter model for automatic parsing of power contract terms, which can improve the accuracy and efficiency of clause extraction, significantly reduce computing costs, enhance domain adaptability, quickly adapt to changes in terms and new contract types in the power industry, and provide innovative solutions for intelligent contract management.

[0006] According to one aspect of the present invention, a method for training a small parameter model for automatic parsing of power contract terms is provided, the method comprising:

[0007] Obtain contract data and perform preprocessing to convert the contract data into a standardized paragraph list;

[0008] Parsing the standardized paragraph list through a large language model, and outputting annotated structured data set as training data;

[0009] The small parameter model is fine-tuned using the training data to obtain a fine-tuned small parameter model, wherein the fine-tuned small parameter model outputs clause classification labels and extracted clause key fields according to the input unlabeled contract paragraph text in the inference stage.

[0010] The final extraction result is obtained and outputted.

[0011] According to some embodiments, obtaining contract data and preprocessing the contract data to convert the contract data into a standardized paragraph list includes:

[0012] Convert the contract data in multiple formats into structured data that can be processed later;

[0013] The contract data is parsed and uniformly stored in a standardized plain text format.

[0014] According to some embodiments, the standardized paragraph list is parsed by a large language model to output a labeled structured data set as training data, including:

[0015] Dividing the contract data into paragraphs through the data input module;

[0016] Inputting the segmented contract data into the large language model for parsing segment by segment;

[0017] The contract data is processed in multiple sections in parallel while retaining contextual information between clauses in the contract data.

[0018] According to some embodiments, the standardized paragraph list is parsed by a large language model to output a labeled structured data set as training data, further comprising:

[0019] The large language model cross-checks the identified key terms according to the specific logical relationship of the contract data;

[0020] A confidence score is provided for the identified key terms, and uncertain terms are marked for manual review.

[0021] According to some embodiments, the annotation data includes: clause type and its classification label, extracted clause core content and corresponding original paragraph text and context.

[0022] According to some embodiments, fine-tuning the small parameter model using the training data includes:

[0023] Insert a low-rank matrix into the attention layer of the small-parameter model, and the initial parameter values ​​are randomly distributed;

[0024] During fine-tuning training, only the weights of the low-rank matrix are updated, and the remaining model parameters remain frozen;

[0025] The weights of the low-rank matrix are adjusted to learn domain-specific terms for classification and content extraction tasks.

[0026] According to another aspect of the present invention, there is provided a method for automatically parsing power contract clauses using a small parameter model, wherein the small parameter model is trained using any of the methods described above, and the method comprises:

[0027] Obtain contract data and pre-process it;

[0028] Inputting the preprocessed contract data into a small parameter model;

[0029] The final extraction result is obtained and output, wherein the clause classification is presented in a highlighted and / or grouped form, and the final extraction result is displayed side by side with the original contract data. The final extraction result is manually verified and adjusted and then stored as feedback information.

[0030] According to another aspect of the present invention, a system for extracting key terms of an electricity contract is provided, the system comprising:

[0031] A data input module, which is used for inputting contract data and converting the format of contract data;

[0032] A large language model clause extraction module, wherein the large language model clause extraction module uses a large language model to identify key clauses in the contract data and generates annotation data;

[0033] A small model fine-tuning module, which uses the labeled data to perform fine-tuning optimization and efficient analysis based on a small parameter model;

[0034] A clause classification and content extraction module, which is used to perform accurate clause classification and content extraction;

[0035] The result output and user feedback module is used to output the final extraction result.

[0036] According to another aspect of the present invention, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the method as described above is implemented.

[0037] According to another aspect of the present invention, there is provided a computing device, comprising:

[0038] Processor; and

[0039] A memory stores a computer program, and when the computer program is executed by the processor, the method described in any one of the above items is implemented.

[0040] According to an embodiment of the present invention, contract data is obtained and preprocessed, the contract data is converted into a standardized paragraph list, the standardized paragraph list is parsed using a large language model, annotated structured data sets are output as training data, and the small parameter model is fine-tuned using the training data to obtain a fine-tuned small parameter model. The fine-tuned small parameter model outputs clause classification labels and extracted clause key fields according to the input unlabeled contract paragraph text in the inference stage, obtains the final extraction result and outputs the final extraction result. The present invention combines large language models with small model fine-tuning, and each module cooperates with each other, which can improve the accuracy and efficiency of clause extraction, significantly reduce computing costs, enhance domain adaptability, and quickly adapt to clause changes and new contract types in the power industry, providing innovative solutions for intelligent contract management.

[0041] According to some embodiments, the present invention uses a large language model for preliminary extraction of power contract terms to generate high-quality annotated data, and then uses a small parameter model for fine-tuning. Based on an efficient parsing method combining a large model with a small model, efficient resource utilization and accurate term extraction are combined.

[0042] According to some embodiments, the domain-specific clause parsing capability is achieved by fine-tuning the model through domain corpus for the professional terms and complex semantic structures in power contracts, improving the understanding and extraction capabilities of industry-specific clauses and addressing the shortcomings of traditional general models in industry adaptability.

[0043] According to some embodiments, the present invention uses dynamic learning and continuous optimization mechanisms to achieve incremental updates of the model through user feedback and newly added contract data, so that it can quickly adapt to changes in clause formats and newly added risk types, ensuring the long-term reliability of the parsing effect. The semantic understanding ability of the large language model and the efficient computing ability of the small model are used to significantly improve the parsing accuracy of key contract clauses.

[0044] According to some embodiments, by training on specialized data of the power industry, the present invention can accurately identify and extract the core terms and key information in power contracts, effectively meeting the needs of the industry. It supports dynamic learning and lightweight deployment, can quickly adapt to changes in terms and new contract types in the power industry, and provide innovative solutions for smart contract management.

[0045] According to some embodiments, the present invention realizes accurate extraction of contract terms, utilizes the strong semantic understanding ability of the large language model, initially extracts the key terms in the contract through design, combines with the fine-tuned small language model to improve domain adaptability, and comprehensively analyzes the key information implicit in the contract text.

[0046] According to some embodiments, the present invention effectively improves model efficiency and deployment convenience by generating labeled data using a large model and fine-tuning based on a small model, thereby achieving efficient resource utilization and lightweight deployment, and reducing the computing cost and complexity of the system.

[0047] According to some embodiments, the present invention enhances dynamic learning capabilities, provides a model incremental update mechanism, continuously optimizes model performance through user feedback and newly added contract samples, and ensures that the system can dynamically adapt to changes in industry needs.

[0048] It is to be understood that the foregoing general description and the following detailed description are exemplary only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for describing the embodiments are briefly introduced below.

[0050] Figure 1 A flow chart illustrating training a small parameter model for automatic parsing of power contract terms according to an example embodiment is shown.

[0051] Figure 2 A schematic diagram showing a system for extracting key terms of a power contract according to an example embodiment is shown.

[0052] Figure 3 A schematic diagram showing an overall technical architecture design according to an example embodiment.

[0053] Figure 4 A block diagram of a computing device is shown according to an exemplary embodiment. DETAILED DESCRIPTION

[0054] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that the present invention will be comprehensive and complete and fully convey the concepts of the example embodiments to those skilled in the art. The same reference numerals in the figures represent the same or similar parts, and thus their repeated description will be omitted.

[0055] In addition, the described features, structures or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present invention. However, those skilled in the art will appreciate that the technical solution of the present invention can be practiced without one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known methods, devices, implementations or operations are not shown or described in detail to avoid blurring various aspects of the present invention.

[0056] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0057] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.

[0058] It should be understood that although the terms first, second, third, etc. may be used herein to describe various components, these components should not be limited by these terms. These terms are used to distinguish one component from another component. Therefore, the first component discussed below can be referred to as the second component without departing from the teachings of the present inventive concept. As used herein, the term "and / or" includes any one of the associated listed items and all combinations of one or more.

[0059] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in the present invention are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0060] Those skilled in the art will appreciate that the drawings are merely schematic diagrams of example embodiments, and the modules or processes in the drawings are not necessarily necessary for implementing the present invention, and therefore cannot be used to limit the protection scope of the present invention.

[0061] In the power industry, contract terms are an important basis for corporate transactions and legal protection. Their content is complex and highly professional. Existing contract terms parsing methods have many technical difficulties and problems in practical applications. The expression of power contract terms is often non-standardized. The same term may use different wording or obscure expressions, which makes it difficult for traditional methods based on template matching or keyword search to accurately extract key information. In addition, common professional terms and long-tail terms in contracts need to be understood in context, and existing parsing technologies are insufficient in semantic understanding. Although current natural language processing technology has made great progress, general pre-trained language models are mainly trained on general domain data, lack the ability to learn specific corpus for the power industry, and are difficult to effectively identify the categories and key contents of industry-specific terms. In particular, in the face of complex power contract structures, existing models cannot flexibly adapt to industry needs. Large language models have large-scale parameters and high computing resource requirements, which limit their wide application in actual scenarios. In particular, when enterprises deal with massive contracts, high computing power dependence significantly increases deployment costs and maintenance difficulties. The terms and contents of power contracts continue to evolve with market changes and policy adjustments. Existing methods usually use static models, which are difficult to quickly adapt to new contract terms formats or emerging risk types. This lack of adaptability may lead to a decrease in the timeliness and accuracy of the terms analysis results.

[0062] In recent years, with the rapid development of natural language processing (NLP) technology, text analysis methods based on deep learning models have gradually been applied to the field of contract parsing. In particular, large language models have shown strong semantic understanding capabilities and can process unstructured contract texts more accurately. However, most existing methods still have many problems. For example: lack of industry-specific optimization, general language models have limited performance in power industry contracts, and it is difficult to handle industry-specific terms and complex clause semantics; high computational costs, large parameter models require high computing power support in practical applications, and it is difficult to meet the needs of enterprises for low-cost and efficient processing; insufficient dynamic adaptability, existing methods are difficult to dynamically adjust the parsing model according to changes in new contracts or clause formats.

[0063] Existing technologies attempt to improve parsing efficiency by fine-tuning language models to adapt to specific domain tasks, or by using transfer learning methods. However, they still fail to achieve efficient and accurate parsing of power contract terms, especially when dealing with scenarios with large contracts and highly complex terms.

[0064] To this end, the present invention proposes a method and computing equipment for training a small parameter model for automatic parsing of power contract clauses, which can improve the accuracy and efficiency of clause extraction, significantly reduce computing costs, enhance domain adaptability, and quickly adapt to changes in clauses and new contract types in the power industry, providing innovative solutions for intelligent contract management.

[0065] Exemplary embodiments of the present invention are described below with reference to the accompanying drawings.

[0066] Figure 1 A flow chart illustrating training a small parameter model for automatic parsing of power contract terms according to an example embodiment is shown.

[0067] See also Figure 1 ,In S101, the contract data is obtained and preprocessed to convert the contract data into a standardized paragraph list.

[0068] According to some embodiments, the contract data in multiple formats are converted into structured data for subsequent processing; and the contract data are parsed and uniformly stored in a standardized plain text format.

[0069] According to some embodiments, the data input module supports multi-format data parsing. The data input module supports multiple contract formats, including PDF, Word, and plain text files. For PDF files, a dedicated parsing tool, such as PDFMiner, PyPDF, etc., is used to extract text content. For Word files, a library that processes document data, such as python-docx, is used to achieve fast text extraction. Contract texts of all formats are uniformly stored in a standardized plain text format after parsing.

[0070] The data input module usually organizes the contract text into chapters or clause paragraphs. Regular expressions are used to identify common delimiters in the contract, such as "Article 1", "1.1", etc., to achieve preliminary segmentation. Paragraph semantic detection is performed based on the language model to ensure that each segmented text has semantic integrity. In order to improve the efficiency of subsequent model parsing, the module normalizes the contract text, including: removing irrelevant characters, such as headers, footers, blank lines, etc.; unifying the format, such as the expression of time, amount, and percentage; eliminating common errors, such as garbled characters caused by encoding problems. In addition to the main text, the module also extracts basic meta-information of the contract, such as the contract name, signing date, and parties involved. This information will be input into the subsequent large language model as auxiliary context to improve the accuracy of clause extraction.

[0071] After being processed by the data input module, the contract text is converted into a standardized list of paragraphs, each of which contains the following structured information: paragraph number, paragraph text content, and related context information, such as the chapter title. The data input module ensures efficient processing and unified format of contract data, and provides standardized data input for subsequent clause parsing and extraction.

[0072] In S103, the standardized paragraph list is parsed by a large language model, and a labeled structured data set is output as training data.

[0073] According to some embodiments, the contract data is segmented into paragraphs; the segmented contract data is input into the large language model in the large language model clause extraction module for parsing; multiple segments of the contract data are processed in parallel, while retaining the contextual information between clauses in the contract data. The large language model cross-checks the identified key clauses based on the specific logical relationship of the contract data; provides confidence scores for the identified key clauses, and marks clauses with uncertainty for manual review.

[0074] According to some embodiments, the intelligent agent Prompt is the core of the large language model to efficiently complete tasks. The Prompt used in the present invention has been designed and optimized, and the large language model clause extraction module has designed several types of Prompts based on the characteristics of the power contract.

[0075] Task-defined prompts are used to clarify the task objectives of the model. For example, the following clauses in the text are divided into categories, such as payment terms, performance terms, and breach of contract liability terms, and the core content of each category of clauses is extracted. The format of the task-defined prompt is:

[0076] Enter text: [Contract paragraph]

[0077] Output format:

[0078] -Term Type: [type]

[0079] -Terms: [Extracted core content]

[0080] Context-enhanced Prompt is used to provide contract context information, such as contract name, parties involved, etc., as supplementary input to help the model better understand the text. The Prompt design has been optimized through multiple rounds of experiments to ensure the accuracy and versatility of the model in clause extraction.

[0081] After the contract text is divided into paragraphs by the data input module, it is input into the large language model for parsing paragraph by paragraph. To improve processing efficiency, the large language model clause extraction module supports batch input, and processes multiple paragraphs of text in parallel by blocks, while retaining the contextual information between clauses. The large language model classifies the clause type of each paragraph of text based on the Prompt instruction, such as payment clauses, performance clauses, breach of contract liability clauses, etc., and extracts its key content. The model can accurately identify implicit or complex clauses through a deep understanding of the text context.

[0082] For the extraction results, the model will perform cross-checks based on the specific logical relationships of the power contract, such as the payment terms are usually associated with the amount, to reduce the possibility of erroneous or missed extractions. At the same time, it will provide a confidence score and mark the terms that may have uncertainty for manual review.

[0083] The output of the large language model clause extraction module is a high-quality structured dataset. Each record includes: clause type and its classification label, extracted clause core content, corresponding contract paragraph text, and confidence score.

[0084] According to some embodiments, the clause type and its classification label, the extracted clause core content and the corresponding original paragraph text and context.

[0085] The large language model clause extraction module generates annotated data sets and eventually outputs structured annotated data, including clause type, classification label, extracted clause core content, and original paragraph text and context. These output results can be used directly in contract management applications or as training data for fine-tuning of small language models to ensure performance improvement and lightweight deployment of subsequent modules. Through the large language model clause extraction module, the present invention can achieve accurate parsing of contract texts and quickly build a high-quality training data set for domain fine-tuning.

[0086] In S105, the small parameter model is fine-tuned using the training data to obtain a fine-tuned small parameter model, wherein the fine-tuned small parameter model outputs clause classification labels and extracted clause key fields according to the input unlabeled contract paragraph text in the inference stage.

[0087] According to some embodiments, a low-rank matrix is ​​inserted into the attention layer of the small-parameter model, and the initial parameter values ​​are randomly distributed; during fine-tuning training, only the weights of the low-rank matrix are updated, and the remaining model parameters remain frozen; the weights of the low-rank matrix are adjusted to learn domain-specific term classification and content extraction tasks.

[0088] The input data of the small model fine-tuning module is high-quality structured annotated data generated by the large language model clause extraction module, which is used for domain fine-tuning of the small model. Each piece of data includes: input text, the original text of the contract paragraph; output label, the corresponding clause type, such as payment clause, performance clause, etc.; extraction content, key fields in the clause, such as amount, date, performance method, etc.; verification data, randomly extracted data from unseen power contracts, as a verification set, used to evaluate the generalization performance of the model.

[0089] The model of the small model fine-tuning module uses the open source small parameter model (QWen1.5-14B) as the base model. These models have moderate parameter amounts, which can adapt to domain tasks and are easy to deploy in an enterprise environment. The pre-trained weights are loaded and most of the model parameters are frozen. Only the parameters of the long-range radio technology (LoRA) adapter are open for update to ensure that basic language knowledge is retained.

[0090] LoRA reduces the number of parameters that need to be updated during fine-tuning by inserting low-rank matrices in the attention layer of the model, thereby achieving efficient domain adaptation. Low-rank matrices are inserted into the attention layer of the pre-trained language model, and the initial parameter values ​​are randomly distributed; only the weights of these low-rank matrices are updated, and the remaining model parameters remain frozen; during the fine-tuning process, the weights of LoRA are adjusted to learn domain-specific clause classification and content extraction tasks. Based on the input contract paragraph, the classification label of the clause is predicted; key fields related to classification in the contract paragraph, such as amount, fulfillment period, etc., are located and extracted.

[0091] The small model in the small model fine-tuning module needs to be trained. First, set the hyperparameters and choose a smaller learning rate to stabilize and optimize the LoRA weights. Set the batch size according to the hardware resources; adjust the number of epochs according to the convergence of the model, usually 3-5 rounds.

[0092] The model is trained multiple times using the training dataset. In each round of training, the contract paragraph text and its annotation information are input. The model outputs the classification results and key field extraction, and the classification accuracy is evaluated by calculating the cross entropy loss function. The weights of LoRA are dynamically adjusted to optimize the model performance and reduce misclassification and information omission.

[0093] After each round of training, the model classification accuracy and the precision and recall of key field extraction are tested with the validation set. After training is completed, the model performance is tested with unseen data, and the results of term classification and content extraction are output, and the causes of errors are analyzed to further optimize the model.

[0094] In the training phase, each training sample includes input text, i.e., contract paragraphs; output labels, i.e., clause classification types; and extracted content as corresponding key fields. The predicted classification labels and extracted content are output and compared with the labeled data to calculate the loss value.

[0095] In the inference stage, the input is the unlabeled contract paragraph text. The prediction results output in the inference stage include: clause classification labels, such as payment clauses, breach of contract liability clauses, etc.; extracted clause key fields, such as amount, performance time, liquidated damages, etc.

[0096] According to some embodiments, the input of the clause classification and content extraction module is the contract text that has been data preprocessed and segmented, and each paragraph of text provides the following information: paragraph text, paragraph-level content of the contract, without annotated clause type or structure information; contextual information, including the title and chapter titles of the contract, which serves as auxiliary information to enhance the model's understanding of the text context.

[0097] The fine-tuned large language model with small parameters is used to complete the task of clause classification and content extraction. The model analyzes the paragraph text through contextual semantics and generates clause classification results. Using the generative ability of the language model, the model directly outputs the clause type to which the paragraph belongs, for example:

[0098] Sample output:

[0099] Term Type: Payment Terms

[0100] Core content: This paragraph describes how and when payment will be made.

[0101] Based on the classification, the model further extracts key fields in the text. For example, for "payment terms", the amount, payment time, etc. are extracted; for "breach of contract terms", the default amount, liability terms, etc. are extracted. The generated output format is as follows:

[0102] Term Type: Payment Terms

[0103] Extract fields:

[0104] -Amount: 5 million yuan

[0105] - Payment time: within 30 days after signing the contract

[0106] The module uses context to enhance the reasoning ability of the model. For example, in paragraphs involving multiple clause types, the model dynamically adjusts the reasoning results through the contract chapter titles and historical text content to ensure the accuracy of classification and extraction. For complex paragraphs or long texts, the model supports multiple rounds of interactive generation, that is, after a round of output classification results, the key fields are further refined and extracted. Through context tracking, the model can correct possible classification errors, for example, the same paragraph belongs to multiple clause types at the same time. The model output results are logically verified using rules or specific templates. For example: check whether the extracted amount field is within the overall contract amount range; whether there are logical errors in the payment time. The output results are stored in a structured format, such as JSON or a table, for direct call by the subsequent contract management system.

[0107] The input of the clause classification and content extraction module is the original unlabeled contract text at the paragraph level, context information, such as the contract chapter title, previous and next related paragraphs, etc. The output is the clause classification result and content extraction result, that is, the clause type label corresponding to each paragraph of text, such as payment terms, performance terms, etc. For the classified paragraphs, the key field information is extracted and output in a structured format. For example:

[0108] {

[0109] "Terms Type":"Payment Terms",

[0110] "Extract Fields":{

[0111] "Amount":"5 million yuan",

[0112] "Payment time": "Within 30 days after signing the contract"

[0113] }

[0114] }

[0115] According to some embodiments, the clause classification is presented in the form of highlighting and / or grouping; the final extraction result is displayed side by side with the original contract data to facilitate user verification; the final extraction result is stored as feedback information after manual verification and adjustment.

[0116] The result output and user feedback module outputs structured results and formats the classification and extraction results into standardized structured data for subsequent management and analysis. The output results support multiple formats, including: table format, such as Excel or CSV, where each row represents a clause paragraph, and columns contain information such as clause type, extracted fields, and original text; JSON format, suitable for docking with other systems or application scenarios, containing key-value pairs of clause type and extracted fields, for example:

[0117] {

[0118] "Paragraph number":1,

[0119] "Terms Type":"Payment Terms",

[0120] "Extract Fields":{

[0121] "Amount":"5 million yuan",

[0122] "Payment time": "Within 30 days after signing the contract"

[0123] },

[0124] "Original text": "Party B shall pay Party A RMB 5 million within 30 days after the signing of the contract."

[0125] }

[0126] The result output and user feedback module provides an intuitive user interface for displaying classification and extraction results. The terms classification is presented in the form of highlighted marks or groups, and the extracted fields are displayed side by side with the original text for easy user verification. It supports interactive editing of field types and values.

[0127] The result output and user feedback module provides a user feedback mechanism, and users can manually check and adjust the extraction results. For example: correct the classification label. If the classification is wrong, the user can directly reselect the correct term type; modify the extraction field. The user can edit or supplement the missing field information.

[0128] The edited data is stored as feedback information for subsequent model optimization. The system records the comparison between the original model output and the user's modified results, the user's specific modification operations and reasons, etc. The collected feedback data will be merged with the original annotated data for continuous fine-tuning and optimization of the model to improve its adaptability to new contract samples. Based on user feedback, the module supports dynamic adjustment of the confidence threshold or extraction strategy of the output results to further improve the accuracy of automated processing.

[0129] The input of the result output and user feedback module is the result of the clause classification and content extraction module, including classification labels, extracted fields and original text. User feedback data includes the results after user verification or editing. The output includes result display, that is, the clause classification and extracted fields displayed in the visual interface; structured data, standardized output format; feedback data, including user verification or editing results stored as incremental data.

[0130] The present invention is based on an efficient parsing method that combines large models with small models. The large language model is used for the preliminary extraction of power contract terms, and high-quality annotated data is generated through Prompt. Then, the small parameter model is used for fine-tuning to achieve a combination of efficient resource utilization and accurate clause extraction. In view of the professional terminology and complex semantic structures in power contracts, the model is fine-tuned through domain corpus to improve the understanding and extraction capabilities of industry-specific clauses, and address the shortcomings of traditional general models in industry adaptability. Incremental updates of the model are achieved through user feedback and newly added contract data, so that it can quickly adapt to changes in clause formats and new risk types, ensuring the long-term reliability of the parsing effect.

[0131] Figure 2 A schematic diagram showing a system for extracting key terms of a power contract according to an example embodiment is shown.

[0132] See also Figure 2 , Figure 2 The components of the power contract key clause extraction system are shown. The system modules include: data input module, large language model clause extraction module, small model fine-tuning module, clause classification and content extraction module, and result output and user feedback module.

[0133] Data input module, which is used for inputting contract data and converting the format of contract data. The data input module is the first step of the present invention, and is responsible for converting the multi-format power contract text into a standardized data structure for subsequent processing. The design goal of this module is to achieve efficient parsing, paragraph segmentation and text normalization of the contract content, laying the foundation for the subsequent clause extraction task.

[0134] Large language model clause extraction module, the large language model clause extraction module uses a large language model to identify key clauses in the contract data and generate annotated data. The large language model clause extraction module is a key component of the present invention, which uses a large-parameter pre-trained language model (QWen2.5-72B) to perform in-depth analysis and clause extraction on the power contract text. This module combines the domain-specific prompt design to identify and extract key clauses from the contract text, laying the foundation for subsequent model fine-tuning and clause classification.

[0135] A small model fine-tuning module, which uses the annotated data to perform fine-tuning optimization and efficient parsing based on a small parameter model. The small model fine-tuning module is one of the core technologies of the present invention, and aims to achieve accurate classification and content extraction of power contract terms by performing efficient domain-specific fine-tuning of a large language model with small parameters. This module introduces LoRA (low-rank adapter) technology, which makes the fine-tuning process efficient and resource-efficient, while retaining the model's general language understanding capabilities, ultimately achieving lightweight deployment and adapting to the actual needs of power contract parsing.

[0136] The clause classification and content extraction module is used to perform accurate clause classification and content extraction. The clause classification and content extraction module realizes semantic parsing and key content extraction of the power contract text based on the fine-tuned small parameter language model. This module uses the strong semantic understanding ability of the language model to automatically classify the contract paragraphs into corresponding clause types through overall analysis, and further extracts the key fields of the clauses from the text to generate structured output results.

[0137] The result output and user feedback module is used to output the final extraction results. The result output and user feedback module is the final processing and optimization link of the present invention, which is responsible for converting the results of the contract clause classification and key content extraction module into a format that is easy to understand and operate, and provides a user interaction interface for checking, editing and feedback of the extraction results, thereby forming a closed loop of continuous model optimization.

[0138] The present invention improves the accuracy and efficiency of clause extraction, and utilizes the semantic understanding ability of a large language model and the efficient computing power of a small model to significantly improve the accuracy of parsing key contract clauses while significantly reducing computing costs. Enhanced domain adaptability. Through training on specialized data for the power industry, the present invention can accurately identify and extract core clauses and key information in power contracts, effectively meeting industry needs. The present invention improves the flexibility and scalability of the system. The present invention supports dynamic learning and lightweight deployment, and can quickly adapt to changes in clauses and new contract types in the power industry, providing innovative solutions for smart contract management.

[0139] Figure 3 A schematic diagram showing an overall technical architecture design according to an example embodiment.

[0140] See also Figure 3 , Figure 3 Shows the design of the overall technical architecture of the system.

[0141] The data input module supports the input of multiple contract data formats, including PDF, Word, and plain text. For scanned contracts, the module integrates OCR technology to convert the contract content into structured text and pre-process the contract paragraphs for subsequent processing.

[0142] The large language model clause extraction module uses the powerful context understanding ability of the large language model (QWen2.5-72B) to quickly identify key clauses in the contract through carefully designed prompts and generate preliminary annotation data. This module is responsible for processing complex semantics and professional terms to ensure high accuracy and coverage of preliminary extraction.

[0143] The small model fine-tuning module uses the annotated data generated in the first phase to perform fine-tuning and optimization based on a small parameter model (such as LLaMA-2 or other open source models), efficiently parses specific contract terms in the power industry, and adapts to actual business needs.

[0144] The clause classification and content extraction module performs accurate clause classification and content extraction. The extraction results are classified according to clause type and stored in a structured form.

[0145] The result output and user feedback module provides clear extraction result output (such as table or JSON format), and supports user editing and feedback on the results, forming a data closed loop for continuous optimization of model performance.

[0146] This architecture realizes an efficient processing flow from contract input to accurate extraction of terms, combining semantic understanding capabilities and efficient use of computing resources.

[0147] Figure 4 A block diagram of a computing device is shown according to an exemplary embodiment.

[0148] like Figure 4 As shown, computing device 30 includes processor 12 and memory 14. Computing device 30 may also include bus 22, network interface 16, and I / O interface 18. Processor 12, memory 14, network interface 16, and I / O interface 18 may communicate with each other via bus 22.

[0149] The processor 12 may include one or more general-purpose CPUs (Central Processing Units, processors), microprocessors, or application-specific integrated circuits, etc., for executing relevant program instructions. According to some embodiments, the computing device 30 may also include a high-performance graphics card (GPU) 20 for accelerating the processor 12.

[0150] The memory 14 may include a machine system readable medium in the form of a volatile memory, such as a random access memory (RAM), a read-only memory (ROM) and / or a cache memory. The memory 14 is used to store one or more programs including instructions and data. The processor 12 can read the instructions stored in the memory 14 to execute the above-mentioned method according to the embodiment of the present invention.

[0151] The computing device 30 may also communicate with one or more networks via the network interface 16. The network interface 16 may be a wireless network interface.

[0152] The bus 22 may include an address bus, a data bus, a control bus, etc. The bus 22 provides a path for exchanging information between components.

[0153] It should be noted that, in the specific implementation process, the computing device 30 may also include other components necessary for normal operation. In addition, those skilled in the art may understand that the above device may only include components necessary for implementing the embodiments of this specification, and need not include all components shown in the figure.

[0154] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of the above method when executed by a processor. The computer-readable storage medium may include, but is not limited to, any type of disk, including a floppy disk, an optical disk, a DVD, a CD-ROM, a microdrive, and a magneto-optical disk, a ROM, a RAM, an EPROM, an EEPROM, a DRAM, a VRAM, a flash memory device, a magnetic card or an optical card, a nanosystem (including a molecular memory IC), a network storage device, a cloud storage device, or any type of medium or device suitable for storing instructions and / or data.

[0155] An embodiment of the present invention further provides a computer program product, which includes a computer program. The computer program is operable to enable a computer to execute part or all of the steps of any one of the methods described in the above method embodiments.

[0156] Those skilled in the art can clearly understand that the technical solution of the present invention can be implemented with the help of software and / or hardware. "Unit" and "module" in this specification refer to software and / or hardware that can independently complete or cooperate with other components to complete specific functions, where the hardware can be, for example, a field programmable gate array, an integrated circuit, etc.

[0157] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described action sequence, because according to the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.

[0158] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0159] In the several embodiments provided by the present invention, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some service interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.

[0160] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0161] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0162] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or the whole or part of the technical solution can be embodied in the form of a software product, which is stored in a memory and includes several instructions for a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the methods of various embodiments of the present invention.

[0163] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0164] The exemplary embodiments of the present invention are specifically shown and described above. It should be understood that the present invention is not limited to the detailed structures, configurations or implementations described herein; on the contrary, the present invention is intended to cover various modifications and equivalent configurations included in the spirit and scope of the appended clauses.

Claims

1. A method for training a small parameter model for automatic parsing of power contract terms, the method comprising: Obtain contract data and perform preprocessing to convert the contract data into a standardized paragraph list; Parsing the standardized paragraph list through a large language model, and outputting annotated structured data set as training data; The small parameter model is fine-tuned using the training data to obtain a fine-tuned small parameter model, wherein the fine-tuned small parameter model outputs clause classification labels and extracted clause key fields according to the input unlabeled contract paragraph text in the inference stage.

2. The method according to claim 1, characterized in that: Obtain contract data and perform preprocessing to convert the contract data into a standardized paragraph list, including: Convert the contract data in multiple formats into structured data that can be processed later; The contract data is parsed and uniformly stored in a standardized plain text format.

3. The method according to claim 1, characterized in that The standardized paragraph list is parsed by a large language model, and a labeled structured data set is output as training data, including: dividing the contract data into paragraphs; Inputting the segmented contract data into the large language model for parsing segment by segment; The contract data is processed in multiple sections in parallel while retaining contextual information between clauses in the contract data.

4. The method according to claim 1, characterized in that: The standardized paragraph list is parsed by a large language model to output a labeled structured data set as training data, which also includes: The large language model cross-checks the identified key terms according to the specific logical relationship of the contract data; A confidence score is provided for the identified key terms, and uncertain terms are marked for manual review.

5. The method according to claim 1, characterized in that The annotation data includes: clause type and its classification label, extracted clause core content and corresponding original paragraph text and context.

6. The method according to claim 1, characterized in that The small parameter model is fine-tuned using the training data, including: Insert a low-rank matrix into the attention layer of the small-parameter model, and the initial parameter values ​​are randomly distributed; During fine-tuning training, only the weights of the low-rank matrix are updated, and the remaining model parameters remain frozen; The weights of the low-rank matrix are adjusted to learn domain-specific terms for classification and content extraction tasks.

7. A method for automatically parsing power contract clauses using a small parameter model, wherein the small parameter model is trained using the method according to any one of claims 1 to 6, the method comprising: Obtain contract data and pre-process it; Inputting the preprocessed contract data into a small parameter model; The final extraction result is obtained and output, wherein the clause classification is presented in a highlighted and / or grouped form, and the final extraction result is displayed side by side with the original contract data. The final extraction result is manually verified and adjusted and then stored as feedback information.

8. A system for extracting key terms of an electricity contract, the system comprising: A data input module, which is used for inputting contract data and converting the format of contract data; A large language model clause extraction module, wherein the large language model clause extraction module uses a large language model to identify key clauses in the contract data and generates annotation data; A small model fine-tuning module, which uses the labeled data to perform fine-tuning optimization and efficient analysis based on a small parameter model; A clause classification and content extraction module, which is used to perform accurate clause classification and content extraction; The result output and user feedback module is used to output the final extraction result.

9. A computer program product, characterized in that The method comprises a computer program, which implements the method according to any one of claims 1 to 7 when being executed by a processor.

10. A computing device, characterized in that include: processor; as well as A memory storing a computer program, wherein when the computer program is executed by the processor, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Automatic accounting entry compiling method and system based on large language model

    CN120013696A

  • Contract processing method and device based on intelligent agent

    CN120975983A

  • Contract element extraction method and related device

    CN121542444A

  • A contract element extraction method and related device

    CN121542444B