A knowledge graph-based intelligent review method and system for electricity sales contracts
By leveraging the synergistic effects of multimodal fusion analysis, dual-track hybrid reasoning, and event-driven incremental review, the problems of multimodal information fusion, risk reasoning, and dynamic rule adaptation in the intelligent review of electricity sales contracts have been solved, achieving efficient, accurate, and interpretable automated review results.
Patent Information
- Application Number
- CN202611258397.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-19
- Publication Date
- 2026-11-10
AI Technical Summary
Existing technologies for intelligent review of electricity sales contracts suffer from insufficient multimodal information fusion, a simplistic risk reasoning architecture, a lack of dynamic rule adaptation mechanisms, and insufficient domain specificity, resulting in low review efficiency, poor accuracy, and insufficient interpretability.
The system employs a multimodal contract document parsing module, a dual-track hybrid reasoning module based on multi-relation graph neural network (MR-GNN), and an event-driven automatic rule change review module to achieve multimodal feature extraction and deep fusion of electricity sales contracts. Combined with the parallel architecture of rule engine and graph neural network, it performs risk identification and dynamic rule adaptation.
It enables efficient, accurate, and interpretable automated review of electricity sales contracts, improves the accuracy of entity identification and the comprehensive ability of risk identification, shortens the response time for rule changes, and enhances the domain specificity of the system.
Smart Images

