Method and system for analyzing large model engineering contract and controlling ai risk

CN122948415APending Publication Date: 2026-10-20SICHUAN HUADONG ELECTRICAL GRP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610971099.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-01
Publication Date
2026-10-20

AI Technical Summary

Technical Problem

[0004]第二类为商用云端AI合同评审SaaS工具,仅能在线上传合同完成基础文本提取与简单风险提示,风险比对依托平台公共知识库,无法接入企业内部私有合同、法规资源,且仅单独输出风险条目,不具备风险分级自动分流、审核后自动复检、报告自动归档的串联流程,各评审环节相互独立,导致评审流程繁琐、人工工作量大、评审标准化程度低

Benefits of technology

[0020]通过将结构化条款数据输入私有知识库执行语义匹配检索,使风险识别过程中具备与企业内部合规标准对应的参考依据,有助于提升风险识别结果的准确性和企业适配性,克服现有AI评审工具仅依赖平台公共知识库导致的识别结果与企业实际合规要求脱节的问题。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure FT_1
    Figure FT_1
  • Figure FT_2
    Figure FT_2
  • Figure SMS_5
    Figure SMS_5
Patent Text Reader

Abstract

This invention discloses a method and system for engineering contract parsing and AI-based risk management based on a large-scale model, belonging to the field of intelligent engineering contract review technology. The method includes: parsing the contract document text and structurally breaking down the clauses to generate structured clause data; inputting the structured clause data into a private knowledge base for semantic matching retrieval to generate risk comparison results; inputting the structured clause data and risk comparison results into a large-scale language model for risk identification and level determination, generating a risk list and the corresponding risk level for each risk item; automatically routing the workflow according to the risk level, automatically approving low-risk levels, and pushing medium- or high-risk levels to the review terminal; receiving the review results, performing compliance re-inspection, generating a review report, and archiving and storing it. This invention automates the entire contract review process, ensuring complete and traceable review records, effectively reducing labor costs, and improving the standardization and compliance of engineering contract risk management.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of intelligent review technology for engineering contracts, and in particular to a method and system for large-scale engineering contract analysis and AI risk management. Background Technology

[0002] Construction contracts are complex and involve numerous risks. Currently, there are two main approaches to risk assessment for construction contracts within the industry.

[0003] The first type is the purely manual review mode, in which business personnel and legal personnel manually upload and read contract documents, manually break down and sort out contract terms, manually compare them with paper or offline stored laws and regulations and risk clauses to find risks, manually determine the severity of risks and then transfer them offline for approval, and manually organize and archive the review materials after the review is completed.

[0004] The second category is commercial cloud-based AI contract review SaaS tools, which can only upload contracts online to complete basic text extraction and simple risk warnings. Risk comparison relies on the platform's public knowledge base and cannot access the enterprise's internal private contracts and legal resources. Moreover, they only output risk items separately and do not have a sequential process of automatic risk classification and diversion, automatic re-examination after review, and automatic report archiving. Each review stage is independent of the others, resulting in a cumbersome review process, a large amount of manual work, and a low degree of review standardization. Summary of the Invention

[0005] To address the technical problem that existing technologies lack a comprehensive control process from risk identification to compliance review, this invention provides a method and system based on large-scale engineering contract analysis and AI-driven risk management.

[0006] The technical solution adopted in this invention is:

[0007] The first aspect of this application provides a method for large-scale engineering contract analysis and AI-based risk management, including the following steps:

[0008] Step 1: Receive the contract documents, perform text parsing and clause structure decomposition on the contract documents, and generate structured clause data;

[0009] Step 2: Input the structured terms data into the private knowledge base to perform semantic matching retrieval and generate risk comparison results;

[0010] Step 3: Input the structured clause data and the risk comparison results into the large language model to perform risk identification and level determination, and generate a risk list and the risk level corresponding to each risk item in the risk list;

[0011] Step 4: Execute automatic workflow routing according to the risk level. When the risk level is a preset low risk level, generate an automatic approval opinion. When the risk level is a preset medium risk level or a preset high risk level, push the risk list to the review terminal.

[0012] Step 5: Receive the audit results returned by the audit terminal, perform a compliance re-inspection based on the audit results, generate a review report, and complete the archiving and storage.

[0013] The second aspect of this application provides a system based on large-scale engineering contract analysis and AI risk management, applying the aforementioned method based on large-scale engineering contract analysis and AI risk management, including:

[0014] The contract parsing module is used to receive contract documents, perform text parsing and clause structured decomposition on the contract documents, and generate structured clause data.

[0015] A private knowledge retrieval and matching module is used to input the structured clause data into a private knowledge base to perform semantic matching retrieval and generate risk comparison results.

[0016] The AI ​​risk assessment module is used to input the structured clause data and the risk comparison results into a large language model to perform risk identification and level determination, and generate a risk list and the risk level corresponding to each risk item in the risk list;

[0017] The automatic workflow scheduling and distribution module is used to automatically distribute the workflow according to the risk level. When the risk level is a preset low risk level, an automatic approval opinion is generated. When the risk level is a preset medium risk level or a preset high risk level, the risk list is pushed to the review terminal.

[0018] The review and re-inspection archiving module is used to receive the review results returned by the review terminal, perform compliance re-inspection based on the review results, generate a review report, and complete archiving and storage.

[0019] The beneficial effects of the present invention are at least one of the following:

[0020] By inputting structured clause data into a private knowledge base to perform semantic matching retrieval, the risk identification process has references corresponding to the company's internal compliance standards, which helps improve the accuracy and adaptability of risk identification results to the company, and overcomes the problem that existing AI review tools rely solely on the platform's public knowledge base, resulting in a disconnect between the identification results and the company's actual compliance requirements.

[0021] Using large language models to perform risk identification and level determination, instead of manual risk assessment item by item, helps reduce the reliance of the review process on the personal experience of reviewers, improves the consistency of risk assessment standards among different reviewers, and enhances review efficiency.

[0022] Workflows are automatically routed based on risk level. Low-risk levels generate automatic approval comments, while medium- and high-risk levels are pushed to the review terminal, reducing manual distribution and transfer steps, which helps to simplify the review process and reduce manual workload.

