Contract information extraction method, device and equipment based on multi-level prompt word instruction

By adopting a multi-level prompt word instruction architecture, the problems of high prompt word coupling, ambiguous subject identification, and unauditable extraction in existing technologies are solved. It achieves high accuracy, high generalization and high maintainability of contract information extraction, adapts to different contract scenarios, and provides traceable structured data.

CN122240858APending Publication Date: 2026-06-19SHANGYANG TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHANGYANG TECH CO LTD
Filing Date
2026-04-15
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

Existing contract information extraction technologies suffer from several problems, including high coupling in the prompt word architecture leading to instruction bloat, fundamental ambiguity in contract subject identification, an unauditable black-box extraction process, and weak generalization ability. They cannot simultaneously achieve extraction accuracy, system scalability, scenario generalization ability, and compliance audit requirements.

Method used

A multi-level prompt word instruction architecture is adopted, including a system meta-instruction layer, an atomic rule configuration layer, and a semantic reasoning audit layer. Through layered decoupling design, the contract information extraction instructions are decoupled and managed in a layered manner. Business role mapping is carried out by combining entity recognition matrix and enterprise directory database, and instruction atomic units are dynamically attached to perform auditable verification and logical closed loop to ensure the transparency and compliance of the extraction process.

🎯Benefits of technology

It achieves high accuracy, high generalization and high maintainability in contract information extraction, can adapt to different contract scenarios, provides traceable and verifiable structured data, and improves system scalability and compliance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122240858A_ABST
    Figure CN122240858A_ABST
Patent Text Reader

Abstract

This invention discloses a method, apparatus, and device for extracting contract information based on multi-level prompt word instructions. The method includes: acquiring the digital signal of the contract document to be processed; identifying business type tags through layout analysis and semantic clustering; then, using an instruction scheduling engine, calling and reconstructing multi-level instruction modules from a preset instruction library based on the tags to assemble a complete multi-level instruction stream; finally, injecting the complete multi-level instruction stream into an intelligent processing module, driving the intelligent processing module to complete the contract information extraction according to the instruction stream constraints, and outputting standardized structured data after verification and auditing. The multi-level instruction module is a three-layer architecture consisting of a decoupled system meta-instruction layer, an atomic rule configuration layer, and a semantic reasoning audit layer. These layers are independent of each other, and lower-level modules cannot modify the upper-level constraint rules. This invention solves the problems of instruction bloat, subject ambiguity, black-box unauditability, and weak generalization ability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of information processing technology, and in particular to a method, apparatus, and device for extracting contract information based on multi-level prompt words. Background Technology

[0002] In the process of enterprise digital transformation, unstructured documents such as contracts, order placement letters, lease agreements, and subcontracting contracts are core vouchers for business processes, legal compliance, and financial settlement. Accurately extracting key information from massive amounts of contract documents is a core step for enterprises to achieve end-to-end digital management of contracts.

[0003] Current contract information extraction technologies are mainly divided into two categories: One type is the traditional solution based on OCR + regular expression rules / template matching. This type of solution requires separate configuration of rules for each contract template, has extremely poor generalization ability, and has high cost and long cycle for adapting new templates. Another type is the extraction scheme based on a large language model plus a single-layer prompt word. This type of scheme offers some flexibility compared to traditional schemes, but it still has four fundamental industry pain points that cannot be solved: First, the prompt word architecture has a high degree of coupling, resulting in a serious instruction bloat problem. Existing technologies all adopt a single-layer linear prompt word design, where all extracted fields, constraint rules, and validation logic are piled up in the same prompt word. As the number of extracted fields increases, the prompt word becomes increasingly bloated, and there is serious interference between fields. Modifying the extraction rule of a single field requires reconstructing the entire prompt word, resulting in extremely poor system scalability.

[0004] Second, there is fundamental ambiguity in the identification of contract parties and confusion in the mapping of business roles. Existing technologies can only identify the legal identity of "Party A / Party B" in a contract. However, in actual business, the same company may be in different legal positions as Party A or Party B in different contracts. Traditional solutions cannot accurately map legal identity to the core business roles of "our company / customer" in the business system, which easily leads to confusion of subject responsibility and renders the extracted data completely invalid.

[0005] Third, the extraction process is a black box, unauditable and untraceable, failing to meet legal compliance requirements. Existing technologies only output the final extraction results, without a complete derivation process or supporting original evidence. When extraction errors occur, it is impossible to pinpoint the root cause of the problem. Furthermore, in highly regulated scenarios such as finance, engineering, and legal affairs, the contract information extraction process must be auditable and traceable, which existing technologies cannot meet at all.

[0006] Fourth, it has weak generalization ability and high cost of adapting to new scenarios. Existing technologies require designing prompts and training dedicated models for each type of contract template. Adapting to new contract types and newly extracted fields requires a lot of manual intervention, resulting in long adaptation cycles and high maintenance costs, making it impossible to quickly respond to the ever-changing business needs of enterprises.

[0007] In summary, existing contract information extraction technologies cannot simultaneously achieve high extraction accuracy, system scalability, scenario generalization ability, and compliance audit requirements. There is an urgent need to propose an architecturally innovative contract information extraction solution to address the fundamental shortcomings of existing technologies. Summary of the Invention

[0008] The purpose of this invention is to provide a method, apparatus, computer-readable storage medium, and computer device for extracting contract information based on multi-level prompt word instructions. Through a layered and decoupled three-level prompt word instruction architecture, it fundamentally solves the four core pain points of existing technologies: instruction bloat, subject ambiguity, black box unauditability, and weak generalization ability, thereby achieving high accuracy, high generalization, high maintainability, and full-process auditability of contract information extraction.

[0009] In a first aspect, the present invention provides a method for extracting contract information based on multi-level prompt words, comprising: Acquire the digital signal of the contract document to be processed, perform layout analysis and semantic clustering on the contract document to be processed, and identify the business type tag corresponding to the contract document to be processed; Through the instruction scheduling engine, based on the business type label, multi-level instruction modules are called and reconstructed from the preset instruction library to assemble a complete multi-level instruction stream. The complete multi-level instruction stream is a scenario-specific instruction stream that only carries instruction atomic units that match the business type label, without redundant instruction content. The multi-level instruction module includes a system meta-instruction layer, an atomic rule configuration layer, and a semantic reasoning audit layer, which are decoupled sequentially. The three modules are independent of each other, and the lower-level modules cannot modify the constraint rules of the upper-level modules. The system meta-instruction layer is the highest priority constraint layer globally. The execution logic of the atomic rule configuration layer and the semantic reasoning audit layer must not break through the entity mapping rules and cognitive boundaries set by the system meta-instruction layer. The system meta-instruction layer is used to perform global business entity mapping and cognitive boundary constraints based on the entity recognition matrix and the enterprise directory database. Its execution logic includes: A pre-set entity recognition matrix and enterprise directory database are used. If an entity in the contract document to be processed is detected to match the characteristics of the enterprise directory database, regardless of the entity's position in the original legal relationship, the entity is normalized and mapped to our company's business role, and the remaining entities are mapped to customer business roles. Pre-defined industry terminology preferences, pricing rule priorities, and global value boundaries in the contract field, thus completing the setting of global cognitive boundaries; The atomic rule configuration layer is used to perform dynamic encapsulation and mounting of extracted elements, and the semantic reasoning audit layer is used to perform auditable verification and logical closure of the extraction process. The complete multi-level instruction stream is injected into the intelligent processing module, driving the intelligent processing module to follow the constraints of the complete multi-level instruction stream and complete the mapping from unstructured contract text to structured extraction results; The structured extraction results are subjected to format standardization, logical self-verification, and compliance auditing, and standardized structured data is output.

[0010] Furthermore, the execution logic of the atomic rule configuration layer includes: Each contract element to be extracted is encapsulated into an independent instruction atomic unit. The instruction atomic unit includes field definition, feature extraction operator, value boundary, and forward and reverse examples. The feature extraction operator is customized for the contract element extraction scenario and includes a set of operators for regular expression matching, semantic similarity matching, and entity type recognition. A preset instruction routing table is used to dynamically retrieve instruction atomic units corresponding to the scenario from the preset instruction library based on the service type tag, and to complete the mounting, while removing instruction atomic units that are not related to the service type tag. A preset weight matrix is ​​configured with priority weights for different instruction atomic units. When semantic conflicts occur in the extraction results of different instruction atomic units, conflict resolution is performed based on the weight matrix.

