Business contract risk intelligent review method and system based on large-scale language model

The intelligent review method for business contract risks based on large-scale language models solves the problems of traditional tools in processing complex contract languages ​​and rule base updates, achieves more efficient and accurate risk identification and assessment, reduces costs and human errors, and ensures Standardization and compliance of contract reviews.

CN118747904APending Publication Date: 2024-10-08ECCOM NETWORK SYST CO LTD

Patent Information

Application Number
CN202410893322.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-04
Publication Date
2024-10-08

AI Technical Summary

Technical Problem

Traditional rule-based business contract risk detection tools are difficult to deal with ambiguous or complex contract language, and the quality and completeness of the rule base directly affect the effectiveness of the tool, and may miss key risk points, especially when the external environment changes. Fast case.

Method used

Adopt a business contract risk intelligent review method based on a large-scale language model. By clarifying the risk review requirement boundaries, we build a BRAT text annotation platform, train semantic related models and language models, design independent command templates, and use command engineering technology and efficient parameter fine-tuning methods. , to achieve risk identification and assessment of contract texts.

Benefits of technology

It improves the efficiency and accuracy of business contract risk review, reduces human errors, reduces reliance on legal professionals, ensures the standardization and compliance of contract review, and significantly improves the review efficiency and accuracy of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118747904A_ABST
    Figure CN118747904A_ABST
Patent Text Reader

Abstract

The invention provides an intelligent business contract risk review method and system based on a large-scale language model, and the method comprises the steps: determining a demand boundary of risk review, and determining a risk type needing to be recognized; extracting text information from the contract file; establishing a BRAT text labeling platform, and labeling by taking a single contract document as a basic labeling unit and taking a paragraph object as a minimum labeling unit; training a semantic correlation model; designing an independent instruction template for each risk rule; training a language model base; and after training of the semantic correlation model and the language model is completed, risk review is performed on the contract. According to the method, human errors are reduced, and errors and omission caused by the fact that manual examination is prone to being influenced by factors such as fatigue and distraction are avoided. According to the method, human errors can be reduced, and the consistency and accuracy of examination are 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 natural language processing, and in particular to a method and system for intelligent review of business contract risks based on a large-scale language model. Background Art

[0002] Intelligent review of business contract risk refers to the process of automatically identifying and evaluating risks in business contracts using artificial intelligence technology, text analysis and processing, and other advanced data science technologies. A complete intelligent review system for business contract risk usually has the following features: 1) Risk rule base, which is based on the knowledge and experience of legal experts and business operators. The system analyzes the content of the contract according to these rules to identify potential risks. 2) Document processing unit, contract files are usually stored in file formats such as PDF and DOCX. It is necessary to extract contract text information from the format file and perform text cleaning. 3) Risk identification unit, which is the core unit of the system and is used to evaluate whether the contract text triggers risks in the risk rule base. 4) Return interactive reports, the system usually provides interactive reports that make it easy for legal advisors and non-legal professionals to understand the risk points in the contract. These reports may include risk summaries, highlighting of key terms, and recommended steps. 5) High review efficiency; compared with manual review, intelligent review can process a large number of contracts faster and reduce the possibility of human errors. It can work 24 / 7 uninterruptedly to improve the speed and consistency of review. 6) Continuous optimization: As the market and legal environment changes, the intelligent review system needs to constantly learn and adapt to new risk factors.

[0003] For the core module of risk assessment, the traditional implementation method usually implements risk detection in the form of rule base + rule engine. The rule base contains a series of pre-defined rules based on laws, regulations, industry standards and internal corporate policies. The rules can be simple keyword matching or more complex logical judgments to identify specific terms, conditions or risk points in the contract. The rule engine is the component that executes the rules, which is responsible for applying the rules in the rule base to the contract text. The rule engine usually has the ability to handle logical operations, conditional judgments and pattern matching. When the contract content matches the rules in the rule base, the rule engine triggers corresponding actions, such as warnings, suggestions or marking risks. The limitation of the rule-based approach is that the quality and completeness of the rules directly affect the effectiveness of the tool. If the rule base is not comprehensive enough or cannot be updated in time to reflect the latest changes in the external environment, the tool may miss key risk points. In addition, rule-based automation tools may have difficulty handling ambiguous or complex contract language.

[0004] The intelligent review of business contract risks based on large-scale language models is a method that has emerged in recent years with the development of artificial intelligence technology. This method uses natural language processing (NLP) technology in deep learning, especially large-scale pre-trained language models, such as the GPT series models and BERT, to improve the automation level of contract risk review. Compared with traditional methods, large-scale language models are significantly better than rule-based implementation methods in terms of risk identification accuracy and robustness through general pre-training and supervised fine-tuning. Summary of the invention

[0005] In view of the defects in the prior art, the purpose of the present invention is to provide a method and system for intelligent review of business contract risks based on a large-scale language model.

[0006] According to the present invention, a business contract risk intelligent review method based on a large-scale language model includes:

[0007] Step S1: Clarify the required boundaries of risk review and determine the types of risks that need to be identified;

[0008] Step S2: extracting text information from the contract document;

[0009] Step S3: Build the BRAT text annotation platform, take a single contract document as the basic annotation unit, and use the paragraph object as the smallest annotation unit for annotation;

[0010] Step S4: training a semantic correlation model;

[0011] Step S5: Design an independent instruction template for each risk rule;

[0012] Step S6: training the language model base;

[0013] Step S7: After the semantic correlation model and language model training is completed, the contract is reviewed for risks.

[0014] Preferably, in step S1:

[0015] Clarify the boundaries of risk review requirements and determine the types of risks that need to be identified, including adverse conditions in contract terms, legal compliance issues, and financial risks; collect relevant legal texts, industry standards, company policies, and risk cases in previous business contracts, extract risk rules from them, create a risk rule library, and adjust the risk rule library according to the external environment;