[0023] Based on the audit results, a compliance re-inspection is performed and an audit report is generated and archived. This process links risk identification, audit routing, and compliance re-inspection into a closed loop, avoiding process breaks caused by the independence of each review stage. This helps to improve the standardization and traceability of the review process. Attached Figure Description

[0024] Figure 1 This is a schematic diagram of the method flow of the present invention;

[0025] Figure 2 This is a system architecture block diagram of the present invention. Detailed Implementation

[0026] The embodiments of the present invention will now be described in detail with reference to the accompanying drawings.

[0027] Example 1

[0028] Methods based on large-scale engineering contract analysis and AI risk management, such as Figure 1 As shown, it includes the following steps:

[0029] Step 1: Receive the contract documents, perform text parsing and clause structure decomposition on the contract documents, and generate structured clause data.

[0030] It should be noted that contract documents refer to electronic documents of engineering contracts that require risk review. The format includes at least one of the following: portable document format, word processing document format, and scanned image format. Text parsing is the process of converting contract documents into plain text. Clause structuring and decomposition is the process of identifying clause boundaries, numbering, titles, and body text from the contract text and categorizing them into predefined clause categories.

[0031] Structured clause data is a collection of clause information organized according to a preset structure. Each clause contains four fields: clause number, clause title, clause body, and clause category.

[0032] In the specific implementation process, the system receives the contract document and review parameters submitted by the external system through the API interface, the contract document is transmitted as a binary file field, and the review parameters are transmitted as a JSON string field, the authentication credential is compared and verified with the pre-stored authorization credential list of the system, a review task identifier is generated after the verification is passed, which is bound to the contract document, and the complete process of text parsing and clause structured splitting is executed to generate structured clause data.

[0033] It should be noted that the external standardized data exchange interface is designed with a RESTful architecture, the interface access path is / api / v1 / contract / review, and the POST request method is uniformly adopted; the interface request body adopts the multipart / form-data encoding format, which can transmit the contract binary file and review business parameters at the same time.

[0034] The review parameter data structure includes the caller identity identifier, authentication credential, contract type identifier and review priority, and the review task identifier is a 128-bit universally unique identifier generated by the UUID algorithm assigned by the system for each review request.

[0035] For example, the external OA system submits a construction contract document and review parameters via POST / api / v1 / contract / review, the review parameters include the contract type, priority and authentication credential, the system generates the review task identifier 550e8400-e29b-41d4-a716-446655440000 after the verification is passed, and returns the status code 200 indicating successful reception;

[0036] Format conversion and text extraction are performed on the contract document to generate pure contract text, for PDF files, the PyMuPDF library is called to extract the text stream page by page and splice them in page order; for DOCX files, the python-docx library is called to traverse the paragraph object set to extract text; for scanned image files, characters are first recognized by the OCR engine, and then layout analysis and paragraph reorganization are performed.

[0037] Unified preprocessing is carried out after text extraction, control characters such as form feeds and consecutive blank lines are removed, all full-width punctuation marks are converted to half-width, sentences are split according to end-of-sentence punctuation, and an incremental sequence number is assigned to each sentence to form an ordered sentence set.

[0038] Clause identification is performed on the preprocessed sentence set, the first character of each sentence is scanned to match three types of standard clause number patterns, for example, starting with Chinese numerals / Arabic numerals followed by a顿号 (enumeration comma) or a period, such as "一、" (1、) and "1."; starting with "第" (No.), with a numeral in the middle and ending with "条" (clause), such as "第一条" (Clause 1) and "第12条" (Clause 12); numerals in parentheses, such as (1) and (一).

[0039] The successfully matched sentence is marked as the starting anchor of the clause. All sentences from the current starting sentence to the starting sentence of the next clause are aggregated to obtain a single clause text block. For each text block, the trained BERT clause classification model is called to output the corresponding clause category label.

[0040] It should be noted that the BERT clause classification model uses BERT-base-chinese pre-trained weights, and the network configuration is a 12-layer transformer encoder with 12 self-attention heads per layer. The hidden layer has a dimension of 768, and the intermediate layer of the feedforward neural network has a dimension of 3072. The activation function is GELU. A fully connected classification layer is added to the top of the pre-trained model. The input is the 768-dimensional [CLS] feature vector corresponding to the text, and the output is a 12-dimensional category vector, corresponding to 12 categories of clauses: contract subject matter, price and payment, construction period and schedule, quality standards, liability for breach of contract, changes and claims, contract termination, dispute resolution, confidentiality clauses, force majeure clauses, notice and service clauses, and communication clauses.

[0041] It should be noted that the training process of the BERT clause classification model is as follows: collect no less than 5000 labeled clause data, and divide them into training, validation, and test sets in an 8:1:1 ratio; use the WordPiece tokenizer for word segmentation, with a maximum sequence length of 512 tokens; set the batch size to 16, the AdamW optimizer, and the learning rate... The weight decay coefficient is 0.01, the number of training epochs is 5, and the early stopping strategy is to terminate the training early if the accuracy of the validation set does not improve after 2 consecutive epochs.

[0042] In each training epoch, the training set is divided into multiple batches of size 16, and the following operations are performed on each batch in sequence:

[0043] The 16 clause texts in the batch are segmented and embedded before being input into the BERT backbone network. The network performs forward computation layer by layer until the last layer, extracting the 768-dimensional hidden state vector of the [CLS] tag. This vector is then linearly transformed by the classification layer to obtain a 12-dimensional logits vector for each clause. Finally, a softmax function is applied to each logits vector to obtain the predicted probability vector for each clause belonging to one of the 12 categories. .

[0044] The predicted probability vectors of the 16 clauses With the corresponding one-hot encoded vector of the real label Substitute the values ​​into the cross-entropy loss function to calculate the average loss for this batch:

[0045]

[0046] In the formula, For the first The one-hot encoded vector corresponding to the true category of each clause. For the model to the first The predicted probability vector of each clause, where · represents the vector dot product operation.