[0011] Furthermore, the execution logic of the semantic reasoning audit layer includes: The intelligent processing module is forced to follow a three-step deduction chain of evidence extraction, semantic calculation, and structured value extraction to complete the extraction of each contract element to be extracted, and simultaneously bind and store the extraction results with the corresponding original evidence and deduction logic one by one; Based on preset contract business rules, cross-field consistency checks and common sense judgments are performed on the extracted results; The system extracts logical deviations based on a pre-defined logical deviation threshold for contract compliance requirements, returns an anomaly flag, and triggers a secondary parsing process.

[0012] Further, the step of performing layout analysis and semantic clustering on the contract document to be processed, and identifying the business type tag corresponding to the contract document to be processed, includes: The contract document to be processed is subjected to page segmentation, text block positioning, and target area identification to obtain page analysis results. The target areas include table areas, paragraph areas, and signature areas. The core semantics of the contract document to be processed are vectorized, and the vectorization result is matched with a preset business type tag library to obtain the business type tag corresponding to the contract document to be processed. The business type tags include lease contracts, order letters, meeting minutes and subcontracting contracts. The preset business type tag library supports custom addition of new business types and corresponding routing rules.

[0013] Furthermore, the step of injecting the complete multi-level instruction stream into the intelligent processing module, driving the intelligent processing module to follow the constraints of the complete multi-level instruction stream, and completing the mapping from unstructured contract text to structured extraction results includes: The complete multi-level instruction stream and the full text content of the contract document to be processed are synchronously input into the large language model or multimodal large model; Drive the large language model or multimodal large model, follow the constraints of the complete multi-level instruction flow, perform semantic reasoning, business entity identification and contract implicit clause derivation, and output structured extraction results with derivation basis and evidence tracing.

[0014] Furthermore, the process of performing format standardization, logical self-verification, and compliance auditing on the structured extraction results, and outputting standardized structured data, includes: The structured extraction results are subjected to data format standardization processing to generate standardized structured data in JSON format that meets the requirements of downstream business system integration. For abnormal extraction results that fail the logic verification, the results are automatically fed back to the instruction scheduling engine, the instruction weights and atomic unit parameters are adjusted, and the extraction process is re-executed, while the preset instruction library is updated synchronously, forming a self-optimizing closed loop.

[0015] Furthermore, the enterprise directory database contains a set of features including the full name, standardized abbreviation, branch names, and unified social credit code of the target enterprise.

[0016] Secondly, the present invention provides a contract information extraction device based on multi-level prompt word instructions, comprising: The document feature recognition module is used to acquire the digital signal of the contract document to be processed, perform layout analysis and semantic clustering on the contract document to be processed, and identify the business type tag corresponding to the contract document to be processed. The multi-level instruction scheduling engine module is used to call and reconstruct multi-level instruction modules from a preset instruction library based on the business type label through the instruction scheduling engine, and assemble a complete multi-level instruction stream. The complete multi-level instruction stream is a scenario-specific instruction stream that only carries instruction atomic units that match the business type label, without redundant instruction content. The multi-level instruction module includes a system meta-instruction layer, an atomic rule configuration layer, and a semantic reasoning audit layer, which are decoupled sequentially. The three modules are independent of each other, and the lower-level modules cannot modify the constraint rules of the upper-level modules. The system meta-instruction layer is the highest priority constraint layer globally. The execution logic of the atomic rule configuration layer and the semantic reasoning audit layer must not break through the entity mapping rules and cognitive boundaries set by the system meta-instruction layer. The system meta-instruction layer is used to perform global business entity mapping and cognitive boundary constraints based on the entity recognition matrix and the enterprise directory database. Its execution logic includes: A pre-set entity recognition matrix and enterprise directory database are used. If an entity in the contract document to be processed is detected to match the characteristics of the enterprise directory database, regardless of the entity's position in the original legal relationship, the entity is normalized and mapped to our company's business role, and the remaining entities are mapped to customer business roles. Pre-defined industry terminology preferences, pricing rule priorities, and global value boundaries in the contract field, thus completing the setting of global cognitive boundaries; The atomic rule configuration layer is used to perform dynamic encapsulation and mounting of extracted elements, and the semantic reasoning audit layer is used to perform auditable verification and logical closure of the extraction process. The large model inference execution module is used to inject the complete multi-level instruction stream into the intelligent processing module, drive the intelligent processing module to follow the constraints of the complete multi-level instruction stream, and complete the mapping from unstructured contract text to structured extraction results; The results audit and output module is used to perform format standardization, logical self-verification and compliance audit on the structured extraction results, and output standardized structured data.

[0017] Thirdly, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the contract information extraction method based on multi-level prompt word instructions as described above.

[0018] Fourthly, the present invention provides a computer device, including a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor executes the computer program to implement the steps of the contract information extraction method based on multi-level prompt word instructions described above.

[0019] Beneficial effects: This invention introduces a multi-level instruction module, consisting of a three-tiered prompt word architecture: a decoupled system meta-instruction layer, an atomic rule configuration layer, and a semantic reasoning audit layer. This architecture decouples and manages contract information extraction instructions hierarchically, effectively avoiding the instruction bloat problem caused by traditional single-level prompt word architectures. Simultaneously, through the entity mapping rules of the highest-priority system meta-instruction layer, it overcomes the limitations of the legal identities of the contracting parties, achieving accurate and unified mapping of business roles across templates and completely eliminating ambiguity in contract subject identification. This method, through the dynamic mounting design of instruction atomic units, can adapt to new contract scenarios and newly extracted fields with zero code. It can flexibly schedule instructions according to contract business types, achieving extreme scenario generalization capabilities and improving the system's adaptability to different contract scenarios. Furthermore, through a layered verification and auditing mechanism, it ensures the logic of the extraction process and the compliance of the results, providing traceable and verifiable contract data for enterprise digital management, thereby improving the accuracy of contract information extraction and system scalability. Attached Figure Description

[0020] Figure 1 This is a flowchart illustrating a contract information extraction method based on multi-level prompt words provided by the present invention.

[0021] Figure 2 This is a schematic diagram of a contract information extraction device based on multi-level prompt words, provided by the present invention.

[0022] Figure 3 This is a schematic diagram of the structure of a computer device provided by the present invention. Detailed Implementation

[0023] The technical solutions of this invention will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are merely some, not all, of the embodiments of this invention. The components of this invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without inventive effort are within the scope of protection of this invention.

[0024] It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. Furthermore, in the description of this invention, terms such as "first," "second," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0025] It should be noted that the method of this embodiment can be executed by a single device, such as a computer or server. The method of this embodiment can also be applied to a distributed scenario, where multiple devices cooperate to complete the task. In such a distributed scenario, one of these devices may execute only one or more steps of the method of this embodiment, and these multiple devices will interact with each other to complete the contract information extraction method based on multi-level prompt words.

[0026] It should be noted that the above description describes some embodiments of the present invention. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps described in the claims can be performed in a different order than that shown in the above embodiments and still achieve the desired results. Furthermore, the processes depicted in the drawings do not necessarily require a specific or sequential order to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0027] Existing contract information extraction technologies suffer from several problems when processing massive amounts of unstructured contract documents. These problems include high coupling of prompt word architecture leading to instruction bloat, fundamental ambiguity in contract subject identification, black-box extraction process making it unauditable, and weak generalization ability leading to high adaptation costs for new scenarios. They cannot simultaneously achieve extraction accuracy, system scalability, scenario generalization ability, and compliance audit requirements.

[0028] Please see Figure 1 This invention proposes a method for extracting contract information based on multi-level prompt words, the method comprising: S100: Obtain the digital signal of the contract document to be processed, perform layout analysis and semantic clustering on the contract document to be processed, and identify the business type label corresponding to the contract document to be processed. S200. Through the instruction scheduling engine, based on the business type label, call and reconstruct multi-level instruction modules from the preset instruction library to assemble a complete multi-level instruction stream. The complete multi-level instruction stream is a scenario-specific instruction stream that only carries instruction atomic units that match the business type label, without redundant instruction content. The multi-level instruction module includes a system meta-instruction layer, an atomic rule configuration layer, and a semantic reasoning audit layer, which are decoupled sequentially. The three modules are independent of each other, and the lower-level modules cannot modify the constraint rules of the upper-level modules. The system meta-instruction layer is the highest priority constraint layer globally. The execution logic of the atomic rule configuration layer and the semantic reasoning audit layer must not break through the entity mapping rules and cognitive boundaries set by the system meta-instruction layer. The system meta-instruction layer is used to perform global business entity mapping and cognitive boundary constraints based on the entity recognition matrix and the enterprise directory database; The atomic rule configuration layer is used to perform dynamic encapsulation and mounting of extracted elements, and the semantic reasoning audit layer is used to perform auditable verification and logical closure of the extraction process. S300. Inject the complete multi-level instruction stream into the intelligent processing module, and drive the intelligent processing module to follow the constraints of the complete multi-level instruction stream to complete the mapping from unstructured contract text to structured extraction results. S400. Perform format standardization, logical self-verification, and compliance audit on the structured extraction results, and output standardized structured data.

