A Contract Recognition and Intelligent Management System and Method Based on MCP
By using the multimodal fusion and reinforcement learning decision model of the MCP system, the efficiency and accuracy issues in heterogeneous contract management are solved, achieving a deep understanding and adaptive processing of the logical relationships between clauses, thereby improving the efficiency and accuracy of contract management.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-09
- Publication Date
- 2026-04-03
AI Technical Summary
Existing contract management technologies are inefficient and inaccurate when dealing with heterogeneous contract formats, lack unified parsing capabilities, and are unable to effectively detect logical relationships between clauses and adaptive learning.
A contract recognition and intelligent management system based on MCP is adopted. By fusing text and image processing results through multimodal methods, a knowledge graph is constructed to detect logical conflicts in clauses and assess compliance risks. Combined with a reinforcement learning decision model, adaptive learning and standardized processing are achieved.
It enables unified processing of multi-format contract documents, deep understanding of the logical relationships between clauses, effective detection of potential conflicts and compliance risks, and improves the efficiency and accuracy of contract management. It also has adaptive learning capabilities and supports standardized integration of different data sources.
Smart Images

Figure CN121304202B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence technology, specifically to a contract recognition and intelligent management system and method based on MCP. Background Technology
[0002] Contract management is a core task for corporate legal and administrative departments. As business scales up, the number of contracts that companies need to handle grows exponentially, placing higher demands on the structured extraction, intelligent analysis, and risk control of contract content. Traditional contract management mainly relies on manual review and data entry, which is inefficient when dealing with a large number of heterogeneous contract formats.
[0003] Currently, common contract management solutions in the industry mainly include OCR-based text extraction systems and keyword-matching-based information extraction tools. These systems can typically extract basic information from standard-format electronic documents, such as contract name, signatories, and contract amount, but they perform poorly when handling complex clauses and non-standard-format documents.
[0004] Existing advanced contract management technologies typically employ a single-modal text analysis approach, extracting contract information through predefined templates and rules, and then combining this with simple natural language processing techniques for clause classification. While this type of technology achieves some success in processing highly standardized contracts, its core technical architecture lacks flexibility, cannot effectively handle multi-format documents, and its trained models are difficult to dynamically adjust according to actual application scenarios.
[0005] Existing technical solutions suffer from several key drawbacks: First, they lack a unified parsing capability for heterogeneous contracts (such as scanned paper copies, electronic documents, and mixed documents containing handwritten annotations), resulting in poor format compatibility. Second, they lack a deep understanding of the logical relationships between contract clauses, making it impossible to effectively detect potential conflicts. Most importantly, existing systems generally lack adaptive learning capabilities, failing to ensure accuracy while maintaining high efficiency, leading to manual processing still consuming significant time. Therefore, existing contract management methods are inefficient and inaccurate in processing heterogeneous data. Summary of the Invention
[0006] In view of this, embodiments of this application provide a contract recognition and intelligent management system and method based on MCP, which aims to solve the technical problems of existing contract management technologies in handling heterogeneous contract formats, detecting logical conflicts in clauses, and lacking adaptive learning capabilities, so as to achieve efficient and accurate contract document processing and management.
[0007] In a first aspect, embodiments of this application provide a contract identification and intelligent management method based on MCP, comprising the following steps:
[0008] Obtain contract documents in multiple formats for the target contract, perform text processing and image processing on the contract documents, and perform multimodal fusion of the text processing results and image processing results to obtain intermediate data;
[0009] Based on the intermediate data, target entities and relationships in the target contract are extracted. A knowledge graph is constructed based on the target entities and their corresponding relationships. Based on the knowledge graph, the target contract is subjected to clause logic conflict detection and compliance risk assessment to obtain the contract assessment result.
[0010] A state space is constructed based on the knowledge graph and the contract evaluation results. A sequence of actions for processing the target contract is generated based on the state space. A decision model is constructed based on the action execution results and performance indicators after executing the sequence of actions, so that a reinforcement learning decision model can be constructed based on the state space, the sequence of actions, and the decision model.
[0011] Based on the reinforcement learning decision model, the MCP interface specification data is determined, and an adapter model for different data sources is constructed based on the MCP interface specification data. The adapter model is used to indicate how to transform data from different data sources into data streams that are compatible with the MCP interface specification data.
[0012] The contract document is processed using the adapter model to obtain a contract MCP data stream. Based on the MCP interface specification data, the knowledge graph and the reinforcement learning decision model are reconstructed for the contract MCP data stream, integrating the model processing results and the model running status.
[0013] Based on the model processing results and the model running status, the contract processing flow for the target contract is executed to obtain a contract management scheme, and the MCP interface specification data and the reinforcement learning decision model are updated according to the contract management scheme.
[0014] As an improvement to the above solution, the step of acquiring contract documents in multiple formats for the target contract, performing text processing and image processing on the contract documents, and fusing the text processing results and image processing results in a multimodal manner to obtain intermediate data includes:
[0015] The contract document is identified by file format recognition, and preprocessed according to the identified file format to obtain a standardized document object;
[0016] The text content is extracted from the standardized document object, and the text content is processed using a preset deep learning entity recognition model to identify multiple entities, including the contract subject, terms and date key entities;
[0017] Determine the dependencies between the contract subject, the terms, and the date key entity, and determine the text processing result based on the entity and the corresponding dependencies;
[0018] The image content is extracted from the standardized document object, and the image content is recognized and structurally extracted using a preset OCR recognition model to obtain the image processing result;
[0019] The text processing results and the image processing results are fused using a multimodal method to output fused data.
[0020] Using a preset data model converter, the fused data is mapped to a predefined JSON pattern to obtain intermediate data.
[0021] As an improvement to the above solution, based on the intermediate data, target entities and relationships in the target contract are extracted; a knowledge graph is constructed based on the target entities and their corresponding relationships; and the target contract is subjected to clause logic conflict detection and compliance risk assessment based on the knowledge graph to obtain contract assessment results, including:
[0022] Semantic analysis is performed on the intermediate data to extract the target entities in the target contract and the relationships between the target entities, forming a set of entity relationship pairs. The target entities include subject-type entities, attribute-type entities, and event-type entities, and the relationships include rights and obligations, master-slave relationships, and conditional relationships.
[0023] Based on the set of entity relationship pairs, a knowledge graph is constructed, where nodes in the knowledge graph represent the target entity, and edges in the knowledge graph represent the relationship between two connected entities.
[0024] In the knowledge graph, trace the association paths between the entities, locate the path conflict points on the association paths, and detect the logical consistency of the terms in the knowledge graph to obtain the logical conflict points;
[0025] Using preset conflict detection rules, the path conflict points and the logical conflict points are compared to obtain target conflict points that conform to the conflict detection rules. Based on the conflict point information of the target conflict points, a conflict detection report is generated, wherein the conflict point information includes conflict location, conflict type and conflict cause.
[0026] Using preset compliance rules, the target conflict point is risk-scored and risk-classified based on the knowledge graph and the conflict detection report to obtain a compliance risk assessment report;
[0027] The conflict detection report and the compliance risk assessment report are combined to form the contract assessment result.
[0028] As an improvement to the above scheme, the step of constructing a state space based on the knowledge graph and the contract evaluation results, generating a sequence of processing actions for the target contract based on the state space, and constructing a decision model based on the action execution results and performance indicators after executing the processing action sequence, so that a reinforcement learning decision model can be constructed based on the state space, the processing action sequence, and the decision model, including:
[0029] Based on the knowledge graph, the contract evaluation results, and the pre-acquired historical contract processing data, a state space is constructed. The state space includes state vectors with multiple dimensions, including field confidence scores, historical accuracy, contract complexity, and recognition difficulty.
[0030] Based on the state space, an action space containing multiple processing actions is constructed. Based on the state space, the action value of each processing action is calculated using a preset deep Q-network. The processing action that maximizes the action value is selected and then arranged in a preset logical order to form a sequence of processing actions.
[0031] Execute the processing actions in the processing action sequence in sequence, and record the execution result and performance indicators of each processing action;
[0032] Based on the action execution result and the performance index, the reward value obtained by executing the processing action is determined. Based on the reward value, the parameters of the deep Q network are updated through backpropagation to obtain the reinforcement learning decision model.
[0033] As an improvement to the above scheme, the step of determining the reward value obtained by performing the processing action based on the action execution result and the performance index, and updating the parameters of the deep Q-network through backpropagation based on the reward value to obtain a reinforcement learning decision model, includes:
[0034] Based on the execution results of the action and the performance indicators, extract the accuracy change value, time consumption and resource usage data, and output the performance evaluation parameters.
[0035] Based on the performance evaluation parameters, the reward value of the processing action is calculated using a preset reward function, which includes an accuracy change item, a time saving item, an action cost penalty item, and an error penalty item.
[0036] The network loss of the deep Q-network is determined based on the reward value and the state vector.
[0037] Based on the network loss, the parameter gradients of each layer in the deep Q-network are calculated using the backpropagation algorithm;
[0038] Based on the parameter gradient, the weights and bias parameters of the deep Q-network are updated using a preset gradient descent optimization algorithm to obtain a reinforcement learning decision model.
[0039] As an improvement to the above scheme, the step of determining the MCP interface specification data based on the reinforcement learning decision model, and constructing adapter models for different data sources based on the MCP interface specification data, includes:
[0040] Based on the reinforcement learning decision model, an MCP interface document and an MCP interface implementation library are determined to constitute the MCP interface specification data. The MCP interface document includes a data format representing the data structure of the interface transmission, an interaction protocol representing the communication rules between modules, and an event handling mechanism. The event handling mechanism is used to indicate the triggering conditions and response logic of key events. The MCP interface implementation library contains program code for executing contract processing.
[0041] The process involves using the adapter model to process the contract document, obtaining a contract MCP data stream, and reconstructing the knowledge graph and the reinforcement learning decision model based on the MCP interface specification data, integrating the model processing results and model running status, including:
[0042] The adapter model is used to extract contract documents from different data sources, and the contract documents from each data source are converted into standardized data that is compatible with the MCP interface specification data. The standardized data is then preprocessed to obtain the contract MCP data stream.
[0043] Based on the MCP interface specification data, text processing and image processing are re-executed, the knowledge graph is reconstructed, and the reinforcement learning decision model is reconstructed. The intermediate data and contract evaluation results obtained after the current re-execution are summarized to obtain the model processing results and model running status.
[0044] As an improvement to the above scheme, the text processing results and the image processing results are fused using a multimodal method to output fused data, including:
[0045] Based on the text processing results and the image processing results, the contract document is divided into multiple non-overlapping subdomains, including clause paragraphs, table areas, and signature sections, according to semantic and structural features.
[0046] Using the feature extraction function corresponding to each subdomain, word vectors, syntactic structure and semantic features are extracted from the text region in the subdomain, and spatial relationship, visual features and content layout information are extracted from the image region in the subdomain, and the local features of each subdomain are output.
[0047] Based on the local features of the subdomain, differential expression rules are configured at the boundaries of the subdomain to construct a feature space, wherein the differential expression rules are used to indicate that discontinuities in the local features are allowed at the boundaries of the subdomain.
[0048] Based on the feature space and the local features, the jump value and average gradient of the cross-domain features are calculated, and the jump value and average gradient are calculated using a preset internal penalty function to obtain the penalty constraint parameters.
[0049] Using a preset symmetric matrix operator, the characteristic coordination equation corresponding to the penalty constraint parameter is solved to obtain the symmetric constraint solution result;
[0050] Based on the solution results of the symmetry constraints, the subdomain processing order is determined according to the preset logical structure of the contract document. The subdomain processing order is used to indicate that subdomains with information density higher than a preset density threshold are processed first, and subdomains with information density lower than the density threshold are processed later.
[0051] Based on the penalty constraint parameters of any subdomain in the subdomain processing order and the interaction penalty parameters of other subdomains associated with the subdomain, global penalty data is determined, and multimodal fusion features are determined. The multimodal fusion features are used to indicate the subdomain that minimizes the global penalty data and its corresponding structured information and the association between the subdomains. The structured information includes the entity and image features in the image content. The interaction penalty parameters are used to indicate the logical consistency between the subdomains.
[0052] Based on the multimodal fusion features, the text processing results and the image processing results are fused using multimodal methods.
[0053] As an improvement to the above scheme, the step of calculating the jump value and average gradient of cross-domain features based on the feature space and the local features, and calculating the jump value and average gradient using a preset internal penalty function to obtain penalty constraint parameters, includes:
[0054] Based on the feature space and the local features of adjacent subdomains, the jump value of the cross-domain feature is obtained;
[0055] Calculate the average gradient and normal vector of the feature space at the domain boundary to obtain gradient vector data;
[0056] Based on the jump value of the cross-domain feature and the gradient vector data, an internal penalty function is constructed. The internal penalty function includes a first penalty term for controlling the jump value of the cross-domain feature, a second penalty term for controlling the change of the gradient vector data, a first weight parameter corresponding to the first penalty term, and a second weight parameter corresponding to the second penalty term. The first weight parameter is used to control the degree of difference of local features in adjacent subdomains, and the second weight parameter is used to control the smoothness of the gradient in the feature space.
[0057] The penalty constraint parameters are obtained by calculating the jump value and the average gradient using the internal penalty function.
[0058] As an improvement to the above scheme, an action space containing multiple processing actions is constructed based on the state space. Based on the state space, a preset deep Q-network is used to calculate the action value of each processing action. The processing action that maximizes the action value is selected, and then arranged in a preset logical order to form a sequence of processing actions, including:
[0059] Based on the state vectors of multiple dimensions, the state space is decomposed into multiple levels according to a preset level of fineness, forming a multi-level state space ordered from coarse to fine. The levels include the coarsest grid, multiple intermediate grids, and the finest grid.
[0060] Based on the multi-level state space, a corresponding Q-value function is defined for each level to obtain a multi-grid Q-value function representation. The Q-value function includes the complete state-action value function corresponding to the finest grid, the simplified value function corresponding to the intermediate grid, and the core feature value estimation function corresponding to the coarsest grid.
[0061] Based on the multi-grid Q-value function representation, a level-to-level transformation operator is determined, wherein the level-to-level transformation operator includes a constraint operator and an extension operator. The constraint operator is used to indicate mapping the Q-value of the fine grid to the first-order coarse grid, and the extension operator is used to indicate extending the Q-value of the coarse grid to the first-order fine grid.
[0062] Based on the inter-level transformation operator, an adaptive smoothing function is constructed. Standard smoothing or high-speed flow smoothing is selected according to the gradient of the Q-value function. The adaptive smoothing function is combined to form a smoothing processing strategy. The adaptive smoothing function is used to indicate the high-speed flow phenomenon in the processing of the contract.
[0063] Based on the smoothing strategy and the multi-grid Q-value function representation, starting from the finest grid, the Q-value of the current finest grid is iteratively smoothed multiple times. The residual corresponding to the smoothed Q-value is calculated and passed to the coarser grid through the constraint operator until the coarsest grid. Starting from the coarsest grid, the coarse-grid optimization solution of the current coarse grid is iteratively solved and passed to the finest grid through the extension operator until the finest grid. The converged Q-value function is then output.
[0064] The optimal policy is extracted from the convergent Q-value function, and a policy smoothing operation is performed to obtain the sequence of processing actions.
[0065] As an improvement to the above scheme, the step of determining the inter-level transformation operator based on the multi-grid Q-value function representation includes:
[0066] Based on the multi-grid Q-value function representation, the Q-values of the fine-grid level are mapped to the coarser-level grid through a preset weighted average algorithm or feature aggregation algorithm to determine the constraint operator definition data of the constraint operator;
[0067] Based on the multi-grid Q-value function representation, the Q-value of the coarse grid level is extended to the finer grid level through a preset interpolation algorithm or feature expansion algorithm to determine the extension operator definition data of the extension operator;
[0068] Based on the constraint operator definition data and the extension operator definition data, a transformation function is constructed, which is used to indicate the minimization of the integral difference between the Q value of the fine mesh level and the Q value of the extended coarse mesh level;
[0069] Based on the transformation function, the ability of the constraint operator definition data and the extension operator definition data to preserve the key characteristics of the value function is verified, and the inter-level transformation operator is obtained.
[0070] As an improvement to the above scheme, the step of constructing an adaptive smoothing function based on the inter-level transformation operator, selecting standard smoothing or high-speed flow smoothing according to the gradient of the Q-value function, and combining the adaptive smoothing function to form a smoothing processing strategy includes:
[0071] Based on the inter-level transformation operator, calculate the absolute value of the gradient of the Q-value function of the current level;
[0072] Based on the absolute value of the gradient, a gradient threshold is determined, and based on the absolute value of the gradient and the gradient threshold, a flow state discrimination result is determined. The gradient threshold is used to distinguish between standard flow and high-speed flow states.
[0073] When the flow state determination result indicates that the absolute value of the gradient is less than the gradient threshold, the standard smoothing algorithm is selected; or when the flow state determination result indicates that the absolute value of the gradient is not less than the gradient threshold, the high-speed flow smoothing algorithm is selected. The high-speed flow smoothing algorithm is used to indicate that adaptive parameters are dynamically adjusted according to the data flow speed.
[0074] The selected standard smoothing algorithm or high-speed flow smoothing algorithm is executed to process the Q-value function, resulting in the smoothing strategy.
[0075] Secondly, embodiments of this application also provide a contract identification and intelligent management system based on MCP, including:
[0076] The document processing module is used to acquire contract documents in various formats for the target contract, perform text processing and image processing on the contract documents, and perform multimodal fusion of the text processing results and image processing results to obtain intermediate data;
[0077] The knowledge graph construction module is used to extract target entities and relationships in the target contract based on the intermediate data, construct a knowledge graph based on the target entities and corresponding relationships, and perform clause logic conflict detection and compliance risk assessment on the target contract based on the knowledge graph to obtain the contract assessment result.
[0078] The model building module is used to construct a state space based on the knowledge graph and the contract evaluation results, generate a sequence of processing actions for the target contract based on the state space, and construct a decision model based on the action execution results and performance indicators after executing the sequence of processing actions, so as to construct a reinforcement learning decision model based on the state space, the sequence of processing actions and the decision model.
[0079] The MCP interface configuration module is used to determine the MCP interface specification data based on the reinforcement learning decision model, and to construct adapter models for different data sources based on the MCP interface specification data. The adapter models are used to indicate how to transform data from different data sources into data streams that are compatible with the MCP interface specification data.
[0080] The data source adaptation module is used to process the contract document using the adapter model to obtain the contract MCP data stream, and to reconstruct the knowledge graph and the reinforcement learning decision model based on the MCP interface specification data, integrating the model processing results and the model running status.
[0081] The contract management module is used to execute the contract processing flow for the target contract based on the model processing results and the model running status, obtain the contract management scheme, and update the MCP interface specification data and the reinforcement learning decision model according to the contract management scheme.
[0082] The contract recognition and intelligent management system and method based on MCP provided in this application realizes unified processing of contract documents in various formats through multimodal parsing and fusion, improving adaptability and compatibility. Then, based on knowledge graph, it analyzes the contract clauses of the target contract, which can deeply understand the logical relationship between clauses and effectively detect potential conflicts and compliance risks. Furthermore, by constructing a reinforcement learning decision model, it has adaptive learning capabilities and can continuously optimize the processing strategy according to the actual application scenario. By adopting the MCP interface specification, it realizes the standardized integration of different data sources, models and processing processes, which improves scalability and maintainability. Through a closed-loop feedback mechanism, it can continuously optimize based on the processing results, achieving a dual improvement in contract management efficiency and accuracy. Attached Figure Description
[0083] To more clearly illustrate the technical solutions of the embodiments of this disclosure, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0084] Figure 1 A flowchart illustrating a contract identification and intelligent management method based on MCP provided in this application embodiment;
[0085] Figure 2 This is a schematic diagram of the structure of a contract recognition and intelligent management system based on MCP, provided for an embodiment of this application. Detailed Implementation
[0086] The embodiments of this application will now be described in detail with reference to the accompanying drawings.
[0087] like Figure 1 As shown in the figure, this application provides a contract identification and intelligent management method based on MCP, which includes the following steps S1 to S6.
[0088] S1. Obtain contract documents in various formats for the target contract, perform text processing and image processing on the contract documents, and perform multimodal fusion of the text processing results and image processing results to obtain intermediate data.
[0089] First, we acquire contract documents in various formats for the target contract, perform text and image processing on these documents, and then fuse the text and image processing results using a multimodal method to obtain intermediate data. The target contract refers to a specific contract that needs to be identified and managed; it may originate from different business units, partners, or legal environments. Contract documents in various formats include, but are not limited to, electronic text files (such as DOC, PDF, TXT, etc.), scanned images (such as JPG, PNG, TIFF, etc.), structured data (such as XML, JSON, etc.), and handwritten documents. These different formats require different processing methods to extract relevant information.
[0090] Text processing refers to the analysis and understanding of the text content in contract documents, including techniques such as text extraction, text classification, named entity recognition, and relation extraction. The first step in text processing is text extraction. For electronic text files, the text content is read directly; for image-formatted documents, Optical Character Recognition (OCR) technology is used to convert the image into processable text. Next, text preprocessing is performed, including word segmentation, stop word removal, stemming, and part-of-speech tagging. Then, text classification is performed, categorizing the contract text according to content type (such as clauses, definitions, and declarations). Finally, named entity recognition is performed to identify key entities in the contract, such as contracting parties, dates, amounts, and products.
[0091] Image processing refers to the analysis and understanding of image content in contract documents, including techniques such as image segmentation, feature extraction, and pattern recognition. The first step in image processing is image preprocessing, which includes operations such as noise reduction, correction, and enhancement to improve image quality. Next, image segmentation is performed, dividing the image into different regions, such as text areas, table areas, graphic areas, and signature / seal areas. Then, feature extraction is performed, extracting visual features from each region, such as color, texture, and shape. Finally, content recognition is performed, identifying specific elements in the image, such as signatures, seals, and charts.
[0092] In this application, multimodal fusion refers to integrating information from different data types or "modalities" into a unified representation. In contract processing, multimodal fusion combines text analysis results with image analysis results to create a comprehensive data representation. Fusion methods can be categorized into three types: Early Fusion, which merges raw data from different modalities before feature extraction; Intermediate Fusion, which merges feature vectors from different modalities at the feature level; and Late Fusion, which merges analysis results from different modalities at the decision level. Specifically, an intermediate fusion strategy is adopted, which constructs a feature space and uses an internal penalty function and symmetric matrix operators to generate unified intermediate data. This intermediate data is a structured data representation containing the content, structure, and semantic information of the contract, providing a foundation for subsequent knowledge graph construction and analysis.
[0093] S2. Based on the intermediate data, extract the target entities and relationships in the target contract, construct a knowledge graph based on the target entities and their corresponding relationships, and perform clause logic conflict detection and compliance risk assessment on the target contract based on the knowledge graph to obtain the contract assessment result.
[0094] In this application, target entities and relationships in the target contract are extracted based on intermediate data. A knowledge graph is constructed based on the target entities and their corresponding relationships. The target contract is then evaluated using the knowledge graph to detect logical conflicts in clauses and assess compliance risks, resulting in a contract evaluation. A target entity is a key information unit in the contract, including the contracting parties (e.g., contracting parties), contract elements (e.g., amount, term), and contract terms (e.g., rights, obligations). Target entity extraction employs deep learning techniques, particularly sequence labeling methods based on pre-trained language models (e.g., BERT, RoBERTa), which can identify various entities and their attributes in the contract text. A relationship refers to the semantic connection between different entities, such as "subject-obligation," "term-exception," and "breach-liability." Relationship extraction uses a relationship classification model, which takes a text paragraph containing two entities as input and predicts the possible relationship types between them. For example, relationship extraction methods include pattern-based methods, feature-based methods, and deep learning-based methods. A hybrid approach integrating syntactic analysis and deep learning is used to improve the accuracy of relationship extraction.
[0095] A knowledge graph is a structured representation of knowledge that constructs a semantic network through entities and relationships, vividly illustrating the connections between knowledge. A contract knowledge graph uses entities in a contract as nodes and relationships between entities as edges to build a complete semantic network for the contract. The construction of a knowledge graph involves three steps: entity modeling, relationship modeling, and knowledge fusion. Entity modeling defines entity types and attributes; relationship modeling defines relationship types and attributes; and knowledge fusion integrates entities and relationships from different parts, resolving redundancy and conflict issues to form a coherent knowledge system.
[0096] Clause logic conflict detection is the process of analyzing whether there are logical contradictions or inconsistencies between contract clauses. Based on knowledge graphs, contract clauses are transformed into logical rules, and then a logical reasoning engine detects conflicts between these rules. Common conflict types include direct conflicts (e.g., one clause allows while another prohibits), indirect conflicts (e.g., inferences between clauses contradict each other), and circular dependencies (e.g., clauses form a circular condition that cannot be satisfied simultaneously). Exemplary conflict detection techniques include formal logic verification, semantic consistency checks, and graph-based path analysis.
[0097] Compliance risk assessment is the process of evaluating whether contract terms comply with relevant laws, regulations, industry standards, and internal policies. This application uses a knowledge graph to compare contract terms against a predefined compliance rule base to identify potential compliance risks. The risk assessment considers multiple dimensions, including legal, financial, operational, and reputational risks. Assessment results typically include information such as risk type, risk level, scope of impact, and corresponding countermeasures.
[0098] The Contract Evaluation Result is a comprehensive output of clause logic conflict detection and compliance risk assessment, providing a complete view of contract quality and risk. The evaluation results are typically presented in structured data format, including identified issues, risk points, measures, and scoring indicators, providing a basis for subsequent contract management decisions.
[0099] S3. Construct a state space based on the knowledge graph and the contract evaluation results, generate a sequence of actions to process the target contract based on the state space, and construct a decision model based on the action execution results and performance indicators after executing the sequence of actions, so as to construct a reinforcement learning decision model based on the state space, the sequence of actions, and the decision model.
[0100] In this application, a state space is constructed based on a knowledge graph and contract evaluation results. A sequence of actions for processing the target contract is generated based on this state space. A decision model is then constructed based on the execution results and performance metrics after executing the action sequence, enabling the construction of a reinforcement learning decision model based on the state space, the action sequence, and the decision model. The state space is a set describing all possible states. In contract management, the state space includes multiple dimensions such as the contract's current state, processing stage, and risk level. The construction of the state space is based on the structured information provided by the knowledge graph and the risk metrics provided by the contract evaluation results, forming a multi-dimensional state description framework.
[0101] A processing action sequence refers to a series of operational steps involved in processing a contract, such as information extraction, clause analysis, risk assessment, and content modification. These actions are automatically generated based on the current state and aim to resolve detected issues and optimize the contract management process. Action generation employs a strategy combining rule-based methods and machine learning, selecting the most suitable action sequence based on contract type, risk characteristics, and processing objectives.
[0102] Action execution result refers to the actual effect obtained after executing a sequence of processing actions, including problem resolution, risk mitigation, and efficiency improvement. These results are collected through system monitoring and user feedback to provide practical data for subsequent model optimization. Performance metrics are quantitative standards for measuring the effectiveness of action execution, including accuracy, recall, F1 score, processing time, and resource consumption. These metrics reflect different aspects of system performance.
[0103] A decision model is an intelligent decision-making framework built upon a state space, a sequence of actions, and execution results. It selects the optimal action based on the current state. The decision model is constructed using supervised learning methods, employing historical processing data as a training set to learn the mapping relationship between states and optimal actions.
[0104] Reinforcement learning decision models are machine learning methods that learn optimal policies through interaction with the environment. In contract management, reinforcement learning models treat contract processing as a decision-making process, where the state is the current state of the contract, the action is the possible processing operation, and the reward is the evaluation of the effect after the operation. The model learns an optimal policy by continuously trying different actions and observing the results, that is, choosing the action that obtains the maximum long-term reward in each state. In this application, a deep Q-network (DQN) is used to implement reinforcement learning. DQN combines deep neural networks with Q-learning, which can handle high-dimensional state spaces and learn complex state-action value functions. The construction of the reinforcement learning decision model includes four steps: environment modeling, reward function design, exploration policy definition, and model training, which can continuously optimize its decision-making ability and adapt to different types of contract management tasks.
[0105] S4. Based on the reinforcement learning decision model, determine the MCP interface specification data, and construct an adapter model for different data sources based on the MCP interface specification data. The adapter model is used to indicate how to transform data from different data sources into data streams that are compatible with the MCP interface specification data.
[0106] In this application, based on a reinforcement learning decision model, MCP interface specification data is determined. Based on this data, adapter models for different data sources are constructed. These adapter models instruct the transformation of data from different data sources into data streams adapted to the MCP interface specification data. It should be noted that MCP (Model-Contract-Process) organically combines the three elements of model, contract, and processing flow into a unified contract management system. MCP interface specification data is a set of data defining the interaction standards between components. It specifies data formats, interaction protocols, interface parameters, etc., ensuring seamless collaboration between the parts.
[0107] The Adapter Model is a middleware component that transforms heterogeneous data from different data sources into a unified format conforming to the MCP interface specification. The Adapter Model employs the Adapter Design Pattern, encapsulating the specific interfaces of the data sources to provide a unified standard interface for other components. The construction of the Adapter Model includes four steps: data source analysis, mapping rule definition, transformation logic implementation, and verification testing. Data source analysis identifies the characteristics and formats of different data sources; mapping rules define the transformation relationship between source and target data; the transformation logic implements the specific data transformation algorithm; and verification testing ensures that the transformation results meet the requirements of the MCP interface specification.
[0108] Different data sources refer to various systems or platforms that provide contract-related information, such as Enterprise Resource Planning (ERP) systems, Customer Relationship Management (CRM) systems, legal databases, and electronic signature platforms. These data sources may use different data formats, encoding standards, and interface protocols, requiring unified processing through an adapter model. Data flow refers to the flow of data between components; it includes various information during processing, such as raw data, intermediate results, and final output.
[0109] S5. Process the contract document using the adapter model to obtain the contract MCP data stream, and reconstruct the knowledge graph and the reinforcement learning decision model based on the MCP interface specification data, integrating the model processing results and the model running status.
[0110] In this application, an adapter model is used to process contract documents to obtain a Contract MCP Data Flow. Based on the MCP interface specification data, a knowledge graph and reinforcement learning decision model are reconstructed for the Contract MCP Data Flow, integrating the model processing results and model running status. The Contract MCP Data Flow is a standardized data flow processed by the adapter model, conforming to the MCP interface specification. It contains complete contract information and processing status and serves as the medium for interaction between various components.
[0111] Rebuilding a knowledge graph refers to updating and optimizing an existing knowledge graph based on standardized MCP data flows. Unlike the initial construction, the reconstruction process is more efficient because the data has been standardized, resulting in more accurate entity and relation extraction. The rebuilt knowledge graph integrates information from different data sources, providing a more comprehensive representation of contract knowledge.
[0112] Rebuilding a reinforcement learning decision model refers to updating and optimizing the decision model using new data and feedback. This process includes adjusting the model structure, updating parameters, and optimizing policies, aiming to improve the model's decision accuracy and efficiency. The rebuilt model is better able to adapt to new contract types and processing tasks.
[0113] Model Processing Results refer to the output obtained after the knowledge graph and reinforcement learning models process the contract, including entity identification results, relationship extraction results, risk assessment results, and processed content, reflecting the system's understanding and analytical capabilities regarding the contract. Model Running Status refers to the model's performance metrics and status information during the processing, such as accuracy, response time, and resource usage. This information is used to monitor the model's health and performance changes.
[0114] Integration is the process of combining model processing results and operational status into a unified view, providing a comprehensive understanding of system performance and output. Integration employs data fusion and visualization techniques to organize information from different sources according to logical relationships, forming a coherent information system.
[0115] S6. Based on the model processing results and the model running status, execute the contract processing flow for the target contract to obtain a contract management scheme, and update the MCP interface specification data and the reinforcement learning decision model according to the contract management scheme.
[0116] In this application, based on the model processing results and model running status, a contract processing workflow for the target contract is executed to obtain a contract management plan. The MCP interface specification data and reinforcement learning decision model are then updated according to the contract management plan. The contract processing workflow is a series of steps for the systematic management of contracts, including information extraction, risk assessment, problem identification, and content modification. The workflow is guided by the reinforcement learning decision model and dynamically adjusted according to contract characteristics and processing objectives.
[0117] A contract management solution is the final output of the contract processing workflow. It is a set of management strategies and operational procedures for a specific contract, including risk control measures, clause optimization, and performance monitoring plans. A contract management solution provides enterprises with concrete and feasible guidance for contract management, helping to improve contract quality and reduce risks.
[0118] Updating the MCP Interface Specification Data involves adjusting and optimizing the interface specification based on practical application experience and changing requirements. Updates may include adding new data fields, modifying data formats, and adjusting interface parameters to improve the system's adaptability and compatibility. Updating the Reinforcement Learning Decision Model involves optimizing the model's strategies and parameters based on the implementation effectiveness of the contract management solution. This process employs incremental learning methods, continuously adjusting the model using new state-action-reward data to continuously improve its decision-making capabilities.
[0119] Through the aforementioned iterative process, continuous learning and optimization lead to a self-improving intelligent contract management system. This system can handle various types of contract documents, provide comprehensive risk assessment and management content, and continuously improve its performance and accuracy with accumulated experience. The design based on the MCP framework ensures flexibility and scalability, enabling it to adapt to the changing contract management needs and business environments of different enterprises.
[0120] In summary, this application combines traditional contract management with advanced artificial intelligence technology through MCP-based contract recognition and intelligent management. By employing technologies such as multimodal fusion, knowledge graph construction, and reinforcement learning, it achieves intelligent and automated contract management, helping enterprises improve contract management efficiency and reduce contract risks.
[0121] In some embodiments, the process of acquiring contract documents in multiple formats for the target contract, performing text processing and image processing on the contract documents, and fusing the text processing results and image processing results in a multimodal manner to obtain intermediate data includes:
[0122] The contract document is identified by file format recognition, and preprocessed according to the identified file format to obtain a standardized document object;
[0123] The text content is extracted from the standardized document object, and the text content is processed using a preset deep learning entity recognition model to identify multiple entities, including the contract subject, terms and date key entities;
[0124] Determine the dependencies between the contract subject, the terms, and the date key entity, and determine the text processing result based on the entity and the corresponding dependencies;
[0125] The image content is extracted from the standardized document object, and the image content is recognized and structurally extracted using a preset OCR recognition model to obtain the image processing result;
[0126] The text processing results and the image processing results are fused using a multimodal method to output fused data.
[0127] Using a preset data model converter, the fused data is mapped to a predefined JSON pattern to obtain intermediate data.
[0128] In this embodiment, the first step is to acquire contract documents in various formats for the target contract. These contract documents can be in diverse formats, including PDF documents, Word documents, scanned images, and even mixed documents containing handwritten annotations. Next, file format recognition is performed on these contract documents. This is an automatic process of determining the document type, typically based on file extensions, header information, and content features. Optionally, file format recognition technology can employ methods such as feature matching and machine learning classification to accurately distinguish between different document types.
[0129] After identifying the file format, appropriate preprocessing techniques are applied based on the format. For PDF documents, text layer extraction and layer separation may be required; for Word documents, their internal structure needs to be parsed; and for scanned images, image enhancement, rotation correction, and noise reduction may be necessary. The purpose of this preprocessing is to convert documents of different formats into standardized document objects that the system can process. A standardized document object is an intermediate representation that stores the content of the original document in a unified data structure, including text content, image content, and their positional relationships, facilitating subsequent text and image processing.
[0130] Next, text content is extracted from standardized document objects and processed using a pre-defined deep learning entity recognition model. Deep learning entity recognition models are natural language processing techniques based on neural networks that can automatically identify named entities in text. In contract document processing, these models typically employ architectures such as BiLSTM-CRF (Bidirectional Long Short-Term Memory Network with Conditional Random Field) or BERT, learning from large amounts of labeled data to grasp the linguistic features and entity patterns of contract text. These models identify various entity types, including contract parties (e.g., Party A, Party B), clauses (e.g., payment terms, liability for breach of contract), and date-related key entities (e.g., signing date, performance period), laying the foundation for subsequent semantic analysis.
[0131] After identifying the entities, it is necessary to determine the dependencies between them. Dependencies refer to the logical connections between key entities such as contract subjects, terms, and dates. For example, there is an "assumption" relationship between "Party A" and "payment obligation," and a "time constraint" relationship between "payment obligation" and "performance period." Dependency determination typically employs dependency parsing or semantic role labeling techniques. By analyzing the grammatical structure and semantic roles of sentences, the type and direction of relationships between entities are identified. Based on the identified entities and their dependencies, a text processing result is generated—a structured text representation that includes the semantic information and logical relationships of the contract text.
[0132] Simultaneously, image content is extracted from standardized document objects, and a pre-defined OCR recognition model is used to recognize and structurally extract the image content. OCR (Optical Character Recognition) is a technology that converts text in an image into editable text, which is particularly important in contract processing because many contracts exist in scanned form. Modern OCR models are mostly based on deep learning techniques, such as a combination architecture of CNN (Convolutional Neural Network) and RNN (Recurrent Neural Network), which can recognize text in various fonts and formats with high accuracy. For special image elements in contracts, such as tables, seals, and handwritten annotations, specialized image segmentation and recognition algorithms are also required, such as Mask R-CNN for region recognition and U-Net for semantic segmentation. Through these processes, the image processing results are obtained, including the text information extracted from the image, table structure, and the location and attributes of other visual elements.
[0133] After obtaining the text and image processing results, they need to be fused using multimodal methods. Multimodal fusion is a key technology in the field of information processing, aiming to comprehensively utilize information from different data modalities (here referring to text and images) to generate a more comprehensive and accurate understanding. In contract processing, multimodal fusion can solve the problem of incomplete or inaccurate information from a single modality, such as integrating OCR-recognized tabular data with text analysis results to ensure data consistency and integrity. Multimodal fusion techniques are typically based on feature-level fusion or decision-level fusion, and may involve advanced methods such as attention mechanisms and cross-modal learning. Through multimodal fusion, the output is fused data, which is a rich representation that integrates textual semantics and image information.
[0134] Finally, using a pre-defined data model converter, the fused data is mapped to a predefined JSON schema to obtain intermediate data. The data model converter is a software component responsible for converting one data structure to another, maintaining data integrity and consistency. JSON (JavaScript Object Notation) is a lightweight data-interchange format; its concise syntax and high readability make it ideal for data transmission. The predefined JSON schema specifies the data organization and field definitions, ensuring that the converted intermediate data has a unified structure, facilitating processing by subsequent modules. As a standardized representation within the system, the intermediate data contains all the key information of the contract document, laying the foundation for knowledge graph construction and subsequent analysis.
[0135] In some embodiments, the step of extracting target entities and relationships from the target contract based on the intermediate data, constructing a knowledge graph based on the target entities and corresponding relationships, and performing clause logic conflict detection and compliance risk assessment on the target contract based on the knowledge graph to obtain a contract assessment result includes:
[0136] Semantic analysis is performed on the intermediate data to extract the target entities in the target contract and the relationships between the target entities, forming a set of entity relationship pairs. The target entities include subject-type entities, attribute-type entities, and event-type entities, and the relationships include rights and obligations, master-slave relationships, and conditional relationships.
[0137] Based on the set of entity relationship pairs, a knowledge graph is constructed, where nodes in the knowledge graph represent the target entity, and edges in the knowledge graph represent the relationship between two connected entities.
[0138] In the knowledge graph, trace the association paths between the entities, locate the path conflict points on the association paths, and detect the logical consistency of the terms in the knowledge graph to obtain the logical conflict points;
[0139] Using preset conflict detection rules, the path conflict points and the logical conflict points are compared to obtain target conflict points that conform to the conflict detection rules. Based on the conflict point information of the target conflict points, a conflict detection report is generated, wherein the conflict point information includes conflict location, conflict type and conflict cause.
[0140] Using preset compliance rules, the target conflict point is risk-scored and risk-classified based on the knowledge graph and the conflict detection report to obtain a compliance risk assessment report;
[0141] The conflict detection report and the compliance risk assessment report are combined to form the contract assessment result.
[0142] In this embodiment, based on the generated intermediate data, the system begins to extract target entities and relationships from the target contract, constructs a knowledge graph, and evaluates the contract. First, semantic analysis is performed on the intermediate data. This is a process of deeply understanding the meaning of the text, going beyond simple keyword matching to capture the context and implicit meaning of the language. Semantic analysis techniques may be based on word vector representation, semantic role labeling, or deep semantic networks, enabling accurate understanding of the intent and constraints of contract terms. Through semantic analysis, the system extracts target entities and the relationships between them from the target contract, forming a set of entity-relationship pairs.
[0143] In this process, target entities are categorized into three types: subject entities, attribute entities, and event entities. Subject entities refer to the contracting parties and related responsible parties, such as "Party A," "Party B," or specific company names; attribute entities refer to characteristic descriptions related to the subject or clauses, such as amount, proportion, time, etc.; event entities refer to the actions and events stipulated in the contract, such as "delivery," "acceptance," and "payment." Relationships between entities are also categorized into several types, including rights and obligations relationships (e.g., "Party A has the right to demand payment from Party B"), principal-subordinate relationships (e.g., the hierarchical relationship between "General Provisions" and "Specific Clauses"), and conditional relationships (e.g., "Performance may be postponed in the event of force majeure"). Therefore, through detailed classification of entities and relationships, the semantic structure of the contract content can be understood more accurately.
[0144] A contract knowledge graph is constructed based on the extracted set of entity relationship pairs. A knowledge graph is a structured method of knowledge representation, composed of nodes (entities) and edges (relationships), capable of visually and intuitively representing complex semantic networks. In a contract knowledge graph, nodes represent target entities, such as contract parties, clause content, and time points; edges represent relationships connecting two entities, such as rights and obligations, and subordinate relationships. Knowledge graph construction typically employs graph database technologies (such as Neo4j and JanusGraph), supporting efficient graph query and analysis operations. Through a contract knowledge graph, a comprehensive understanding of the overall structure of a contract and the complex relationships between its components can be achieved, providing a foundation for subsequent conflict detection and risk assessment.
[0145] After constructing the knowledge graph, the association paths between entities are traced within the graph to locate path conflict points. An association path is a set of edges connecting two entities in the knowledge graph, representing the indirect relationship between them. Path conflict points refer to nodes or edges on an association path that exhibit logical inconsistencies, such as the same entity being assigned contradictory rights and obligations in different clauses. Graph traversal algorithms (such as depth-first search and breadth-first search) and path analysis techniques are used to examine the association paths between all key entities and identify potential conflicts. Simultaneously, the logical consistency of clauses in the knowledge graph is checked to identify potential logical contradictions and pinpoint logical conflict points. Logical consistency detection involves rule reasoning and constraint verification, enabling the discovery of issues such as "mismatch between payment terms and liability for breach of contract" and "conflict between contract period and performance obligation time."
[0146] Next, using pre-defined conflict detection rules, the discovered path conflicts and logical conflicts are compared and analyzed. Conflict detection rules are a set of predefined logical conditions and constraints used to determine whether conflicts in contract clauses conform to specific patterns. These rules may be written based on domain expert knowledge or automatically generated from historical data through machine learning. Through rule comparison, target conflict points that meet the conflict detection rules are selected, and a conflict detection report is generated based on the information of these conflict points. Conflict point information includes the conflict location (specific clause or chapter), conflict type (e.g., logical contradiction, unclear responsibilities), and conflict cause (e.g., unreasonable conditions, ambiguous wording). The conflict detection report presents this information in a structured format, facilitating user understanding and handling of potential problems in the contract.
[0147] Optionally, this embodiment also utilizes preset compliance rules to perform risk scoring and risk classification on target conflict points based on knowledge graphs and conflict detection reports. Compliance rules are a series of constraints based on laws, regulations, industry standards, and internal corporate policies, used to assess the compliance and risk level of contract terms. Risk scoring is a quantitative representation of the risk level of each conflict point, typically calculated based on factors such as the scope of risk impact, probability of occurrence, and severity. Risk classification maps risk scores to different risk levels (e.g., high, medium, low risk) to facilitate risk management and prioritization. Through this step, a compliance risk assessment report is generated, detailing the nature, level, and potential impact of each risk point, and may provide risk mitigation measures.
[0148] Finally, the conflict detection report and compliance risk assessment report are combined into a complete contract evaluation result. The contract evaluation result is a comprehensive analysis and evaluation of the target contract, including structured conflict information, risk assessment, and optimization content. Through the construction of a knowledge graph and graph-based conflict detection and risk assessment, a deep understanding and analysis of contract content can be achieved, significantly improving the intelligence and efficiency of contract management.
[0149] In some embodiments, the step of constructing a state space based on the knowledge graph and the contract evaluation result, generating a sequence of processing actions for the target contract based on the state space, and constructing a decision model based on the action execution results and performance indicators after executing the processing action sequence, so as to construct a reinforcement learning decision model based on the state space, the processing action sequence, and the decision model, includes:
[0150] Based on the knowledge graph, the contract evaluation results, and the pre-acquired historical contract processing data, a state space is constructed. The state space includes state vectors with multiple dimensions, including field confidence scores, historical accuracy, contract complexity, and recognition difficulty.
[0151] Based on the state space, an action space containing multiple processing actions is constructed. Based on the state space, the action value of each processing action is calculated using a preset deep Q-network. The processing action that maximizes the action value is selected and then arranged in a preset logical order to form a sequence of processing actions.
[0152] Execute the processing actions in the processing action sequence in sequence, and record the execution result and performance indicators of each processing action;
[0153] Based on the action execution result and the performance index, the reward value obtained by executing the processing action is determined. Based on the reward value, the parameters of the deep Q network are updated through backpropagation to obtain the reinforcement learning decision model.
[0154] In this embodiment, the dimensions of the state vector include key indicators such as field confidence scores, historical accuracy, contract complexity, and recognition difficulty. Field confidence scores refer to the degree of certainty regarding the recognition result, typically represented by a value between 0 and 1. For example, the confidence level for recognizing the "contract amount" field as "1 million yuan" might be 0.95, while the confidence level for recognizing the "performance period" as "within 30 days from the date of signing" might be 0.85. Therefore, this embodiment can help identify which fields may have uncertain processing results, requiring additional verification or processing. Historical accuracy refers to statistical data on the accuracy rate when processing similar contracts in the past, providing experience for current decision-making. For example, it may record the historical processing accuracy rates for different contract types and document formats; when encountering a new contract, the historical processing performance of similar contracts can be referenced to adjust the strategy. Contract complexity is a quantitative indicator of the complexity of the contract document structure, possibly calculated based on features such as the number of clauses, nesting levels, and the proportion of special clauses. A contract containing hundreds of clauses, multiple attachments, and complex cross-references will be far more complex than a simple standard contract. The identification difficulty dimension reflects the technical challenges that may be encountered during the identification process, such as document quality issues (blurriness, distortion), formatting specificity, or density of technical terms. These dimensions together constitute a complete representation of the contract processing status, providing a comprehensive basis for subsequent decision-making.
[0155] Based on the constructed state space, an action space containing multiple processing actions is further constructed. The action space is the set of all possible operations that an agent can perform in reinforcement learning. In a contract processing system, these actions may include, but are not limited to: adjusting OCR recognition parameters (e.g., increasing sensitivity to low-contrast text), switching to a domain-specific text analysis model (e.g., switching from a general model to a financial contract-specific model), re-performing high-precision recognition of specific regions, adding additional verification steps, or requesting manual intervention. Each action represents a specific operational strategy that the system may adopt when processing contracts, and different optimal choices may exist for different states.
[0156] Based on the current state space, a pre-defined deep Q-network is used to calculate the action value of each possible action. Deep Q-Network (DQN) is a core algorithm in reinforcement learning that combines traditional Q-learning methods with deep neural networks to handle complex decision-making problems in high-dimensional state spaces. Q-learning is a model-free reinforcement learning algorithm whose core idea is to learn a state-action value function Q(s,a), which represents the expected long-term cumulative reward of taking action a in state s. The deep Q-network approximates this Q-function through multiple layers of neural networks. Its input is a vector representation of the current state, and its output is a Q-value estimate for each possible action. The hidden layers of the network may contain multiple fully connected or convolutional layers to extract high-level features of the state and perform non-linear mapping. In practice, the current contract processing state (including field confidence, historical accuracy, and other multi-dimensional indicators) is input into the deep Q-network, and the network outputs a Q-value estimate for each possible action (such as adjusting parameters, switching models, etc.). A higher Q-value indicates that the action is more valuable in the long run.
[0157] Based on the computational results of the deep Q-network, actions that maximize the value of an action are selected, i.e., those actions with the highest Q-values. This selection strategy is called a greedy policy, which always chooses the action with the highest estimated value. In practical applications, to balance exploration and exploitation, an ε-greedy policy may be adopted, which randomly selects actions with a certain probability to explore potentially underestimated action values. After selecting the actions, they need to be arranged in a preset logical order to form a complete sequence of processing actions. This is because some actions may have prerequisite dependencies, such as text extraction before semantic analysis, or the order of certain actions may significantly affect efficiency. This sorting process may be based on predefined business rules, operation dependency graphs, or priority matrices to ensure that the generated action sequence is logically sound and executable.
[0158] Once the processing sequence is determined, each action in the sequence will be executed sequentially, and the execution results and performance metrics of each action will be recorded in detail. Execution results include the direct output of the action, such as the new recognition results after adjusting OCR parameters, and changes in analysis after switching models. Performance metrics quantify the effectiveness and efficiency of the action execution, and may include: accuracy changes (e.g., improvement or decrease in recognition accuracy), execution time (processing time required to complete the action), resource consumption (e.g., CPU utilization, memory usage), and user feedback (e.g., confirmation or correction during manual intervention). These records serve as the basis for evaluating the current action's effectiveness and are also a key data source for learning and optimization.
[0159] Next, based on the recorded action execution results and performance metrics, the reward value obtained for each processing action is determined. The reward value is a core concept in reinforcement learning; it is the immediate feedback from the environment to the agent's behavior, used to guide the learning direction. In a contract processing system, the reward function may consider multiple factors: improved accuracy brings positive rewards (e.g., a +0.5 reward for every 1% increase in recognition accuracy); time savings also contribute positively (e.g., a +0.1 reward for every second saved); while excessive resource consumption or errors result in negative penalties (e.g., a -1.0 penalty for every 1% increase in error rate). Therefore, this embodiment, through this multi-dimensional reward mechanism, can learn a strategy that balances accuracy, efficiency, and resource consumption.
[0160] Based on the calculated reward value, the parameters of the deep Q-network are updated using the backpropagation algorithm, thereby continuously improving and optimizing the decision model. Backpropagation is a standard method for training neural networks. Its core is to calculate the gradient of the loss function with respect to each network parameter and update the parameters in the opposite direction of the gradient to reduce the loss. In deep Q-network training, a typical loss function is the temporal difference error, which measures the difference between the current Q-value estimate and the target Q-value. The target Q-value is usually composed of the actual reward plus the maximum Q-value estimate for the next state (multiplied by a discount factor). This method is called the Q-learning algorithm. Through repeated experience collection and network updates, the deep Q-network gradually learns the ability to accurately estimate the value of different state-action pairs, forming a complete reinforcement learning decision model.
[0161] Therefore, this embodiment constructs a reinforcement learning decision-making model with adaptive and continuous learning capabilities. As more contracts are processed, experience is accumulated, model parameters are updated, and the decision-making strategy becomes increasingly optimized. This experience-based learning approach is particularly suitable for complex tasks like contract processing, which require handling diverse documents and balancing multiple objectives. Simultaneously, through the exploratory mechanism of reinforcement learning, new strategy combinations can be tried, potentially discovering efficient processing paths that are difficult to pre-set manually. In this way, contract processing strategies are continuously optimized, improving recognition accuracy and processing efficiency while reducing resource consumption and the need for manual intervention, ultimately achieving highly intelligent contract management.
[0162] Based on the above embodiments, in some embodiments, determining the reward value obtained by performing the processing action based on the action execution result and the performance index, and updating the parameters of the deep Q-network through backpropagation based on the reward value to obtain a reinforcement learning decision model, includes:
[0163] Based on the execution results of the action and the performance indicators, extract the accuracy change value, time consumption and resource usage data, and output the performance evaluation parameters.
[0164] Based on the performance evaluation parameters, the reward value of the processing action is calculated using a preset reward function, which includes an accuracy change item, a time saving item, an action cost penalty item, and an error penalty item.
[0165] The network loss of the deep Q-network is determined based on the reward value and the state vector.
[0166] Based on the network loss, the parameter gradients of each layer in the deep Q-network are calculated using the backpropagation algorithm;
[0167] Based on the parameter gradient, the weights and bias parameters of the deep Q-network are updated using a preset gradient descent optimization algorithm to obtain a reinforcement learning decision model.
[0168] In this embodiment, the specific steps for determining the reward value and updating the parameters of the deep Q-network based on the action execution results and performance metrics are as follows: First, based on the action execution results and performance metrics, accuracy change values, time consumption, and resource usage data are extracted, and performance evaluation parameters are output. Accuracy change values reflect the difference in recognition or analysis accuracy before and after action execution and are a core indicator for evaluating action effectiveness; time consumption records the processing time required for action execution, reflecting the efficiency dimension; resource usage data includes computational resource metrics such as CPU usage and memory consumption, reflecting the resource efficiency of the action. These parameters together constitute a comprehensive evaluation of the action execution effectiveness.
[0169] Next, based on performance evaluation parameters, the reward value for the processing action is calculated using a preset reward function. The reward function is a key component in reinforcement learning, mapping environmental feedback into numerical signals and guiding the agent's learning direction. In this embodiment, the reward function consists of several components: an accuracy change term encourages the system to select actions that improve recognition and analysis accuracy, typically proportional to the accuracy improvement; a time-saving term rewards actions with high execution efficiency, related to the amount of time saved; an action cost penalty term penalizes actions with high resource consumption, preventing the selection of overly complex or resource-intensive operations; and an error penalty term provides negative incentives for actions that lead to errors or risks, enhancing safety and reliability. Therefore, this embodiment, through a multi-dimensional reward mechanism, can achieve a balance among multiple objectives, pursuing an overall optimal decision-making strategy.
[0170] Based on the calculated reward value and the current state vector, the network loss of the deep Q-network is determined. Network loss is a metric that measures the difference between the model's predicted value and the target value. In reinforcement learning, a commonly used loss function is Temporal Difference Error, which measures the difference between the current Q-value estimate and the actual reward plus the maximum Q-value estimate for the next state. The calculation of the network loss provides the direction and magnitude for updating the model parameters.
[0171] Subsequently, based on the network loss, the parameter gradients of each layer in the deep Q-network are calculated using the backpropagation algorithm. Backpropagation is a core algorithm in deep learning; it uses a chain rule to calculate the partial derivatives of the loss function with respect to each parameter layer by layer from the output layer to the input layer, i.e., the parameter gradients. The parameter gradients represent the rate of change of the loss function along each parameter direction at the current parameter point, indicating the direction of parameter adjustment. In a deep Q-network, the parameters include the weight matrix and bias vector of each layer. By calculating their gradients, it is possible to determine how to adjust these parameters to reduce the loss.
[0172] Finally, based on the calculated parameter gradients, the weights and bias parameters of the deep Q-network are updated using a pre-defined gradient descent optimization algorithm, resulting in a reinforcement learning decision model. Gradient descent is a commonly used optimization algorithm that updates parameters in the opposite direction of the gradient with a certain step size, gradually reducing the loss function value. In practical applications, improved versions of optimization algorithms such as stochastic gradient descent (SGD), Adam, and RMSProp may be used. These algorithms improve convergence speed and stability through mechanisms such as adaptive learning rate and momentum. Through multiple iterations of parameter updates, the deep Q-network gradually learns the mapping relationship between states and optimal actions, forming a reinforcement learning decision model that can automatically select the optimal operation sequence based on the state of the task.
[0173] Therefore, this embodiment, through a reinforcement learning-based decision-making mechanism, can learn from experience, continuously improve its strategies, handle high-dimensional state spaces and complex decision-making scenarios, balance short-term gains and long-term rewards to achieve global optimization, and adapt to environmental changes, exhibiting good generalization capabilities. In contract recognition and intelligent management, it can automatically select the most suitable processing flow based on the characteristics of different contracts, improving processing efficiency and accuracy. Simultaneously, with the accumulation of experience, it continuously optimizes decision-making strategies, achieving continuous improvement in system performance.
[0174] In some embodiments, determining the MCP interface specification data based on the reinforcement learning decision model, and constructing adapter models for different data sources based on the MCP interface specification data, includes:
[0175] Based on the reinforcement learning decision model, an MCP interface document and an MCP interface implementation library are determined to constitute the MCP interface specification data. The MCP interface document includes a data format representing the data structure of the interface transmission, an interaction protocol representing the communication rules between modules, and an event handling mechanism. The event handling mechanism is used to indicate the triggering conditions and response logic of key events. The MCP interface implementation library contains program code for executing contract processing.
[0176] The process involves using the adapter model to process the contract document, obtaining a contract MCP data stream, and reconstructing the knowledge graph and the reinforcement learning decision model based on the MCP interface specification data, integrating the model processing results and model running status, including:
[0177] The adapter model is used to extract contract documents from different data sources, and the contract documents from each data source are converted into standardized data that is compatible with the MCP interface specification data. The standardized data is then preprocessed to obtain the contract MCP data stream.
[0178] Based on the MCP interface specification data, text processing and image processing are re-executed, the knowledge graph is reconstructed, and the reinforcement learning decision model is reconstructed. The intermediate data and contract evaluation results obtained after the current re-execution are summarized to obtain the model processing results and model running status.
[0179] Specifically, firstly, based on the established reinforcement learning decision model, the MCP interface documentation and implementation library are determined, together forming the complete MCP interface specification data. The reinforcement learning decision model plays a crucial role in this process, intelligently determining the optimal interface design scheme by leveraging experience accumulated from previous contract processing. For example, the model may have learned that certain data formats are more efficient for processing specific types of contracts, or that certain communication patterns can better handle complex dependencies. The system utilizes these learning outcomes to generate the interface specification most suitable for the current business scenario and technical environment.
[0180] The MCP interface document is a core component of the interface specification, detailing the rules and standards for data exchange between modules. The interface document contains three key elements: data format, interaction protocol, and event handling mechanism. The data format defines the data structure transmitted through the interface, specifying how various types of data are represented and encoded. In a contract processing system, the data format may include JSON structures for text content (such as contract terms, subject information, key dates, etc.), encoding standards for image data (such as resolution, color depth, compression methods, etc. of scanned documents), and methods for representing metadata (such as document source, processing history, version information, etc.). Standardized data formats ensure that different modules can accurately understand and process the information transmitted to each other, avoiding processing errors caused by data inconsistencies.
[0181] Interaction protocols characterize the communication rules between modules, defining how each component sends requests, receives responses, and handles exceptions. Interaction protocols may employ a request-response model (such as a REST API), a publish-subscribe model (such as a message queue), or a stream processing model (such as a data stream pipeline), the specific choice depending on the characteristics and requirements of the interaction between modules. For example, the document extraction module and the OCR recognition module might use a synchronous request-response model to ensure that each document is processed completely; while the distribution of risk analysis results might use a publish-subscribe model, allowing multiple downstream modules to simultaneously receive and process the analysis results. Interaction protocols also define communication timing requirements, timeout handling, retry mechanisms, and load balancing strategies to ensure stable operation under various conditions.
[0182] The event handling mechanism is a key component in the MCP interface specification for handling dynamic changes. It indicates the triggering conditions and response logic for critical events. Events are significant state changes, such as "high-risk clause detected," "confidence level below threshold identified," "processing timeout," or "potential data inconsistency detected." The event handling mechanism defines the triggering conditions (how to determine if an event has occurred), priority levels (ranking the importance of different events), notification methods (how to pass events to relevant modules), and response strategies (how each module should handle events). For example, when the risk score of a contract clause exceeds a preset threshold, a "high-risk clause" event is triggered. This event may automatically initiate additional review processes, send alerts to relevant personnel, and mark the clause in the knowledge graph for further analysis. Therefore, this embodiment, through the event handling mechanism, can intelligently respond to various expected and unexpected situations, improving robustness and adaptability.
[0183] The MCP interface implementation library is the accompanying code implementation of the MCP interface documentation, containing the program code that performs contract processing. The implementation library is provided as a callable API, function library, or component, which developers can directly integrate to implement functionality compatible with the MCP interface specification. The implementation library typically consists of multiple layers: a base layer provides data structure definitions, serialization / deserialization tools, and low-level communication functions; a middle layer implements core business logic and data processing algorithms; and an application layer provides high-level interfaces and workflows for specific tasks. For example, the implementation library might provide natural language processing components for text analysis, computer vision components for image recognition, graph database interfaces for knowledge graph construction, and decision frameworks for reinforcement learning. By providing standardized implementation libraries, consistent behavior and efficient collaboration among modules are ensured, while simplifying development and maintenance.
[0184] Based on the defined MCP interface specification data, adapter models are constructed for different data sources. The adapter model is a software design pattern used to solve compatibility issues between different interfaces. In the contract processing system, the main function of the adapter model is to convert contract documents from various heterogeneous data sources into a standard format conforming to the MCP interface specification. In this embodiment, the data sources that may need to be processed are diverse, including enterprise document management systems (such as SharePoint, Documentum), electronic contract platforms (such as DocuSign, Adobe Sign), email systems (such as Outlook, Gmail), cloud storage services (such as Dropbox, OneDrive), local file systems, and even traditional scanned document libraries. Each data source has its own unique data structure, access API, and authentication mechanism. The adapter model provides a unified data access interface by encapsulating these differences.
[0185] Adapter models typically employ a layered design: First, the connection layer establishes connections to specific data sources, handling authentication, authorization, and session management; second, the extraction layer retrieves the original contract documents from the data source, handling operations such as pagination, filtering, and sorting; third, the transformation layer converts the original documents into the MCP specification format, including structure mapping, encoding conversion, and metadata supplementation; finally, the validation layer ensures that the transformed data fully complies with the MCP interface specification requirements. Different data sources require different adapter implementations, but they all adhere to the same interface specification, enabling them to process documents from various sources in a unified manner.
[0186] In this embodiment, a constructed adapter model is used to extract contract documents from different data sources and transform these documents into standardized data compatible with the MCP interface specification. The extraction process may involve various technical means, such as API calls, web crawling, file parsing, or database queries, depending on the characteristics of the data source. For example, for electronic contract platforms like DocuSign, their provided APIs are used to obtain contract data; for email attachments, MIME format parsing is required to extract and recognize the contract file; for scanned documents, image processing and OCR recognition may be necessary first. After extracting the original documents, the adapter performs a conversion process, mapping the original format to the MCP specification format. This process includes field mapping (mapping source data fields to the target schema), data cleaning (handling missing values, outliers, and format inconsistencies), structure transformation (adjusting data hierarchy and relationships), and encoding standardization (ensuring consistency in text encoding, date formats, etc.). After conversion, the adapter also verifies the standardized data to ensure it meets all requirements of the MCP interface specification, such as the existence of required fields, correct data types, and valid relational references.
[0187] After preprocessing the standardized data, a contract MCP data stream is obtained. Preprocessing involves further processing and optimizing the standardized data to improve the efficiency and accuracy of subsequent processing steps. Preprocessing may include data augmentation (such as adding additional metadata tags and calculating derived features), text standardization (such as case unification, punctuation standardization, and spell correction), content segmentation (breaking long documents into logical units such as clauses, chapters, and appendices), language detection (identifying and tagging the document's language), and preliminary classification (performing preliminary classification of the document based on content characteristics). In this embodiment, through preprocessing, the original standardized data is transformed into a more structured and standardized contract MCP data stream, laying the foundation for subsequent in-depth analysis and processing. The contract MCP data stream adopts a streaming processing model, allowing processing to begin when only a portion of the data is received, without waiting for all data to be loaded. This significantly improves the efficiency of processing large contract documents.
[0188] Based on the MCP interface specification data, text processing and image processing were re-executed to reconstruct the knowledge graph and reinforcement learning decision model. Text processing included a series of natural language processing techniques, such as word segmentation and syntactic analysis (identifying the syntactic structure of text), named entity recognition (identifying entities such as subjects, dates, and amounts in contracts), relation extraction (identifying relationships between entities, such as "Party A pays Party B an amount"), semantic analysis (understanding the meaning and intent of the text), and sentiment analysis (evaluating the positive or negative nature of terms). Image processing handled non-textual elements in the contract, such as OCR recognition (converting text in images into editable text), table recognition (identifying and extracting table structure and content), signature verification (identifying and verifying document signatures), and watermark detection (identifying document watermarks and security markers). These processes strictly adhered to the interfaces and data formats defined by the MCP interface specification to ensure the consistency and usability of the processing results.
[0189] The reconstruction of the knowledge graph, based on processed text and image data, organizes entities, relationships, and attributes from contracts into a structured knowledge network. The knowledge graph construction process includes entity extraction (identifying key entities from text), relationship extraction (identifying semantic relationships between entities), attribute extraction (identifying entity attributes and features), graph integration (integrating newly extracted knowledge into the existing graph), and reasoning verification (verifying the graph's consistency through logical reasoning). The newly constructed knowledge graph adopts the data structure and access interface defined by the MCP interface specification, ensuring consistent understanding and use of the graph content. The reconstruction of the reinforcement learning decision model is also based on standardized data and interfaces. It utilizes information from the contract MCP data stream to update the model's state space, action space, and reward function, further optimizing the decision-making strategy. Through reconstruction based on unified specifications, consistent analytical quality and decision-making levels are ensured regardless of the source of the contracts being processed.
[0190] Finally, the intermediate data and contract evaluation results obtained after the current re-execution are summarized to obtain the model processing results and model running status. Intermediate data includes various intermediate results generated during processing, such as text annotation, entity recognition results, relationship diagrams, risk scores, and conflict detection results. This intermediate data is not only a component of the final result but also an important basis for internal debugging and optimization. The contract evaluation results are the final output analysis conclusions, including contract risk assessment (identifying potential legal and commercial risks), clause compliance checks (verifying whether clauses comply with laws, regulations, and internal policies), clause conflict detection (discovering logical contradictions and inconsistencies within the contract), and key information summaries (extracting core information and key clauses from the contract). The model processing results are a comprehensive summary of all outputs, organized in a standard format defined by the MCP interface specification, facilitating use by other components or external systems. The model running status records system performance data during processing, such as processing time, resource utilization, recognition accuracy, and abnormal events, providing a basis for system monitoring and performance optimization.
[0191] Therefore, this embodiment achieves consistent processing of contract documents from different sources through a unified processing flow based on the MCP interface specification, ensuring the comparability and reliability of the analysis results. Simultaneously, the standardized interface and data format greatly improve scalability and interoperability, easily integrating new data sources, processing modules, and analysis algorithms. Regardless of the contract's origin, it can be converted to a standard format, applying unified analysis logic to generate standardized results, truly achieving intelligent and automated contract management.
[0192] In some embodiments, the multimodal fusion of the text processing result and the image processing result, and the output of fused data, includes:
[0193] Based on the text processing results and the image processing results, the contract document is divided into multiple non-overlapping subdomains, including clause paragraphs, table areas, and signature sections, according to semantic and structural features.
[0194] Using the feature extraction function corresponding to each subdomain, word vectors, syntactic structure and semantic features are extracted from the text region in the subdomain, and spatial relationship, visual features and content layout information are extracted from the image region in the subdomain, and the local features of each subdomain are output.
[0195] Based on the local features of the subdomain, differential expression rules are configured at the boundaries of the subdomain to construct a feature space, wherein the differential expression rules are used to indicate that discontinuities in the local features are allowed at the boundaries of the subdomain.
[0196] Based on the feature space and the local features, the jump value and average gradient of the cross-domain features are calculated, and the jump value and average gradient are calculated using a preset internal penalty function to obtain the penalty constraint parameters.
[0197] Using a preset symmetric matrix operator, the characteristic coordination equation corresponding to the penalty constraint parameter is solved to obtain the symmetric constraint solution result;
[0198] Based on the solution results of the symmetry constraints, the subdomain processing order is determined according to the preset logical structure of the contract document. The subdomain processing order is used to indicate that subdomains with information density higher than a preset density threshold are processed first, and subdomains with information density lower than the density threshold are processed later.
[0199] Based on the penalty constraint parameters of any subdomain in the subdomain processing order and the interaction penalty parameters of other subdomains associated with the subdomain, global penalty data is determined, and multimodal fusion features are determined. The multimodal fusion features are used to indicate the subdomain that minimizes the global penalty data and its corresponding structured information and the association between the subdomains. The structured information includes the entity and image features in the image content. The interaction penalty parameters are used to indicate the logical consistency between the subdomains.
[0200] Based on the multimodal fusion features, the text processing results and the image processing results are fused using multimodal methods.
[0201] Specifically, based on the text processing and image processing results, the contract document is first divided into multiple non-overlapping subdomains, including clause paragraphs, table areas, and signature / signature sections, according to semantic and structural features. A subdomain is a region in the contract document with similar features and functions; it is the basic processing unit for multimodal fusion. The clause paragraph subdomain contains contract clauses in plain text form, usually organized in natural paragraphs; the table area subdomain contains structured tabular information, such as payment plans, product lists, or service details; and the signature / signature section subdomain contains authentication information such as signatures, seals, and dates. The process of dividing subdomains utilizes two key features: semantic features and structural features. Semantic features focus on the meaning and function of the content, such as whether the text describes rights and obligations, whether it contains quantity and monetary information, and whether it expresses time agreements; structural features focus on the organizational form of the content, such as whether it uses a paragraph layout, whether it has a table structure, and whether it contains specific visual markers. By comprehensively analyzing these two types of features, the system can accurately identify and divide different types of subdomains.
[0202] Optionally, the subdomain partitioning employs a hierarchical clustering algorithm. First, the document is divided into a grid. Then, the similarity is calculated based on the feature vector of each grid cell. Adjacent cells with high similarity are merged into larger regions, ultimately forming a set of disjoint subdomains. Therefore, this embodiment ensures the relative consistency of features within each subdomain while maximizing the differences between different subdomains through subdomain partitioning.
[0203] Next, using the feature extraction function corresponding to each subdomain, word vectors, grammatical structures, and semantic features are extracted from the text regions within the subdomain, and spatial relationships, visual features, and content layout information are extracted from the image regions within the subdomain, outputting the local features of each subdomain. The feature extraction function is a dedicated algorithm designed for specific types of subdomains, capable of efficiently extracting key features of that type of content. For text regions, three core features are extracted: word vectors are numerical representations of words in the text, typically using pre-trained word embedding models (such as Word2Vec, GloVe, or BERT) to map each word into a high-dimensional vector, capturing the semantics and contextual relationships of words; grammatical structures are obtained through dependency parsing, describing the grammatical composition of the text and the dependency relationships between words, which is crucial for understanding complex clauses; semantic features are extracted through deep learning models, capturing the text's theme, intent, and logical relationships, such as conditional relationships, causal relationships, or temporal relationships.
[0204] For image regions, three key features are extracted: spatial relationships describe the positional relationships between image elements, such as top-bottom, left-right, containment, and adjacency, which are particularly important for understanding table structures and chart layouts; visual features are extracted using computer vision algorithms, including color distribution, texture features, edge features, and shape features, which help identify signatures, marks, and special symbols; and content layout information describes the layout and organization of content, such as alignment, spacing, and font variations, which reflect the logical structure and hierarchy of the content. Through these feature extraction functions, a comprehensive and accurate set of local features is generated for each subdomain. These features retain key information about the subdomain content and are computationally and comparable, providing a solid foundation for subsequent feature fusion.
[0205] Based on the local features of subdomains, difference expression rules are configured at the boundaries of the subdomains to construct a feature space. A feature space is a mathematical space for representing and processing feature vectors, providing a unified representation framework for features from different subdomains. Unlike traditional feature spaces, the feature space constructed in this embodiment allows for feature discontinuities at subdomain boundaries, achieved through difference expression rules. Difference expression rules are a set of mathematical rules that indicate whether local feature discontinuities are allowed at subdomain boundaries. This design takes into account the inherent differences between different types of content in contract documents; for example, plain text paragraphs and table areas already have significant differences in feature representation, and forcing their features to transition smoothly at boundaries would lead to information distortion.
[0206] The difference expression rules are mathematically expressed through boundary conditions, defining the allowed range and manner of feature variation at the boundaries. For each pair of adjacent subdomains, a dedicated difference expression rule is configured based on the subdomain type and content characteristics. For example, the boundary between a text paragraph and a table area may allow for larger structural feature jumps, but requires a certain continuity in semantic features; while between two adjacent text paragraphs, a higher degree of overall feature continuity may be required. Therefore, this embodiment constructs a feature space that can accurately represent the complex structure of contract documents through a flexible difference expression mechanism, providing a theoretical basis for subsequent feature fusion and coordination.
[0207] Based on the above embodiments, in some embodiments, the step of calculating the jump value and average gradient of cross-domain features based on the feature space and the local features, and calculating the jump value and average gradient using a preset internal penalty function to obtain penalty constraint parameters, includes:
[0208] Based on the feature space and the local features of adjacent subdomains, the jump value of the cross-domain feature is obtained;
[0209] Calculate the average gradient and normal vector of the feature space at the domain boundary to obtain gradient vector data;
[0210] Based on the jump value of the cross-domain feature and the gradient vector data, an internal penalty function is constructed. The internal penalty function includes a first penalty term for controlling the jump value of the cross-domain feature, a second penalty term for controlling the change of the gradient vector data, a first weight parameter corresponding to the first penalty term, and a second weight parameter corresponding to the second penalty term. The first weight parameter is used to control the degree of difference of local features in adjacent subdomains, and the second weight parameter is used to control the smoothness of the gradient in the feature space.
[0211] The penalty constraint parameters are obtained by calculating the jump value and the average gradient using the internal penalty function.
[0212] In this embodiment, based on the feature space and local features, the jump value and average gradient of cross-domain features are calculated, and these values are calculated using a preset internal penalty function to obtain penalty constraint parameters. The jump value of cross-domain features refers to the degree of difference in feature values at the boundary of adjacent subdomains, which quantifies the feature discontinuity between different subdomains. Specifically, the jump value of cross-domain features is first obtained based on the feature space and the local features of adjacent subdomains. For each pair of adjacent subdomains Di and Dj, the system calculates the difference in their feature values on the common boundary Γij. If Fi(x) and Fj(x) represent the feature values of subdomains Di and Dj at position x, respectively, the jump value can be represented as a certain norm of the difference between the two (usually the L2 norm or the infinite norm). This jump value reflects the degree of difference between the content of different subdomains. A larger jump value usually indicates a significant change in content type or function.
[0213] In this embodiment, in addition to the jump value, the average gradient and normal vector of the feature space at the domain boundary are also calculated to obtain gradient vector data. The gradient vector reflects the rate of change and direction of the feature in space and is an important indicator for measuring feature smoothness. For the boundary Γi of each subdomain Di, the gradient of the feature along the boundary is calculated. Fi(x) and the boundary normal vector ni(x), then calculate their inner product ( Let Fi(x)·ni(x)) be the normal gradient. The average gradient is the average of the normal gradients at all points along the boundary. Gradient vector data provides information about the "rate" of feature change and is crucial for controlling the smooth transition of features.
[0214] Based on the calculated jump values and gradient vector data of cross-domain features, an internal penalty function is constructed. The internal penalty function is a mathematical function used to evaluate the quality of feature distribution in the feature space, particularly its behavior at subdomain boundaries. The internal penalty function comprises two key components: a first penalty term and a second penalty term. The first penalty term controls the jump values of cross-domain features, penalizing feature discontinuities at boundaries; the second penalty term controls the changes in gradient vector data, penalizing non-smooth changes in features. These two terms are associated with the first and second weight parameters, respectively, which determine the influence of each penalty term.
[0215] The first weight parameter controls the degree of difference in local features between adjacent subdomains, determining the system's tolerance for feature discontinuities. A larger first weight parameter means a greater tendency to maintain feature continuity, even between different types of subdomains; a smaller first weight parameter allows for larger feature jumps, suitable for situations with significant differences in content types. The second weight parameter controls the smoothness of the gradient in the feature space, determining the required rate of feature change. A larger second weight parameter requires smoother feature changes, which is beneficial for maintaining content coherence; a smaller second weight parameter allows for more abrupt feature changes, suitable for situations with complex and varied content structures.
[0216] In this embodiment, the constructed internal penalty function is used to calculate the jump value and average gradient to obtain penalty constraint parameters. These penalty constraint parameters are a set of values representing the degree of constraint on feature behavior at the boundary of each subdomain. Higher penalty constraint parameters indicate that the feature distribution at that location is not ideal and needs adjustment; lower penalty constraint parameters indicate that the feature distribution is as expected and can be maintained. These parameters will play a crucial role in the subsequent feature coordination process, guiding how to adjust and fuse features from different subdomains.
[0217] Next, this embodiment utilizes a pre-defined symmetric matrix operator to solve the feature coordination equations corresponding to the penalty constraint parameters, obtaining the symmetry constraint solution results. The symmetric matrix operator is a special mathematical operator that ensures the stability and convergence of the feature coordination process. The feature coordination equations are a set of mathematical equations describing how to adjust the features of each subdomain to achieve the optimal overall feature distribution. These equations typically employ variational form, transforming the feature coordination problem into an energy minimization problem. The symmetry constraint solution results are a set of optimized feature representations that achieve overall coordination while preserving the characteristics of each subdomain.
[0218] Based on the symmetry constraint solution results, the subdomain processing order is determined according to the pre-defined logical structure of the contract document. The subdomain processing order indicates the order in which each subdomain is processed, following the "information priority" principle: subdomains with information density higher than a pre-defined density threshold are processed first, followed by those with information density lower than the threshold. Information density is an indicator that evaluates the ratio of the amount of information contained in a subdomain to its spatial size, typically calculated using methods such as feature entropy and content complexity. Subdomains with high information density (such as key clause paragraphs and complex tables) contain more key information; prioritizing these areas allows for earlier retrieval of the contract's core content, improving processing efficiency. The logical structure of the contract document reflects the organizational hierarchy and relationships of the content; for example, general clauses usually precede special clauses, main content precedes appendices, and clause content precedes signatures. By combining information density and logical structure, the optimal subdomain processing order is determined, laying the foundation for the final feature fusion.
[0219] Based on the determined subdomain processing order, penalty constraint parameters and interaction penalty parameters of other associated subdomains are calculated for each subdomain to determine global penalty data and multimodal fusion features. Interaction penalty parameters indicate logical consistency between subdomains, evaluating semantic coherence and structural consistency between different subdomain contents. For example, whether the data in a table matches the description in the main text, or whether the signing date matches the time agreement in the terms. Global penalty data is a synthesis of penalty constraint parameters and interaction penalty parameters from all subdomains, providing an indicator for evaluating the overall feature distribution quality.
[0220] Multimodal fusion features are the final output fusion result, indicating the subdomains that minimize the global penalty data, along with their corresponding structured information and the relationships between subdomains. Structured information includes entities recognized in text processing and image features in image content, organized in a uniform format for easy subsequent processing and analysis. Relationships between subdomains describe the referencing, dependency, or interpretative relationships between different content parts; for example, a clause might reference content from a specific table, or signature information might verify the validity of a specific clause. By minimizing the global penalty data, the optimal feature fusion scheme is found, preserving the characteristics of each subdomain while ensuring overall consistency and coherence.
[0221] Finally, based on the multimodal fusion features, the text processing results and image processing results are fused using a multimodal method. The specific implementation of multimodal fusion employs a graph neural network-based approach, representing each subdomain as a node in a graph and the relationships between subdomains as edges. Information exchange and integration are then achieved through a message passing mechanism. The fused result preserves the semantic richness of the text content and the visual characteristics of the image content, while establishing close connections between them, resulting in a comprehensive and unified understanding of the contract document.
[0222] Therefore, this embodiment, through multimodal fusion, can effectively process the complex content in contract documents, overcoming the limitations of single-modal processing and providing high-quality fused data for subsequent knowledge graph construction and risk analysis. Whether it is plain text clauses, structured tables, or signature images, they can be integrated into a coherent whole, achieving intelligent understanding and processing of the entire contract content.
[0223] In some embodiments, the step of constructing an action space containing multiple processing actions based on the state space, and calculating the action value of each processing action using a preset deep Q-network based on the state space, selecting the processing action that maximizes the action value, and then arranging them in a preset logical order to form a sequence of processing actions, includes:
[0224] Based on the state vectors of multiple dimensions, the state space is decomposed into multiple levels according to a preset level of fineness, forming a multi-level state space ordered from coarse to fine. The levels include the coarsest grid, multiple intermediate grids, and the finest grid.
[0225] Based on the multi-level state space, a corresponding Q-value function is defined for each level to obtain a multi-grid Q-value function representation. The Q-value function includes the complete state-action value function corresponding to the finest grid, the simplified value function corresponding to the intermediate grid, and the core feature value estimation function corresponding to the coarsest grid.
[0226] Based on the multi-grid Q-value function representation, a level-to-level transformation operator is determined, wherein the level-to-level transformation operator includes a constraint operator and an extension operator. The constraint operator is used to indicate mapping the Q-value of the fine grid to the first-order coarse grid, and the extension operator is used to indicate extending the Q-value of the coarse grid to the first-order fine grid.
[0227] Based on the inter-level transformation operator, an adaptive smoothing function is constructed. Standard smoothing or high-speed flow smoothing is selected according to the gradient of the Q-value function. The adaptive smoothing function is combined to form a smoothing processing strategy. The adaptive smoothing function is used to indicate the high-speed flow phenomenon in the processing of the contract.
[0228] Based on the smoothing strategy and the multi-grid Q-value function representation, starting from the finest grid, the Q-value of the current finest grid is iteratively smoothed multiple times. The residual corresponding to the smoothed Q-value is calculated and passed to the coarser grid through the constraint operator until the coarsest grid. Starting from the coarsest grid, the coarse-grid optimization solution of the current coarse grid is iteratively solved and passed to the finest grid through the extension operator until the finest grid. The converged Q-value function is then output.
[0229] The optimal policy is extracted from the convergent Q-value function, and a policy smoothing operation is performed to obtain the sequence of processing actions.
[0230] In this embodiment, the state space is first decomposed into multiple levels based on multi-dimensional state vectors and according to a preset level of granularity, forming a multi-level state space ordered from coarse to fine. State space is a mathematical space describing possible states. In a contract processing system, the state space contains information from multiple dimensions, such as contract content, processing progress, identified entities, and risk assessment results. A state vector is a numerical representation of a specific state in the state space; it encodes multi-dimensional state information into a vector for easy calculation and processing. Multi-level state space is a hierarchical method for representing states, dividing the state space into multiple levels according to different levels of granularity, forming a coarse-to-fine state representation hierarchy.
[0231] The multi-level state space comprises three main levels: the coarsest grid, multiple intermediate grids, and the finest grid. The coarsest grid provides a highly abstract representation of the state space, retaining only the core feature dimensions, such as contract type and processing stage. The coarsest grid represents the state with low dimensionality and high computational efficiency, but with limited precision. The intermediate grids provide multiple levels of fineness in state representation, striking a balance between precision and computational efficiency, retaining some detailed information while controlling computational complexity. The finest grid provides the most detailed representation of the state space, containing all relevant state dimensions and detailed information, offering the highest precision but also the greatest computational complexity.
[0232] The design of the multi-level state space adopts the principle of hierarchical refinement, meaning that each finer-level grid is a further subdivision and expansion of the coarser-level grid. For example, a coarse grid might simply represent contract risk as three levels: "high / medium / low," while a finer grid might subdivide it into specific risk scores (such as continuous scores from 0 to 100) and multiple risk dimensions (legal risk, financial risk, performance risk, etc.). By constructing a multi-level state space, the appropriate level of granularity of state representation can be flexibly selected according to actual needs and computational resources, enabling efficient learning and decision-making in large-scale state spaces.
[0233] Next, based on the multi-level state space, a corresponding Q-value function is defined for each level, resulting in a multigrid Q-value function representation. The Q-value function is a core concept in reinforcement learning, estimating the long-term cumulative reward of taking a specific action in a specific state, guiding the agent to make optimal decisions. In traditional deep Q-learning, typically only a single, unified Q-value function is defined. However, this embodiment introduces a multigrid Q-value function, defining dedicated Q-value functions for state levels of different granularities, forming a cooperative family of functions.
[0234] Specifically, multi-grid Q-value functions include three main types: the Complete State-Action Value Function (CFU) corresponding to the finest grid, the Simplified Value Function (SFU) corresponding to the intermediate grid, and the Core Feature Value Estimation Function (CFU) corresponding to the coarsest grid. The CFU, defined on the finest grid, considers all state dimensions and possible actions, providing the most accurate value estimate, but also has the highest computational complexity. This function is typically implemented using deep neural networks, capable of handling high-dimensional state spaces and complex nonlinear value relationships. The Simplified Value Function, defined on the intermediate grid, appropriately simplifies the state representation and action space, improving computational efficiency while maintaining reasonable accuracy. Simplification methods may include reducing state dimensions and merging similar states or actions. The Core Feature Value Estimation Function, defined on the coarsest grid, considers only the most critical state features and core actions, providing a highly abstract yet computationally efficient value estimate.
[0235] Therefore, this embodiment constructs a multi-grid Q-value function representation, allowing parallel learning and optimization at different levels of granularity. This enables rapid acquisition of coarse policy guidance on a coarse grid and precise optimization of local decisions on a fine grid, improving learning efficiency and policy quality. This method is particularly suitable for processing complex documents such as contracts, which possess hierarchical structures and multi-scale characteristics, simultaneously grasping both macro-level policy direction and micro-level processing details.
[0236] Based on the multi-grid Q-value function representation, inter-level transfer operators are further determined. Inter-level transfer operators are a set of mathematical operators used to transfer information and value estimation between different levels of a multi-level state space. These operators are core components of the multi-grid method, enabling Q-value functions at different levels to collaborate and jointly construct a consistent and efficient value learning system. In this embodiment, two key inter-level transfer operators are defined: the restriction operator and the prolongation operator. The restriction operator is used to map the Q-values of the fine grid to the coarser grid, realizing the aggregation and abstraction of information. The restriction process typically involves weighted averaging of the Q-values of adjacent states on the fine grid or using other dimensionality reduction techniques to compress high-dimensional information into a low-dimensional representation. For example, when mapping from the finest grid to an intermediate grid, the Q-values of multiple similar states are merged, or only information in certain key dimensions is retained. The restriction operator ensures that the coarse grid can obtain the key information in the fine grid, providing a basis for learning and decision-making on the coarse grid. The extension operator is used to extend the Q-value of the coarse mesh to a finer mesh, thus refining and expanding the information. The extension process typically involves interpolating the Q-value on the coarse mesh or predicting it using a deep learning model to generate the corresponding value on the fine mesh. For example, when mapping from an intermediate mesh to the finest mesh, linear interpolation, spline interpolation, or more complex neural network mappings are used to generate Q-value estimates on the fine mesh. The extension operator ensures that the value information learned on the coarse mesh can guide further optimization on the fine mesh, accelerating the learning process on the fine mesh.
[0237] Therefore, this embodiment restricts the operators and extension operators to satisfy certain mathematical properties, such as maintaining positive definiteness and satisfying spectral equivalence conditions, to ensure the convergence and stability of the multigrid algorithm. In practical implementation, these operators may be implemented using linear mappings, deep neural networks, or other machine learning models, with the specific choice depending on the characteristics of the state space and performance requirements.
[0238] Based on inter-level transformation operators, an adaptive smoothing function is constructed. Standard smoothing or high-flow smoothing is selected according to the gradient of the Q-value function, and the adaptive smoothing function is combined to form a smoothing strategy. The adaptive smoothing function is a special mathematical function used to adjust the smoothness of the Q-value function, ensuring the stability and accuracy of value estimation. In contract processing, a "high-flow phenomenon" may occur, referring to the drastic changes in the Q-value in certain regions, forming characteristics similar to high-speed flow in fluid dynamics. This phenomenon typically appears at critical decision points or areas of sudden risk abrupt change in contracts; for example, the handling strategy of certain specific clauses may lead to a sharp change in risk assessment results.
[0239] The adaptive smoothing function automatically selects an appropriate smoothing method based on the gradient of the Q-value function (i.e., the rate of value change): when the gradient is small, standard smoothing is used, employing methods such as local weighted averaging to smooth the Q-value and improve stability; when the gradient is large, high-flow smoothing is used, employing nonlinear smoothing techniques specifically designed to handle drastic changes, preserving key change information while reducing noise impact. Therefore, this embodiment, by adaptively selecting an appropriate smoothing method, ensures both effective handling of stable regions and accurate capture of important information at key decision points, thus improving the overall quality of value learning.
[0240] The Smoothing Processing Strategy is a complete Q-value smoothing scheme that combines an adaptive smoothing function and multi-level state representation, providing a stable and efficient computational framework for multi-grid Q-value learning. The strategy defines key parameters such as the execution order of smoothing operations, the number of iterations, and convergence conditions, guiding value optimization in multi-level state spaces. Therefore, this embodiment, through the Smoothing Processing Strategy, can efficiently handle large-scale state spaces, accelerate Q-value learning convergence, and improve strategy quality.
[0241] Specifically, with the smoothing strategy and multi-grid Q-value function representation, this embodiment begins the multi-grid iterative solution process. A V-cycle structure is employed, including a reduction-order stage from fine to coarse and a reduction-order stage from coarse to fine. Starting with the finest grid, multiple smoothing operations are iteratively performed on the Q-value of the current fine grid, adjusting the Q-value using the previously defined adaptive smoothing function to reduce local noise and improve stability. The smoothing operation typically employs Jacobi iteration, Gauss-Seidel iteration, or variations thereof, automatically selecting an appropriate smoothing method based on the characteristics of the current state and the gradient of the Q-value.
[0242] After smoothing, the residuals corresponding to the smoothed Q-values are calculated. The residuals are the difference between the actual Q-value and the ideal Q-value, representing the degree of optimization of the current Q-function. Larger residuals indicate that the Q-function is not yet fully optimized and requires further iteration; smaller residuals indicate that the Q-function is close to the optimal solution. The residuals are propagated to the coarser grid through a constraint operator; this process is called residual restriction. Residual restriction transfers error information from the finer grid to the coarser grid, enabling the coarser grid to help correct the value estimates on the finer grid.
[0243] This process continues, propagating the residuals upwards level by level until the coarsest grid is reached. At the coarsest grid, due to the small size of the state space, the coarse-grid optimization problem is solved directly, yielding the coarse-grid optimization solution. This step typically employs exact solution methods, such as dynamic programming, policy iteration, or direct matrix solving, because the scale of the coarse grid makes these methods computationally feasible.
[0244] After obtaining the coarse-grid optimization solution, a coarse-to-fine order progression process begins. First, the coarse-grid optimization solution is transferred to the finer-grid level using a prolongation operator; this step is called solution prolongation. The prolonged solution provides an initial estimate of the Q-value function for the fine-grid. Then, multiple smoothing operations are performed on this fine-grid to further improve the Q-value estimate. This process continues, progressively prolonging and smoothing downwards until the finest grid is reached, completing a full V-shaped cycle.
[0245] This embodiment may require executing multiple V-shaped loops until the Q-value function converges, i.e., the residual is less than a preset threshold or the maximum number of iterations is reached. A converged Q-value function indicates that a (approximately) optimal state-action value estimate has been found, which can be used to guide actual decision-making. This multi-grid iterative method significantly accelerates the convergence process of Q-value learning, especially for large-scale state spaces, where its efficiency is far superior to traditional single-grid methods.
[0246] Finally, the optimal policy is extracted from the converged Q-value function, and a policy smoothing operation is performed to obtain the final sequence of actions. The process of extracting the optimal policy involves selecting the action that maximizes the Q-value for each state, forming a state-action mapping table. However, directly extracted policies may suffer from unsmoothness or inconsistency; for example, similar states may be assigned completely different actions, which can lead to instability or incoherence in system behavior in practical applications. To address this issue, this embodiment performs policy smoothing, adjusting and optimizing the original policy by considering the similarity and transition relationships between states, making it smoother and more consistent. Policy smoothing may employ various techniques, such as policy gradient smoothing, local consistency constraints, or deep neural network refitting. The smoothed policy is more robust and interpretable, better adapting to state changes and uncertainties in real-world application scenarios.
[0247] Therefore, the resulting sequence of processing actions is a series of steps arranged in a preset logical order, guiding how to process the current contract document. This sequence takes into account the characteristics of the contract, processing objectives, and system status, representing the optimal processing strategy under the current conditions. Processing actions may include various operations such as document segmentation, entity extraction, relationship analysis, risk assessment, and conflict detection. Their combination and order have been intelligently optimized by the system to efficiently and accurately complete the contract processing task.
[0248] Therefore, this embodiment achieves efficient learning and decision optimization in complex state spaces through a deep Q-learning scheme based on a multi-grid method. It can process various types of contract documents and automatically adjust the processing strategy according to actual needs. It combines the computational efficiency of multi-grid algorithms with the expressive power of deep reinforcement learning, making it particularly suitable for processing documents with multi-scale features and complex structures, such as contracts, and providing powerful decision support for intelligent contract management systems.
[0249] Based on the above embodiments, in some embodiments, determining the inter-level transformation operator based on the multi-grid Q-value function representation includes:
[0250] Based on the multi-grid Q-value function representation, the Q-values of the fine-grid level are mapped to the coarser-level grid through a preset weighted average algorithm or feature aggregation algorithm to determine the constraint operator definition data of the constraint operator;
[0251] Based on the multi-grid Q-value function representation, the Q-value of the coarse grid level is extended to the finer grid level through a preset interpolation algorithm or feature expansion algorithm to determine the extension operator definition data of the extension operator;
[0252] Based on the constraint operator definition data and the extension operator definition data, a transformation function is constructed, which is used to indicate the minimization of the integral difference between the Q value of the fine mesh level and the Q value of the extended coarse mesh level;
[0253] Based on the transformation function, the ability of the constraint operator definition data and the extension operator definition data to preserve the key characteristics of the value function is verified, and the inter-level transformation operator is obtained.
[0254] First, based on the multi-grid Q-value function representation, inter-level transformation operators are determined. These operators act as bridges connecting different levels of the multi-level state space, ensuring effective information transfer and sharing between Q-value functions at each level. In this embodiment, two key transformation operators need to be constructed: a restriction operator and a prolongation operator. The restriction operator maps information from the finer-grid level to the coarser-level grid, achieving information compression and abstraction; the prolongation operator extends information from the coarser-grid level to the finer-level grid, achieving information refinement and supplementation. These two operators together constitute the information transfer mechanism of the multi-grid method, and their design directly affects the efficiency and accuracy of the multi-grid method.
[0255] Specifically, firstly, based on the multi-grid Q-value function representation, a pre-defined weighted averaging algorithm or feature aggregation algorithm is used to map the Q-values of the fine-grid level to a coarser-level grid, thus determining the constraint operator definition data. The weighted averaging algorithm is a commonly used information aggregation method. It generates the Q-value of the corresponding state on the coarse grid by weighted averaging of the Q-values of adjacent states on the fine-grid. The weight design typically considers the distance, similarity, or correlation between states to ensure that important information is preserved during the aggregation process. For example, in contract processing, when mapping from the fine-grid to the coarse-grid, a weighted averaging of the clause risk scores is applied, giving higher weights to key clauses to ensure that risk information is accurately represented in the coarse-grid.
[0256] Feature aggregation algorithms are a more sophisticated information compression method that considers not only the Q-values themselves but also the feature representations of the states. By aggregating or compressing state features, they generate state representations and corresponding Q-values on a coarse grid. Commonly used feature aggregation techniques include Principal Component Analysis (PCA), autoencoders, or other dimensionality reduction methods. For example, an autoencoder can be used to compress high-dimensional contract features into low-dimensional representations, and then a Q-value function on a coarse grid can be constructed based on these compressed representations. This method is particularly suitable for processing contract documents with complex feature structures, preserving key information while significantly reducing computational complexity.
[0257] Restriction operator definition data is a collection of data describing the specific implementation of a restriction operator, including the operator type, parameter configuration, and mapping rules. This data explicitly defines how to map the Q-value of a fine mesh to a coarse mesh, providing concrete guidance for performing restriction operations. The format of restriction operator definition data may include mapping matrices, neural network weights, or other mathematical representations, depending on the specific implementation method.
[0258] Next, based on the multi-grid Q-value function representation, the Q-values at the coarse-grid level are extended to a finer-level grid using a pre-defined interpolation algorithm or feature expansion algorithm, thus determining the extension operator definition data. Interpolation algorithms are a commonly used information extension method that generates a denser data representation by interpolating between known data points. In multi-grid Q-value learning, commonly used interpolation algorithms include linear interpolation, bilinear interpolation, and spline interpolation. For example, when extending from a coarse-grid to a fine-grid, bilinear interpolation is used to calculate the corresponding Q-value on the fine-grid based on four adjacent Q-values on the coarse-grid. This interpolation method is computationally simple and suitable for handling relatively smooth Q-value functions.
[0259] Feature expansion algorithms are a more complex method of information expansion that transforms abstract information on a coarse grid into a detailed representation on a fine grid by expanding or reconstructing feature representations. These algorithms are often used in conjunction with feature aggregation algorithms to form an encoder-decoder mechanism. Common feature expansion techniques include inverse principal component analysis, decoder networks, or other generative models. For example, using a decoder network corresponding to the encoder, the low-dimensional feature representation on the coarse grid is restored to a high-dimensional representation on the fine grid. Then, based on these restored features, the Q-values on the fine grid are calculated, generating richer and more accurate fine-grid representations, which are particularly suitable for handling state spaces with complex nonlinear characteristics.
[0260] Prolongation operator definition data is a collection of data describing the specific implementation of a prolongation operator, including the operator type, parameter configuration, and mapping rules. This data explicitly defines how to extend the Q-value of a coarse mesh to a fine mesh, providing specific guidance for performing the prolongation operation. Similar to constraint operator definition data, the format of prolongation operator definition data may include mapping matrices, neural network weights, or other mathematical representations, depending on the specific implementation method.
[0261] Based on defined constraint operator and extension operator data, a transfer function is constructed. The transfer function is a mathematical function used to evaluate and optimize the performance of inter-level transfer operators, minimizing the integral difference between the Q-value of the fine-grid level and the Q-value of the extended coarse-grid level. This integral difference represents the fidelity of information transfer between levels; the smaller the difference, the more complete the information is preserved, and the higher the efficiency of the multi-grid method.
[0262] Transition functions are typically expressed in integral form, calculating the difference between the original Q-value on a fine mesh and the Q-value after constraints and extension operations. This difference can be represented by the L2 norm (mean squared error), L1 norm (absolute difference), or other discrepancy measures suitable for specific applications. Minimizing this difference usually involves an optimization problem, using gradient descent, quasi-Newton methods, or other optimization algorithms to adjust the parameters of the constraint and extension operators to minimize the transition function value. Through this optimization process, the transition operator best suited to the current multi-level state space and the characteristics of the Q-value function can be found.
[0263] After constructing the transformation function, the ability of the constraint operator definition data and the extension operator definition data to preserve the key features of the value function is verified based on the transformation function. Key features of the value function refer to the core attributes of the Q-value function, which are crucial for accurately expressing state-action value and guiding decision-making. In contract processing systems, key features of the value function may include monotonicity (higher risk, lower value), boundary conditions (value estimation under extreme conditions), smoothness (similar states have similar values), and domain-specific knowledge (such as compliance requirements and risk assessment criteria).
[0264] Preservation capability refers to the degree to which a transformation operator retains these key characteristics when transmitting information between levels. The extent to which the transformation operator protects these characteristics during information transmission is evaluated through experiments or theoretical analysis. For example, a series of test states and corresponding Q-values are generated, and these values are then iteratively transmitted through constraint and extension operations to observe the retention of key characteristics. If it is found that certain characteristics are significantly distorted or lost during transmission, the design or parameters of the transformation operator need to be adjusted to improve the preservation capability.
[0265] The validation process typically considers multiple metrics, such as feature retention rate, error distribution, and convergence speed, to comprehensively evaluate the performance of the transformation operator. This validation process ensures that the inter-level transformation operator can effectively transfer Q-value information while preserving the key characteristics of the value function, providing a reliable information transfer mechanism for multi-grid Q-value learning. Finally, based on the validation results, the final inter-level transformation operator is determined, completing this crucial step.
[0266] Subsequently, in some embodiments, the step of constructing an adaptive smoothing function based on the inter-level transformation operator, selecting standard smoothing or high-speed flow smoothing according to the gradient of the Q-value function, and combining the adaptive smoothing function to form a smoothing processing strategy includes:
[0267] Based on the inter-level transformation operator, calculate the absolute value of the gradient of the Q-value function of the current level;
[0268] Based on the absolute value of the gradient, a gradient threshold is determined, and based on the absolute value of the gradient and the gradient threshold, a flow state discrimination result is determined. The gradient threshold is used to distinguish between standard flow and high-speed flow states.
[0269] When the flow state determination result indicates that the absolute value of the gradient is less than the gradient threshold, the standard smoothing algorithm is selected; or when the flow state determination result indicates that the absolute value of the gradient is not less than the gradient threshold, the high-speed flow smoothing algorithm is selected. The high-speed flow smoothing algorithm is used to indicate that adaptive parameters are dynamically adjusted according to the data flow speed.
[0270] The selected standard smoothing algorithm or high-speed flow smoothing algorithm is executed to process the Q-value function, resulting in the smoothing strategy.
[0271] In this embodiment, an adaptive smoothing function is constructed based on a defined inter-level transformation operator. Standard smoothing or high-speed flow smoothing is selected according to the gradient of the Q-value function, and the adaptive smoothing function is combined to form a smoothing strategy. The adaptive smoothing function is an intelligently adjusting mathematical function that automatically selects the most suitable smoothing method based on the local characteristics of the Q-value function. In complex contract processing systems, the Q-value function may exhibit different characteristics in different regions: some regions show gentle changes, suitable for standard smoothing; while other regions change drastically, forming a phenomenon similar to "high-speed flow" in fluid mechanics, requiring special smoothing treatment. The core advantage of the adaptive smoothing function lies in its ability to intelligently identify these regions with different characteristics and apply the most appropriate smoothing strategy.
[0272] First, based on the inter-level transformation operator, the absolute value of the gradient of the Q-value function at the current level is calculated. The gradient is a measure of the rate of change of a function; it represents the speed of change of the function in each direction. In a multidimensional state space, the gradient of the Q-value function is a vector, with each component corresponding to the rate of change of the Q-value in that dimension. The absolute value of the gradient is the modulus or norm of the gradient vector, providing a scalar measure of the overall drastic change in the Q-value function.
[0273] Gradient calculation typically employs numerical differentiation methods, such as forward differencing, central differencing, or higher-order differencing schemes. In multigrid methods, inter-level transformation operators are used to assist gradient calculation; for example, gradient information is estimated by comparing the current grid with an equivalent representation obtained through constraints and extensions. This approach leverages the characteristics of multi-level representations, providing more stable and accurate gradient estimates, especially in regions with sparse data or high noise levels.
[0274] Based on the calculated absolute value of the gradient, a gradient threshold is determined, and the flow state is determined according to the absolute value of the gradient and the gradient threshold. The gradient threshold is a pre-defined criterion used to distinguish between standard flow and high flow states. Standard flow states refer to regions where the Q-value function changes relatively smoothly; these regions typically correspond to routine decision points in contract processing, such as the evaluation of standard clauses or the calculation of routine risks. High flow states, on the other hand, refer to regions where the Q-value function changes drastically; these regions typically correspond to critical decision points or areas of sudden risk change in contract processing, such as the handling of key clauses, the identification of significant risks, or the resolution of complex conflicts.
[0275] There are several methods for determining the gradient threshold: the fixed threshold method directly sets a predetermined numerical standard; the statistical method determines the threshold based on the statistical characteristics of the gradient distribution of the Q-value function (such as the mean plus a certain number of standard deviations); and the adaptive method dynamically adjusts the threshold according to the characteristics of the current task and the system state. In complex contract processing systems, the adaptive method is usually adopted to ensure that the threshold can adapt to the characteristics of different types of contracts and the needs of different processing stages.
[0276] The flow state determination result assesses the flow characteristics of the current state, classifying it as either a standard flow or a high-speed flow. This determination is achieved by comparing the absolute value of the gradient with a gradient threshold: if the absolute value of the gradient is less than the threshold, the current state is classified as a standard flow; if the absolute value of the gradient is not less than the threshold, the current state is classified as a high-speed flow. This determination result guides the selection of subsequent smoothing algorithms, ensuring that the system uses the most appropriate processing method for regions with different characteristics.
[0277] When the flow state determination result indicates that the absolute value of the gradient is less than the gradient threshold, the standard smoothing algorithm is selected. The standard smoothing algorithm is a traditional smoothing method suitable for regions of relatively gentle Q-value functions. These algorithms are typically based on weighted averaging, local fitting, or iterative relaxation methods, such as Jacobi iteration, Gauss-Seidel iteration, or the SOR (Successive Over-Relaxation) method. This embodiment reduces noise and irregular fluctuations in the Q-value function by fusing and balancing local information, thereby improving the stability and reliability of the estimation.
[0278] The typical steps of a standard smoothing algorithm include: determining the smoothing window, i.e., which neighboring states' Q-values to consider; assigning smoothing weights to determine the degree of influence of each neighboring state; and calculating a weighted average to obtain the smoothed Q-value. These steps may require multiple iterations until the Q-value reaches the expected smoothness or meets the convergence condition. Standard smoothing algorithms are computationally simple and stable, suitable for handling most regions of normal states, but may perform poorly in regions of rapid change, even leading to the loss of important information.
[0279] When the flow state determination result indicates that the absolute value of the gradient is not less than the gradient threshold, the high-flow smoothing algorithm is selected. The high-flow smoothing algorithm is a smoothing method specifically designed for handling rapidly changing regions. It can dynamically adjust adaptive parameters according to the data flow rate, smoothing noise while preserving key change information. These algorithms are typically based on nonlinear smoothing techniques, adaptive filtering, or edge-preserving filtering, such as bilateral filtering, anisotropic diffusion, or total variation minimization.
[0280] The core feature of the high-speed streaming smoothing algorithm is its adaptability, which dynamically adjusts the smoothing parameters based on the data flow velocity (i.e., the gradient magnitude). Regions with high data flow velocity use a weaker smoothing intensity to preserve important change information, while regions with low data flow velocity use a stronger smoothing intensity to effectively suppress noise. Therefore, through this dynamic adjustment mechanism, the algorithm ensures both efficiency and accuracy when processing complex Q-value functions, achieving the dual goals of noise suppression and preservation of important information simultaneously.
[0281] Adaptive parameters are a key component of high-speed flow smoothing algorithms, controlling the strength, scope, and direction of the smoothing process. These parameters may include smoothing weights, neighborhood size, and edge detection thresholds, which are dynamically adjusted based on local gradients or other feature indicators to ensure the smoothing process adapts to local data characteristics. For example, in high-gradient regions, reducing smoothing weights increases edge detection sensitivity, ensuring important boundary information is not smoothed away; while in low-gradient regions, increasing smoothing weights expands the neighborhood and improves the smoothing effect.
[0282] In this embodiment, the selected standard smoothing algorithm or high-speed flow smoothing algorithm is executed to process the Q-value function, resulting in a smoothing processing strategy. The smoothing processing strategy is a complete operational plan that defines how to apply smoothing operations in multi-grid Q-value learning. The strategy includes key information such as the selection rules for the smoothing algorithm, execution order, number of iterations, and convergence conditions, providing a clear operational guide for the system.
[0283] Smoothing strategies are typically implemented adaptively, dynamically adjusting the smoothing operation based on the current grid level, learning stage, and local characteristics. For example, in the early stages of learning, a stronger smoothing intensity is used to quickly suppress noise and obtain a coarse but stable value estimate; while in the later stages of learning, the smoothing intensity is reduced to retain more detailed information and improve the accuracy of the value estimate. This dynamic adjustment ensures that the smoothing process achieves optimal results at different stages of learning, improving overall learning efficiency and result quality.
[0284] This processing strategy, based on an adaptive smoothing function, effectively handles various characteristic regions within the Q-value function, achieving high-quality smoothing results in both gently changing, conventional regions and rapidly changing, critical decision-making regions. This smoothing capability is particularly important for processing complex contract documents, as different parts of the contract may have very different characteristics and importance, requiring intelligent smoothing methods to ensure processing quality.
[0285] Therefore, this embodiment establishes a complete multi-grid Q-value learning framework by determining inter-level transformation operators and constructing an adaptive smoothing function, which can efficiently handle complex decision-making problems in large-scale contract documents. The inter-level transformation operators ensure effective information transfer between grids of different fineness, while the adaptive smoothing function guarantees the stability and accuracy of the Q-value learning process, improving the system's learning efficiency and decision quality, enabling it to cope with contract processing tasks of various types and complexities.
[0286] like Figure 2 As shown in the figure, this application provides a contract identification and intelligent management system based on MCP, the system including:
[0287] The document processing module 201 is used to acquire contract documents in various formats for the target contract, perform text processing and image processing on the contract documents, and perform multimodal fusion of the text processing results and image processing results to obtain intermediate data.
[0288] The knowledge graph construction module 202 is used to extract target entities and relationships in the target contract based on the intermediate data, construct a knowledge graph based on the target entities and corresponding relationships, and perform clause logic conflict detection and compliance risk assessment on the target contract based on the knowledge graph to obtain the contract assessment result.
[0289] The model building module 203 is used to build a state space based on the knowledge graph and the contract evaluation result, generate a sequence of processing actions for the target contract based on the state space, and build a decision model based on the action execution results and performance indicators after executing the sequence of processing actions, so as to build a reinforcement learning decision model based on the state space, the sequence of processing actions and the decision model.
[0290] MCP interface configuration module 204 is used to determine MCP interface specification data based on the reinforcement learning decision model, and to construct adapter models for different data sources based on the MCP interface specification data. The adapter models are used to indicate how to transform data from different data sources into data streams that are compatible with the MCP interface specification data.
[0291] The data source adaptation module 205 is used to process the contract document using the adapter model to obtain the contract MCP data stream, and to reconstruct the knowledge graph and the reinforcement learning decision model based on the MCP interface specification data for the contract MCP data stream, integrating the model processing results and the model running status.
[0292] The contract management module 206 is used to execute the contract processing flow for the target contract based on the model processing results and the model running status, obtain a contract management scheme, and update the MCP interface specification data and the reinforcement learning decision model according to the contract management scheme.
[0293] The system of this application embodiment can execute the method provided in this application embodiment. The implementation principle is similar. The actions performed by each module in the system of each embodiment of this application correspond to the steps in the method of each embodiment of this application. For detailed functional descriptions of each module of the system, please refer to the descriptions in the corresponding methods shown above, which will not be repeated here.
[0294] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A contract identification and intelligent management method based on MCP, characterized in that, Includes the following steps: Obtain contract documents in multiple formats for the target contract, perform text processing and image processing on the contract documents, and perform multimodal fusion of the text processing results and image processing results to obtain intermediate data; Based on the intermediate data, target entities and relationships in the target contract are extracted. A knowledge graph is constructed based on the target entities and their corresponding relationships. The target contract is then subjected to clause logic conflict detection and compliance risk assessment based on the knowledge graph to obtain the contract assessment result. The target entities are the key information units in the contract, including the contract subject, contract elements, and contract clauses. The relationships refer to the semantic connections between different entities, including rights and obligations, master-slave relationships, and conditional relationships. A state space is constructed based on the knowledge graph and the contract evaluation results. This state space includes multiple dimensions such as the current state of the contract, processing stage, and risk level. A sequence of processing actions for the target contract is generated based on this state space. This sequence refers to a series of operational steps for processing the contract, including information extraction, clause analysis, risk assessment, and content modification. Based on the execution results and performance indicators after executing the sequence, the execution results refer to the actual effects obtained after executing the sequence. The performance indicators are quantitative standards for measuring the effectiveness of the actions, including accuracy, recall, F1 score, processing time, and resource consumption. A decision model is constructed that can select the optimal processing action based on the current state. This allows a reinforcement learning decision model to be constructed based on the state space, the processing action sequence, and the decision model. The reinforcement learning decision model treats contract processing as a decision-making process, where the state is the current state of the contract, the action is the possible processing operation, and the reward is the evaluation of the effect after the operation. Based on the reinforcement learning decision model, the MCP interface specification data is determined, and an adapter model for different data sources is constructed based on the MCP interface specification data. The adapter model is used to indicate how to transform data from different data sources into data streams that are compatible with the MCP interface specification data. MCP is a unified contract management system that combines three elements: model, contract, and processing flow. The contract document is processed using the adapter model to obtain a contract MCP data stream. Based on the MCP interface specification data, the knowledge graph and the reinforcement learning decision model are reconstructed for the contract MCP data stream, integrating the model processing results and the model running status. Based on the model processing results and the model running status, the contract processing flow for the target contract is executed to obtain a contract management scheme, and the MCP interface specification data and the reinforcement learning decision model are updated according to the contract management scheme.
2. The method according to claim 1, characterized in that, The process involves acquiring contract documents in multiple formats for the target contract, performing text and image processing on the contract documents, and then fusing the text and image processing results using multimodal methods to obtain intermediate data, including: The contract document is identified by file format recognition, and preprocessed according to the identified file format to obtain a standardized document object; The text content is extracted from the standardized document object, and the text content is processed using a preset deep learning entity recognition model to identify multiple entities, including the contract subject, terms and date key entities; Determine the dependencies between the contract subject, the terms, and the date key entity, and determine the text processing result based on the entity and the corresponding dependencies; The image content is extracted from the standardized document object, and the image content is recognized and structurally extracted using a preset OCR recognition model to obtain the image processing result; The text processing results and the image processing results are fused using a multimodal method to output fused data. Using a preset data model converter, the fused data is mapped to a predefined JSON pattern to obtain intermediate data.
3. The method according to claim 2, characterized in that, Based on the intermediate data, the target entities and relationships in the target contract are extracted. A knowledge graph is constructed based on the target entities and their corresponding relationships. The target contract is then subjected to clause logic conflict detection and compliance risk assessment based on the knowledge graph to obtain the contract assessment result, including: Semantic analysis is performed on the intermediate data to extract the target entities in the target contract and the relationships between the target entities, forming a set of entity relationship pairs. The target entities include subject-type entities, attribute-type entities, and event-type entities. Based on the set of entity relationship pairs, a knowledge graph is constructed, where nodes in the knowledge graph represent the target entity, and edges in the knowledge graph represent the relationship between two connected entities. In the knowledge graph, trace the association paths between the entities, locate the path conflict points on the association paths, and detect the logical consistency of the terms in the knowledge graph to obtain the logical conflict points; Using preset conflict detection rules, the path conflict points and the logical conflict points are compared to obtain target conflict points that conform to the conflict detection rules. Based on the conflict point information of the target conflict points, a conflict detection report is generated, wherein the conflict point information includes conflict location, conflict type and conflict cause. Using preset compliance rules, the target conflict point is risk-scored and risk-classified based on the knowledge graph and the conflict detection report to obtain a compliance risk assessment report; The conflict detection report and the compliance risk assessment report are combined to form the contract assessment result.
4. The method according to claim 3, characterized in that, The process involves constructing a state space based on the knowledge graph and the contract evaluation results, generating a sequence of actions for processing the target contract based on the state space, and constructing a decision model based on the action execution results and performance indicators after executing the sequence of actions. This allows for the construction of a reinforcement learning decision model based on the state space, the sequence of actions, and the decision model. The process includes: Based on the knowledge graph, the contract evaluation results, and the pre-acquired historical contract processing data, a state space is constructed. The state space includes state vectors with multiple dimensions, including field confidence scores, historical accuracy, contract complexity, and recognition difficulty. Based on the state space, an action space containing multiple processing actions is constructed. Based on the state space, the action value of each processing action is calculated using a preset deep Q-network. The processing action that maximizes the action value is selected and then arranged in a preset logical order to form a sequence of processing actions. Execute the processing actions in the processing action sequence in sequence, and record the execution result and performance indicators of each processing action; Based on the action execution result and the performance index, the reward value obtained by executing the processing action is determined. Based on the reward value, the parameters of the deep Q network are updated through backpropagation to obtain the reinforcement learning decision model.
5. The method according to claim 4, characterized in that, The process of determining the reward value obtained from performing the processing action based on the action execution result and the performance metric, and updating the parameters of the deep Q-network through backpropagation based on the reward value to obtain a reinforcement learning decision model includes: Based on the execution results of the action and the performance indicators, extract the accuracy change value, time consumption and resource usage data, and output the performance evaluation parameters. Based on the performance evaluation parameters, the reward value of the processing action is calculated using a preset reward function, which includes an accuracy change item, a time saving item, an action cost penalty item, and an error penalty item. The network loss of the deep Q-network is determined based on the reward value and the state vector. Based on the network loss, the parameter gradients of each layer in the deep Q-network are calculated using the backpropagation algorithm; Based on the parameter gradient, the weights and bias parameters of the deep Q-network are updated using a preset gradient descent optimization algorithm to obtain a reinforcement learning decision model.
6. The method according to claim 5, characterized in that, The step of determining the MCP interface specification data based on the reinforcement learning decision model, and constructing adapter models for different data sources based on the MCP interface specification data, includes: Based on the reinforcement learning decision model, an MCP interface document and an MCP interface implementation library are determined to constitute the MCP interface specification data. The MCP interface document includes a data format representing the data structure of the interface transmission, an interaction protocol representing the communication rules between modules, and an event handling mechanism. The event handling mechanism is used to indicate the triggering conditions and response logic of key events. The MCP interface implementation library contains program code for executing contract processing. The process involves using the adapter model to process the contract document, obtaining a contract MCP data stream, and reconstructing the knowledge graph and the reinforcement learning decision model based on the MCP interface specification data, integrating the model processing results and model running status, including: The adapter model is used to extract contract documents from different data sources, and the contract documents from each data source are converted into standardized data that is compatible with the MCP interface specification data. The standardized data is then preprocessed to obtain the contract MCP data stream. Based on the MCP interface specification data, text processing and image processing are re-executed, the knowledge graph is reconstructed, and the reinforcement learning decision model is reconstructed. The intermediate data and contract evaluation results obtained after the current re-execution are summarized to obtain the model processing results and model running status.
7. The method according to claim 6, characterized in that, The text processing results and the image processing results are fused using a multimodal method to output fused data, including: Based on the text processing results and the image processing results, the contract document is divided into multiple non-overlapping subdomains, including clause paragraphs, table areas, and signature sections, according to semantic and structural features. Using the feature extraction function corresponding to each subdomain, word vectors, syntactic structure and semantic features are extracted from the text region in the subdomain, and spatial relationship, visual features and content layout information are extracted from the image region in the subdomain, and the local features of each subdomain are output. Based on the local features of the subdomain, differential expression rules are configured at the boundaries of the subdomain to construct a feature space, wherein the differential expression rules are used to indicate that discontinuities in the local features are allowed at the boundaries of the subdomain. Based on the feature space and the local features, the jump value and average gradient of the cross-domain features are calculated, and the jump value and average gradient are calculated using a preset internal penalty function to obtain the penalty constraint parameters. Using a preset symmetric matrix operator, the characteristic coordination equation corresponding to the penalty constraint parameter is solved to obtain the symmetric constraint solution result; Based on the solution results of the symmetry constraints, the subdomain processing order is determined according to the preset logical structure of the contract document. The subdomain processing order is used to indicate that subdomains with information density higher than a preset density threshold are processed first, and subdomains with information density lower than the density threshold are processed later. Based on the penalty constraint parameters of any subdomain in the subdomain processing order and the interaction penalty parameters of other subdomains associated with the subdomain, global penalty data is determined, and multimodal fusion features are determined. The multimodal fusion features are used to indicate the subdomain that minimizes the global penalty data and its corresponding structured information and the association between the subdomains. The structured information includes the entity and image features in the image content. The interaction penalty parameters are used to indicate the logical consistency between the subdomains. Based on the multimodal fusion features, the text processing results and the image processing results are fused using multimodal methods.
8. The method according to claim 7, characterized in that, Based on the feature space and the local features, the jump value and average gradient of the cross-domain features are calculated. A preset internal penalty function is used to calculate the jump value and the average gradient to obtain penalty constraint parameters, including: Based on the feature space and the local features of adjacent subdomains, the jump value of the cross-domain feature is obtained; Calculate the average gradient and normal vector of the feature space at the domain boundary to obtain gradient vector data; Based on the jump value of the cross-domain feature and the gradient vector data, an internal penalty function is constructed. The internal penalty function includes a first penalty term for controlling the jump value of the cross-domain feature, a second penalty term for controlling the change of the gradient vector data, a first weight parameter corresponding to the first penalty term, and a second weight parameter corresponding to the second penalty term. The first weight parameter is used to control the degree of difference of local features in adjacent subdomains, and the second weight parameter is used to control the smoothness of the gradient in the feature space. The penalty constraint parameters are obtained by calculating the jump value and the average gradient using the internal penalty function.
9. The method according to claim 8, characterized in that, Based on the state space, an action space containing multiple processing actions is constructed. Based on the state space, a preset deep Q-network is used to calculate the action value of each processing action. The processing action that maximizes the action value is selected, and then arranged in a preset logical order to form a sequence of processing actions, including: Based on the state vectors of multiple dimensions, the state space is decomposed into multiple levels according to a preset level of fineness, forming a multi-level state space ordered from coarse to fine. The levels include the coarsest grid, multiple intermediate grids, and the finest grid. Based on the multi-level state space, a corresponding Q-value function is defined for each level to obtain a multi-grid Q-value function representation. The Q-value function includes the complete state-action value function corresponding to the finest grid, the simplified value function corresponding to the intermediate grid, and the core feature value estimation function corresponding to the coarsest grid. Based on the multi-grid Q-value function representation, a level-to-level transformation operator is determined, wherein the level-to-level transformation operator includes a constraint operator and an extension operator. The constraint operator is used to indicate mapping the Q-value of the fine grid to the first-order coarse grid, and the extension operator is used to indicate extending the Q-value of the coarse grid to the first-order fine grid. Based on the inter-level transformation operator, an adaptive smoothing function is constructed. Standard smoothing or high-speed flow smoothing is selected according to the gradient of the Q-value function. The adaptive smoothing function is combined to form a smoothing processing strategy. The adaptive smoothing function is used to indicate the high-speed flow phenomenon in the processing of the contract. Based on the smoothing strategy and the multi-grid Q-value function representation, starting from the finest grid, the Q-value of the current finest grid is iteratively smoothed multiple times. The residual corresponding to the smoothed Q-value is calculated and passed to the coarser grid through the constraint operator until the coarsest grid. Starting from the coarsest grid, the coarse-grid optimization solution of the current coarse grid is iteratively solved and passed to the finest grid through the extension operator until the finest grid. The converged Q-value function is then output. The optimal policy is extracted from the convergent Q-value function, and a policy smoothing operation is performed to obtain the sequence of processing actions.
10. The method according to claim 9, characterized in that, The determination of the inter-level transformation operator based on the multi-grid Q-value function representation includes: Based on the multi-grid Q-value function representation, the Q-values of the fine-grid level are mapped to the coarser-level grid through a preset weighted average algorithm or feature aggregation algorithm to determine the constraint operator definition data of the constraint operator; Based on the multi-grid Q-value function representation, the Q-value of the coarse grid level is extended to the finer grid level through a preset interpolation algorithm or feature expansion algorithm to determine the extension operator definition data of the extension operator; Based on the constraint operator definition data and the extension operator definition data, a transformation function is constructed, which is used to indicate the minimization of the integral difference between the Q value of the fine mesh level and the Q value of the extended coarse mesh level; Based on the transformation function, the ability of the constraint operator definition data and the extension operator definition data to preserve the key characteristics of the value function is verified, and the inter-level transformation operator is obtained.
11. The method according to claim 10, characterized in that, The process involves constructing an adaptive smoothing function based on the inter-level transformation operator, selecting standard smoothing or high-speed flow smoothing according to the gradient of the Q-value function, and combining the adaptive smoothing function to form a smoothing strategy, including: Based on the inter-level transformation operator, calculate the absolute value of the gradient of the Q-value function of the current level; Based on the absolute value of the gradient, a gradient threshold is determined, and based on the absolute value of the gradient and the gradient threshold, a flow state discrimination result is determined. The gradient threshold is used to distinguish between standard flow and high-speed flow states. When the flow state determination result indicates that the absolute value of the gradient is less than the gradient threshold, the standard smoothing algorithm is selected; or when the flow state determination result indicates that the absolute value of the gradient is not less than the gradient threshold, the high-speed flow smoothing algorithm is selected. The high-speed flow smoothing algorithm is used to indicate that adaptive parameters are dynamically adjusted according to the data flow speed. The selected standard smoothing algorithm or high-speed flow smoothing algorithm is executed to process the Q-value function, resulting in the smoothing strategy.
12. A contract recognition and intelligent management system based on MCP, characterized in that, include: The document processing module is used to acquire contract documents in various formats for the target contract, perform text processing and image processing on the contract documents, and perform multimodal fusion of the text processing results and image processing results to obtain intermediate data; The knowledge graph construction module is used to extract target entities and relationships in the target contract based on the intermediate data, construct a knowledge graph based on the target entities and their corresponding relationships, and perform clause logic conflict detection and compliance risk assessment on the target contract based on the knowledge graph to obtain the contract assessment result. The target entities are key information units in the contract, including contract subjects, contract elements, and contract clauses. The relationships refer to the semantic connections between different entities, including rights and obligations, master-slave relationships, and conditional relationships. The model building module is used to construct a state space based on the knowledge graph and the contract evaluation results. The state space includes multiple dimensions such as the current state of the contract, processing stage, and risk level. Based on the state space, a sequence of processing actions for the target contract is generated. This sequence refers to a series of operational steps for processing the contract, including information extraction, clause analysis, risk assessment, and content modification. Based on the action execution results and performance indicators after executing the action sequence, the module constructs a decision model capable of selecting the optimal processing action based on the current state. This enables the construction of a reinforcement learning decision model based on the state space, the processing action sequence, and the decision model. The reinforcement learning decision model treats contract processing as a decision-making process, where the state is the current state of the contract, the action is the possible processing operation, and the reward is the evaluation of the effect after the operation. The MCP interface configuration module is used to determine the MCP interface specification data based on the reinforcement learning decision model, and to construct adapter models for different data sources based on the MCP interface specification data. The adapter models are used to indicate how to transform data from different data sources into data streams that are compatible with the MCP interface specification data. MCP is a unified contract management system that combines three elements: model, contract, and processing flow. The data source adaptation module is used to process the contract document using the adapter model to obtain the contract MCP data stream, and to reconstruct the knowledge graph and the reinforcement learning decision model based on the MCP interface specification data, integrating the model processing results and the model running status. The contract management module is used to execute the contract processing flow for the target contract based on the model processing results and the model running status, obtain the contract management scheme, and update the MCP interface specification data and the reinforcement learning decision model according to the contract management scheme.
Citation Information
Patent Citations
Contract risk reasoning method based on prompt design and knowledge graph
CN117973518A
Contract risk intelligent identification method and system
CN120542439A