[0047] With loss value To optimize the objective, the gradient of the loss value with respect to the parameters of each layer of the BERT backbone network and the parameters of the classification layer is calculated layer by layer from the classification layer backward using the chain rule.

[0048] The AdamW optimizer calculates the update amount of each parameter based on the gradient value of each parameter and the current momentum state, and adjusts the value of each parameter according to the update amount to complete one parameter update for this batch; the weight decay coefficient of 0.01 applies L2 regularization penalty to the parameters during parameter update to suppress overfitting.

[0049] After completing one epoch of training by traversing all batches of the training set, the classification accuracy is evaluated on the validation set to determine whether the early stopping condition is triggered. After training is completed, the checkpoint with the highest accuracy on the validation set is selected as the final model parameter.

[0050] Subcategory keyword detection is performed on the clause categories output by the BERT classification model. Since quality warranty clauses and safety production clauses belong to the legally necessary subcategories under the two major categories of quality standards and schedule and progress, respectively, in construction contracts, the 12 categories output by BERT cannot identify them independently. Therefore, warranty keyword scanning (keyword set: {warranty, warranty period, warranty responsibility, quality warranty, defect liability period}) is performed on the text of clauses in the BERT classification results that belong to the quality standards category. If at least one keyword is matched, the category label of the clause is updated from quality standards to quality warranty clause. Safety keyword scanning (keyword set: {safety production, safety responsibility, safety management, safety measures, safety protection}) is performed on the text of clauses that belong to the schedule and progress category. If at least one keyword is matched, the category label of the clause is updated from schedule and progress to safety production clause. After the subcategory keyword detection is completed, the original 12 categories output by BERT are merged with the subcategory update results to generate the final clause category label, which is then written into the clause category field of the structured clause data.

[0051] Step 2: Input the structured terms data into the private knowledge base to perform semantic matching retrieval and generate risk comparison results.

[0052] In one possible implementation, the structured terms data is input into a private knowledge base to perform semantic matching retrieval, generating risk comparison results including the following:

[0053] Each clause in the structured clause data is vectorized to generate a clause vector; the clause vector is then matched with the knowledge vectors pre-stored in the private knowledge base to recall standard clauses, risk clauses, and legal bases that meet the preset threshold of matching degree, thereby generating the risk comparison result.

[0054] It should be noted that the private knowledge base is a data storage and retrieval system deployed within the enterprise's internal network, storing the enterprise's proprietary contract review knowledge. Knowledge entry types include standard clauses, risk clauses, legal basis, and internal policies. The vector database uses the Milvus vector retrieval component, which supports localized deployment, and is deployed as a standalone machine within the enterprise's intranet environment.

[0055] The vector dimension is configured according to the latest output dimension of the Alibaba Tongyi Qianwen Embedding model to ensure consistency in the vector writing, retrieval and comparison process. During the initial configuration phase, the system completes the interface configuration such as vector library connection address, index name and access parameters, and verifies the connection through sample text writing, vector recall test and similarity retrieval test.

[0056] Each knowledge entry is pre-processed into a fixed-dimensional vector by the Alibaba Tongyi Qianwen Embedding model and stored in the vector database. The risk comparison result is the output of semantic matching retrieval, which includes a list of matching knowledge entries organized by clause number. Each entry contains the matching type, similarity score and knowledge text.

[0057] In the implementation process, the Alibaba Cloud Tongyi Qianwen Embedding model is used to map the input text into a fixed-dimensional floating-point vector, and the output dimension is determined according to the configuration of the latest version of the model. The vectorization processing is invoked through the official Alibaba Cloud API interface with key authentication, without the need to deploy the embedded model file locally.

[0058] For each clause's text block, if the text length does not exceed the model's supported input limit, the vector is obtained directly. If it exceeds the limit, it is segmented sequentially according to the limit length, and the vector for each segment is obtained separately before performing a one-dimensional arithmetic mean.

[0059]

[0060] In the formula, This represents the number of segments after the clause text block is cut; The dimension index of the vector; For the first text vector, the first... Dimensional value, For the second text vector, the first... Dimensional value, ... For the first The first piece of text vector Dimensional value; The first digit of the merged vector Dimensional value.

[0061] Vector of Terms As a query vector, IVF_FLAT approximate nearest neighbor retrieval is performed in the contract_knowledge_base set of the Milvus vector database.

[0062] Search parameter settings: top_k=5, which returns the 5 matching entries with the highest cosine similarity; metric_type=COSINE, which is the cosine similarity metric. The cosine similarity calculation formula is:

[0063]

[0064] In the formula, Let be the vector of the clause text to be matched. This is a vector of the text of a knowledge entry in the knowledge base. Return entries with a cosine similarity ≥ 0.75.

[0065] The matching results are organized into risk comparison results objects according to the clause number. Each matching entry includes a knowledge entry identifier, matching type (standard clause / risk clause / legal basis), cosine similarity score, and knowledge text fragment.

[0066] Step 3: Input the structured clause data and the risk comparison results into the large language model to perform risk identification and level determination, and generate a risk list and the risk level corresponding to each risk item in the risk list.

[0067] In one possible implementation, the structured clause data and the risk comparison results are input into a large language model to perform risk identification and level determination, generating a risk list and the risk level corresponding to each risk item in the risk list, including the following:

[0068] The structured clause data and the risk comparison results are input into the big language model, which performs risk clause identification, missing clause detection, and illegal expression determination to generate the risk list. The big language model then determines the level of each risk item in the risk list according to preset risk grading rules to generate the risk level corresponding to each risk item.

[0069] It should be noted that the large language model used in this embodiment is the latest version of the Ali Tongyi Qianwen online large model. The general architecture of the Ali Tongyi Qianwen large model adopts the following modular hierarchical structure:

[0070] The input embedding layer segments the input text into a token sequence using a word segmenter. Each token is then mapped to an embedding vector via a word embedding matrix, and this embedding vector is added element-wise to the positional encoding vector to generate the input representation vector. The dimension of the embedding vector is denoted as... .