[0016] In step S2:

[0017] Collect historical contract documents, convert contract documents in various formats into unified format files, determine the type of text objects, extract format information, extract text information from contract documents, and filter invalid information including pictures, comments, website links, contract orders, corporate logos and corporate seals.

[0018] Preferably, in step S3:

[0019] Conduct unified training for annotation personnel and clarify annotation standards; build a BRAT text annotation platform, with a single contract document as the basic annotation unit and a paragraph object as the smallest annotation unit;

[0020] The annotation process involves the following situations:

[0021] The paragraph text has no semantic correlation with any risk rule in the risk rule library, so no special annotation is required in this case;

[0022] The paragraph text has a semantic correlation relationship with several risk rules in the risk rule library, but the risk rules are not triggered. In this case, several types of semantic correlation relationship tags are marked for the paragraph text;

[0023] The paragraph text and several risk rules in the risk rule library not only have semantic correlation, but also trigger the risk rules. In this case, several types of risk triggering tags are marked for the paragraph object;

[0024] After BRAT annotation is completed, the annotation data is exported and organized into semantically related annotation datasets and risk-triggered annotation datasets.

[0025] Preferably, in step S4:

[0026] Select the base model and use the Encoder in the transformer architecture as the base model, including BERT and RoBERTa; embed the manually annotated semantically relevant annotation dataset into the instruction template set, and the template format of the instruction template set is: whether {contract text} has a semantically relevant relationship with {risk rule};

[0027] The contract text is replaced with a specific contract paragraph text object, and the risk rules are replaced with a risk rule object;

[0028] The stochastic gradient descent method is used for parameter fine-tuning training, and the training goal is to minimize the cross entropy loss. When calculating the loss function, the positive samples are weighted. After the training is completed, the model weight with the highest accuracy is saved. After the semantic relevance model training is completed, for each contract text paragraph, the semantic model predicts the relevance of the contract text with all risk rules. At this time, there are two situations: if the contract text is not relevant to all risk rules, the contract text will not be used as the output of the large-scale language model for further risk identification and assessment; if the contract text is related to at least one risk rule, the contract text and the related risk rules will be further sent to the large-scale language model to determine whether the contract text triggers specific risk rules.

[0029] Preferably, in step S5:

[0030] Risk rules are different, and the risk items triggered are different. Using instruction engineering technology, an independent instruction template is designed for each risk rule. The instruction template is designed according to the following steps:

[0031] Step S5.1: Select a large-scale language model base;

[0032] Step S5.2: For each risk rule, select a subset of rights annotations under the risk rule from the risk trigger annotation data set as an evaluation set to verify the effect of the instruction;

[0033] Step S5.3: adjust the instruction template, collect the prediction results of the base model, and calculate the quantitative indicators accuracy, recall rate and precision;

[0034] Repeat steps S5.1 to S5.3 in sequence until the quantitative evaluation index converges, and save the instruction template set.

[0035] Preferably, in step S6:

[0036] The large-scale language model base is trained in an efficient parameter fine-tuning method, including LORA and P-Tuning V2. The contract paragraph text and risk rules in the risk trigger annotation dataset are embedded into the corresponding instruction template to generate instructions. The instructions are input into the base language model for prediction. The cross entropy loss is calculated based on the prediction results of the large-scale language model and the real manual annotation labels, and the parameters are updated. This iteration is carried out until the base language model converges and the optimal model parameters are saved.

[0037] Preferably, in step S7:

[0038] After the training of the semantic relevance model and the language model is completed, a risk review is conducted on the new contract in the inference stage. For the input contract document, the text information stored in the contract document is extracted, and the extracted text is cleaned and processed into a paragraph list. For each paragraph object, a Batch is formed with all the risk rules in the risk rule library. Each paragraph text is assembled with the risk rule and input into the semantic similarity model for judgment. According to the custom threshold, the set of paragraph text and risk rule pairs with semantic similarity to the risk rule higher than the preset standard are screened out. Each paragraph text and risk rule pair is assembled into a specific instruction template to construct a Prompt instruction. The instruction is input into the language model, and the set of paragraph texts that trigger the risk and the list of risk rules triggered by each paragraph text are returned.

[0039] According to the present invention, a business contract risk intelligent review system based on a large-scale language model is provided, comprising:

[0040] Module M1: Clarify the requirements of risk review and determine the types of risks that need to be identified;

[0041] Module M2: Extract text information from contract documents;

[0042] Module M3: Build the BRAT text annotation platform, taking a single contract document as the basic annotation unit and paragraph objects as the smallest annotation unit;

[0043] Module M4: training semantic correlation model;

[0044] Module M5: Design an independent instruction template for each risk rule;

[0045] Module M6: Training language model base;

[0046] Module M7: After the semantic correlation model and language model training are completed, the contract is reviewed for risks.

[0047] Preferably, in the module M1:

[0048] Clarify the boundaries of risk review requirements and determine the types of risks that need to be identified, including adverse conditions in contract terms, legal compliance issues, and financial risks; collect relevant legal texts, industry standards, company policies, and risk cases in previous business contracts, extract risk rules from them, create a risk rule library, and adjust the risk rule library according to the external environment;

[0049] In the module M2:

[0050] Collect historical contract documents, convert contract documents in various formats into a unified format, determine the type of text objects, extract format information, extract text information from contract documents, and filter invalid information including pictures, comments, website links, contract orders, corporate logos, and corporate seals;

[0051] In the module M3:

[0052] Conduct unified training for annotation personnel and clarify annotation standards; build a BRAT text annotation platform, with a single contract document as the basic annotation unit and a paragraph object as the smallest annotation unit;

[0053] The annotation process involves the following situations:

[0054] The paragraph text has no semantic correlation with any risk rule in the risk rule library, so no special annotation is required in this case;