[0029] In this embodiment of the invention, step S100 performs feature recognition and type labeling: acquiring the digital signal of the document to be processed, and identifying the business type label of the document, such as an order form, lease contract, or meeting minutes, through a layout analysis module and a semantic clustering operator. The digital signal can be an image file acquired by a scanner or a directly generated PDF document.

[0030] Step S200 realizes multi-level dynamic instruction scheduling and scenario-specific instruction stream assembly.

[0031] This step is the core innovation of the present invention. The core objective is to dynamically generate a multi-level instruction flow that is fully matched with the contract scenario based on the identified business type tags. Through a three-layer decoupled instruction architecture design, it fundamentally solves the core pain points of existing technologies, such as high coupling of single-layer prompt words, instruction bloat, rule conflicts, and model illusion.

[0032] The specific implementation process is as follows: The instruction scheduling engine triggers and matches tags: Using the business type tag identified in step S100 as the sole input, the instruction scheduling engine searches the preset instruction library and preset instruction routing table to complete the matching and filtering of corresponding instruction modules and instruction atomic units. The preset instruction library is a pre-built, dynamically expandable instruction resource library that stores global constraint rules of the system meta-instruction layer, instruction atomic units for each scenario in the atomic rule configuration layer, and verification rule modules of the semantic reasoning audit layer. The preset instruction routing table has a preset mapping relationship between business type tags and instruction atomic units, including a whitelist of mandatory instruction atomic units for the corresponding scenario and a blacklist of irrelevant instruction atomic units.

[0033] Multi-level instruction module reconstruction and hierarchical constraint locking: Based on the matching results, the instruction scheduling engine calls and reconstructs three sequentially decoupled modules from the preset instruction library: the system meta-instruction layer, the atomic rule configuration layer, and the semantic reasoning audit layer. These three modules strictly adhere to the core rule of "upper layer constrains lower layer, lower layer cannot modify upper layer," where: The system meta-instruction layer is the highest-priority constraint layer in the entire extraction system. It serves as the cognitive foundation for the entire multi-level instruction flow, taking effect globally and throughout the entire process. The entity mapping rules and cognitive boundaries set by the system meta-instruction layer, as well as all execution logic in the atomic rule configuration layer and semantic reasoning audit layer, must not be violated. The core of the system meta-instruction layer is used to execute global business entity mapping and cognitive boundary constraints based on the entity recognition matrix and the enterprise directory database. Specifically, this includes four core constraints: business entity normalization mapping rules, contract domain industry terminology discrimination preferences, pricing rule priorities, and global value boundaries.

[0034] The atomic rule configuration layer is the core execution unit of the extraction logic. It is used to dynamically encapsulate and mount the extracted contract elements. All instructions in this layer must comply with the global constraints of the system meta-instruction layer and must not modify or break through the entity mapping rules and cognitive boundaries.

[0035] The semantic reasoning audit layer is the quality control link for the extraction results. Its core function is to perform auditable verification and logical closure of the extraction process. The verification rules and derivation logic of this layer must follow the global constraints of the system meta-instruction layer and must not exceed the preset cognitive boundaries and business rules.

[0036] Scenario-specific instruction stream assembly and redundancy removal: Based on business type tags, the instruction scheduling engine dynamically pulls instruction atomic units that match the business type tag from a whitelist in the preset instruction library, completes hierarchical mounting, and automatically removes irrelevant instruction atomic units from the blacklist, finally assembling a complete multi-level instruction stream. The complete multi-level instruction stream is a scenario-specific instruction stream that only mounts instruction atomic units that match the current business type tag, without any redundant instruction content.

[0037] For example: For contract documents with the business type tag "order letter", only instruction atomic units specific to the order placement scenario, such as "material atomic", "delivery date atomic", and "freight atomic", are attached, and irrelevant instruction atomic units for lease contracts and subcontracting contracts are automatically removed; For contract documents with the business type tag "lease contract", only instruction atomic units specific to the lease scenario, such as lease start rules, rent-free period, rent standard, and leased property information, are attached. Irrelevant instruction atomic units from other scenarios, such as "lease start rules atomic", "rent-free days atomic", and "settlement cycle atomic", are automatically removed.

[0038] In this embodiment, the scenario-specific instruction stream employs a triple redundancy removal mechanism to ensure no redundant instruction content: first, scenario-level redundancy removal completely masks instruction atomic units not belonging to the current scenario; second, field-level redundancy removal automatically removes non-core element instruction units not covered by the contract text; and third, rule-level redundancy removal automatically removes rule content that overlaps with global constraints at the system's meta-instruction layer. The resulting instruction stream, compared to existing technologies with full-text prompts, reduces token usage and completely eliminates the problem of inter-field interference caused by redundant instructions.

[0039] Step S300 implements instruction stream-driven extraction: The assembled complete instruction stream is injected into the intelligent processing module, driving it to perform high-dimensional reasoning in the semantic vector space, completing the mapping from unstructured text to structured data. After receiving the contract text and instruction stream, the intelligent processing module follows the steps defined in the instruction stream, for example, first identifying specific patterns in the text, then extracting the corresponding information, and finally organizing the extracted information according to a preset structure.

[0040] Step S400 performs result validation and structured output: Data format standardization, logical self-validation, and compliance auditing are performed on the output results, ultimately generating standardized format data. Format standardization involves converting the extracted results into a unified data format, such as JSON, for easier subsequent system processing. Logical self-validation automatically feeds back abnormal extracted results that fail logical validation to the instruction scheduling engine, adjusts instruction weights and atomic unit parameters, re-executes the extraction process, and synchronously updates the preset instruction library, forming a self-optimizing closed loop. Compliance auditing checks whether the extracted results conform to business specifications. After completing these steps, the final standardized structured data can be output.

[0041] In this invention, the multi-level instruction module is a three-layer independent architecture that is decoupled sequentially, and the specific implementation is as follows: First layer: System meta-instruction layer (global baseline layer) This layer forms the cognitive foundation of the entire extraction system, is globally effective, and cannot be modified by lower layers. Its execution logic is as follows: 1. Business Entity Normalization Mapping: A pre-set entity identification matrix and enterprise directory database are used. If an entity in the contract document to be processed is detected to match the characteristics of the enterprise directory database, regardless of the entity's position in the original legal relationship, the entity will be normalized and mapped to our company's business role, and the remaining entities will be mapped to customer business roles. 2. Global cognitive boundary setting: Preset the industry terminology discrimination preference, pricing rule priority and global value boundary in the contract field to complete the global cognitive boundary setting.

[0042] Specifically, to address the issues of contract subject identification and role normalization, this invention pre-configures an entity identification matrix and an enterprise directory database.

[0043] An entity recognition matrix can be a predefined set of rules used to identify various entities in contract text, such as company names, personal names, and organizational structures.

[0044] In one embodiment, the enterprise directory database contains a set of features including the full name, standardized abbreviation, branch names, and unified social credit code of the target enterprise.

[0045] When the system's meta-instruction layer detects that an entity in the contract document to be processed matches any feature in the feature set of the enterprise directory database, it triggers normalization mapping, regardless of the legal identity descriptions of the principal, agent, contracting party, contractor, lessor, or lessee in the original contract text.

[0046] The enterprise directory database is a database containing information such as known enterprise names, aliases, and abbreviations, used to assist in identifying and verifying enterprise entities in contracts. When the system meta-instruction layer detects that an entity in the contract document being processed matches the characteristics in the enterprise directory database, the system meta-instruction layer automatically triggers the role alignment operator. Regardless of the legal relationship role described in the original contract text as "Party A," "Party B," "Client," or "Agent," the system meta-instruction layer will uniformly map it to the preset business role "Self_Side" (our company). "Self_Side" usually represents our own side or core party in the contract, while other entities not identified as "Self_Side" are uniformly mapped to "Client_Side" (client / partner), representing the other party or related party in the contract. This is not restricted by the legal identity descriptions of the client, agent, contracting party, contractor, lessor, or lessee in the original contract text, ensuring that all subsequent extracted billing terms and seal permissions can be accurately collected to the preset subject.

[0047] This normalization process (i.e., identity normalization operator) effectively solves the technical problem of subject identification ambiguity in heterogeneous templates, helps to eliminate the diversity of original text expressions, provides a unified and standardized entity role view for subsequent business logic processing, and improves the robustness of role identification.