[0071] The multi-layer transformer-decoder layer stack, the input representation vector passes through sequentially... Decoder layers with identical layer structures. Each decoder layer contains the following sub-layers: The first sub-layer is a masked multi-head self-attention layer, which uses a masking mechanism to ensure that when generating the current token, the model can only focus on the current token and the tokens before it, and cannot focus on subsequent tokens. The first sub-layer contains... There are 1 attention head, and each attention head independently computes the query vector. Key vector Value vector Dimensions of each attention head The formula for calculating the self-attention output of each attention head is:

[0072]

[0073] in, To query the vector matrix, This is the transpose of the key vector matrix; This is the scaling factor; This is a mask matrix used to mask information about future tokens; This is the normalized exponential function, used to convert the output into a probability distribution; It is a value vector matrix; This is the self-attention output matrix of the attention head.

[0074] The outputs of each attention point are concatenated and then linearly transformed to obtain... A dimensional output vector.

[0075] The second sub-layer is a feedforward neural network layer, consisting of two fully connected layers. The output dimension of the first layer is... The activation function is GELU; the output dimension of the second layer is... Each sub-layer is followed by residual connections and layer normalization operations.

[0076] The last layer is the decoder layer. The output vector of the decoder layer is linearly transformed and mapped to the dimension of the vocabulary size. The softmax function is used to calculate the generation probability of each token in the vocabulary, and the token with the highest probability is selected as the generated output.

[0077] It should be noted that the training of the large language model is divided into two stages. The first stage is unsupervised pre-training: on a large-scale general text corpus, the training objective is autoregressive language modeling, that is, predicting the next token based on the previous token sequence and optimizing the cross-entropy loss function. After pre-training, the large language model has general natural language understanding and generation capabilities. The second stage is supervised fine-tuning and human feedback reinforcement learning, which is fine-tuned on high-quality instruction-following data annotated by humans, so that the model can perform specific tasks according to user instructions and output results in a structured format.

[0078] In this embodiment, the access and deployment method of the Alibaba Cloud Tongyi Qianwen large model is as follows: the large model is called using the official Alibaba Cloud API interface with key authentication, eliminating the need to deploy model weight files on a local server. During the call, request forwarding and result reception are completed within the enterprise intranet environment via HTTPS encryption protocol, ensuring that contract data does not leave the enterprise intranet. The model service identifier, call address, API key, and interface version information are uniformly registered and maintained in the system configuration module, supporting subsequent operation and maintenance, access control, and version upgrades. The large model access method is also compatible with the OpenAI call protocol and can be configured directly on the Dify platform.

[0079] When the Dify platform calls the Alibaba Tongyi Qianwen Big Model, it passes the following input data to the Alibaba Tongyi Qianwen Big Model: the contract text to be parsed, the main text of the clauses in the structured clause data, the risk comparison results returned by the vector database retrieval in step 2 (including standard clauses, risk clauses and legal basis texts), and a pre-arranged legal review-specific prompt word template.

[0080] The output data returned by the Alitongyi Qianwen Big Data Model includes: contract structure parsing results, risk level assessment results, clause modification suggestions and compliance basis. During the initialization phase, the system configuration module configures the Alitongyi Qianwen API address, API key and interface version, and verifies the connection through sample text writing, model call link testing and other methods.

[0081] The integration of large language models with the field of engineering contract risk assessment is a retrieval-enhanced generation mode. In this mode, the risk identification reasoning of large language models does not rely solely on the general legal common sense learned in the pre-training stage. Instead, it uses the enterprise standard clauses, historical risk clauses, and legal basis retrieved and matched from the private knowledge base in step 2 as auxiliary reference information. Through prompt word engineering, it injects these domain-specific knowledge into the reasoning context.

[0082] The prompts constrain the model's behavior to the domain role of an expert in legal risk assessment of engineering contracts through system role settings. They provide specific factual information and corporate compliance benchmarks for individual cases through clause content and risk comparison results, and guide the model to perform analysis according to preset review processes and criteria through task instructions and risk classification rules.

[0083] The inherent relationship between the input and output data of the large language model in this embodiment is as follows: The input data includes three types of information sources: The first type is the text of the clauses in the structured clause data, which serves as the review object for risk identification; the second type is the text of the matching knowledge entries in the risk comparison results generated in step 2, including standard clauses (compliance baseline), risk clauses (risk reference), and legal basis (legality benchmark), which serve as the comparison benchmark for risk identification; the third type is the text of the related clause set (when a clause association diagram is constructed in step 1), which serves as the context information for cross-clause conflict detection. The output data is a risk list array in JSON format, with each element being a risk item object.

[0084] The causal reasoning chain from input to output is as follows: The large language model compares the main text of the clause with the standard clause item by item to identify deviations in the clause that are inconsistent with the standard clause; it matches the deviations with the pattern characteristics of the risk clause to determine whether the deviations constitute a known risk pattern; then it compares the deviations with the legal basis to determine whether the deviations reach the level of illegality or violation; and finally, it assesses the risk level according to the quantitative criteria in the preset risk classification rules.

[0085] Risk identification is the process of identifying legal or compliance risks after reading structured clause data and risk comparison results using a large language model. It includes three subtypes: risk clause identification (detecting arrangements in clauses that are unfavorable to the company), missing clause detection (determining whether the contract is missing a certain type of necessary clause), and illegal expression determination (detecting expressions in clauses that violate regulations or internal systems).

[0086] The risk list is a collection of risk items. Each risk item contains six fields: risk number, risk description, trigger clause identifier, trigger clause fragment, risk type, and risk level. The risk level is divided into three levels: low, medium, and high, according to its severity.

[0087] The risk comparison results provide reference information such as standard clauses, risk clauses, and legal basis. However, this reference information cannot be directly equated with the risk assessment results. For example, a cosine similarity of 0.88 only indicates that the semantics of the clause are close to known risks, and cannot directly determine that there is definitely a risk. A large language model is needed to integrate multi-source information for legal logical reasoning, combine the reference information with the content of the clause, and make an accurate judgment on the existence and severity of the risk according to the aforementioned reasoning chain.