[0055] The paragraph text has a semantic correlation relationship with several risk rules in the risk rule library, but the risk rules are not triggered. In this case, several types of semantic correlation relationship tags are marked for the paragraph text;

[0056] The paragraph text and several risk rules in the risk rule library not only have semantic correlation, but also trigger the risk rules. In this case, several types of risk triggering tags are marked for the paragraph object;

[0057] After BRAT annotation is completed, the annotation data is exported and organized into semantically related annotation datasets and risk-triggered annotation datasets;

[0058] In the module M4:

[0059] Select the base model and use the Encoder in the transformer architecture as the base model, including BERT and RoBERTa; embed the manually annotated semantically relevant annotation dataset into the instruction template set, and the template format of the instruction template set is: whether {contract text} has a semantically relevant relationship with {risk rule};

[0060] The contract text is replaced with a specific contract paragraph text object, and the risk rules are replaced with a risk rule object;

[0061] The stochastic gradient descent method is used for parameter fine-tuning training, and the training goal is to minimize the cross entropy loss. When calculating the loss function, the positive samples are weighted. After the training is completed, the model weight with the highest accuracy is saved. After the semantic relevance model training is completed, for each contract text paragraph, the semantic model predicts the relevance of the contract text with all risk rules. At this time, there are two situations: if the contract text is not relevant to all risk rules, the contract text will not be used as the output of the large-scale language model for further risk identification and assessment; if the contract text is related to at least one risk rule, the contract text and the related risk rules will be further sent to the large-scale language model to determine whether the contract text triggers specific risk rules.

[0062] Preferably, in the module M5:

[0063] Risk rules are different, and the risk items triggered are different. Using instruction engineering technology, an independent instruction template is designed for each risk rule. The instruction template is designed according to the following steps:

[0064] Module M5.1: Choose a large-scale language model base;

[0065] Module M5.2: For each risk rule, select the subset of rights annotations under the risk rule from the risk trigger annotation data set as the evaluation set to verify the effect of the instruction;

[0066] Module M5.3: Adjust the instruction template, collect the prediction results of the base model, and calculate the quantitative indicators of accuracy, recall and precision;

[0067] Repeat modules M5.1 to M5.3 in sequence until the quantitative evaluation index converges, and save the instruction template set;

[0068] In the module M6:

[0069] Train the large-scale language model base in an efficient parameter fine-tuning method, including LORA and P-Tuning V2. Embed the contract paragraph text and risk rules in the risk trigger annotation dataset into the corresponding instruction template, generate instructions, input the instructions into the base language model for prediction, calculate the cross entropy loss based on the large-scale language model prediction results and the real manual annotation labels, and update the parameters. Iterate until the base language model converges and saves the optimal model parameters.

[0070] In the module M7:

[0071] After the training of the semantic relevance model and the language model is completed, a risk review is conducted on the new contract in the inference stage. For the input contract document, the text information stored in the contract document is extracted, and the extracted text is cleaned and processed into a paragraph list. For each paragraph object, a Batch is formed with all the risk rules in the risk rule library. Each paragraph text is assembled with the risk rule and input into the semantic similarity model for judgment. According to the custom threshold, the set of paragraph text and risk rule pairs with semantic similarity to the risk rule higher than the preset standard are screened out. Each paragraph text and risk rule pair is assembled into a specific instruction template to construct a Prompt instruction. The instruction is input into the language model, and the set of paragraph texts that trigger the risk and the list of risk rules triggered by each paragraph text are returned.

[0072] Compared with the prior art, the present invention has the following beneficial effects:

[0073] 1. The purpose of this invention is to apply the currently rapidly developing artificial intelligence technology to business contract risk review, so as to improve the efficiency and accuracy of business contract risk review, improve the standardization of contract review, and reduce the adverse effects of human errors.

[0074] 2. The present invention improves efficiency and speed: Manual contract review is a time-consuming and labor-intensive process. The present method can automatically analyze contract documents and quickly identify potential risk points, thereby significantly improving review efficiency and speed.

[0075] 3. The present invention reduces human errors: Manual review is easily affected by factors such as fatigue and distraction, resulting in errors and omissions. This method can reduce human errors and improve the consistency and accuracy of review.

[0076] 4. The present invention reduces costs: The present method can reduce reliance on legal professionals and reduce the overall cost of contract review.

[0077] 5. The present invention improves standardization and compliance: This method ensures that all contracts are reviewed based on the same external conditions, such as standard risk rule bases, deep learning models, information extraction algorithms, instruction templates, etc.

[0078] 6. The present invention proposes to pre-place a semantic similarity judgment model before the language model. The parameter scale of the semantic similarity judgment model is about one percent of that of the large-scale language model. The model integration method proposed by this method takes into account the efficiency and accuracy of contract review. For a business contract document to be reviewed, most of the text information in the document does not trigger the risks in the risk rule library, such as the order information, Party A and Party B information in the contract document, etc. Most of the irrelevant contract texts can be filtered out by pre-placing the semantic similarity model. In the historical contract documents owned by the company, about 95% of the paragraph texts and risk rule pairs do not have strong semantic correlations. Therefore, these paragraph texts and risk rule pairs are directly filtered out, which saves a lot of computing resources and improves the system's review efficiency and accuracy.

[0079] 7. The instruction engineering technology proposed in the present invention can greatly improve the accuracy of system audits. In the semantic similarity judgment model, for paragraph text and risk rules, the present invention does not directly convert paragraph text and risk rules into vector representations, and then calculate the Cosine distance of the two vectors. Instead, the paragraph text and risk rules are embedded into the instruction template to form a complete semantic judgment expression, thereby improving the accuracy of semantic model training and reasoning. Secondly, in the process of language model risk prediction training and reasoning, an independent instruction template is designed for each risk rule. Because each risk rule has different characteristics, a unified instruction template cannot well stimulate the potential of the language model. Therefore, each risk rule involves a separate instruction template, which can further improve the prediction ability of the model. BRIEF DESCRIPTION OF THE DRAWINGS

