A method for generating audit rules deeply fusing an audit rule system
By constructing a knowledge rule base for the power grid auditing field, and using graph embedding and large language model coding combined with cross-attention and few-sample prompt templates, the problems of insufficient integration of domain knowledge, inaccurate semantic understanding, and inaccurate pattern linking in the power grid auditing field are solved, and efficient natural language parsing and database pattern linking of power grid auditing rules and regulations are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHANDONG UNIV OF FINANCE & ECONOMICS
- Filing Date
- 2026-05-06
- Publication Date
- 2026-07-31
AI Technical Summary
Existing technologies in the field of power grid auditing suffer from problems such as insufficient integration of domain knowledge, low accuracy of semantic understanding, lack of business constraints in the parsing process, and inaccurate schema linking. These issues result in the natural language parsing results of power grid auditing rules and regulations failing to meet compliance requirements and database schema linking conflicts.
By constructing a knowledge rule base in the field of power grid auditing, graph embedding technology and large language model encoding are used to process structured and unstructured knowledge respectively. By combining cross-attention and few-sample prompt templates, deep semantic alignment between natural language queries and power grid auditing knowledge is achieved, and pattern link ambiguity is resolved through a comprehensive scoring mechanism.
It improves the accuracy of semantic understanding in the field of power grid auditing, the parsing results conform to business logic and compliance requirements, the pattern links are accurate and unambiguous, it adapts to the dynamic updates of power grid auditing rules, and reduces maintenance costs.
Smart Images