[0088] In the specific implementation process, input prompts are constructed. The prompts consist of four parts: Part 1 is the system role setting, for example, you are a professional engineering contract legal risk review expert, please identify risks, detect missing clauses, and determine illegal expressions in the contract clauses, and output a risk list in the specified JSON format; Part 2 is the clause content, including clause number, clause title, clause category, and clause text; Part 3 is the risk comparison results, listing the type, similarity, and text of each matching knowledge item; Part 4 is the task instructions and risk classification rules.

[0089] The specific criteria for risk grading rules are as follows: The system calculates three quantitative indicators for each structured clause in sequence: cosine similarity S = cosine similarity between the clause text vector and the enterprise's internal standard clause text vector; deviation ratio D = deviation ratio between the numerical parameters in the clause and the corresponding numerical parameters in the enterprise's internal standard clause (D = |V clause -V standard | / V standard Clauses without numerical parameters (D=0), risk similarity S risk =Cosine similarity between the vector of the clause text and the vector of risk clauses in the private knowledge base. Based on the above three indicators, the risk level is determined as follows:

[0090] A low-risk level is defined as follows: S≥0.6 and D≤0.2. Furthermore, if the main text of the clause does not match the pre-stored legal prohibition provisions in the system, and if there are typos identified by the Chinese spelling check tool in the main text of the clause, or if the difference between adjacent clause numbers after sorting is greater than 1 (i.e., there is a skipped number), and S≥0.6 and D≤0.2 are met simultaneously, it is still considered low-risk.

[0091] The medium-risk level meets any of the following conditions but does not meet any of the conditions for the high-risk level:

[0092] (1) D>0.2 and the numerical parameters in the clause do not exceed the upper limit of the corresponding parameters stipulated by laws or administrative regulations; (2) S<0.6 and S risk >S;(3)The contract’s set of clause categories is missing at least one of the non-mandatory necessary clause categories {confidentiality clause, force majeure clause, notice service clause, change and claim clause, communication clause}. The clause category set is generated by merging the 12 categories of labels and sub-category keyword detection results output by the BERT clause classification model in step 1. The above 5 non-mandatory necessary clause categories are all category labels or sub-category update results that can be directly identified by the BERT model. Therefore, the missing clause categories can be determined directly by traversing the clause category field of the structured clause data.

[0093] A high-risk level meets any of the following conditions:

[0094] (1) The main text of the clause matches the pre-stored legal prohibition clauses in the system successfully; (2) The numerical parameters in the clause exceed the upper limit of the corresponding parameters stipulated by laws or administrative regulations; (3) S < 0.4 and S risk ≥0.6; (4) The contract lacks a legally or administratively mandated clause category in its clause category set. The legally necessary clause category set for construction contracts is {quality warranty clause, safety production clause}. The quality warranty clause and safety production clause are identified from the quality standard and construction period and schedule clauses by the sub-category keyword detection in step 1, respectively. Therefore, the determination of this condition depends on whether the sub-category keyword detection in step 1 updates the category label of the relevant clause to the quality warranty clause or the safety production clause. If the sub-category keyword detection does not detect the relevant keyword, it is determined that the legally necessary clause category is missing.

[0095] The Dify platform calls the Alibaba Cloud Qianwen Big Model API interface and sends a request in the enterprise intranet environment using the official Alibaba Cloud compatible interface with HTTPS encryption protocol. The temperature parameter in the request parameters is set to 0.1 to ensure output determinism, and the maximum number of tokens is set to 4096 to accommodate the complete risk list output. The Alibaba Cloud Qianwen Big Model returns a risk list in JSON format, and the system parses and standardizes the risk number format.

[0096] Considering that the above implementation methods still have the following technical problems in practical applications:

[0097] Considering that in the above scheme, after the contract text is identified and classified, the generated structured clause data are independent of each other, and the reference relationships between clauses are not extracted and recorded.

[0098] However, in actual engineering contracts, there are often referencing relationships between different clauses. The text of the clauses may refer to the provisions of other clauses by saying that they are in accordance with Article N or the stipulations of a certain clause of this contract, so that the meaning and validity of the clauses depend on the specific content of the referenced clauses.

[0099] For example, a construction contract stipulates in its payment terms that a 30% advance payment will be made after signing the contract, and the remaining 97% will be paid after the project is completed and accepted. This clause makes the completion and acceptance a prerequisite for the payment of the remaining 97%, meaning that the payment terms in the payment terms depend on the definition of the specific time and standards for completion and acceptance in the delivery terms.

[0100] If the delivery terms stipulate that the final acceptance includes two stages, preliminary acceptance and final acceptance, and the final acceptance is to be carried out within 90 calendar days after the completion of the preliminary acceptance, but the payment terms do not specify whether the final acceptance refers to the preliminary acceptance or the final acceptance, then there is an objective uncertainty regarding the payment point. That is, it is impossible to determine whether payment will be made upon completion of the preliminary acceptance or the final acceptance. This uncertainty may lead to disputes such as the payer delaying payment or the contractor claiming payment in advance.

[0101] The aforementioned logical conflicts between clauses stem from the referencing relationships between clause texts. However, in the basic solution, after each clause is independently separated, the referencing relationship information between clauses is lost in the structured clause data, causing such cross-clause logical conflicts to be overlooked. To solve this technical problem, in another optional implementation, the generation of structured clause data also includes the following:

[0102] The reference relationships of each clause in the structured clause data are extracted, and a clause association graph is constructed. The clause association graph is used to record the references between each clause.

[0103] When the structured clause data and the risk comparison results are input into the big language model to perform risk identification and level determination, the set of related clauses of the target clause is obtained from the clause association diagram, and the set of related clauses, together with the target clause and the risk comparison results, is input into the big language model.

[0104] The large language model identifies cross-clause logical conflicts between the target clause and the set of related clauses and generates cross-clause conflict risk items, which are then added to the risk list.

[0105] It should be noted that citation extraction is the process of identifying references between clauses from the main text of the clauses. A clause relationship graph is a directed graph data structure built with clauses as nodes and citation relationships as directed edges, used to record the references between clauses.

[0106] Cross-clause logical conflict refers to a situation where multiple related clauses contradict or are inconsistent in terms of rights and obligations, time points, monetary standards, or applicable conditions.

[0107] Because there are natural referential relationships between the clauses in engineering contracts, such as payment and delivery, liability for breach of contract and quality standards, dispute resolution and procedural guidelines, these referential relationships are ignored when analyzing each clause independently, resulting in the inability to detect logical contradictions across clauses.

[0108] By constructing a clause relationship diagram and inputting related clauses into the large language model during risk identification, the model can perceive the reference relationships between clauses and detect cross-clause conflicts.

[0109] In the specific implementation process, the structured clause data is scanned and extracted using three types of citation patterns: The first type is clause number citation, which scans the text of the clauses in the main text for textual expressions such as "according to Article N", "see Article N" or "except as otherwise agreed in Article N", using "according to Article N", "see Article N", "in accordance with Article N", and "except as otherwise agreed in Article N" as the starting keywords, and continuously reads the subsequent numeric characters until non-numeric characters stop, and extracts the cited clause number N.

[0110] The second category involves citations of clause titles. This involves scanning the text for phrases like "according to the stipulations of Clause XXX of this Contract," using "according to this Contract" or "referring to this Contract" as the starting keyword and "the stipulations of the clause" or "the clause" as the ending keyword, extracting the title keywords between the two. Jaccard coefficients are then calculated for the title keywords and each clause title. The Jaccard coefficient is calculated as the number of intersection elements / the number of union elements. The node with the largest coefficient exceeding 0.5 is the cited clause.

[0111] The third category involves summarizing and referencing clause content. This involves scanning the text for phrases like "execute according to the provisions of this contract (XXX)", extracting the content summary, generating vectors using an embedding model, calculating the cosine similarity with each clause's text vector, and selecting the node with the highest similarity. After extraction, a clause association graph is constructed using clauses as nodes and referencing relationships as directed edges.

[0112] During risk identification, adjacent nodes within one hop from the target clause in the clause association diagram are obtained as the set of related clauses. The text of the related clauses, together with the target clause and the risk comparison results, are input into the big language model. The big language model identifies cross-clause logical conflicts and generates cross-clause conflict risk items.

[0113] For example, Article 5 of the payment terms stipulates that the employer shall pay 97% of the total contract price within 30 working days after the completion and acceptance of the project. Article 8 of the delivery terms stipulates that the completion and acceptance is divided into preliminary acceptance and final acceptance, and the final acceptance shall be carried out within 90 working days after the completion of the preliminary acceptance.

[0114] After reading Articles 5 and 8, the large language model identified that Article 5 uses the completion and acceptance of the project as the payment trigger condition, while Article 8 divides the completion and acceptance into two stages: preliminary acceptance and final acceptance. Article 5 does not clearly specify whether the completion and acceptance refers to preliminary acceptance or final acceptance. The two articles have logical ambiguity in terms of time points, which constitutes a cross-article logical conflict and generates a cross-article conflict risk item.

[0115] Step 4: Execute automatic workflow routing based on the risk level. When the risk level is a preset low risk level, generate an automatic approval opinion. When the risk level is a preset medium risk level or a preset high risk level, push the risk list to the review terminal.

[0116] In one possible implementation, generating an automatic approval opinion when the risk level is a preset low risk level, and pushing the risk list to the review terminal when the risk level is a preset medium risk level or a preset high risk level, includes the following:

[0117] Based on the risk level and the preset workflow routing rules, determine the audit process path corresponding to the risk list;

[0118] When the risk level is a preset low risk level, the system proceeds along the review process path to the automatic approval node and generates the automatic approval opinion.

[0119] When the risk level is a preset medium risk level or a preset high risk level, the process proceeds to the manual review node along the review process path, and the risk list is pushed to the review terminal.

[0120] It should be noted that automatic workflow routing is a process that automatically determines the review and processing path for each risk item based on the risk level of each risk item in the risk list and according to preset routing rules.

[0121] The risk level is generated by the large language model in step 3 according to the preset risk classification rules. It is divided into three levels: low risk, medium risk and high risk. The specific criteria for each level have been recorded in detail in step 3 and will not be repeated here. The preset workflow routing rules are a set of condition judgment rules. For example, if the risk level is low, it will be automatically approved; if the risk level is medium, it will be manually reviewed; and if the risk level is high, it will be manually reviewed.

[0122] The review terminal is a terminal device or web interface for legal or business review personnel to manually view, analyze, and modify contract terms. The automatic approval opinion is a review conclusion automatically generated by the system for low-risk items that does not require manual review. It includes a risk item identifier, a pass timestamp, and an SHA-256 digital signature.

[0123] Because engineering contracts typically involve a large number of risk items, indiscriminately pushing all of them to the review terminal would cause reviewers to spend time processing a large number of low-risk or formal risk items, diluting their review efforts on medium- and high-risk items. By automatically approving low-risk items and only pushing medium- and high-risk items for review, review resources can be concentrated on key risk items that require manual judgment, thus improving the efficiency of review resource utilization.

[0124] In the specific implementation process, based on the risk level field value of each risk item in the risk list, routing rules are matched: when the risk level is low, an automatic approval opinion object is generated, which includes the risk number, decision type = automatic approval, timestamp, and SHA-256 (risk number + timestamp) digital signature, and is written to the audit result database; when the risk level is medium or high, a data packet is pushed to the audit terminal via the WebSocket protocol. The packet contains all fields of the risk item, the corresponding structured clause data, the risk comparison result matching item list, and the text of the related clauses involved in the risk item when the clause association diagram is constructed in step 3.

[0125] For example, if a risk item has a low risk level, it will be automatically approved according to the matching rules, and the system will generate an automatic approval opinion. If a risk item has a medium risk level, it will be assigned to manual review according to the matching rules. After receiving the push notification, the review terminal will display the risk list on the left side of the webpage interface, display the original text of the corresponding clause in the center and highlight the risk-related text fragments, and display the knowledge base matching entries for reference on the right side.

[0126] It should be noted that the system supports differentiated workflow configurations for different types of engineering contracts. If a fixed workflow configuration is used for all contract types, the review process will lack specificity. It should also be noted that the visual workflow orchestration interface is a user interface module for legal or management personnel to configure the contract review process through graphical operation. It supports functions such as adding processes, editing nodes, connecting conditions, saving parameters, and version management.

[0127] Workflow nodes are the basic processing units that make up the contract review process chain. The nodes are connected in the order of business to form an executable process chain.

[0128] The node types defined in this embodiment include the following six categories: text parsing node, knowledge base matching node, clause association diagram construction node, risk identification node, hierarchical judgment node, and diversion node.

[0129] The contract type rule template is a set of conditional rules that pre-set node activation configurations, knowledge base scope, review thresholds, and processing parameters for different types of engineering contracts.

[0130] In the specific implementation process, in the visual workflow orchestration interface, users can drag and drop six types of nodes in the order of business to form an executable process link: text parsing node, knowledge base matching node, clause association diagram construction node (optional), risk identification node, hierarchical judgment node, and diversion node.

[0131] The clause association diagram construction node is an optional node. It is inserted into the link when the corresponding node in the contract type rule template is marked as enabled, and skipped when marked as disabled. Data transfer between nodes is performed using a structured field mapping method. The output fields of the previous node are passed to the input fields of the next node through the field mapping configuration relationship.

[0132] The internal processing logic and input / output data definitions of each node are as follows: The input of the text parsing node is the original contract text, the contract attachment text, the contract type identifier, and the business party information. The node internally calls the format conversion, clause recognition, and clause classification processes described in step 1, and the output is a structured clause result dataset.

[0133] The input to the knowledge base matching node is the structured terms result dataset and the contract type identifier. The node internally calls the vectorization processing and approximate nearest neighbor retrieval process described in step 2, and the output is the recalled standard terms, risk terms, legal basis and corresponding similarity values.

[0134] The input to the clause association graph construction node is the structured clause result dataset. The node internally calls the three types of reference pattern scanning and extraction and clause association graph construction process in step 3. The output is the clause association graph data object and the set of related clauses for each clause.

[0135] The inputs to the risk identification node are the clause content, the knowledge base matching results, and the set of related clauses attached when the clause association graph construction node is enabled. The node internally calls the large language model risk identification process described in step 3. When the clause association graph construction node is enabled, it adds the text of related clauses to the prompt words and instructs the model to detect cross-clause logical conflicts. The output is a risk point description, risk type, triggering basis, and modification suggestions.

[0136] The input to the risk identification node is the risk identification result. The node internally calls the risk classification rules described in step 3 and outputs the risk level corresponding to each risk item.

[0137] The input to the diversion node is the risk level. The node executes diversion routing according to the diversion rules. That is, low-risk nodes automatically pass and generate automatic approval opinions, while medium-risk and high-risk nodes push the data to the review terminal.

[0138] It should be noted that the system has the following default exception handling mechanism for any abnormal situations that occur during the execution of each node: when an input field is missing, an error log is recorded and the current clause is marked as pending manual processing; when the model interface returns an exception, it will automatically retry once, and if the exception still occurs, it will jump to the manual review node.

[0139] When the number of retrieved results is 0 or the total similarity is below the preset minimum, the matching results for that clause in the knowledge base matching node are skipped, and execution continues in the risk identification node in the mode of no matching knowledge entries.

[0140] For different types of engineering contracts, the system presets the following differentiated configuration schemes: For general construction contracts, it uses the rule templates corresponding to the schedule clauses, quality clauses, price clauses, and breach of contract clauses, and limits the search scope to the construction contract knowledge base section in the knowledge base matching node; For procurement contracts, it uses the rule templates corresponding to the category clauses, delivery clauses, acceptance clauses, payment clauses, and after-sales clauses, and limits the search scope to the procurement contract knowledge base section in the knowledge base matching node; For consulting service contracts, it uses the rule templates corresponding to the deliverables clauses, intellectual property clauses, and confidentiality obligation clauses, and limits the search scope to the consulting service contract knowledge base section in the knowledge base matching node. By configuring the rule templates, knowledge base scope, and review thresholds corresponding to different contract types, differentiated process processing is achieved.

[0141] Step 5: Receive the audit results returned by the audit terminal, perform a compliance re-inspection based on the audit results, generate a review report, and complete the archiving and storage.

[0142] In one possible implementation, the step of performing a compliance re-inspection based on the audit results, generating a review report, and completing archiving and storage includes the following:

[0143] Based on the modifications in the audit results, risk identification and rule verification are re-executed on the modified clauses to generate a re-inspection result.

[0144] When the re-inspection results indicate that all risk items have been rectified, the risk list, the audit results, and the re-inspection results are summarized to generate the review report.

[0145] The review report, the contract documents, and the audit process log are stored together to complete the archiving and storage.

[0146] It should be noted that the audit results are structured data submitted by the auditors after completing the manual review on the audit terminal. They include the auditor's identification, audit timestamp, audit decision for each risk item, the revised clause text and modification explanation, and the audit decision includes whether it has been eliminated, modified, or rejected.

[0147] Compliance review is the process of re-executing the revised clauses, identifying risks, and verifying rules. The review report is a formatted, portable document summarizing the risk list, audit results, and review results.

[0148] Because the revisions made by auditors to the terms may result in two outcomes: the original risk is eliminated without introducing new risks, or the revisions fail to eliminate risks or even introduce new risks. If a compliance review is not performed, the effectiveness of the audit revisions cannot be verified. Archived storage will persistently save the data throughout the entire process, providing a data foundation for subsequent audit traceability.

[0149] In the specific implementation process, the system receives the audit results returned by the audit terminal, extracts the modified clause text to replace the original clause content for risk items whose decision type is modified, re-executes the semantic matching retrieval in step 2 and the risk identification process in step 3, and generates the re-inspection results.

[0150] If no medium or high-level risk items are found in the risk list of the re-inspection results, it is determined that all risk items have been rectified. The original risk list, all audit results, and re-inspection results are summarized, and a portable document format review report is generated page-by-page using a report generation library. This report includes basic contract information, a risk list summary table, audit process records, and re-inspection results. An archive record is created in the archive table of the relational database using the review task identifier as the primary key. The contract documents, review report, and audit process log are stored in the corresponding bucket of the object storage service. The audit process log is a time-series record of the operations of each module throughout the entire process. Each log entry includes a timestamp, module name, operation description, and operation result.

[0151] Example 2

[0152] A system based on large-scale engineering contract analysis and AI risk management is provided, applying the aforementioned methods for large-scale engineering contract analysis and AI risk management, such as... Figure 2 As shown, it includes:

[0153] The contract parsing module is used to receive contract documents, perform text parsing and clause structured decomposition on the contract documents, and generate structured clause data.

[0154] A private knowledge retrieval and matching module is used to input the structured clause data into a private knowledge base to perform semantic matching retrieval and generate risk comparison results.

[0155] The AI ​​risk assessment module is used to input the structured clause data and the risk comparison results into a large language model to perform risk identification and level determination, and generate a risk list and the risk level corresponding to each risk item in the risk list;

[0156] The automatic workflow scheduling and distribution module is used to automatically distribute the workflow according to the risk level. When the risk level is a preset low risk level, an automatic approval opinion is generated. When the risk level is a preset medium risk level or a preset high risk level, the risk list is pushed to the review terminal.

[0157] The review and re-inspection archiving module is used to receive the review results returned by the review terminal, perform compliance re-inspection based on the review results, generate a review report, and complete archiving and storage.

[0158] The embodiments described above are merely illustrative of specific implementations of the present invention, and while the descriptions are detailed, they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention.

Claims

1. A method based on large-scale engineering contract analysis and AI risk management, characterized in that, Includes the following steps: Step 1: Receive the contract documents, perform text parsing and clause structure decomposition on the contract documents, and generate structured clause data; Step 2: Input the structured terms data into the private knowledge base to perform semantic matching retrieval and generate risk comparison results; Step 3: Input the structured clause data and the risk comparison results into the large language model to perform risk identification and level determination, and generate a risk list and the risk level corresponding to each risk item in the risk list; Step 4: Execute automatic workflow routing according to the risk level. When the risk level is a preset low risk level, generate an automatic approval opinion. When the risk level is a preset medium risk level or a preset high risk level, push the risk list to the review terminal. Step 5: Receive the audit results returned by the audit terminal, perform a compliance re-inspection based on the audit results, generate a review report, and complete the archiving and storage.

2. The method for large-scale engineering contract analysis and AI risk management according to claim 1, characterized in that, The process of parsing the contract document and breaking down its clauses into a structured form to generate structured clause data includes the following: Perform format conversion and text extraction on the contract document to generate the contract text; The contract text is subjected to clause identification and classification, and each clause in the contract text is assigned to the corresponding clause category to generate the structured clause data containing clause number, clause title, clause body and clause category.

3. The method for large-scale engineering contract analysis and AI risk management according to claim 1, characterized in that, The structured terms data is input into a private knowledge base to perform semantic matching retrieval, generating risk comparison results including the following: The clauses in the structured clause data are vectorized to generate clause vectors; The clause vector is matched with the knowledge vectors pre-stored in the private knowledge base to recall standard clauses, risk clauses and legal basis that meet the preset threshold of matching degree, and the risk comparison result is generated.

4. The method for large-scale engineering contract analysis and AI risk management according to claim 1, characterized in that, The structured clause data and the risk comparison results are input into a large language model to perform risk identification and level determination, generating a risk list and the risk level corresponding to each risk item in the risk list, including the following: The structured clause data and the risk comparison results are input into the big language model, which then performs risk clause identification, missing clause detection, and illegal expression determination to generate the risk list. The large language model determines the level of each risk item in the risk list according to the preset risk classification rules, and generates the risk level corresponding to each risk item.

5. The method for large-scale engineering contract analysis and AI risk management according to claim 1, characterized in that, When the risk level is a preset low risk level, an automatic approval opinion is generated. When the risk level is a preset medium risk level or a preset high risk level, the risk list is pushed to the review terminal, including the following: Based on the risk level and the preset workflow routing rules, determine the audit process path corresponding to the risk list; When the risk level is a preset low risk level, the system proceeds along the review process path to the automatic approval node and generates the automatic approval opinion. When the risk level is a preset medium risk level or a preset high risk level, the process proceeds to the manual review node along the review process path, and the risk list is pushed to the review terminal.

6. The method for large-scale engineering contract analysis and AI risk management according to claim 1, characterized in that, The process of performing a compliance re-inspection based on the audit results, generating a review report, and completing archiving and storage includes the following: Based on the modifications in the audit results, risk identification and rule verification are re-executed on the modified clauses to generate a re-inspection result. When the re-inspection results indicate that all risk items have been rectified, the risk list, the audit results, and the re-inspection results are summarized to generate the review report. The review report, the contract documents, and the audit process log are stored together to complete the archiving and storage.

7. The method for large-scale engineering contract analysis and AI risk management according to claim 1, characterized in that, The received contract documents include the following: The contract documents and review parameters submitted by the external system are received through the application programming interface (API). The review parameters are authenticated and verified. Once the verification is successful, a review task identifier is generated. The review task identifier is then associated with the contract document and the text parsing and clause structure splitting process is initiated. After the review report is generated, it is sent back to the external system via the application programming interface.

8. A system based on large-scale engineering contract analysis and AI risk management, characterized in that: The method for large-scale engineering contract analysis and AI risk management based on any one of claims 1-7 includes: The contract parsing module is used to receive contract documents, perform text parsing and clause structured decomposition on the contract documents, and generate structured clause data. A private knowledge retrieval and matching module is used to input the structured clause data into a private knowledge base to perform semantic matching retrieval and generate risk comparison results. The AI ​​risk assessment module is used to input the structured clause data and the risk comparison results into a large language model to perform risk identification and level determination, and generate a risk list and the risk level corresponding to each risk item in the risk list; The automatic workflow scheduling and distribution module is used to automatically distribute the workflow according to the risk level. When the risk level is a preset low risk level, an automatic approval opinion is generated. When the risk level is a preset medium risk level or a preset high risk level, the risk list is pushed to the review terminal. The review and re-inspection archiving module is used to receive the review results returned by the review terminal, perform compliance re-inspection based on the review results, generate a review report, and complete archiving and storage.