[0080] Other features, objects and advantages of the present invention will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:

[0081] Figure 1 A schematic diagram of the intelligent review and reasoning process for business contract risks;

[0082] Figure 2 This is a partial screenshot of the results of the business contract risk intelligent review test example. DETAILED DESCRIPTION

[0083] The present invention is described in detail below in conjunction with specific embodiments. The following embodiments will help those skilled in the art to further understand the present invention, but are not intended to limit the present invention in any form. It should be noted that, for those of ordinary skill in the art, several changes and improvements can also be made without departing from the concept of the present invention. These all belong to the protection scope of the present invention.

[0084] Embodiment 1:

[0085] According to a business contract risk intelligent review method based on a large-scale language model provided by the present invention, Figure 1-Figure 2 As shown, including:

[0086] Step S1: Clarify the required boundaries of risk review and determine the types of risks that need to be identified;

[0087] Specifically, in step S1:

[0088] Clarify the boundaries of risk review requirements and determine the types of risks that need to be identified, including adverse conditions in contract terms, legal compliance issues, and financial risks; collect relevant legal texts, industry standards, company policies, and risk cases in previous business contracts, extract risk rules from them, create a risk rule library, and adjust the risk rule library according to the external environment;

[0089] Step S2: extracting text information from the contract document;

[0090] In step S2:

[0091] Collect historical contract documents, convert contract documents in various formats into unified format files, determine the type of text objects, extract format information, extract text information from contract documents, and filter invalid information including pictures, comments, website links, contract orders, corporate logos and corporate seals.

[0092] Step S3: Build the BRAT text annotation platform, take a single contract document as the basic annotation unit, and use the paragraph object as the smallest annotation unit for annotation;

[0093] Specifically, in step S3:

[0094] Conduct unified training for annotation personnel and clarify annotation standards; build a BRAT text annotation platform, with a single contract document as the basic annotation unit and a paragraph object as the smallest annotation unit;

[0095] The annotation process involves the following situations:

[0096] The paragraph text has no semantic correlation with any risk rule in the risk rule library, so no special annotation is required in this case;

[0097] The paragraph text has a semantic correlation relationship with several risk rules in the risk rule library, but the risk rules are not triggered. In this case, several types of semantic correlation relationship tags are marked for the paragraph text;

[0098] The paragraph text and several risk rules in the risk rule library not only have semantic correlation, but also trigger the risk rules. In this case, several types of risk triggering tags are marked for the paragraph object;

[0099] After BRAT annotation is completed, the annotation data is exported and organized into semantically related annotation datasets and risk-triggered annotation datasets.

[0100] Step S4: training a semantic correlation model;

[0101] Specifically, in step S4:

[0102] Select the base model and use the Encoder in the transformer architecture as the base model, including BERT and RoBERTa; embed the manually annotated semantically relevant annotation dataset into the instruction template set, and the template format of the instruction template set is: whether {contract text} has a semantically relevant relationship with {risk rule};

[0103] The contract text is replaced with a specific contract paragraph text object, and the risk rules are replaced with a risk rule object;

[0104] The stochastic gradient descent method is used for parameter fine-tuning training, and the training goal is to minimize the cross entropy loss. When calculating the loss function, the positive samples are weighted. After the training is completed, the model weight with the highest accuracy is saved. After the semantic relevance model training is completed, for each contract text paragraph, the semantic model predicts the relevance of the contract text with all risk rules. At this time, there are two situations: if the contract text is not relevant to all risk rules, the contract text will not be used as the output of the large-scale language model for further risk identification and assessment; if the contract text is related to at least one risk rule, the contract text and the related risk rules will be further sent to the large-scale language model to determine whether the contract text triggers specific risk rules.

[0105] Step S5: Design an independent instruction template for each risk rule;

[0106] Specifically, in step S5:

[0107] Risk rules are different, and the risk items triggered are different. Using instruction engineering technology, an independent instruction template is designed for each risk rule. The instruction template is designed according to the following steps:

[0108] Step S5.1: Select a large-scale language model base;

[0109] Step S5.2: For each risk rule, select a subset of rights annotations under the risk rule from the risk trigger annotation data set as an evaluation set to verify the effect of the instruction;

[0110] Step S5.3: adjust the instruction template, collect the prediction results of the base model, and calculate the quantitative indicators accuracy, recall rate and precision;

[0111] Repeat steps S5.1 to S5.3 in sequence until the quantitative evaluation index converges, and save the instruction template set.

[0112] Step S6: training the language model base;

[0113] Specifically, in step S6:

[0114] The large-scale language model base is trained in an efficient parameter fine-tuning method, including LORA and P-Tuning V2. The contract paragraph text and risk rules in the risk trigger annotation dataset are embedded into the corresponding instruction template to generate instructions. The instructions are input into the base language model for prediction. The cross entropy loss is calculated based on the prediction results of the large-scale language model and the real manual annotation labels, and the parameters are updated. This iteration is carried out until the base language model converges and the optimal model parameters are saved.

[0115] Step S7: After the semantic correlation model and language model training is completed, the contract is reviewed for risks.

[0116] Specifically, in step S7:

[0117] After the training of the semantic relevance model and the language model is completed, a risk review is conducted on the new contract in the inference stage. For the input contract document, the text information stored in the contract document is extracted, and the extracted text is cleaned and processed into a paragraph list. For each paragraph object, a Batch is formed with all the risk rules in the risk rule library. Each paragraph text is assembled with the risk rule and input into the semantic similarity model for judgment. According to the custom threshold, the set of paragraph text and risk rule pairs with semantic similarity to the risk rule higher than the preset standard are screened out. Each paragraph text and risk rule pair is assembled into a specific instruction template to construct a Prompt instruction. The instruction is input into the language model, and the set of paragraph texts that trigger the risk and the list of risk rules triggered by each paragraph text are returned.