[0048] In one embodiment, the entity recognition matrix function can be implemented through technologies such as regular expressions, keyword matching, and named entity recognition (NER) models, and the enterprise directory database can be utilized through database queries, fuzzy matching, and other methods.

[0049] Meanwhile, a clear "cognitive boundary" is set for the contract information extraction process to ensure that the extraction results conform to specific business logic and industry norms. This invention pre-sets the discrimination preference of industry terms in the contract field, the priority of pricing rules, and the global value boundary.

[0050] Industry-specific terminology discrimination preferences in the contract field refer to the pre-setting of priorities or biases for the identification and understanding of terms, expressions, and semantic habits unique to specific contract types or industries (such as construction contracts, financial contracts, and leasing contracts). For example, in construction contracts, "construction costs" may have higher priority than "service fees." This can be achieved by constructing industry dictionaries, terminologies, or configuring semantic rules.

[0051] Pricing rule priority is a pre-defined priority order that the system should follow when extracting pricing information when there may be multiple pricing methods or clauses in a contract. For example, when a contract contains multiple pricing descriptions such as fixed total price, quantity-based pricing, and cost-plus pricing, the system should select the most important pricing method for extraction according to the preset priority.

[0052] Global value boundaries set reasonable value ranges or format constraints for the numerical values ​​of the elements to be extracted in a contract. For example, monetary fields should be positive numbers, date fields should conform to a specific date format, and percentage fields should be between 0% and 100%. This helps filter out obviously erroneous extraction results and improves data quality. This can be achieved through data validation rules, regular expressions, or numerical range limitations.

[0053] Through the above technical solutions, the system's meta-instruction layer can achieve accurate identification and standardized mapping of business entities in contract texts. The pre-built entity recognition matrix works in conjunction with the enterprise directory database to ensure that regardless of the role an entity plays in the original text, it can be accurately normalized to either our company's business role or the customer's business role. This greatly simplifies the complexity of subsequent business logic processing and improves the consistency and accuracy of entity identification. Simultaneously, by pre-setting industry terminology discrimination preferences, pricing rule priorities, and global value boundaries in the contract domain, a clear cognitive framework and constraints are set for the intelligent processing module. This ensures that the extraction process strictly follows the business logic and common sense of the specific industry, effectively avoiding erroneous extraction due to semantic misunderstanding or rule ambiguity. This ensures a more accurate and reliable mapping process from unstructured contract text to structured extraction results, ultimately outputting standardized structured data that conforms to business specifications.

[0054] Second layer: Atomized rule configuration layer (feature extraction layer) This layer is the core execution unit for extracting logic, enabling hot-swapping and zero-code expansion. The specific implementation logic is as follows: 1. Instruction Atomization Encapsulation: Each contract element to be extracted is encapsulated into an independent instruction atomic unit. The instruction atomic unit includes field definition, feature extraction operator, value boundary, and forward and reverse examples. The feature extraction operator is customized for the contract element extraction scenario and includes a set of operators for regular expression matching, semantic similarity matching, and entity type recognition. 2. Dynamic Mounting and Routing: A preset instruction routing table is used to dynamically retrieve instruction atomic units corresponding to the scenario from the preset instruction library based on the service type tag to complete the mounting, and instruction atomic units that are not related to the service type tag are removed; wherein, the preset instruction routing table has a preset mapping relationship between each service type tag and instruction atomic unit; 3. Semantic conflict resolution: A preset weight matrix is ​​configured with priority weights for different instruction atomic units. When semantic conflicts occur in the extraction results of different instruction atomic units, conflict resolution is performed based on the weight matrix.

[0055] Specifically, to achieve refined and modular management and extraction of contract elements, this invention encapsulates each contract element to be extracted into an independent instruction atomic unit. Each instruction atomic unit is designed to contain multiple key attributes. For example, field definitions clarify the element's name, data type, and structure, ensuring standardized extraction results; feature extraction operators are a set of tools customized for contract element extraction scenarios, which can include various algorithms or rules such as regular expression matching, semantic similarity matching, and entity type recognition, used to identify and locate target elements from text; value boundaries limit the legal value range or format of the element, such as date formats and amount ranges, to ensure the validity of the extraction results; positive and negative examples provide specific extraction paradigms to guide the intelligent processing module in learning or verification, improving extraction accuracy. Through this encapsulation method, the extraction logic of each element becomes independent and controllable, facilitating subsequent configuration and management.

[0056] To adapt to the extraction needs of contracts with different business types, this invention pre-defines an instruction routing table. This table pre-defines the mapping relationship between various business type tags and instruction atomic units, including a whitelist of mandatory instruction atomic units for the corresponding scenario and a blacklist of irrelevant instruction atomic units. When the system identifies the business type tag of the contract document to be processed, it can dynamically retrieve the instruction atomic units corresponding to that business type tag from the pre-define instruction library based on this tag, and attach them to the current extraction task. Simultaneously, instruction atomic units unrelated to the current business type tag will be removed, allowing each extraction instruction to focus on specific elements, effectively reducing field interference, avoiding unnecessary rule interference, improving extraction efficiency and accuracy in complex scenarios, and solving the problem of instruction interference. For example, for a "lease contract," the system will only load instruction atomic units related to leasing, and will not load instruction atomic units specific to "purchase contracts" or "subcontracting contracts." If additional extraction fields are needed later, only the corresponding instruction atomic units need to be added to the pre-define instruction library, without modifying the original instruction architecture. Business logic is decoupled from the underlying parsing program, and new templates can be quickly adapted by configuring the instruction atomic library, which greatly reduces the operation and maintenance cost and achieves zero-code expansion.

[0057] Furthermore, considering that in complex contract texts, different instruction atomic units may produce conflicting extraction results for the same element, this invention pre-sets a weight matrix, which is configured with priority weights for different instruction atomic units. When the intelligent processing module detects semantic conflicts in the extraction results of different instruction atomic units during the extraction process, the system will perform conflict resolution based on the pre-set weight matrix and output the extraction result with higher priority. This weight matrix can assign priorities or confidence levels to different instruction atomic units or their internal feature extraction operators, thereby prioritizing the adoption of results with higher weights when conflicts occur, or intelligently selecting or synthesizing the final extraction result through strategies such as weighted voting and rule sorting, ensuring the consistency and reliability of the output data.

[0058] For example, in scenarios where there are significant differences between the "Order Letter" and "Lease Contract" fields, the system adopts an "on-demand mounting" mode.

[0059] If step S100 identifies the document feature as "order letter," the scheduling engine only retrieves and loads: "material atom," "delivery date atom," and "freight atom." If it is identified as "lease contract," it is dynamically replaced with: "rent start rule atom," "rent-free days atom," and "settlement cycle atom." This modular mounting method eliminates the interference of redundant fields on the intelligent processing module and solves the problem of decreased recognition accuracy caused by instruction expansion.

[0060] The above technical solution encapsulates each contract element to be extracted into an independent instruction atomic unit, configuring it with detailed field definitions, feature extraction operators, value boundaries, and positive and negative examples. This significantly improves the granularity and configurability of the atomic rule configuration layer, making the extraction logic for each element clear and controllable. Simultaneously, through a pre-set instruction routing table, instruction atomic units can be dynamically loaded and removed based on the contract's business type tag, ensuring the scenario adaptability and efficiency of rule configuration and avoiding unnecessary rule interference. Furthermore, the introduction of a pre-set weight matrix enables intelligent conflict resolution when semantic conflicts arise from the extraction results of different instruction atomic units. This effectively improves the accuracy, consistency, and robustness of contract information extraction, significantly reducing the cost of manual intervention and post-processing, and providing high-quality, highly reliable instruction input for the intelligent processing module.

[0061] Third layer: Semantic reasoning audit layer (verification audit layer) This layer serves as a quality control step for the extracted results, ensuring auditable logic and traceable results. The specific implementation logic is as follows: 1. Forced three-step deduction chain: The intelligent processing module is forced to follow the three-step deduction chain of evidence extraction, semantic calculation and structured value extraction to complete the extraction of each contract element to be extracted, and simultaneously bind and store the extraction results with the corresponding original evidence and deduction logic one by one; 2. Business logic closed-loop verification: Based on preset contract business rules, perform cross-field consistency verification and common sense judgment on the extracted results; 3. Secondary anomaly analysis: The results of extracting logical deviations based on the pre-set logical deviation thresholds for contract compliance requirements are returned as an anomaly flag, triggering the secondary analysis process.