Figure CN122489641A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the interdisciplinary fields of artificial intelligence, natural language processing, and power grid auditing. More specifically, it relates to a method for generating audit rules that deeply integrates power grid auditing rules and regulations. Background Technology
[0002] Existing Text-to-SQL technologies often employ general-domain semantic understanding models in the natural language parsing stage. For vertical domains like power grid auditing, some technologies simply introduce domain dictionaries for word matching, or embed a small number of domain documents through a basic Retrieval Augmentation (RAG) framework, attempting to combine natural language with domain knowledge. For relevant technical sources, please refer to research on RAG architecture in the general Text-to-SQL domain and literature on general NLP applications in the power auditing field.
[0003] Disadvantages of existing technology: The integration of domain knowledge is not in-depth: the general parsing model lacks in-depth structured integration of the rules and regulations specific to power grid auditing (such as the power grid fund audit specifications, power engineering bidding audit standards, and power grid financial reconciliation rules). It is impossible to achieve an accurate understanding of audit semantics by relying solely on word matching or simple document retrieval, which can easily lead to misunderstandings of terms and semantic deviations.
[0004] Domain knowledge representation is limited: Existing technologies do not differentiate and vectorize the structured and unstructured mixed distribution characteristics of power grid audit knowledge, resulting in domain knowledge being unable to be effectively semantically aligned with natural language queries.
[0005] The parsing process lacks business constraints: The natural language parsing process does not embed the business constraints and threshold standard rules of power grid audit as structured constraints into the parsing stage. The semantic representation after parsing lacks the guidance of audit business logic, which poses a compliance risk for subsequent SQL generation.
[0006] Inaccurate schema linking: When linking the parsed natural language with the power grid audit database schema, relying solely on semantic similarity matching without combining instance characteristics of the power grid audit data for disambiguation easily leads to link conflicts of fields with the same name or similar table names, making it impossible to accurately match relevant schema items in the power grid audit database. Summary of the Invention
[0007] To overcome the shortcomings of existing technologies, this invention provides a method for generating audit rules that deeply integrates power grid audit rules and regulations. This method is applicable to the accurate semantic understanding and domain knowledge fusion processing of natural language queries in power grid audit scenarios. This invention addresses the following problems: (1) To solve the problem that existing natural language parsing methods do not deeply integrate with power grid audit rules and regulations and have low semantic understanding accuracy, and to achieve deep semantic alignment between natural language query and knowledge in the power grid audit field.
[0008] (2) To solve the problem of targeted processing of structured and unstructured knowledge in power grid auditing, a knowledge vector library adapted to the power grid auditing field is constructed by using graph embedding technology for structured knowledge and large language model encoding for unstructured knowledge, thereby realizing the integration of computability and efficient retrieval of domain knowledge.
[0009] (3) To address the problem of the disconnect between the parsing results and the audit business logic during the natural language parsing process of combining power grid audit business rules, the power grid audit rules and regulations are transformed into structured constraints and embedded in the parsing process to ensure that the parsing results meet the power grid audit compliance requirements.
[0010] (4) Solve the ambiguity and conflict of database schema links in the power grid audit scenario, improve the matching accuracy of natural language parsing results and power grid audit database schema items, and ensure accurate location of relevant data tables and fields.
[0011] This invention is achieved through the following technical solution: a method for generating audit rules that deeply integrates power grid audit rules and regulations, specifically including the following steps: Step S1: Construct a knowledge rule base for the power grid audit domain: The rules and regulations related to power grid auditing are divided into two categories: structured knowledge and unstructured knowledge. They are processed separately and a fusion knowledge rule base is constructed. Step S2, Vectorized representation of natural language query for power grid audit: The user-input power grid audit natural language query is segmented into a text sequence, and then transformed into a low-dimensional dense natural language question embedding vector through an embedding layer. A natural language question embedding matrix is then constructed. , in For matrix The The row corresponds to the first Embedding vectors of each word To query the number of words, This is the embedding dimension, which is consistent with the dimensions in the generated power grid audit knowledge rule vector library; Step S3: Enhanced knowledge fusion for power grid auditing based on cross-attention: Embedding natural language problems into a matrix Cross-attention calculation is performed with the power grid audit knowledge rule vector library to achieve deep semantic fusion of domain knowledge and natural language query; Step S4, Enhanced Few-Sample Hints for Power Grid Audits: Design a few-sample prompt template adapted for the power grid auditing field. The template embeds several example pairs of "typical natural language queries and semantic parsing results for power grid auditing". First, these example pairs of text are converted into vector representations through the same embedding layer. Then, the enhanced semantic representation matrix is applied in the sequence dimension. The vector representations of the example pairs are concatenated to form a new enhanced sequence containing context examples, which is then input into subsequent network layers. Step S5, Precise Mode Linking and Disambiguation: By precisely linking the enhanced semantic representation that integrates power grid audit knowledge with the power grid audit database schema, the problems of link ambiguity and conflict can be resolved.
[0012] As a preferred option, step S1 specifically includes the following steps: Step S1-1: Structured Knowledge: Structured knowledge includes the power grid accounting subject mapping table, power grid audit risk indicator thresholds, power grid financial reconciliation relationship templates, and business database schema relationships; these are formalized into triples to construct a knowledge graph for the power grid audit domain; the graph embedding technology TransE is used to learn low-dimensional dense vectors of entities and relationships to generate structural feature vectors; Step S1-2, Unstructured Knowledge: Unstructured knowledge includes power grid regulations and industry inspection standards. A large language model fine-tuned from the power grid audit corpus is used as the encoder. Based on the fine-tuned model, the text is first subjected to deep semantic encoding. At the same time, the model is guided by a designed prompt template to extract key structured elements such as "audit entity", "constraints", and "logical relationships". The encoding results of these elements are fused with the contextual semantic encoding of the original text to generate a semantic feature vector containing key element information. Step S1-3, Knowledge Fusion: Concatenate the structural feature vector and semantic feature vector of each power grid audit knowledge rule. The concatenated vectors can be compressed in dimension by a linear transformation as needed to generate a unified knowledge rule vector, which is then stored in a vector database to form a computable and searchable power grid audit knowledge rule vector library. At the same time, this power grid audit knowledge rule vector library supports iterative optimization based on feedback from power grid audit experts and model confidence assessment to adapt to the dynamic updates of power grid audit rules.
[0013] Furthermore, the triple consists of a head entity, a relation, and a tail entity.
[0014] Furthermore, in steps S1-2, a large language model fine-tuned from the power grid audit corpus is used as the encoder. The fine-tuning process involves constructing a high-quality corpus of domain texts, including power grid regulations and industry inspection standards, and performing supervised fine-tuning of the general-purpose large language model BERT with the goal of tasks including domain terminology recognition, semantic relation extraction, and compliance logic judgment, so that it can capture the semantic features and business logic of the power grid audit domain during the encoding process.
[0015] As a preferred option, step S3 specifically includes the following steps: Step S3-1: Construct the query matrix Key matrix Value matrix Embedding natural language problems into a matrix Mapped to query matrix The knowledge rule vector library for power grid auditing is mapped to a key matrix. Sum matrix ; through a trainable projection matrix Perform a linear transformation on the input; Step S3-2: Calculate attention weights: Calculate the association strength between the natural language query and each power grid audit knowledge rule by scaling the dot product attention, and generate an attention weight matrix. ; Step S3-3, Knowledge Fusion and Normalization: Combine the attention weight matrix with the value matrix Weighted fusion yields a preliminary semantic representation of the fused power grid audit knowledge. Then, through residual connections and layer normalization techniques, while integrating knowledge from the power grid audit domain, the original semantics of natural language queries are preserved, ultimately outputting an enhanced semantic representation matrix that integrates power grid audit knowledge rules. .
[0016] As a preferred option, step S5 specifically includes the following steps: Step S5-1, Schema Vectorization of Power Grid Audit Database: Encode the schema metadata of the power grid audit database into schema item vectors using a large language model. ; Step S5-2, Semantic Similarity Matching: Calculate Enhanced Semantic Representation Each semantic unit With pattern term vector cosine similarity For each pattern item The maximum similarity is taken as the overall semantic similarity. Filter out those with similarity higher than a preset threshold The pattern terms form an initial candidate pattern term set. ; Step S5-3, Instance-level content matching and disambiguation: Sample data from the power grid audit database is used as the basis for disambiguation, and the sampled data values of the fields corresponding to the pattern items are calculated. d Natural Language Query q Content matching degree, quantifying the relevance between pattern items and query intent. ; Step S5-4, Comprehensive scoring and screening: Combining semantic similarity Content matching Introducing a balance coefficient Calculate the overall score for each candidate pattern item: The pattern with the highest overall score is selected to resolve link conflicts, and finally, those patterns with scores higher than the final threshold are filtered out. The pattern terms constitute the candidate pattern term set for the optimized power grid audit database. This provides a precise data source mapping for subsequent query processing.
[0017] Furthermore, the schema metadata in step S5-1 includes table name, field name, primary and foreign key constraints, field comments, and sample data.
[0018] By employing the above technical solutions, this invention has the following beneficial effects compared to existing technologies: Significantly improved semantic understanding accuracy in the field of power grid auditing: Through targeted vectorization processing and cross-attention fusion, deep semantic alignment between power grid auditing rules and regulations and natural language queries has been achieved, solving the problem of insufficient understanding of power grid auditing terminology and business logic by general models, and effectively reducing the deviation rate of semantic parsing.
[0019] The knowledge representation has strong adaptability: In view of the mixed distribution of structured and unstructured knowledge in power grid auditing, graph embedding and large language model encoding are used for targeted processing. The knowledge rule vector generated by the fusion retains the precise logical constraints of structured knowledge and contains the rich contextual semantics of unstructured knowledge, thus adapting to the knowledge characteristics of the power grid auditing field.
[0020] The analysis results conform to the power grid audit business rules: the power grid audit rules and regulations are transformed into structured constraints and embedded in the entire analysis process, combined with the enhancement of few-sample prompts, to ensure that the analysis results are consistent with the business logic and compliance requirements of power grid audit.
[0021] Pattern linking is accurate and unambiguous: Through a comprehensive scoring mechanism that combines semantic similarity and instance content matching, the problem of link conflicts between fields with the same name and similar table names in the power grid audit database is effectively solved. The accuracy of pattern linking is far higher than that of traditional single semantic matching methods.
[0022] Highly scalable and dynamically adaptable: The power grid audit knowledge rule base supports iterative optimization based on expert feedback and model evaluation, enabling it to quickly adapt to updates and adjustments to power grid audit rules and regulations without requiring large-scale model retraining, thus reducing maintenance costs.
[0023] Additional aspects and advantages of the invention will become apparent in the following description or may be learned by practice of the invention. Attached Figure Description
[0024] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, in which: Figure 1 is a framework diagram of the audit rule generation method for deep integration of power grid audit rules and regulations; Figure 2 shows the network structure diagram of knowledge fusion and enhancement for power grid auditing. Figure 3 is a flowchart of the power grid audit database schema linking and disambiguation process. Detailed Implementation
[0025] To better understand the above-mentioned objectives, features, and advantages of the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in these embodiments can be combined with each other.
[0026] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and therefore the scope of protection of the invention is not limited to the specific embodiments disclosed below.
[0027] The following is combined with Figures 1 to 3 The method for generating audit rules for the deeply integrated power grid audit rule system according to an embodiment of the present invention will be described in detail.
[0028] like Figure 1 As shown, this invention proposes a method for generating audit rules that deeply integrates power grid audit rules and regulations, specifically including the following steps: Step S1: Construct a knowledge rule base for the power grid audit domain: The rules and regulations related to power grid auditing are divided into two categories: structured knowledge and unstructured knowledge. These are then processed separately, and a fusion-based knowledge rule base is constructed. The specific steps include: Step S1-1: Structured Knowledge: Structured knowledge includes the power grid accounting subject mapping table, power grid audit risk indicator thresholds, power grid financial reconciliation relationship templates, and business database schema relationships; these are formalized into triples (head entity, relation, tail entity) to construct a knowledge graph for the power grid audit domain; the graph embedding technology TransE is used to learn low-dimensional dense vectors of entities and relations to generate structural feature vectors; Step S1-2, Unstructured Knowledge: Unstructured knowledge includes power grid-related regulations and industry inspection standards. A large language model fine-tuned from the power grid audit corpus is used as the encoder. The fine-tuning process involves constructing a high-quality corpus of a large amount of domain text including power grid-related regulations and industry inspection standards. The general-purpose large language model BERT is then supervised and fine-tuned with the goals of domain terminology recognition, semantic relationship extraction, and compliance logic judgment. This allows it to more accurately capture the semantic features and business logic of the power grid audit domain during the encoding process. Based on the fine-tuned model, deep semantic encoding is first performed on the text. Simultaneously, a designed prompt template guides the model to extract key structured elements such as "audit entity," "constraints," and "logical relationships." The encoding results of these elements are then fused with the contextual semantic encoding of the original text (e.g., vector concatenation or pooling) to generate a semantic feature vector containing key element information. Step S1-3, Knowledge Fusion: Concatenate the structural feature vector and semantic feature vector of each power grid audit knowledge rule. The concatenated vectors can be compressed in dimension by a linear transformation as needed to generate a unified knowledge rule vector, which is then stored in a vector database to form a computable and searchable power grid audit knowledge rule vector library. At the same time, this power grid audit knowledge rule vector library supports iterative optimization based on feedback from power grid audit experts and model confidence assessment to adapt to the dynamic updates of power grid audit rules.
[0029] Step S2, Vectorized representation of natural language query for power grid audit: The user-input power grid audit natural language query is segmented into a text sequence, and then transformed into a low-dimensional dense natural language question embedding vector through an embedding layer. A natural language question embedding matrix is then constructed. , in For matrix The The row corresponds to the first Embedding vectors of each word To query the number of words, This is the embedding dimension, which is consistent with the dimensions in the generated power grid audit knowledge rule vector library; Step S3: Enhanced knowledge fusion for power grid auditing based on cross-attention: like Figure 2 As shown, the natural language problem is embedded in the matrix. Cross-attention calculation is performed with the power grid audit knowledge rule vector library to achieve deep semantic fusion of domain knowledge and natural language queries; specifically, the following steps are included: Step S3-1: Construct the query matrix Key matrix Value matrix Embedding natural language problems into a matrix Mapped to query matrix The knowledge rule vector library for power grid auditing is mapped to a key matrix. Sum matrix To ensure dimensionality matching, a trainable projection matrix is used. The input is linearly transformed (these projection matrices are fine-tuned on the power grid audit corpus to adapt to domain features). Step S3-2: Calculate attention weights: Calculate the association strength between the natural language query and each power grid audit knowledge rule by scaling the dot product attention, and generate an attention weight matrix. A higher weight value indicates a stronger semantic relevance between the knowledge rule and the current query. Step S3-3, Knowledge Fusion and Normalization: Combine the attention weight matrix with the value matrix Weighted fusion yields a preliminary semantic representation of the fused power grid audit knowledge. Then, through residual connections and layer normalization techniques, while integrating knowledge from the power grid audit domain, the original semantics of natural language queries are preserved, avoiding feature distribution shifts. Finally, the enhanced semantic representation matrix integrating power grid audit knowledge rules is output. .
[0030] Step S4, Enhanced Few-Sample Hints for Power Grid Audits: Design a few-sample prompt template adapted for the power grid auditing field. The template embeds several example pairs of "typical natural language queries and semantic parsing results for power grid auditing." To combine the matrix and the template, these example text pairs are first converted into vector representations through the same embedding layer. Then, the enhanced semantic representation matrix is applied along the sequence dimension. The vector representations of the example pairs are concatenated to form a new enhanced sequence containing contextual examples, which is then input into subsequent network layers. This further strengthens the model's ability to resolve fuzzy concepts and technical terms in the field of power grid auditing, ensuring that the model accurately understands the power grid auditing business intent behind natural language queries.
[0031] Step S5, Precise Mode Linking and Disambiguation: like Figure 3As shown, the enhanced semantic representation integrating power grid audit knowledge is precisely linked with the power grid audit database schema to resolve link ambiguity and conflict issues. Specifically, this includes the following steps: Step S5-1: Schema Vectorization of the Power Grid Audit Database: The schema metadata of the power grid audit database, including table names, field names, primary and foreign key constraints, field comments, and sample data, is encoded into schema item vectors using a large language model. ; Step S5-2, Semantic Similarity Matching: Calculate Enhanced Semantic Representation Each semantic unit With pattern term vector cosine similarity For each pattern item The maximum similarity is taken as the overall semantic similarity. Filter out those with similarity higher than a preset threshold The pattern terms form an initial candidate pattern term set. ; Step S5-3, Instance-level content matching and disambiguation: Sample data from the power grid audit database is used as the basis for disambiguation, and the sampled data values of the fields corresponding to the pattern items are calculated. d Natural Language Query q Content matching degree, quantifying the relevance between pattern items and query intent. ; Step S5-4, Comprehensive scoring and screening: Combining semantic similarity Content matching Introducing a balance coefficient Calculate the overall score for each candidate pattern item: The pattern with the highest overall score is selected to resolve link conflicts, and finally, those patterns with scores higher than the final threshold are filtered out. The pattern terms constitute the candidate pattern term set for the optimized power grid audit database. This provides a precise data source mapping for subsequent query processing.
[0032] Specific application example: Analysis of power grid project fund audit query This example combines Figures 1 to 3 The process shown applies this invention to the scenario of "natural language query parsing for power grid project fund auditing," as detailed below: 1. Application Scenario: When a user inputs a natural language query, "Query the names of projects and corresponding construction units for the actual disbursement of funds for power grid projects in East China region in 2024-2025 that exceed 20% of the bid amount", the query needs to be accurately semantically parsed and linked to the relevant tables / fields in the power grid audit database.
[0033] 2. Implementation steps: (1) Knowledge rule base call: retrieve relevant knowledge rule vectors from the power grid audit knowledge rule base, such as “audit threshold for power grid project fund allocation”, “association rules between power grid project bidding and fund allocation table”, and “audit scope of power grid project in East China”.
[0034] (2) Query vectorization: The query statement is segmented and converted into an embedding matrix with a dimension of 768, which is consistent with the dimension of the knowledge rule vector.
[0035] (3) Knowledge fusion: The attention weights of the query and each knowledge rule are obtained through cross-attention calculation. Among them, the rule "funds disbursement exceeds 20% threshold" has the highest weight. After fusion, an enhanced semantic representation is obtained, which clarifies that the core constraints of the query are "actual disbursement amount > winning bid amount × 120%", time range "2024-2025", and geographical range "East China region".
[0036] (4) Enhanced prompts for fewer samples: The typical parsing paradigm of “power grid project overspending query” in the matching template is used to strengthen the semantic intent of “project name and construction unit” as the core search fields.
[0037] (5) Pattern Linking: The enhanced semantic representation was matched with the power grid audit database pattern. The semantic similarity of “Power Grid Engineering Bidding Form” (including the winning bid amount, project name, and construction unit) and “East China Region Fund Allocation Details Form” (including the actual allocation amount and project number) was calculated to be 0.92 and 0.90, respectively. Combined with sample data (such as the value characteristics of the “East China Region” field in the allocation details form) for content matching, the comprehensive scores were 0.91 and 0.89, respectively. Finally, these two tables and their corresponding fields were determined as candidate pattern items, with no link conflicts.
[0038] 3. Implementation Results: The parsing results accurately captured the business constraints and query intent of the power grid audit. The schema links were unambiguous, laying a solid foundation for generating correct SQL queries. The parsing time was ≤0.5 seconds, meeting the needs of real-time queries.
[0039] In the description of this specification, the terms "one embodiment," "some embodiments," "specific embodiment," etc., refer to a specific feature, structure, material, or characteristic described in connection with that embodiment or example, which is included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0040] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for generating audit rules for a deep fusion of grid audit rule regimes, characterized by Specifically, it includes the following steps: Step S1: Construct a knowledge rule base for the power grid audit domain: The rules and regulations related to power grid auditing are divided into two categories: structured knowledge and unstructured knowledge. They are processed separately and a fusion knowledge rule base is constructed. Step S2, Vectorized representation of natural language query for power grid audit: The user input power grid audit natural language query is divided into text sequences, and is converted into a low-dimensional dense natural language problem embedding vector through an embedding layer to construct a natural language problem embedding matrix, , wherein is a matrix of the first row corresponds to the embedding vector of the first word, is the number of query words, is the embedding dimension, which is consistent with the dimension in the generated power grid audit knowledge rule vector library; Step S3: Enhanced knowledge fusion for power grid auditing based on cross-attention: Embedding natural language questions into matrices Cross-attention calculation with grid audit knowledge rule vector library, realizing deep semantic fusion of domain knowledge and natural language query; Step S4, Enhanced Few-Sample Hints for Power Grid Audits: Design a few-sample prompt template adapted for the power grid auditing domain. The template embeds several example pairs of "typical natural language queries and semantic parsing results for power grid auditing". First, these example text pairs are converted into vector representations through the same embedding layer. Then, the enhanced semantic representation matrix is applied in the sequence dimension. The vector representations of the example pairs are concatenated to form a new enhanced sequence containing context examples, which is then input into subsequent network layers. Step S5, Precise Mode Linking and Disambiguation: By precisely linking the enhanced semantic representation that integrates power grid audit knowledge with the power grid audit database schema, the problems of link ambiguity and conflict can be resolved.
2. The audit rule generation method for a deeply integrated power grid audit rule system according to claim 1, characterized in that... Step S1 specifically includes the following steps: Step S1-1: Structured Knowledge: Structured knowledge includes the power grid accounting subject mapping table, power grid audit risk indicator thresholds, power grid financial reconciliation relationship templates, and business database schema relationships; these are formalized into triples to construct a knowledge graph for the power grid audit domain; the graph embedding technology TransE is used to learn low-dimensional dense vectors of entities and relationships to generate structural feature vectors; Step S1-2, Unstructured Knowledge: Unstructured knowledge includes power grid regulations and industry inspection standards. A large language model fine-tuned from the power grid audit corpus is used as the encoder. Based on the fine-tuned model, the text is first subjected to deep semantic encoding. At the same time, the model is guided by a designed prompt template to extract key structured elements such as "audit entity", "constraints", and "logical relationships". The encoding results of these elements are fused with the contextual semantic encoding of the original text to generate a semantic feature vector containing key element information. Step S1-3, Knowledge Fusion: Concatenate the structural feature vector and semantic feature vector of each power grid audit knowledge rule. The concatenated vectors can be compressed in dimension by a linear transformation as needed to generate a unified knowledge rule vector, which is then stored in a vector database to form a computable and searchable power grid audit knowledge rule vector library. At the same time, this power grid audit knowledge rule vector library supports iterative optimization based on feedback from power grid audit experts and model confidence assessment to adapt to the dynamic updates of power grid audit rules.
3. The audit rule generation method for a deeply integrated power grid audit rule system according to claim 2, characterized in that... The triple consists of a head entity, a relation, and a tail entity.
4. The audit rule generation method for a deeply integrated power grid audit rule system according to claim 2, characterized in that... In steps S1-2, a large language model fine-tuned from the power grid audit corpus is used as the encoder. The fine-tuning process involves constructing a high-quality corpus of domain texts, including power grid regulations and industry inspection standards, and performing supervised fine-tuning of the general large language model BERT with the goal of tasks including domain terminology recognition, semantic relation extraction, and compliance logic judgment, so that it can capture the semantic features and business logic of the power grid audit domain during the encoding process.
5. The audit rule generation method for a deeply integrated power grid audit rule system according to claim 1, characterized in that... Step S3 specifically includes the following steps: Step S3-1: Construct the query matrix Key matrix Value matrix Embedding natural language problems into a matrix Mapped to query matrix The knowledge rule vector library for power grid auditing is mapped to a key matrix. Sum matrix ; through a trainable projection matrix Perform a linear transformation on the input; Step S3-2: Calculate attention weights: Calculate the association strength between the natural language query and each power grid audit knowledge rule by scaling the dot product attention, and generate an attention weight matrix. ; Step S3-3, Knowledge Fusion and Normalization: Combine the attention weight matrix with the value matrix Weighted fusion yields a preliminary semantic representation of the fused power grid audit knowledge. Then, through residual connections and layer normalization techniques, while integrating knowledge from the power grid audit domain, the original semantics of natural language queries are preserved, ultimately outputting an enhanced semantic representation matrix that integrates power grid audit knowledge rules. .
6. The audit rule generation method for a deeply integrated power grid audit rule system according to claim 1, characterized in that... Step S5 specifically includes the following steps: Step S5-1, Schema Vectorization of Power Grid Audit Database: Encode the schema metadata of the power grid audit database into schema item vectors using a large language model. ; Step S5-2, Semantic Similarity Matching: Calculate Enhanced Semantic Representation Each semantic unit With pattern term vector cosine similarity For each pattern item The maximum similarity is taken as the overall semantic similarity. Filter out those with similarity higher than a preset threshold The pattern terms form an initial candidate pattern term set. ; Step S5-3, Instance-level content matching and disambiguation: Sample data from the power grid audit database is used as the basis for disambiguation, and the sampled data values of the fields corresponding to the pattern items are calculated. d Natural Language Query q Content matching degree, quantifying the relevance between pattern items and query intent. ; Step S5-4, Comprehensive scoring and screening: Combining semantic similarity Content matching Introducing a balance coefficient Calculate the overall score for each candidate pattern item: The pattern with the highest overall score is selected to resolve link conflicts, and finally, those patterns with scores higher than the final threshold are filtered out. The pattern terms constitute the candidate pattern term set for the optimized power grid audit database. This provides a precise data source mapping for subsequent query processing.
7. The audit rule generation method for a deeply integrated power grid audit rule system according to claim 6, characterized in that... The schema metadata in step S5-1 includes table name, field name, primary and foreign key constraints, field comments, and sample data.