[0118] Embodiment 2:

[0119] Embodiment 2 is a preferred example of Embodiment 1, and is used to illustrate the present invention in more detail.

[0120] The present invention also provides a business contract risk intelligent review system based on a large-scale language model. The business contract risk intelligent review system based on a large-scale language model can be implemented by executing the process steps of the business contract risk intelligent review method based on a large-scale language model, that is, those skilled in the art can understand the business contract risk intelligent review method based on a large-scale language model as a preferred implementation of the business contract risk intelligent review system based on a large-scale language model.

[0121] According to the present invention, a business contract risk intelligent review system based on a large-scale language model is provided, comprising:

[0122] Module M1: Clarify the requirements of risk review and determine the types of risks that need to be identified;

[0123] Specifically, in the module M1:

[0124] Clarify the boundaries of risk review requirements and determine the types of risks that need to be identified, including adverse conditions in contract terms, legal compliance issues, and financial risks; collect relevant legal texts, industry standards, company policies, and risk cases in previous business contracts, extract risk rules from them, create a risk rule library, and adjust the risk rule library according to the external environment;

[0125] Module M2: Extract text information from contract documents;

[0126] In the module M2:

[0127] Collect historical contract documents, convert contract documents in various formats into a unified format, determine the type of text objects, extract format information, extract text information from contract documents, and filter invalid information including pictures, comments, website links, contract orders, corporate logos, and corporate seals;

[0128] Module M3: Build the BRAT text annotation platform, taking a single contract document as the basic annotation unit and paragraph objects as the smallest annotation unit;

[0129] In the module M3:

[0130] Conduct unified training for annotation personnel and clarify annotation standards; build a BRAT text annotation platform, with a single contract document as the basic annotation unit and a paragraph object as the smallest annotation unit;

[0131] The annotation process involves the following situations:

[0132] The paragraph text has no semantic correlation with any risk rule in the risk rule library, so no special annotation is required in this case;

[0133] The paragraph text has a semantic correlation relationship with several risk rules in the risk rule library, but the risk rules are not triggered. In this case, several types of semantic correlation relationship tags are marked for the paragraph text;

[0134] The paragraph text and several risk rules in the risk rule library not only have semantic correlation, but also trigger the risk rules. In this case, several types of risk triggering tags are marked for the paragraph object;

[0135] After BRAT annotation is completed, the annotation data is exported and organized into semantically related annotation datasets and risk-triggered annotation datasets;

[0136] Module M4: training semantic correlation model;

[0137] In the module M4:

[0138] Select the base model and use the Encoder in the transformer architecture as the base model, including BERT and RoBERTa; embed the manually annotated semantically relevant annotation dataset into the instruction template set, and the template format of the instruction template set is: whether {contract text} has a semantically relevant relationship with {risk rule};

[0139] The contract text is replaced with a specific contract paragraph text object, and the risk rules are replaced with a risk rule object;

[0140] The stochastic gradient descent method is used for parameter fine-tuning training, and the training goal is to minimize the cross entropy loss. When calculating the loss function, the positive samples are weighted. After the training is completed, the model weight with the highest accuracy is saved. After the semantic relevance model training is completed, for each contract text paragraph, the semantic model predicts the relevance of the contract text with all risk rules. At this time, there are two situations: if the contract text is not relevant to all risk rules, the contract text will not be used as the output of the large-scale language model for further risk identification and assessment; if the contract text is related to at least one risk rule, the contract text and the related risk rules will be further sent to the large-scale language model to determine whether the contract text triggers specific risk rules.

[0141] Module M5: Design an independent instruction template for each risk rule;

[0142] Specifically, in the module M5:

[0143] Risk rules are different, and the risk items triggered are different. Using instruction engineering technology, an independent instruction template is designed for each risk rule. The instruction template is designed according to the following steps:

[0144] Module M5.1: Choose a large-scale language model base;

[0145] Module M5.2: For each risk rule, select the subset of rights annotations under the risk rule from the risk trigger annotation data set as the evaluation set to verify the effect of the instruction;

[0146] Module M5.3: Adjust the instruction template, collect the prediction results of the base model, and calculate the quantitative indicators of accuracy, recall and precision;

[0147] Repeat modules M5.1 to M5.3 in sequence until the quantitative evaluation index converges, and save the instruction template set;

[0148] Module M6: Training language model base;

[0149] In the module M6:

[0150] Train the large-scale language model base in an efficient parameter fine-tuning method, including LORA and P-Tuning V2. Embed the contract paragraph text and risk rules in the risk trigger annotation dataset into the corresponding instruction template, generate instructions, input the instructions into the base language model for prediction, calculate the cross entropy loss based on the large-scale language model prediction results and the real manual annotation labels, and update the parameters. Iterate until the base language model converges and saves the optimal model parameters.

[0151] Module M7: After the semantic correlation model and language model training are completed, the contract is reviewed for risks.

[0152] In the module M7:

[0153] After the training of the semantic relevance model and the language model is completed, a risk review is conducted on the new contract in the inference stage. For the input contract document, the text information stored in the contract document is extracted, and the extracted text is cleaned and processed into a paragraph list. For each paragraph object, a Batch is formed with all the risk rules in the risk rule library. Each paragraph text is assembled with the risk rule and input into the semantic similarity model for judgment. According to the custom threshold, the set of paragraph text and risk rule pairs with semantic similarity to the risk rule higher than the preset standard are screened out. Each paragraph text and risk rule pair is assembled into a specific instruction template to construct a Prompt instruction. The instruction is input into the language model, and the set of paragraph texts that trigger the risk and the list of risk rules triggered by each paragraph text are returned.

[0154] Embodiment 3:

[0155] Embodiment 3 is a preferred example of Embodiment 1, and is used to illustrate the present invention in more detail.