[0062] Specifically, to ensure the transparency, traceability, and auditability of the contract information extraction process, this invention mandates that the intelligent processing module follow a three-step logical deduction chain (LogicChain) of evidence extraction → semantic calculation → structured value extraction, thus solving the "black box" problem of implicit clause extraction and providing logical support for business auditing.

[0063] "Evidence extraction" refers to the intelligent processing module's ability to accurately identify and extract original text fragments supporting the extraction result from the original contract text when extracting specific contract elements. Examples include a key numerical value, date, or a complete description of a clause. This can be achieved by using a Large Language Model (LLM) to output the original text location or specific text content cited when generating the extraction result.

[0064] "Semantic calculus" refers to performing deep semantic understanding and logical reasoning on extracted evidence to determine its relationship with the elements to be extracted, and to perform necessary calculations or transformations. This invention introduces a semantic calculus algorithm, which can leverage the powerful reasoning capabilities of LLM combined with preset business logic rules. For example, for the "rent-free period" field, the instruction does not directly extract numbers, but is guided by a derivation chain: first, it locks the start time trigger text (such as "equipment entry"), second, it identifies offset logic (such as "grant 15 days of rent-free period"), and finally combines boundary judgment rules (such as "count the beginning but not the end") to output accurate structured business parameters.

[0065] "Structured retrieval" refers to filling the final result obtained through semantic computation according to a predefined structured data format (e.g., specific fields in a JSON object). This ensures the standardization of the output data and the readability of downstream systems.

[0066] The aforementioned "three-step derivation chain" emphasizes the logical order and rigor of the extraction process, namely, the complete path from original evidence to semantic understanding and then to structured output. Simultaneously, this invention binds and stores the extraction results with the corresponding original evidence and derivation logic one by one. When storing structured data, each extracted field is accompanied by a description of its corresponding original evidence and derivation process, providing detailed evidence for subsequent auditing, review, and problem investigation.

[0067] Based on this, in order to improve the accuracy and logical rationality of the extraction results, this invention performs cross-field consistency checks and common sense judgments on the extraction results based on preset contract business rules.

[0068] Among them, "pre-defined contract business rules" refer to pre-defined logical constraints and business common sense that reflect industry practices and legal requirements for specific contract types or business scenarios. These rules include, but are not limited to: the total contract price should equal the sum of the prices of each item, the contract effective date cannot be later than the signing date, and the lease term cannot be negative. These rules can be configured in the form of a rule engine, knowledge graph, or hard-coded logic. "Cross-field consistency verification" refers to checking whether the logical relationship between different extracted fields conforms to these pre-defined business rules. For example, if both "lease start date" and "lease end date" are extracted from the contract, the system will verify whether the "lease end date" is logically later than the "lease start date". "Common sense judgment" refers to checking whether the value of a single extracted field conforms to common business common sense or a pre-defined value range. For example, determining whether the extracted "rent" is non-negative or whether the "contract amount" is within a reasonable range. Through these verifications and judgments, logical errors or data that do not conform to common sense can be promptly identified and corrected during the extraction process.

[0069] Furthermore, to establish an effective error handling and self-repair mechanism, this invention extracts the logical deviation results based on a preset logical deviation threshold according to contract business compliance requirements, returns an anomaly flag, and triggers a secondary parsing process.

[0070] "Logical deviation" refers to the extraction result failing the aforementioned cross-field consistency check or common-sense judgment, or its confidence level falling below the preset business compliance requirement threshold. This "preset threshold for business compliance requirements" is set based on the business's stringent requirements for data accuracy. For example, for critical financial data, the threshold may be very strict, and any slight deviation may be considered an anomaly. When a logical deviation is detected, such as the sum of the extracted "prepayment ratio" and "progress payment ratio" exceeding 100%, the system will "return an anomaly flag," adding an identifier to the extraction result indicating a potential problem requiring manual intervention or further processing. Simultaneously, the system will "trigger a secondary parsing process," meaning the anomaly result will not be directly output but will be resubmitted to the intelligent processing module for further processing. During the secondary parsing process, instruction parameters can be adjusted, more detailed contextual information provided, or different extraction strategies employed to obtain more accurate results. This mechanism also provides feedback to the instruction scheduling engine, enabling it to optimize instruction weights or atomic unit parameters based on anomalies, thus forming a self-optimizing closed loop to ensure the business rationality of the output data.

[0071] Through the above technical solution, this invention can significantly improve the reliability, accuracy, and auditability of contract information extraction results. The forced intelligent processing module follows a three-step deduction chain of evidence extraction, semantic calculation, and structured value extraction, and simultaneously binds and stores the extraction results, original evidence, and deduction logic. This ensures that each extraction result has a clear source and reasoning process to support it, greatly enhancing the transparency and traceability of the extraction results, facilitating manual review, and meeting stringent compliance audit requirements. Based on this, cross-field consistency checks and common-sense judgments are performed based on preset contract business rules, which can promptly detect and correct logical errors or data that does not conform to business common sense during the extraction process. This significantly improves the accuracy and logical rationality of the extraction results, preventing low-quality data from flowing into downstream business systems. Furthermore, for extraction results that deviate from the preset threshold, the system can automatically return an exception flag and trigger a secondary parsing process. This not only establishes an effective error handling and self-repair mechanism, improving the robustness and automation of the overall extraction system and reducing manual intervention, but also provides a feedback loop for the continuous optimization of the instruction library, enabling the entire extraction system to continuously learn and improve, ultimately providing a highly reliable, auditable, and self-correcting method for extracting contract information.

[0072] Therefore, the contract information extraction method based on multi-level prompt word instructions provided in this embodiment of the invention introduces a multi-level instruction module. This module consists of a three-level prompt word architecture: a decoupled system meta-instruction layer, an atomic rule configuration layer, and a semantic reasoning audit layer. This achieves decoupling and hierarchical management of contract information extraction instructions, effectively avoiding the instruction bloat problem caused by traditional single-level prompt word architectures. Simultaneously, through the entity mapping rules of the highest-priority system meta-instruction layer, the limitations of the legal identities of the contracting parties are overcome, achieving accurate and normalized mapping of business roles across templates and completely eliminating ambiguity in contract subject identification. This method, through the dynamic mounting design of instruction atomic units, can adapt to new contract scenarios and newly extracted fields with zero code. It can flexibly schedule instructions according to the contract business type, achieving extreme scenario generalization capabilities and improving the system's adaptability to different contract scenarios. Furthermore, through a layered verification and auditing mechanism, the logic of the extraction process and the compliance of the results are ensured, providing traceable and verifiable contract data for enterprise digital management, thereby improving the accuracy of contract information extraction and system scalability.

[0073] In one embodiment of the present invention, step S100 involves performing layout analysis and semantic clustering on the contract document to be processed to identify the business type tag corresponding to the contract document to be processed, including: S110. Perform page cutting, text block positioning, and target area recognition on the contract document to be processed to obtain page analysis results, wherein the target area includes table area, paragraph area and signature area; S120. Perform vectorization processing on the core semantics of the contract document to be processed, and match the vectorization processing result with a preset business type tag library to obtain the business type tag corresponding to the contract document to be processed. The business type tag includes lease contract, order letter, meeting minutes and subcontract. The preset business type tag library supports custom addition of new business types and corresponding routing rules.

[0074] To achieve accurate identification of contract documents, the process first involves page segmentation, text block localization, and target area identification to obtain refined layout analysis results. Specifically, page segmentation divides the document page into independent areas according to its physical layout, such as by detecting margins, column lines, or blank areas to distinguish different content blocks. Text block localization further identifies and determines the location and extent of specific text content blocks within these segmented areas. This can be achieved using Optical Character Recognition (OCR) technology to identify text regions and aggregate them based on features such as line spacing and paragraph spacing. Building upon this, target area identification is performed to distinguish regions in the contract document with specific structures and semantics. For example, it identifies table areas containing structured data, paragraph areas carrying the main clauses, and signature areas containing signatory and date information. Accurate identification of these areas provides a structured foundation for subsequent information extraction. For instance, table areas typically contain data organized in rows and columns, paragraph areas carry the main text content and clauses of the contract, and signature areas concentrate key information such as the signatory, date, and seal. By clearly distinguishing these areas, the system can adopt different processing strategies based on the characteristics of different areas. For example, it can perform specialized table structure parsing on table areas, semantic understanding on paragraph areas, and key information extraction on signature areas.