Figure CN123070880A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of electricity market transaction technology, and in particular to a method and system for intelligent review of electricity sales contracts based on knowledge graphs. Background Technology
[0002] With the deepening of power market reform, electricity sales companies, as important participants in the power market, play a crucial role in connecting power generation enterprises and power users. The review of electricity sales contracts is a core link in ensuring the security of power transactions and preventing market risks. Traditional electricity sales contract review relies on manual review by legal experts, which suffers from low efficiency, inconsistent standards, and high professional barriers. In recent years, artificial intelligence technology has been gradually introduced into the field of contract review, but general intelligent contract review methods are difficult to adapt to the professionalism and special characteristics of electricity sales contracts. Electricity sales contracts not only contain traditional legal clauses but also involve professional elements unique to the power market, such as the qualifications of the trading parties, the amount of electricity purchased and sold, the settlement price, deviation assessment, green electricity attributes, liability for breach of contract, and performance period. These elements are distributed across multiple modalities, including text paragraphs, table cells, and seal images, placing high demands on the multimodal information fusion capabilities of intelligent review systems.
[0003] With the rapid development of natural language processing technology, deep learning-based contract review methods have made significant progress. In text representation, pre-trained language models such as BERT and RoBERTa, through large-scale unsupervised pre-training, can capture deep semantic features of contract texts, demonstrating excellent performance in contract named entity recognition and clause classification tasks. In syntactic analysis, dependency parsing techniques can reveal the grammatical dependencies between words in contract clauses, helping to identify complex rights and obligations structures. In knowledge representation, knowledge graph technology explicitly models structured knowledge in contracts through entity-relation-entity triples, supporting complex risk reasoning. In graph representation learning, graph embedding technology maps entities and relations in knowledge graphs to a low-dimensional vector space, enabling reasoning based on graph neural networks. In rule-based reasoning, rule engines such as Drools and SWRL, through forward or backward chain reasoning mechanisms, can perform interpretable risk assessments based on predefined rules.
[0004] In multimodal learning and graph neural networks, the LayoutLM series of models, by fusing textual semantics and document layout information, have demonstrated significant advantages in document understanding tasks, proving the supplementary value of document visual structure information for text understanding. Graph Attention Networks (GAT) assign differentiated weights to different neighbor nodes in the graph through an attention mechanism, achieving flexible aggregation of neighbor information. Relational Graph Convolutional Networks (R-GCN) design relation-specific parameter matrices for multi-relation graphs, effectively handling diverse relation types in knowledge graphs. Hybrid graph attention networks such as HyGAT-LP further combine heterogeneous graph modeling and link prediction capabilities, achieving good results in knowledge graph reasoning tasks.
[0005] While the aforementioned existing technologies have achieved certain results in their respective application scenarios, the following technical shortcomings still exist in the intelligent review task for electricity sales contracts: 1. Insufficient Multimodal Information Fusion. Most existing contract review methods rely on plain text for named entity recognition, ignoring the fact that a large amount of crucial information in electricity sales contracts is distributed within table cells and seal images. Experiments show that the plain text NER method achieves an accuracy rate of only 72.4% for entities related to "deviation assessment" and only 68.9% for entities related to "green electricity attributes," with an average accuracy rate of only 81.7% for the seven core entity categories. Key information such as electricity price structure and electricity volume data in table areas is difficult to extract accurately due to a lack of row and column structure perception, causing the review system to miss important risk factors.
[0006] 2. The risk reasoning architecture is simplistic. Existing methods typically employ a single technical approach at the risk reasoning level: pure rule engines, while possessing good interpretability and clearly explaining the basis for risk judgment, exhibit poor generalization ability when faced with unenumerated variations of contract terms, making it difficult to cover all potential risk patterns; pure graph neural networks, while possessing strong semantic generalization ability and capable of transferring risk knowledge from similar contract structures, have a "black box" nature in their reasoning process, lacking interpretability and failing to meet the transparency requirements of financial compliance scenarios. While both technical approaches have their advantages, they have failed to effectively collaborate, resulting in a difficulty in simultaneously achieving accuracy and interpretability in risk identification.
[0007] 3. Lack of a dynamic rule adaptation mechanism. Electricity market trading rules are constantly being updated and improved, with frequent changes to rules such as deviation assessment standards and green electricity trading details. Currently, the existing rule engine requires manual rewriting of rule scripts and full regression testing after rule changes, typically taking 2-3 days to adapt. This creates a compliance review window, potentially leading to contracts based on repealed rules entering the market and generating compliance risks.
[0008] 4. Insufficient domain specificity. Existing general contract review systems lack a deep understanding of the unique elements of electricity sales contracts. Deviation assessment mechanisms in electricity sales contracts involve complex domain knowledge structures such as permissible deviation ranges, assessment prices, and exemption scenarios. Green electricity attributes involve policy concepts such as green electricity certificates and renewable energy consumption responsibility weights. These domain-specific knowledge structures are not adequately represented in general pre-trained models, limiting the recognition accuracy and risk detection capabilities of the review system.
[0009] In summary, to address the shortcomings of existing technologies, there is an urgent need to propose an intelligent review system for electricity sales contracts that integrates multimodal deep learning, hybrid reasoning architecture, and event-driven rule management, so as to achieve efficient, accurate, and interpretable automated review and risk management of electricity sales contracts. Summary of the Invention
[0010] This invention addresses the technical problems in existing technologies regarding the balance between the interpretability and generalization ability of multimodal information fusion and risk reasoning, as well as the dynamic adaptation of rules, by providing a knowledge graph-based intelligent review method and system for electricity sales contracts.
[0011] The technical solution of the present invention to solve the above-mentioned technical problems is as follows: In a first aspect, the present invention provides an intelligent review system for electricity sales contracts based on knowledge graphs, comprising: The system includes a multimodal contract document parsing module, a dual-track hybrid reasoning module based on a multi-relational graph neural network (MR-GNN), and an event-driven automatic review module for rule changes.
[0012] The multimodal fusion contract document parsing module is used to extract and deeply fuse multimodal features from the input electricity sales contract document, and identify seven core entities in the contract. The processing flow is as follows: Page layout analysis and region segmentation. The input contract document image is analyzed to segment it into text block regions, table regions, and image regions. The image regions include seals and signatures. A two-dimensional position code is generated for each region, recording its relative coordinate position on the page.
[0013] Trimodal parallel feature extraction is performed. For text block regions, a power domain BERT model is used for text semantic feature extraction. This power domain BERT is a domain-adapted model obtained by further pre-training on power market domain corpora based on the general BERT model, which can better understand power market terminology. For the two-dimensional positional information of each region, two-dimensional positional encoding is used for layout feature extraction to capture the spatial structure information of the document. For image regions, a lightweight CNN is used for visual feature extraction to obtain image-level feature representations of seals and signatures.
[0014] Cross-modal attention fusion is performed in the multimodal Transformer layer. Textual semantic features, layout features, and visual features are input into the multimodal Transformer layer, and deep fusion of the three modal features is achieved through a cross-modal attention mechanism. The cross-modal attention mechanism allows feature representations from different modalities to reference each other in attention calculation, enabling text understanding to refer to the layout context and layout analysis to leverage textual semantic information, thereby achieving information complementarity between modalities.
[0015] Furthermore, for the table area, this invention utilizes a row-column attention subnetwork for processing. This subnetwork calculates attention weights in both the row and column directions, models the row-column structural relationships between table cells, and improves the accuracy of extracting numerical information such as electricity price and electricity consumption within the table.
[0016] Finally, the multimodal fusion contract document parsing module outputs seven core entities, including: transaction entity, electricity purchase and sale volume, settlement price, deviation assessment, green electricity attribute, liability for breach of contract, performance period, and their corresponding attribute information and confidence scores.
[0017] The MR-GNN-based dual-track hybrid reasoning module is used for risk identification reasoning on the contract knowledge graph, employing a dual-track architecture that combines a rule engine and a graph neural network. The risk identification reasoning includes the following steps: A contract knowledge graph is constructed and integrated. The entities and their relationships output by the multimodal contract document parsing module are merged with a pre-defined knowledge graph of the electricity sales contract domain to construct an instantiated contract knowledge graph. This domain knowledge graph includes knowledge from areas such as electricity market access rules, deviation assessment standards, and green electricity trading policies.
[0018] Within the rules engine framework, SWRL rules are combined with the Drools forward chain inference engine for rule reasoning. Electricity sales contract review rules are organized into five risk categories: entity qualification risk, price settlement risk, deviation assessment risk, performance guarantee risk, and policy compliance risk. Each SWRL rule includes rule premises, rule conclusions, and rule metadata. The rule metadata records the rule's source basis, effective date, and priority information.
[0019] In the GNN semantic reasoning track, MR-GNN is used for graph neural network reasoning. The MR-GNN includes components: a relation-aware graph attention layer, a risk prior embedding layer, and a hierarchy-aware aggregation layer.
[0020] The relation-aware graph attention layer calculates relation-specific attention coefficients for different types of relations in the knowledge graph. For an edge (v, u) of relation type r, its attention coefficient is calculated using the following formula: , in, and Let be the hidden state vectors of nodes v and u, respectively. Let r be the projection matrix of relation r. Let r be the embedding vector of relation r. Let r be the attention parameter vector. This represents a vector concatenation operation. Let v be the set of neighboring nodes; The node update formula is: , in, Let l be the self-connected projection matrix of the l-th layer. This is the activation function.
[0021] The risk prior embedding layer encodes the prior knowledge of the above five types of risks into learnable embedding vectors, which serve as part of the initial node features of the MR-GNN, guiding the graph neural network to focus on risk-related subgraph structures.
[0022] The hierarchical perception aggregation layer is based on the hierarchical depth of nodes in the knowledge graph. Dynamically adjust the number of hops in the aggregation : , in, This represents the maximum aggregation hop count. This mechanism allows entity nodes located in the shallow layers of the graph to aggregate broader neighborhood information, while entity nodes located in the deeper layers of the graph focus on local fine structures.
[0023] Adaptive weighted fusion is performed. The fusion weights of the rule engine track and the GNN semantic inference track are calculated using the following formula: , in, This refers to the rule coverage of the rule engine. The confidence level for GNN orbit prediction. and As learnable parameters, the final risk prediction probability is: , When the rule engine has matching rules, the fusion weights are biased towards the rule engine output to ensure interpretability; when the rule engine has no matching rules, the fusion weights are biased towards the GNN output to enhance generalization ability.
[0024] The event-driven rule change automatic review module is used to automatically trigger incremental reviews of historical contracts when electricity market rules change.
[0025] The rule knowledge graph modeling involves modeling each review rule as a Rule node, the substitution relationship between rules as REPLACES edges, the repeal relationship as SUPERSEDES edges, and the invalidation relationship as INVALIDATES edges, forming a directed acyclic graph of rule evolution.
[0026] Based on the event bus architecture, the event publish-subscribe mechanism includes: when an external rule change event occurs, the rule management service publishes the change event to the event bus, and the rule engine instances that have subscribed to the corresponding risk topic asynchronously receive the event notification and automatically update the rule cache.
[0027] After the rules are changed, the system automatically queries the affected contract nodes in the knowledge graph and only performs incremental reasoning recalculation on the affected contract subgraphs, instead of re-reasoning the entire graph, thus ensuring 100% review coverage while reducing computational overhead.
[0028] Compared with the prior art, the present invention has at least the following beneficial effects: 1. In this invention, a multimodal contract document parsing module employs BERT (for the power industry) to extract semantic features, two-dimensional positional encoding to extract layout features, and a lightweight CNN to extract visual features. These features are then deeply fused through a cross-modal attention mechanism within a multimodal Transformer layer. Specifically, a row and column attention sub-network is introduced for table regions, effectively addressing the technical limitations of pure text methods in handling multimodal information. The cross-modal attention mechanism allows text understanding to reference the layout context and the explicit modeling of table structural relationships by the row and column attention sub-network.
[0029] 2. In this invention, a dual-track hybrid inference module based on MR-GNN is used. The rule engine track provides interpretable rule matching inference, while the GNN semantic inference track provides generalizable graph embedding inference. The two tracks are adaptively weighted and fused to achieve complementary advantages. For scenarios with known rule coverage, the rule engine provides accurate and interpretable inference results. For novel contract structures not covered by rules, MR-GNN transfers risk knowledge from similar graph structures through a relation-aware graph attention layer and a hierarchy-aware aggregation layer, thus compensating for the shortcomings of a single inference architecture.
[0030] 3. In this invention, an event-driven automatic review module for rule changes models review rules as Rule nodes in a rule knowledge graph, and models the evolutionary relationships between rules as REPLACES, SUPERSEDES, and INVALIDATES edges. Combined with the publish-subscribe mechanism of the event bus and the incremental inference strategy, the rule change response time is significantly shortened. The graph-based modeling of rule evolution enables the system to automatically track rule dependencies, the incremental inference strategy avoids the overhead of full recalculation, and the event-driven architecture eliminates the waiting time for manual intervention.
[0031] 4. This invention has been specifically optimized for the seven core entities and five risk types of electricity sales contracts. The BERT in the power field is further pre-trained with power market corpus to adapt to domain terminology. The risk prior embedding layer of MR-GNN encodes the prior knowledge of the five types of risks. The rule engine organizes the review rules according to the five risk categories, enabling the system to have a deep understanding of the unique elements of electricity sales contracts, which is different from general contract review systems. Attached Figure Description
[0032] Figure 1 This is a flowchart illustrating an intelligent review method for electricity sales contracts based on knowledge graphs, according to the present invention. Figure 2 This is a system framework diagram of an intelligent review system for electricity sales contracts based on knowledge graphs, according to the present invention. Figure 3 This is a comparison chart of the entity recognition accuracy of multimodal fusion and plain text methods according to embodiments of the present invention; Figure 4 This is a comparison chart of the risk identification performance of five types of different inference architectures in an embodiment of the present invention. Figure 5 This is a graph showing the performance trend of the rule engine as the size of the rule base changes, according to an embodiment of the present invention. Detailed Implementation
[0033] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0034] In the description of this invention, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the stated features. In the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.
[0035] In the description of this invention, the term "for example" is used to mean "used as an example, illustration, or description." Any embodiment described as "for example" in this invention is not necessarily to be construed as being more preferred or advantageous than other embodiments. The following description is provided to enable any person skilled in the art to make and use the invention. Details are set forth in the following description for purposes of explanation. It should be understood that those skilled in the art will recognize that the invention can be made without using these specific details. In other instances, well-known structures and processes will not be described in detail to avoid obscuring the description of the invention with unnecessary detail. Therefore, the invention is not intended to be limited to the embodiments shown, but is consistent with the broadest scope of the principles and features disclosed herein.
[0036] Example 1 like Figures 1-5 As shown in the example, a provincial power trading center conducted a batch review of 100 annual power purchase and sale contracts (PDF scans). These 100 contracts covered four power source types: coal-fired power, wind power, solar power, and gas-fired power. The contract types included bilateral negotiation, centralized bidding, and public listing.
[0037] A knowledge graph-based intelligent review method for electricity sales contracts includes the following steps: S100 Contract Document Acquisition and Preprocessing The administrator uploads 100 scanned copies of annual power purchase and sale contracts in PDF format via a web interface. Each contract document contains 20 to 50 A4-sized scanned images. The system renders each PDF page by page as a PNG image, records the page index and document number, and forms a batch review task queue.
[0038] S200, Page Layout Analysis and Segmentation For each page of the contract image, the system uses a layout analysis model based on the Detectron2 framework for region segmentation. The page image is input into the Region Proposal Network, and after prediction by the RoI Align layer and the classification head, the page content is segmented into: text block regions, including the main text of the clauses, titles, and annotations; table regions, including electricity and price details, transaction curve tables, and settlement method tables; and image regions, including the signature page, seals, and qualification certificate attachments. Each region is segmented using bounding box coordinates. And region type label representation.
[0039] S300, Trimodal Feature Extraction For each region obtained from the layout analysis, the system extracts three modal features in parallel: Text semantic feature extraction: For text block regions, a pre-trained BERT model in the power industry is used for encoding. This BERT model is further pre-trained on power industry corpora. The OCR-recognized text is input into Power-BERT, and the [CLS] position vector is taken as the semantic feature. .
[0040] Two-dimensional location embedding feature extraction: The bounding boxes of each region are mapped to location embeddings using two-dimensional location encoding. For the center coordinates and width and height Apply sine and cosine encoding respectively: , in, These are the geometric attribute values to be encoded. For embedding dimension indexes, This is the location embedding dimension. The encoded vectors of the four attributes are concatenated to obtain the final location embedding feature. This encoding method preserves the relative spatial relationships between regions, enabling the model to perceive layout information such as "above," "below," and "left."
[0041] Local visual feature extraction: For text block regions and table regions, corresponding image blocks are cropped and input into a lightweight CNN. The lightweight CNN is based on the MobileNetV3-Small backbone network, and the input size is... Channel 3 outputs a visual feature vector after global average pooling. For image regions, utilize higher resolution. Enter details to preserve the seal and signature.
[0042] S400, cross-modal attention deep fusion and entity recognition Cross-modal attention fusion: For three modal features in the same region, a cross-modal attention mechanism is used for deep fusion. First, the three features are mapped to a unified dimension through linear projection. , , in, The projection matrix is learnable. To achieve fusion dimensions, text features are used as queries, and scaled dot product attention is calculated between them and the key-value pairs of location and visual features, respectively. , Fusion is represented as: This mechanism enables text semantics to adaptively supplement auxiliary information from location and visual modality, effectively handling OCR errors and layout misalignment.
[0043] Row and Column Attention Subnetwork: For table regions, a row and column attention subnetwork is introduced based on cross-modal fusion. Cells are organized into sequences by rows and columns, and in-row attention is calculated. and Lenne attention : , The cell is ultimately represented as This mechanism effectively captures the structural dependencies in rows and columns of the table, significantly improving the quality of feature representation in scenarios where electricity price / electricity quantity values are aligned.
[0044] Seven Entity Recognition: Based on multimodal fusion representation, and using Conditional Random Field (CRF) for sequence labeling, the following seven types of contract element entities are identified: (1) Transaction entities, including: enterprise name and unified social credit code; (2) Purchase and sale of electricity, including: annual transaction volume and monthly allocated volume; (3) Settlement electricity price, including: basic electricity price, floating electricity price, and transmission and distribution price; (4) Deviation assessment, including: allowable range, assessment unit price, and conditions for exemption from assessment; (5) Green electricity attributes, including: green certificate number and environmental rights ownership; (6) Liability for breach of contract, including: the percentage of liquidated damages, the maximum amount of compensation, and exemption clauses; (7) Performance period, including: effective date, termination date, and renewal conditions.
[0045] On a test set of 100 contracts, the average F1 score for the seven types of entity recognition reached 0.926, with the F1 score for the transaction entity being 0.981, which is 6.2 percentage points higher than the baseline for the single text modality.
[0046] S500, Contract Knowledge Graph Construction and Rule Knowledge Graph Integration Contract Knowledge Graph Construction: Constructing a contract knowledge graph from the seven types of entities identified by S400. Node attributes include entity value, confidence level, source page number, and region coordinates. Relationships between entities are automatically extracted through page proximity and semantic template matching.
[0047] Power trading rules knowledge graph integration: combining contract knowledge graph with pre-built power trading rules knowledge graph Integration. The rule knowledge graph contains structured rule knowledge such as the "Basic Rules for Medium and Long-Term Electricity Transactions," provincial transaction details, and pricing policies. During integration, entity links are used to match contract parties with the market entity registration database and to align electricity and electricity price terms with standard definitions in the rule base, resulting in an integrated knowledge graph. ,in For the set of aligned edges.
[0048] S600, Rule Engine Track Reasoning The system simultaneously initiates dual-track inference. The first track is the rule engine track, which uses SWRL to describe inference rules and executes them through the Drools forward chain inference engine. The rule base is organized according to a five-zone management framework. (1) Clause integrity area: Check whether all seven types of entities exist; (2) Entity Compliance Zone: Verify the qualifications of the transaction entity; (3) Price Reasonableness Zone: Verify whether the settlement electricity price exceeds the limit; (4) Liability Balance Zone: Assess the symmetry of liability for breach of contract; (5) Rule Consistency Zone: Compare the contract terms with the latest transaction rules.
[0049] The rules engine took 12 seconds to reason about 100 contracts, outputting a list of rule violations and a risk score. .
[0050] S700, GNN semantic reasoning track The second track is the GNN semantic reasoning track, which uses the proposed Multi-Relation Graph Neural Network (MR-GNN) for deep reasoning on the fused knowledge graph. MR-GNN consists of a three-layer structure: First layer: Relational Graph Attention Layer: for fused knowledge graphs Each node in It aggregates information from its neighboring nodes. (Regarding relation types...) , Given the set of all relation types in the graph, the attention coefficient is calculated as follows: , in, They are nodes and his neighbors eigenvectors, For relationship The learnable weight matrix, For relationship Embedded vector, For relationship Attention parameter vector, This represents a vector concatenation operation. For nodes The neighborhood group, The activation function has a negative slope of 0.2.
[0051] The node update formula is: , in, For nodes In the Layer feature representation, and The first Layer relational propagation weights and self-loop weights The activation function is ReLU. This layer uses a relation-aware attention mechanism to enable the model to distinguish the differential contributions of different relation types to risk propagation.
[0052] The second layer: Risk Prior Embedding Layer: This layer introduces a risk prior embedding matrix to address risks such as missing clauses, conflicting parties, abnormal pricing, imbalanced responsibilities, and inconsistent rules in the field of electricity sales contract review. Each risk category corresponds to a learnable prior embedding vector, which serves as the bias term for graph attention computation: ,in For nodes Risk prior embedding of type association, This is the risk bias coefficient. is the cosine similarity function. This layer enables the model to incorporate domain prior knowledge into the graph reasoning process.
[0053] The third layer: Hierarchical-aware Aggregation Layer: Adaptively adjusts the aggregation range based on the node's hierarchical depth within the contract structure. Define the hierarchical-aware aggregation depth function: , in, For maximum aggregation depth, For nodes Depth in the contract structure tree, the contract root node Chapter nodes Clause Node Element Node , This is to round down. The root node and chapter node have a large aggregation range. or It captures the global context; the aggregation range of underlying feature nodes is relatively small. or Preserve local details. The layered MR-GNN propagation yields the final risk perception representation for each node. .
[0054] The risk classification output is calculated through the Softmax layer: , in, To output the weight matrix, For bias vectors, The probability distributions for the five types of risks are shown.
[0055] S800, Adaptive Weighted Fusion An adaptive weighted fusion is performed on the outputs of the dual-track inference. Let the risk score of the rule engine track be... That is, based on the normalization of the number of SWRL rule violations, the risk score of the MR-GNN orbital is obtained by taking the highest risk probability among the contract nodes. Calculate the confidence difference between the two tracks, and then use the Sigmoid function to calculate the fusion weights of the rule engine tracks: , in, and These are confidence level estimates for the outputs of the two orbitals, respectively. The difference sensitivity coefficient, For bias terms, The sigmoid function is used. The orbital weights of the MR-GNN are... .
[0056] The final risk score is: , This mechanism allows the system to dynamically adjust weights based on the reliability of two types of reasoning in the current case: the rule engine has a higher weight when the rules are clearly applicable, and the GNN has a higher weight when complex semantic relationships are involved. Risk scoring is divided into four levels: Low risk Medium risk. High risk, This is extremely high risk.
[0057] S900, Rule Change Detection and Modeling After the initial review of 100 contracts is completed, the system enters rule change monitoring mode via the event bus. When a new electricity pricing policy is released, the rule management module detects the change event through the event bus subscription mechanism. The new rule is modeled as a Rule node. The attributes include: rule_id, version number, effective_date, and abstract.
[0058] S1000, Determination of the Scope of Impact of the Change Based on the relationship type between the old and new rules, create change edges in the rule knowledge graph: (1) REPLACES edge: The new rule partially replaces some clauses of the old rule, creating a REPLACES edge; (2) SUPERSEDES edges: The new rule completely replaces the old rule, creating SUPERSEDES edges; (3) INVALIDATES edge: The new rule abolishes the old rule and creates the INVALIDATES edge.
[0059] Starting from the changed rule node, traverse backwards along the edges REPLACES, SUPERSEDES, and INVALIDATES to determine the set of affected rule nodes. Then, by aligning the contract nodes and rule nodes... Determine the set of contract nodes affected. Finally, the influence is extended to the neighboring nodes of the affected contracts, forming a subgraph of the affected contracts. ,in , .
[0060] S1100, Incremental Reasoning Verification For the affected contract subgraph The system performs incremental inference verification. Specifically, only for... The nodes in the system re-execute the S600 rule engine orbital inference and the S700 MR-GNN orbital inference, while unaffected contracts retain their original review conclusions. Because the affected subgraph is much smaller than the entire graph, incremental inference takes only 28% of the time required for a full re-review. For contracts where the risk level changes after review, the system automatically generates a review report and pushes it to the legal review personnel at the transaction center.
[0061] S1200, Review Result Output The system outputs the review results as a structured report, including: (1) Basic contract information and risk level labels; (2) Entity extraction results and source location; (3) Details of rule engine violations; (4) Attention heatmap of MR-GNN; (5) Risk tracing path; (6) Rule changes affect status markers.
[0062] This embodiment achieves high precision, high efficiency, and high maintainability in electricity sales contract review through the synergistic effect of multimodal fusion analysis, dual-track hybrid reasoning, and event-driven incremental review.
[0063] Example 2 This example uses an annual electricity purchase and sale contract submitted by an electricity sales company as the processing object, which consists of 15 pages. Pages 3-5 are the electricity price table and electricity bill settlement table, with tables as the main content. Pages 6-8 are the deviation assessment clauses, which are a mixture of text and tables. Pages 9-10 are the green electricity attribute description, with text and certificate images as the main content.
[0064] A knowledge graph-based intelligent review method for electricity sales contracts includes the following steps: Step 1: Page Layout Analysis and Area Segmentation The contract document's page-by-page images are input into a CNN-based layout analysis model. This model extracts page feature maps using a ResNet-50 backbone network, generates candidate regions via a region proposal network, and classifies them. In this embodiment, the electricity price table area on pages 3-5 is labeled as a table region, the green electricity certificate scan image on pages 9-10 is labeled as an image region, and the remaining content is labeled as text regions. Region segmentation outputs the type label and bounding box coordinates for each region. The coordinate values are in pixels.
[0065] Step 2: Parallel Feature Extraction of Three Modalities Three feature extraction methods are performed in parallel for each region: (1) Text Features: For the text sequence recognized by OCR, BERT encoding pre-trained in the power industry is used. Let the input text sequence be... Output word embedding vectors: , The 768 represents the text feature dimension. This BERT model underwent domain-adaptive pre-training on 10,000 electricity sales contracts and a corpus of electricity industry data.
[0066] (2) Layout features: Calculate the position embedding vector based on the two-dimensional position of each cell: , in The coordinates of the bounding box center are and The dimensions are width and height, and the coordinates are normalized values relative to the page. 256 represents the layout feature dimension.
[0067] (3) Visual features: Input the region image into a lightweight CNN (MobileNet-V3) and output a visual feature vector: , 512 represents the visual feature dimension.
[0068] Step 3: Multimodal Transformer Layer Fusion The three features are concatenated and input into a multimodal Transformer layer, where deep fusion is achieved through a cross-modal attention mechanism. Taking text features as the query and layout features as the key and value as an example: , , In the formula, The projection matrix is learnable; For text feature vectors; For layout feature vectors; For attention head dimension; This is a scaling factor to prevent the Softmax gradient from vanishing.
[0069] Step 4: Row and Column Attention Subnetwork For the table area, a row and column attention subnetwork is introduced to perform self-attention calculations in the row and column directions, respectively.
[0070] Directional attention: , Column-oriented attention: , In the formula, This is the projection matrix along the row direction; This is the projection matrix along the column direction. The final output is the concatenation of the two matrices: , and These represent the number of rows and columns in the table, respectively.
[0071] Electricity Price Table Analysis (Pages 3-5) Page 3 contains a table of electricity prices for peak, valley, and flat periods, with a 7-row, 5-column structure: the first row is the table header, rows 2-4 are the electricity prices for peak, flat, and valley periods, respectively, and rows 5-7 are the total of government funds and surcharges, transmission and distribution prices, and electricity prices per unit.
[0072] Page layout analysis outputs the table's bounding box. OCR identified "peak hour electricity price" in the first column of the second row and "0.85" in the third column of the second row. Text feature extraction input "peak hour electricity price" into a power-related BERT, outputting word embeddings. The semantic representations of terms such as "electricity price" and "time period" are highly correlated with the corresponding nodes in the power knowledge graph. Layout features are based on cell-normalized coordinates. Computational position embedding This encodes the cell's position information in the first column. In visual feature extraction, the visual features of the number "0.85" match the currency amount format.
[0073] In row-column attention calculation, row-direction attention associates the "peak-hour electricity price" in the same row with "0.85", with a weight. The column focuses on a longitudinal comparison of electricity prices from July to September with those from January to June, with weighted averages. The model identified an industry pattern where peak summer electricity prices are higher than those in other months.
[0074] Recognition results: Peak hour electricity price: 0.85 yuan / kWh; Normal hour: 0.55 yuan / kWh; Off-peak hour: 0.25 yuan / kWh; Government funds and surcharges: 0.035 yuan / kWh. The output JSON format includes the following fields: Time period type, Applicable month, Electricity price value, Unit, and Data source page number.
[0075] Analysis of Deviation Assessment Form (Pages 6-8) Page 7 contains a complex nested table with merged cells: the first column of rows 1-2 is merged vertically into "Assessment Cycle", the second and third columns of row 1 are merged horizontally into "Monthly Deviation Assessment", and the fourth and fifth columns of row 1 are merged horizontally into "Annual Deviation Assessment".
[0076] Page layout analysis output bounding box The merged cell detection module outputs a mask. OCR identified "assessment cycle", "±3%", "±5%", and "0.3 yuan / kWh". The semantic distance between the keywords "deviation" and "assessment" in the text features and the "deviation assessment" node in the knowledge graph is 0.12. Layout features provide special handling for merged cells: the normalized height of merged cells with a vertical span of 2 rows is... Larger than a regular cell Visual features identified a pattern of missing boundary lines in merged cells, specifically the absence of horizontal dividing lines within vertically merged cells.
[0077] In the row and column attention, the row direction associates "monthly deviation assessment" with "±3%" and "0.3 yuan / kWh", with weights of 0.91 and 0.88 respectively; the column direction compares monthly deviation with annual deviation vertically, with a weight of 0.82. The model infers that the tolerance for annual deviation is higher than that for monthly deviation.
[0078] Recognition results: Monthly deviation allowable range ±3%, annual deviation ±5%, and the unit price for exceeding the deviation assessment is 0.3 yuan / kWh. A structured description of the merged cells is also output.
[0079] Green electricity attribute identification (pages 9-10) The bottom half of page 9 contains the green electricity description text, and the top half of page 10 contains an embedded GEC certificate scan image.
[0080] The layout analysis labels the certificate image as an image region and outputs bounding boxes. Text features identified terms such as "green electricity certificate," "renewable energy," "wind power," and "green certificate number." The semantic similarity between the BERT encoded vector and the "green electricity" node in the knowledge graph was 0.94. Layout features encoded the relative positional relationship between the certificate image and the "green certificate number" text. Visual features showed high activation values in the certificate border, national emblem pattern, and QR code area, recognizing the style of the official green electricity certificate.
[0081] In cross-modal attention fusion, the attention weights of the text "green electricity transaction volume" and the transaction volume region in the certificate image. This enables cross-modal alignment between textual descriptions and visual evidence.
[0082] Identification results: The green electricity transaction volume is 5 million kWh, the green certificate number is GEC-2024-XXXXX, the green electricity type is wind power, and the renewable energy attribute is true. The confidence level for transaction volume identification is 0.93, and the confidence level for certificate authenticity determination is 0.96.
[0083] The results of the comparative experiment on a dataset of 2000 electricity sales contracts are as follows: Experiments show that this method improves performance by 19.7% and 22.6% compared to pure text methods in deviation assessment and green electricity attribute recognition, respectively. This improvement is mainly attributed to: layout features enabling the model to accurately identify merged cells and table structures; visual features supporting certificate authenticity verification and digital format recognition; and cross-modal attention achieving deep alignment between text semantics and visual evidence. The table cell recognition accuracy reaches 96.3%, meeting the requirements for engineering applications.
[0084] It should be noted that the descriptions of each embodiment in the above embodiments have different focuses. For parts that are not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0085] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0086] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0087] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0088] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0089] Although preferred embodiments of the invention have been described, those skilled in the art, once they have learned the basic inventive concept, can make other changes and modifications to these embodiments.
[0090] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of this invention and its equivalents, this invention also intends to include these modifications and variations.
Claims
1. A knowledge graph-based intelligent review method for electricity sales contracts, characterized in that, Includes the following steps: S1. Obtain the electricity sales contract document to be reviewed, and perform layout analysis to divide it into text block areas, table areas, and image areas; S2. Extract the text semantic features of the text block region, the two-dimensional position embedding features of the table region and the image region, and the local visual features of the image region, respectively. S3. Deeply fuse the features described in S2 through a cross-modal attention mechanism to obtain a multimodal fusion representation; S4. Based on the multimodal fusion representation, perform entity recognition, extract contract element entities and construct a contract knowledge graph, and fuse the pre-constructed power trading rule knowledge graph; S5. A dual-track hybrid reasoning architecture is used for risk reasoning: the rule engine track is based on SWRL rule forward chain reasoning to obtain rule risk scores, and the GNN semantic reasoning track is based on multi-relation graph neural network to perform semantic risk pattern recognition to obtain semantic risk scores. The fusion weights are adaptively calculated based on the difference between the rule engine coverage and the GNN confidence, and the final risk score is obtained by weighted fusion. S6. When the power trading rules change, the changed rules are modeled as rule nodes in a knowledge graph. Rule change events are published through the event bus. The affected contract subgraphs are determined based on the replacement, substitution, and repeal relationships between the rule nodes. Incremental reasoning is performed on the affected contract subgraphs for review, and the review results are output.
2. The intelligent review method for electricity sales contracts based on knowledge graphs according to claim 1, characterized in that, The extraction of text semantic features from the text block region, two-dimensional position embedding features from the table region and image region, and local visual features from the image region are specifically as follows: The semantic features of the text are extracted using a pre-trained BERT model in the power industry. The two-dimensional location embedding feature is extracted using two-dimensional location encoding; The local visual features were extracted using a lightweight CNN.
3. The intelligent review method for electricity sales contracts based on knowledge graphs according to claim 2, characterized in that, For the table region, feature extraction is performed using a row and column attention sub-network, specifically as follows: Attention is calculated separately for the row and column directions of the table. The row-direction attention output and the column-direction attention output are cascaded and fused. Cell-level entity recognition is then performed based on the cascaded and fused representation.
4. The intelligent review method for electricity sales contracts based on knowledge graphs according to claim 1, characterized in that, The multi-relationship graph neural network has a three-layer structure, including: A relation-aware graph attention layer is used to calculate attention coefficients based on relation types. These attention coefficients are calculated by a learnable relation weight vector and concatenated features. The risk prior embedding layer is used to embed prior knowledge of risk types into vectors and concatenate them with node features; the hierarchical perception aggregation layer is used to dynamically determine the aggregation hop count based on the distance from the node to the central node.
5. The intelligent review method for electricity sales contracts based on knowledge graphs according to claim 4, characterized in that, The adaptive calculation of fusion weights includes the following steps: The difference between the rule engine coverage and the GNN confidence is calculated, and the difference is multiplied by an adjustable coefficient and a bias is added. The result is then input into the Sigmoid function to obtain the fusion weights.
6. The intelligent review method for electricity sales contracts based on knowledge graphs according to claim 1, characterized in that, The step of modeling change rules as rule nodes in a knowledge graph includes the following steps: Create a Rule type node, which includes a rule identifier, version number, effective time, and content summary attributes; Establish REPLACES, SUPERSEDES, and INVALIDATES edge types between the Rule type nodes, representing replacement, substitution, and obsolescence relationships, respectively.
7. The intelligent review method for electricity sales contracts based on knowledge graphs according to claim 6, characterized in that, The determination of the affected contract subgraph specifically includes: Traverse along the REPLACES, SUPERSEDES, and INVALIDATES edge types to determine the affected contract nodes; Risk reasoning is re-performed only on the affected subgraphs formed by the affected contract nodes, and the re-reasoning results are merged with the original reasoning results of the unaffected areas.
8. The intelligent review method for electricity sales contracts based on knowledge graphs according to claim 1, characterized in that, The contract elements include: transaction parties, electricity volume purchased and sold, settlement price, deviation assessment, green electricity attributes, liability for breach of contract, and performance period; The risk types identified by the risk reasoning include: missing clauses, conflicting parties, abnormal pricing, imbalance of responsibilities, and inconsistent rules.
9. The intelligent review method for electricity sales contracts based on knowledge graphs according to claim 1, characterized in that, The SWRL rules in the rule engine track have a five-zone management structure, including: The rules are divided into sections on completeness of terms, compliance of entities, reasonable pricing, balance of responsibilities, and consistency of rules.
10. A knowledge graph-based intelligent review system for electricity sales contracts, characterized in that, Includes the following modules: The document acquisition module is used to acquire the electricity sales contract documents to be reviewed; The layout analysis module is used to perform layout analysis on the contract document, dividing it into text block areas, table areas, and image areas. The feature extraction module is used to extract the text semantic features of the text block region, the two-dimensional position embedding features of the table region and the image region, and the local visual features of the image region, respectively. The cross-modal fusion module is used to deeply fuse the text semantic features, two-dimensional position embedding features, and local visual features through a cross-modal attention mechanism to obtain a multimodal fusion representation; The entity recognition module is used to perform entity recognition based on the multimodal fusion representation and extract contract element entities; The graph construction module is used to construct the identified contract element entities into a contract knowledge graph and integrate it with a pre-built power trading rule knowledge graph. The dual-track reasoning module is used to perform risk reasoning using a dual-track hybrid reasoning architecture, which includes a rule engine track and a GNN semantic reasoning track: the rule engine track performs forward chain reasoning based on SWRL rules to obtain rule risk scores, and the GNN semantic reasoning track performs semantic-level risk pattern recognition based on a multi-relation graph neural network to obtain semantic risk scores. The adaptive fusion module is used to adaptively calculate the fusion weights based on the difference between the rule engine coverage and the GNN confidence, and then weight and fuse the rule risk score and the semantic risk score to obtain the final risk score. The rule change module is used to model the changed rules as rule nodes in a knowledge graph when power trading rules change, and publish rule change events through the event bus. The impact analysis module is used to determine the affected contract subgraphs based on the replacement, substitution, and repeal relationships between the rule nodes. The incremental review module is used to perform incremental reasoning review on the affected contract subgraphs and output the review results.