[0156] The present invention specifically includes technologies such as deep learning, large-scale language models, information extraction, instruction engineering, and efficient parameter fine-tuning.

[0157] The present invention proposes a business contract risk intelligent review method based on a large-scale language model. The specific steps of implementing the method are as follows:

[0158] Step 1: Clarify the boundaries of risk review requirements with legal experts, contract review specialists, sales representatives, and corporate managers, and determine the types of risks that need to be identified, such as adverse conditions in contract terms, legal compliance issues, and financial risks. Collect relevant legal texts, industry standards, company policies, and risk cases in previous business contracts, extract and refine several risk rules, and finally create the risk rule library required for this method. Note that the risk rule library needs to be adjusted in a timely manner according to the external environment.

[0159] Step 2: Collect historical contract documents. Since standardization is gradually established during the business development process, there may be many problems with historical contract documents. First, convert contract documents in various formats into a unified format, such as the DOCX file format. This format is based on the XML standard and can determine the type of text objects and extract their format information to facilitate subsequent text information extraction. Then extract text information from the contract documents and filter out invalid information such as pictures, comments, website links, contract orders, corporate logos, and corporate seals.

[0160] Step 3: Conduct unified training for annotation personnel and clarify annotation standards; build a BRAT text annotation platform, with a single contract document as the basic annotation unit and a paragraph object as the smallest annotation unit. The annotation process involves the following situations: 1) There is no semantic correlation between the paragraph text and any risk rule in the risk rule library, and no special annotation is required in this case; 2) The paragraph text and several risk rules in the risk rule library only have a semantic correlation, but the risk rules are not triggered. In this case, the paragraph text is marked with several types of semantic correlation tags; 3) The paragraph text and several risk rules in the risk rule library not only have a semantic correlation, but also trigger the risk rules. In this case, the paragraph object is marked with several types of risk trigger tags. After the BRAT annotation is completed, the annotation data is exported and organized to form a semantic correlation annotation dataset and a risk trigger annotation dataset.

[0161] Step 4, train the semantic correlation model. First, a suitable base model needs to be selected. The present invention intends to use the Encoder in the transformer architecture as the base model, such as BERT and RoBERTa. Secondly, the manually annotated semantically related annotation data set is embedded into the instruction template set. The template format of the instruction template set is "Whether {contract text} has a semantic correlation with {risk rule}.". The "contract text" wrapped in curly braces needs to be replaced with a specific business contract paragraph text object, and the "risk rule" wrapped in curly braces needs to be replaced with a specific risk rule object. Finally, the stochastic gradient descent method is used for parameter fine-tuning training, and the training goal is to minimize the cross-entropy loss. Since the semantically related annotation data set has an imbalance problem of positive and negative samples, the positive samples are weighted when calculating the loss function. After the training is completed, the model weight with the highest accuracy is saved. After the semantic relevance model training is completed, for each contract text paragraph, the semantic model will predict the relevance of the contract text with all risk rules. At this time, there are two situations: 1) The contract text is not relevant to all risk rules, then the contract text will not be used as the output of the large-scale language model for further risk identification and assessment; 2) The contract text is related to at least one risk rule, then the contract text and the relevant risk rules will be further sent to the large-scale language model to determine whether the contract text triggers specific risk rules.

[0162] Step 5. Since risk rules have obvious differences, such as different risk items being triggered, it is necessary to use instruction engineering technology. According to the basic principles of instruction engineering - clarity, simplicity, and iteration, an independent instruction template is designed for each risk rule. Specifically, the instruction template is designed according to the following steps: 1) Select a suitable large-scale language model base. 2) For each risk rule, filter out the subset of rights annotations under the risk rule from the risk trigger annotation data set as the evaluation set to verify the effect of the instruction. 3) Then continuously adjust the instruction template, collect the prediction results of the base model, and calculate the quantitative indicators - accuracy, recall, and precision. Repeat steps 1-3 in sequence until the quantitative evaluation indicators converge, and finally save the instruction template set.

[0163] Step 6: Train the large-scale language model base in an efficient parameter fine-tuning manner. Commonly used efficient parameter fine-tuning methods include LORA, P-Tuning V2 and other methods. Combined with the output results of step 5, the "contract paragraph text" and "risk rules" in the risk trigger annotation dataset are embedded into the corresponding instruction template to generate instructions, and then the instructions are input into the base language model for prediction. The cross entropy loss is calculated based on the prediction results of the large-scale language model and the real manual annotation labels (yes | no, yes means the risk is triggered, no means the risk is not triggered), and the parameters are updated. This iteration is repeated until the base language model converges and the optimal model parameters are saved.

[0164] Step 7: After the semantic correlation model and language model training are completed, how to conduct risk review on new business contracts in the reasoning stage (such as attached Figure 1 As shown). First, for the input contract file, extract the text information stored in the contract file. Note that if it is a PDF or other format file, it is best to convert it to a DOCX format file. Second, clean the extracted text and process it into a paragraph list. Third, for each paragraph object, form a Batch with all the risk rules in the risk rule library. Each paragraph text and risk rule are assembled according to the requirements of step 4, and then input into the semantic similarity model for judgment. According to the custom threshold, select the set of paragraph text and risk rule pairs with high semantic similarity to the risk rule. Fourth, assemble each paragraph text and risk rule pair into a specific instruction template to construct a Prompt instruction, and then input the instructions one by one into the language model. Finally, return the set of paragraph texts that trigger the risk, as well as the list of risk rules triggered by each paragraph text.

[0165] At present, artificial intelligence technology has made significant breakthroughs. With large-scale language models as the core, various types of applications developed have achieved good results. In this method, for the semantic similarity judgment model, in the custom semantic related annotation data set, which consists of 50,858 positive and negative samples, of which 6,325 are positive samples. The accuracy of the semantic model on the evaluation sub-dataset reached 99.0%, the recall rate reached 94.8%, and the precision rate reached 78.9%. For the language model, in the custom risk trigger data set, the accuracy of the model on the evaluation sub-dataset reached 97.82%, the recall rate reached 91.58%, and the precision rate reached 80.91%. From the perspective of quantitative evaluation indicators, this method has greatly improved the accuracy compared with the traditional rule method.