[0075] Subsequently, the core semantics of the contract document to be processed are vectorized. This process converts key textual content (such as titles and core rights and obligations clauses) into numerical representations in a high-dimensional vector space. This process is achieved using advanced natural language processing techniques, such as pre-trained deep learning language models (e.g., BERT, GPT) to generate semantic embedding vectors for the document. These vectors capture the document's deep semantic information and contextual relationships. By vectorizing the core semantics, unstructured textual information can be effectively transformed into a machine-computable and comparable form. The vectorization result is then matched against a pre-defined business type tag library to obtain the corresponding business type tag for the contract document. The matching process is accomplished by calculating the similarity (e.g., cosine similarity) between the document's semantic vector and the representative vectors of each business type tag in the tag library, selecting the tag with the highest similarity as the document's business type. The pre-defined business type tag library contains various common contract types, such as lease agreements, order letters, meeting minutes, and subcontracting contracts, each with its unique semantic features.

[0076] It's worth noting that the preset business type tag library supports custom addition of new business types and corresponding routing rules. This means that when new contract types or business requirements emerge, users can flexibly add new business type tags to the tag library and configure corresponding instruction scheduling routing rules for them. For example, new contract templates or sample documents can be uploaded, and the system updates the tag library by learning from this new data, thereby ensuring that the system can continuously adapt to constantly changing business scenarios and maintain its flexibility and scalability.

[0077] Through the above technical solution, this invention effectively solves the problem of inaccurate identification of business types in contract documents. By performing refined layout segmentation, text block positioning, and target region identification on contract documents, the system can accurately understand the physical structure and key information areas of the document, laying a solid foundation for subsequent semantic analysis. Simultaneously, the core semantics are vectorized and matched with a preset business type tag library, ensuring the accuracy and robustness of document business type classification. In particular, the preset business type tag library supports custom addition of new business types and corresponding routing rules, greatly enhancing the system's flexibility and adaptability, enabling it to cope with the ever-emerging new types of contract documents. This precise and scalable business type identification capability allows the instruction scheduling engine to call and reconstruct the most matching multi-level instruction modules based on highly accurate business type tags, thereby ensuring a more accurate and efficient mapping process from unstructured contract text to structured extraction results, significantly improving the accuracy and automation level of the entire contract information extraction method.

[0078] In one embodiment of the present invention, in step S300, the specific implementation method of injecting the complete multi-level instruction stream into the intelligent processing module, driving the intelligent processing module to follow the constraints of the complete multi-level instruction stream, and completing the mapping from unstructured contract text to structured extraction results includes: S310. Synchronously input the complete multi-level instruction stream and the full text content of the contract document to be processed into the large language model or multimodal large model. S320: Drive the large language model or multimodal large model, follow the constraints of the complete multi-level instruction flow, perform semantic reasoning, business entity identification and contract implicit clause derivation, and output structured extraction results with derivation basis and evidence tracing.

[0079] Specifically, step S310 aims to provide comprehensive input information for subsequent intelligent processing. The complete multi-level instruction flow includes all guiding information, from global business entity mapping and cognitive boundary constraints to the dynamic encapsulation and mounting of extracted elements, and the auditable verification and logical closure of the extraction process. The full text content of the contract document to be processed is the raw, unstructured data source. Synchronous input means that instructions and data are provided to the model within the same processing cycle, ensuring that the model can refer to instructions in real-time and comprehensively when processing data. In practice, the instruction flow and text content can be packaged into a unified input request and sent to the large language model or multimodal large model via an API interface. The instruction flow can be embedded in input prompts in a specific format (such as JSON, XML, or a specific markup language) or provided as an independent context parameter. For multimodal large models, if the contract document contains images (such as stamps or handwritten annotations), the full text content may also include image information, which is converted into a processable format using image recognition technology and input along with the text content.

[0080] Building upon this foundation, step S320 drives the large language model or multimodal large model, adhering to the constraints of a complete multi-level instruction flow, to perform semantic reasoning, business entity identification, and derivation of implicit contract terms. This step is the core processing stage, clarifying the specific implementation method of the intelligent processing module and its key tasks. Choosing a large language model or multimodal large model as the intelligent processing module leverages its powerful natural language understanding, generation, and reasoning capabilities. Adhering to the constraints of the instruction flow means that when the model performs tasks, its behavior and output must conform to the rules, preferences, boundaries, and verification logic defined in the instruction flow. Specifically, semantic reasoning refers to the large language model's ability to deeply understand and infer complex statements and logical relationships in contract text based on its pre-trained knowledge and the context provided by the instruction flow. For example, based on the business rules defined in the instruction flow, it can infer the legal validity or potential risks of a clause. Business entity identification refers to the model's ability to identify various business entities in the contract text, such as company names, personal names, dates, amounts, addresses, and product names. The system meta-instruction layer can provide an entity identification matrix and a company directory database to guide the model in more accurate entity identification and normalized mapping. Implicit contract clause derivation is an advanced capability of large language models. It can deduce clauses or potential obligations not explicitly stated in a contract, based on the contract's context, industry practices, and cognitive boundaries set in the instruction flow. For example, it can deduce potential maintenance responsibilities or renewal priorities based on the type and term of a lease contract. Constraint compliance can be achieved through sophisticated prompt engineering in the instruction flow. For instance, it can explicitly require the model to include specific fields in its output, adhere to specific formats, select values ​​within specific ranges, or resolve conflicts using a weighted matrix. During inference, the model continuously refers to these instructions to ensure its output meets expectations.

[0081] Finally, the output is a structured extraction result with reasoning and evidence tracing. This step emphasizes the quality and credibility of the extraction results. It's not just about outputting structured data, but more importantly, providing how this data was derived—its reasoning process and the evidence in the original text. This is crucial for contract information extraction, as the legal validity of contracts requires all extraction results to be verifiable, facilitating manual review and auditing. In practice, when generating extraction results, the large language model can be instructed to simultaneously output the original text fragments (evidence tracing) upon which it relied for semantic reasoning, entity recognition, or implicit clause derivation, as well as the logical chain of its derivation (reasoning basis). For example, for the extracted "contract amount," the model not only outputs the numerical value but also indicates its location in the original text and briefly explains how it was identified and extracted from the original text. For derived implicit clauses, the model lists the original clauses and business rules upon which its derivation is based. This information can be output along with the structured data as nested JSON fields, XML tags, or specific markup formats.

[0082] The above technical solution synchronously inputs the complete multi-level instruction stream and the full text of the contract document to be processed into a large language model or multimodal large model, driving it to perform semantic reasoning, business entity identification, and derivation of implicit contract terms. This effectively solves the problem that traditional intelligent processing modules struggle to accurately understand deep semantics, deduce implicit terms, and comply with instruction constraints when faced with complex contract texts. The large language model or multimodal large model, with its powerful contextual understanding and reasoning capabilities, can deeply analyze unstructured contract texts, overcoming the limitations of traditional methods in handling complex semantics and implicit information. By using the complete multi-level instruction stream as input, the model is effectively guided, ensuring that its extraction process follows preset business rules and cognitive boundaries, thereby significantly improving the accuracy and completeness of the extraction results, including the identification of implicit terms not explicitly expressed. Simultaneously, the output includes the reasoning basis and evidence tracing, ensuring that each extracted data point has a clear source and reasoning process, greatly enhancing the credibility and auditability of the results, facilitating manual review and compliance checks, and meeting high-standard business requirements.

[0083] In one embodiment of the present invention, step S400, which involves performing format standardization, logical self-verification, and compliance auditing on the structured extraction result to output standardized structured data, includes: S410. Perform data format standardization processing on the structured extraction results to generate standardized structured data in JSON format that meets the requirements of downstream business system integration. S420. For abnormal extraction results that fail the logic verification, the results are automatically fed back to the instruction scheduling engine. After adjusting the instruction weights and atomic unit parameters, the extraction process is re-executed, and the preset instruction library is updated synchronously to form a self-optimizing closed loop.

[0084] Specifically, step S410 aims to transform and encapsulate the structured extraction results output by the intelligent processing module according to a predefined JSON schema. This includes, but is not limited to, unifying fields of different data types (such as dates, amounts, and text) into a JSON-supported format, organizing related data into nested objects or arrays, and ensuring that all field names are consistent with the interface specifications expected by downstream business systems. For example, a date extracted from a contract, such as "October 26, 2023" or "October 26, 2023", will be standardized into the JSON string format "2023-10-26"; an amount, such as "One Million Yuan", will be standardized into the numeric type "1000000.00". Through standardization, it can be ensured that the extraction results can be directly parsed and used by various heterogeneous downstream business systems (such as ERP systems, CRM systems, contract management systems, etc.) without the need for an additional data conversion layer, thereby improving data flow efficiency and system integration.