[0166] Those skilled in the art know that, in addition to realizing the system and its various devices, modules, and units provided by the present invention in a purely computer-readable program code, it is entirely possible to realize the same functions in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers by logically programming the method steps. Therefore, the system and its various devices, modules, and units provided by the present invention can be considered as a hardware component, and the devices, modules, and units included therein for realizing various functions can also be regarded as structures within the hardware component; the devices, modules, and units for realizing various functions can also be regarded as both software modules for realizing the method and structures within the hardware component.

[0167] The above describes the specific embodiments of the present invention. It should be understood that the present invention is not limited to the above specific embodiments, and those skilled in the art can make various changes or modifications within the scope of the claims, which does not affect the essence of the present invention. In the absence of conflict, the embodiments of the present application and the features in the embodiments can be combined with each other arbitrarily.

Claims

1. A business contract risk intelligent review method based on a large-scale language model, characterized in that: include: Step S1: Clarify the required boundaries of risk review and determine the types of risks that need to be identified; Step S2: extracting text information from the contract document; Step S3: Build the BRAT text annotation platform, take a single contract document as the basic annotation unit, and use the paragraph object as the smallest annotation unit for annotation; Step S4: training a semantic correlation model; Step S5: Design an independent instruction template for each risk rule; Step S6: training the language model base; Step S7: After the semantic correlation model and language model training is completed, the contract is reviewed for risks.

2. The method for intelligent review of business contract risks based on a large-scale language model according to claim 1 is characterized by: In step S1: Clarify the boundaries of risk review requirements and determine the types of risks that need to be identified, including adverse conditions in contract terms, legal compliance issues, and financial risks; collect relevant legal texts, industry standards, company policies, and risk cases in previous business contracts, extract risk rules from them, create a risk rule library, and adjust the risk rule library according to the external environment; In step S2: Collect historical contract documents, convert contract documents in various formats into unified format files, determine the type of text objects, extract format information, extract text information from contract documents, and filter invalid information including pictures, comments, website links, contract orders, corporate logos and corporate seals.

3. The method for intelligent review of business contract risks based on a large-scale language model according to claim 1 is characterized in that: In step S3: Conduct unified training for annotation personnel and clarify annotation standards; build a BRAT text annotation platform, with a single contract document as the basic annotation unit and a paragraph object as the smallest annotation unit; The annotation process involves the following situations: The paragraph text has no semantic correlation with any risk rule in the risk rule library, so no special annotation is required in this case; The paragraph text has a semantic correlation relationship with several risk rules in the risk rule library, but the risk rules are not triggered. In this case, several types of semantic correlation relationship tags are marked for the paragraph text; The paragraph text and several risk rules in the risk rule library not only have semantic correlation, but also trigger the risk rules. In this case, several types of risk triggering tags are marked for the paragraph object; After BRAT annotation is completed, the annotation data is exported and organized into semantically related annotation datasets and risk-triggered annotation datasets.

4. The method for intelligent review of business contract risks based on a large-scale language model according to claim 1 is characterized in that: In step S4: Select the base model and use the Encoder in the transformer architecture as the base model, including BERT and RoBERTa; embed the manually annotated semantically relevant annotation dataset into the instruction template set, and the template format of the instruction template set is: whether {contract text} has a semantically relevant relationship with {risk rule}; The contract text is replaced with a specific contract paragraph text object, and the risk rules are replaced with a risk rule object; The stochastic gradient descent method is used for parameter fine-tuning training, and the training goal is to minimize the cross entropy loss. When calculating the loss function, the positive samples are weighted. After the training is completed, the model weight with the highest accuracy is saved. After the semantic relevance model training is completed, for each contract text paragraph, the semantic model predicts the relevance of the contract text with all risk rules. At this time, there are two situations: if the contract text is not relevant to all risk rules, the contract text will not be used as the output of the large-scale language model for further risk identification and assessment; if the contract text is related to at least one risk rule, the contract text and the related risk rules will be further sent to the large-scale language model to determine whether the contract text triggers specific risk rules.

5. The method for intelligent review of business contract risks based on a large-scale language model according to claim 1 is characterized in that: In step S5: Risk rules are different, and the risk items triggered are different. Using instruction engineering technology, an independent instruction template is designed for each risk rule. The instruction template is designed according to the following steps: Step S5.1: Select a large-scale language model base; Step S5.2: For each risk rule, select a subset of rights annotations under the risk rule from the risk trigger annotation data set as an evaluation set to verify the effect of the instruction; Step S5.3: adjust the instruction template, collect the prediction results of the base model, and calculate the quantitative indicators accuracy, recall rate and precision; Repeat steps S5.1 to S5.3 in sequence until the quantitative evaluation index converges, and save the instruction template set.

6. The method for intelligent review of business contract risks based on a large-scale language model according to claim 1 is characterized in that: In step S6: The large-scale language model base is trained in an efficient parameter fine-tuning method, including LORA and P-Tuning V2. The contract paragraph text and risk rules in the risk trigger annotation dataset are embedded into the corresponding instruction template to generate instructions. The instructions are input into the base language model for prediction. The cross entropy loss is calculated based on the prediction results of the large-scale language model and the real manual annotation labels, and the parameters are updated. This iteration is carried out until the base language model converges and the optimal model parameters are saved.