[0085] Furthermore, this invention proposes to automatically feed back abnormal extraction results that fail logical validation to the instruction scheduling engine. After adjusting the instruction weights and atomic unit parameters, the extraction process is re-executed, and the preset instruction library is updated synchronously, forming a self-optimizing closed loop. Specifically, when the structured extraction results are found to be abnormal after logical self-validation (e.g., by checking whether the contract amount is negative, whether the date range is reasonable, whether key clauses are missing, etc., according to preset business rules), the system does not simply mark the error. Instead, it automatically sends these abnormal results, along with their context information, back to the instruction scheduling engine as feedback signals. The instruction scheduling engine intelligently analyzes and adjusts the instruction weights or atomic unit parameters that caused the abnormality based on the abnormality type and error mode. For example, if the regular expression matching rule of an atomic unit is too broad, leading to mis-extraction, the system may tighten its matching rule; if the weight of an atomic unit is too low, causing its result to be overwritten by other inaccurate results, the system may appropriately increase its weight. After adjustment, the system re-executes the extraction process for the abnormal document or similar documents to verify the adjustment effect. Once verified, these optimized instruction weights and atomic unit parameters will be synchronously saved and updated to the preset instruction library, enabling the entire system to learn from past errors, continuously improve its extraction accuracy and robustness, and achieve continuous self-optimization and iteration.

[0086] The above technical solution firstly standardizes the data format of the extracted structured results, specifically generating standardized JSON-formatted structured data that meets the requirements of downstream business systems. This effectively solves the problem of data format incompatibility between different business systems, ensuring that the extracted results can be seamlessly integrated into subsequent business processes, greatly improving data utilization efficiency and automation. Secondly, for abnormal extracted results that fail logical validation, this invention innovatively introduces an automatic feedback mechanism, feeding them back to the instruction scheduling engine and intelligently adjusting instruction weights and atomic unit parameters, thereby re-executing the extraction process. More importantly, by synchronously updating the preset instruction library, the system can learn from errors and continuously optimize its extraction strategy, forming a highly efficient self-optimizing closed loop. This not only significantly reduces the need for manual intervention and improves the accuracy and robustness of the extracted results, but also enables the entire contract information extraction system to adapt to constantly changing business rules and contract types, achieving continuous performance improvement and intelligent evolution.

[0087] In summary, the core innovations of the embodiments of the present invention lie in the following points: 1. Architectural innovation to completely solve the problem of instruction bloat: This invention is the first to create a three-level prompt word architecture that is decoupled sequentially: system meta-instruction layer, atomic rule configuration layer, and semantic reasoning audit layer. It achieves complete independence of global constraints, element extraction, and reasoning verification. Modification of rules for a single field does not require adjustment of the overall prompt word, which fundamentally solves the defects of bloated instructions and high coupling in existing technologies.

[0088] 2. Completely eliminate ambiguity in contract subject identification and achieve zero-error business mapping: This invention uses a business entity normalization mapping mechanism based on a pre-built enterprise directory database and the highest-priority system meta-instruction layer entity mapping rules to break through the limitations of contract legal identity. Regardless of whether the target enterprise is in the legal position of Party A or Party B in the contract, it can be accurately mapped to a fixed business role. This achieves accurate normalization mapping of business roles across templates, improves the robustness of role identification, completely solves the problem of data extraction failure caused by subject confusion in existing technologies, and effectively reduces the subject identification error rate.

[0089] 3. The entire process is auditable and traceable, meeting stringent regulatory compliance requirements: This invention enforces a three-step deduction chain through a semantic reasoning audit layer. Each extraction result is accompanied by original evidence and complete deduction logic, completely breaking the black-box extraction mode of existing technologies. The extraction process is auditable, traceable, and verifiable throughout, fully meeting the compliance requirements of highly regulated scenarios such as finance, engineering, and legal affairs. This is a core advantage that no existing technology possesses.

[0090] 4. Extreme generalization capability, significantly reducing the cost of scenario adaptation: Through the dynamic mounting and hot-swappable design of atomic instruction units, this invention only requires the addition of independent instruction atomic units to adapt to new extraction fields and contract templates, completing the adaptation of new scenarios with zero code, greatly shortening the adaptation cycle of new contract types, and significantly reducing the system development and maintenance costs.

[0091] 5. Self-optimizing closed-loop design to continuously improve extraction results: This invention uses an automatic feedback mechanism for abnormal results to automatically adjust instruction weights and atomic unit parameters based on the extraction results and update the instruction library synchronously. The system has continuous self-optimization capabilities, requiring no frequent manual intervention, and the extraction accuracy continues to improve with the accumulation of business data.

[0092] Please see Figure 2 Based on the same inventive concept, and corresponding to the methods of any of the above embodiments, this invention also discloses a contract information extraction device based on multi-level prompt word instructions, comprising: The document feature recognition module is used to acquire the digital signal of the contract document to be processed, perform layout analysis and semantic clustering on the contract document to be processed, and identify the business type tag corresponding to the contract document to be processed. The multi-level instruction scheduling engine module is used to call and reconstruct multi-level instruction modules from a preset instruction library based on the business type label through the instruction scheduling engine, and assemble a complete multi-level instruction stream. The complete multi-level instruction stream is a scenario-specific instruction stream that only carries instruction atomic units that match the business type label, without redundant instruction content. The multi-level instruction module includes a system meta-instruction layer, an atomic rule configuration layer, and a semantic reasoning audit layer, which are decoupled sequentially. The three modules are independent of each other, and the lower-level modules cannot modify the constraint rules of the upper-level modules. The system meta-instruction layer is the highest priority constraint layer globally. The execution logic of the atomic rule configuration layer and the semantic reasoning audit layer must not break through the entity mapping rules and cognitive boundaries set by the system meta-instruction layer. The system meta-instruction layer is used to perform global business entity mapping and cognitive boundary constraints based on the entity recognition matrix and the enterprise directory database. Its execution logic includes: A pre-set entity recognition matrix and enterprise directory database are used. If an entity in the contract document to be processed is detected to match the characteristics of the enterprise directory database, regardless of the entity's position in the original legal relationship, the entity is normalized and mapped to our company's business role, and the remaining entities are mapped to customer business roles. Pre-defined industry terminology preferences, pricing rule priorities, and global value boundaries in the contract field, thus completing the setting of global cognitive boundaries; The atomic rule configuration layer is used to perform dynamic encapsulation and mounting of extracted elements, and the semantic reasoning audit layer is used to perform auditable verification and logical closure of the extraction process. The large model inference execution module is used to inject the complete multi-level instruction stream into the intelligent processing module, drive the intelligent processing module to follow the constraints of the complete multi-level instruction stream, and complete the mapping from unstructured contract text to structured extraction results; The results audit and output module is used to perform format standardization, logical self-verification and compliance audit on the structured extraction results, and output standardized structured data.

[0093] The apparatus described above is used to implement the contract information extraction method based on multi-level prompt words in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.

[0094] like Figure 3 As shown, based on the same inventive concept, corresponding to any of the above embodiments, this embodiment of the invention also discloses a computer device, including a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the computer program, it implements the steps of the above-described contract information extraction method based on multi-level prompt word instructions.

[0095] Specifically, the device includes: a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, memory 1020, input / output interface 1030, and communication interface 1040 are interconnected within the device via the bus 1050.

[0096] The processor 1010 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.

[0097] The memory 1020 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 1020 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program code is stored in the memory 1020 and is called and executed by the processor 1010.

[0098] The input / output interface 1030 is used to connect input / output modules to realize information input and output. Input / output modules can be configured as components within the device or connected externally to the device to provide corresponding functions. Input devices may include keyboards, mice, touchscreens, microphones, various sensors, etc., while output devices may include displays, speakers, vibrators, indicator lights, etc.

[0099] The communication interface 1040 is used to connect the communication module to enable communication and interaction between this device and other devices. The communication module can communicate via wired means (such as USB (Universal Serial Bus), network cable, etc.) or wireless means (such as mobile network, WIFI (Wireless Fidelity), Bluetooth, etc.).

[0100] Bus 1050 includes a pathway for transmitting information between various components of the device, such as processor 1010, memory 1020, input / output interface 1030, and communication interface 1040.

[0101] It should be noted that although the above-described device only shows the processor 1010, memory 1020, input / output interface 1030, communication interface 1040, and bus 1050, in specific implementations, the device may also include other components necessary for normal operation. Furthermore, those skilled in the art will understand that the above-described device may only include the components necessary for implementing the embodiments of this specification, and not necessarily all the components shown in the figures.

[0102] The computer device described in the above embodiments is used to implement the contract information extraction method based on multi-level prompt words in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.