7. The method for intelligent review of business contract risks based on a large-scale language model according to claim 1 is characterized in that: In step S7: After the training of the semantic relevance model and the language model is completed, a risk review is conducted on the new contract in the inference stage. For the input contract document, the text information stored in the contract document is extracted, and the extracted text is cleaned and processed into a paragraph list. For each paragraph object, a Batch is formed with all the risk rules in the risk rule library. Each paragraph text is assembled with the risk rule and input into the semantic similarity model for judgment. According to the custom threshold, the set of paragraph text and risk rule pairs with semantic similarity to the risk rule higher than the preset standard are screened out. Each paragraph text and risk rule pair is assembled into a specific instruction template to construct a Prompt instruction. The instruction is input into the language model, and the set of paragraph texts that trigger the risk and the list of risk rules triggered by each paragraph text are returned.

8. A business contract risk intelligent review system based on a large-scale language model, characterized in that: include: Module M1: Clarify the requirements of risk review and determine the types of risks that need to be identified; Module M2: Extract text information from contract documents; Module M3: Build the BRAT text annotation platform, taking a single contract document as the basic annotation unit and paragraph objects as the smallest annotation unit; Module M4: training semantic correlation model; Module M5: Design an independent instruction template for each risk rule; Module M6: Training language model base; Module M7: After the semantic correlation model and language model training are completed, the contract is reviewed for risks.

9. The business contract risk intelligent review system based on large-scale language model according to claim 8 is characterized by: In the module M1: Clarify the boundaries of risk review requirements and determine the types of risks that need to be identified, including adverse conditions in contract terms, legal compliance issues, and financial risks; collect relevant legal texts, industry standards, company policies, and risk cases in previous business contracts, extract risk rules from them, create a risk rule library, and adjust the risk rule library according to the external environment; In the module M2: Collect historical contract documents, convert contract documents in various formats into a unified format, determine the type of text objects, extract format information, extract text information from contract documents, and filter invalid information including pictures, comments, website links, contract orders, corporate logos, and corporate seals; In the module M3: Conduct unified training for annotation personnel and clarify annotation standards; build a BRAT text annotation platform, with a single contract document as the basic annotation unit and a paragraph object as the smallest annotation unit; The annotation process involves the following situations: The paragraph text has no semantic correlation with any risk rule in the risk rule library, so no special annotation is required in this case; The paragraph text has a semantic correlation relationship with several risk rules in the risk rule library, but the risk rules are not triggered. In this case, several types of semantic correlation relationship tags are marked for the paragraph text; The paragraph text and several risk rules in the risk rule library not only have semantic correlation, but also trigger the risk rules. In this case, several types of risk triggering tags are marked for the paragraph object; After BRAT annotation is completed, the annotation data is exported and organized into semantically related annotation datasets and risk-triggered annotation datasets; In the module M4: Select the base model and use the Encoder in the transformer architecture as the base model, including BERT and RoBERTa; embed the manually annotated semantically relevant annotation dataset into the instruction template set, and the template format of the instruction template set is: whether {contract text} has a semantically relevant relationship with {risk rule}; The contract text is replaced with a specific contract paragraph text object, and the risk rules are replaced with a risk rule object; The stochastic gradient descent method is used for parameter fine-tuning training, and the training goal is to minimize the cross entropy loss. When calculating the loss function, the positive samples are weighted. After the training is completed, the model weight with the highest accuracy is saved. After the semantic relevance model training is completed, for each contract text paragraph, the semantic model predicts the relevance of the contract text with all risk rules. At this time, there are two situations: if the contract text is not relevant to all risk rules, the contract text will not be used as the output of the large-scale language model for further risk identification and assessment; if the contract text is related to at least one risk rule, the contract text and the related risk rules will be further sent to the large-scale language model to determine whether the contract text triggers specific risk rules.

10. The business contract risk intelligent review system based on large-scale language model according to claim 8 is characterized in that: In the module M5: Risk rules are different, and the risk items triggered are different. Using instruction engineering technology, an independent instruction template is designed for each risk rule. The instruction template is designed according to the following steps: Module M5.1: Choose a large-scale language model base; Module M5.2: For each risk rule, select the subset of rights annotations under the risk rule from the risk trigger annotation data set as the evaluation set to verify the effect of the instruction; Module M5.3: Adjust the instruction template, collect the prediction results of the base model, and calculate the quantitative indicators of accuracy, recall and precision; Repeat modules M5.1 to M5.3 in sequence until the quantitative evaluation index converges, and save the instruction template set; In the module M6: Train the large-scale language model base in an efficient parameter fine-tuning method, including LORA and P-Tuning V2. Embed the contract paragraph text and risk rules in the risk trigger annotation dataset into the corresponding instruction template, generate instructions, input the instructions into the base language model for prediction, calculate the cross entropy loss based on the large-scale language model prediction results and the real manual annotation labels, and update the parameters. Iterate until the base language model converges and saves the optimal model parameters. In the module M7: After the training of the semantic relevance model and the language model is completed, a risk review is conducted on the new contract in the inference stage. For the input contract document, the text information stored in the contract document is extracted, and the extracted text is cleaned and processed into a paragraph list. For each paragraph object, a Batch is formed with all the risk rules in the risk rule library. Each paragraph text is assembled with the risk rule and input into the semantic similarity model for judgment. According to the custom threshold, the set of paragraph text and risk rule pairs with semantic similarity to the risk rule higher than the preset standard are screened out. Each paragraph text and risk rule pair is assembled into a specific instruction template to construct a Prompt instruction. The instruction is input into the language model, and the set of paragraph texts that trigger the risk and the list of risk rules triggered by each paragraph text are returned.

Citation Information

Patent Citations

  • Contract risk point identification method and device

    CN115936436A

  • Fine tuning training method of large language model, contract risk review method and system

    CN116775879A

Cited By

  • Contract review report generation method based on large model integrated optimization

    CN118940732A

  • Contract risk assessment and compliance check method, system and equipment based on large language model, and medium

    CN119863119A

  • Project file risk analysis method and system

    CN120012784A

  • Method and equipment for constructing large ethical examination model based on instruction set optimization

    CN120067308A