[0103] Based on the same inventive concept, corresponding to any of the above embodiments, this invention also discloses a computer-readable storage medium storing a computer program thereon, which is used to cause a computer to execute the contract information extraction method based on multi-level prompt words as described above.

[0104] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transfer medium that can be used to store information accessible by a computing device.

[0105] The computer program stored in the storage medium of the above embodiments is used to enable the computer to execute the contract information extraction method based on multi-level prompt words as described in any of the above embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.

[0106] The above description is merely a preferred embodiment of the present invention and the technical principles employed. The present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions that can be made by those skilled in the art will not depart from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of the present invention, the scope of which is determined by the scope of the claims.

Claims

1. A method for contract information extraction based on multi-level prompt instruction, characterized in that, include: Acquire the digital signal of the contract document to be processed, perform layout analysis and semantic clustering on the contract document to be processed, and identify the business type tag corresponding to the contract document to be processed; Through the instruction scheduling engine, based on the business type label, multi-level instruction modules are called and reconstructed from the preset instruction library to assemble a complete multi-level instruction stream. The complete multi-level instruction stream is a scenario-specific instruction stream that only carries instruction atomic units that match the business type label, without redundant instruction content. The multi-level instruction module includes a system meta-instruction layer, an atomic rule configuration layer, and a semantic reasoning audit layer, which are decoupled sequentially. The three modules are independent of each other, and the lower-level modules cannot modify the constraint rules of the upper-level modules. The system meta-instruction layer is the highest priority constraint layer globally. The execution logic of the atomic rule configuration layer and the semantic reasoning audit layer must not break through the entity mapping rules and cognitive boundaries set by the system meta-instruction layer. The system meta-instruction layer is used to perform global business entity mapping and cognitive boundary constraints based on the entity recognition matrix and the enterprise directory database. Its execution logic includes: A pre-set entity recognition matrix and enterprise directory database are used. If an entity in the contract document to be processed is detected to match the characteristics of the enterprise directory database, regardless of the entity's position in the original legal relationship, the entity is normalized and mapped to our company's business role, and the remaining entities are mapped to customer business roles. Pre-defined industry terminology preferences, pricing rule priorities, and global value boundaries in the contract field, thus completing the setting of global cognitive boundaries; The atomic rule configuration layer is used to perform dynamic encapsulation and mounting of extracted elements, and the semantic reasoning audit layer is used to perform auditable verification and logical closure of the extraction process. The complete multi-level instruction stream is injected into the intelligent processing module, driving the intelligent processing module to follow the constraints of the complete multi-level instruction stream and complete the mapping from unstructured contract text to structured extraction results; The structured extraction results are subjected to format standardization, logical self-verification, and compliance auditing, and standardized structured data is output.

2. The method of claim 1, wherein, The execution logic of the atomic rule configuration layer includes: Each contract element to be extracted is encapsulated into an independent instruction atomic unit. The instruction atomic unit includes field definition, feature extraction operator, value boundary, and forward and reverse examples. The feature extraction operator is customized for the contract element extraction scenario and includes a set of operators for regular expression matching, semantic similarity matching, and entity type recognition. A preset instruction routing table is used to dynamically retrieve instruction atomic units corresponding to the scenario from the preset instruction library based on the service type tag, and to complete the mounting, while removing instruction atomic units that are not related to the service type tag; wherein, the preset instruction routing table has a preset mapping relationship between each service type tag and instruction atomic unit; A preset weight matrix is ​​configured with priority weights for different instruction atomic units. When semantic conflicts occur in the extraction results of different instruction atomic units, conflict resolution is performed based on the weight matrix. 3.The contract information extraction method based on multi-level prompt word instruction of claim 1, wherein, The execution logic of the semantic reasoning audit layer includes: The intelligent processing module is forced to follow a three-step deduction chain of evidence extraction, semantic calculation, and structured value extraction to complete the extraction of each contract element to be extracted, and simultaneously bind and store the extraction results with the corresponding original evidence and deduction logic one by one; Based on preset contract business rules, cross-field consistency checks and common sense judgments are performed on the extracted results; The system extracts logical deviations based on a pre-defined logical deviation threshold for contract compliance requirements, returns an anomaly flag, and triggers a secondary parsing process.

4. The multi-level prompt instruction based contract information extraction method of claim 1, wherein, The step of performing layout analysis and semantic clustering on the contract document to be processed, and identifying the business type tag corresponding to the contract document to be processed, includes: The contract document to be processed is subjected to page segmentation, text block positioning, and target area identification to obtain page analysis results. The target areas include table areas, paragraph areas, and signature areas. The core semantics of the contract document to be processed are vectorized, and the vectorization result is matched with a preset business type tag library to obtain the business type tag corresponding to the contract document to be processed. The business type tags include lease contracts, order letters, meeting minutes and subcontracting contracts. The preset business type tag library supports custom addition of new business types and corresponding routing rules.

5. The method of claim 1, wherein, The step of injecting the complete multi-level instruction stream into the intelligent processing module, driving the intelligent processing module to follow the constraints of the complete multi-level instruction stream, and completing the mapping from unstructured contract text to structured extraction results includes: The complete multi-level instruction stream and the full text content of the contract document to be processed are synchronously input into the large language model or multimodal large model; Drive the large language model or multimodal large model, follow the constraints of the complete multi-level instruction flow, perform semantic reasoning, business entity identification and contract implicit clause derivation, and output structured extraction results with derivation basis and evidence tracing.

6. The multi-level prompt instruction based contract information extraction method of claim 1, wherein, The process of performing format standardization, logical self-verification, and compliance auditing on the structured extraction results outputs standardized structured data, including: The structured extraction results are subjected to data format standardization processing to generate standardized structured data in JSON format that meets the requirements of downstream business system integration. For abnormal extraction results that fail the logic verification, the results are automatically fed back to the instruction scheduling engine, the instruction weights and atomic unit parameters are adjusted, and the extraction process is re-executed, while the preset instruction library is updated synchronously, forming a self-optimizing closed loop.

7. The multi-level prompt instruction based contract information extraction method of claim 1, wherein, The enterprise directory database contains a set of features including the target enterprise's full name, standardized abbreviation, branch names, and unified social credit code.

8. A contract information extraction apparatus based on a multi-level prompt word instruction, characterized by, include: The document feature recognition module is used to acquire the digital signal of the contract document to be processed, perform layout analysis and semantic clustering on the contract document to be processed, and identify the business type tag corresponding to the contract document to be processed. The multi-level instruction scheduling engine module is used to call and reconstruct multi-level instruction modules from a preset instruction library based on the business type label through the instruction scheduling engine, and assemble a complete multi-level instruction stream. The complete multi-level instruction stream is a scenario-specific instruction stream that only carries instruction atomic units that match the business type label, without redundant instruction content. The multi-level instruction module includes a system meta-instruction layer, an atomic rule configuration layer, and a semantic reasoning audit layer, which are decoupled sequentially. The three modules are independent of each other, and the lower-level modules cannot modify the constraint rules of the upper-level modules. The system meta-instruction layer is the highest priority constraint layer globally. The execution logic of the atomic rule configuration layer and the semantic reasoning audit layer must not break through the entity mapping rules and cognitive boundaries set by the system meta-instruction layer. The system meta-instruction layer is used to perform global business entity mapping and cognitive boundary constraints based on the entity recognition matrix and the enterprise directory database. Its execution logic includes: A pre-set entity recognition matrix and enterprise directory database are used. If an entity in the contract document to be processed is detected to match the characteristics of the enterprise directory database, regardless of the entity's position in the original legal relationship, the entity is normalized and mapped to our company's business role, and the remaining entities are mapped to customer business roles. Pre-defined industry terminology preferences, pricing rule priorities, and global value boundaries in the contract field, thus completing the setting of global cognitive boundaries; The atomic rule configuration layer is used to perform dynamic encapsulation and mounting of extracted elements, and the semantic reasoning audit layer is used to perform auditable verification and logical closure of the extraction process. The large model inference execution module is used to inject the complete multi-level instruction stream into the intelligent processing module, drive the intelligent processing module to follow the constraints of the complete multi-level instruction stream, and complete the mapping from unstructured contract text to structured extraction results; The results audit and output module is used to perform format standardization, logical self-verification and compliance audit on the structured extraction results, and output standardized structured data.

9. A computer readable storage medium having stored thereon a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the contract information extraction method based on multi-level prompt words as described in any one of claims 1 to 7.

10. A computer device comprising a memory, a processor, and a computer program stored on the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the contract information extraction method based on multi-level prompt word instructions as described in any one of claims 1 to 7.