Power data security policy large model question-answering system and method based on relation pooling
Through the big-model Q&A system of power data security policy based on relationship pooling, the problems of inefficiency and compliance risks of power data security management systems in the existing technology are solved, efficient policy query and dynamic updates are achieved, and decision-making transparency and user trust are enhanced.
Patent Information
- Application Number
- CN202411784537.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-06
- Publication Date
- 2025-03-18
AI Technical Summary
The existing power data security management system relies on manual queries and simple keyword searches, which are inefficient, difficult to handle complex policy queries, and lack dynamic update mechanisms, resulting in compliance risks.
A large-scale question-and-answer system for power data security policy based on relationship pooling is adopted, including a knowledge base for power data security policy, language model, question processing module, answer generation module and user output module. Through structured processing and classification policy documents, combined with large language model and graph neural network technology, intelligent answers to natural language problems and dynamic updates of policy terms are realized.
It greatly improves the efficiency of policy inquiries, reduces management costs, ensures that users always use the latest policy terms, enhances the transparency and interpretability of the decision-making process, and supports intelligent Q&A and multiple rounds of dialogue in complex scenarios.
Smart Images

Figure CN119646160A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of power data security management and intelligent question and answer technology, and specifically relates to a power data security policy large model question and answer system and method based on relationship pooling. Background Art
[0002] The existing systems and tools for power data security management usually rely on manual query and simple keyword search methods. Users need to consult a large number of policy documents on their own, resulting in low query efficiency and easy deviations in policy implementation due to inaccurate understanding. The specific defects are as follows:
[0003] Traditional power data security policy management systems usually require users to manually review policy documents one by one and rely on simple keyword matching technology. This approach cannot quickly respond to complex policy query needs, especially when policy terms are complex and change frequently.
[0004] When generating decisions or recommendations, traditional power data security management systems are usually based only on simple keyword matching and rule judgment, lacking a transparent display of the decision-making process. This approach cannot clearly explain the basis and logic of the decision to users, especially in complex policy scenarios, which can easily lead to users lacking trust in the system's recommended results, affecting the credibility and compliance of the decision.
[0005] The existing system lacks the ability to handle complex questions and cannot directly respond to users' natural language queries through intelligent question-answering. Users need to rely on precise keyword matching during the query process and it is difficult to get accurate answers through fuzzy queries, especially when users are not familiar with policy terms, which can easily lead to misunderstandings.
[0006] Because the existing system relies on manual policy query and interpretation, enterprises or organizations need to invest a lot of manpower to review policies and ensure compliance, which increases management costs in long-term operations.
[0007] Power data security policies are frequently updated, and most existing policy management systems do not have a dynamic update mechanism, making it impossible to obtain the latest policy terms in a timely manner. This causes users to use old versions of policies to perform work, which may lead to compliance risks.
[0008] Although there are some policy query tools based on keyword search, these tools have a narrow scope of use and simple functions, which cannot meet the needs of real-time and intelligent policy interpretation in modern power data security management. Therefore, the existing technology requires a solution based on intelligent technology to improve the efficiency of policy query, reduce management costs, and ensure that users always use the latest policy terms. Summary of the invention
[0009] The purpose of the present invention is to overcome the shortcomings of the prior art and to provide a large-scale question-answering system and method for power data security policy based on relationship pooling, so as to improve the efficiency of policy query, reduce management costs, and ensure that users always use the latest policy terms.
[0010] The object of the present invention is achieved as follows: a large-model question-answering system for power data security policy based on relationship pooling includes a power data security policy knowledge base, a language model, a question processing module, an answer generation module, and a user output module;
[0011] The data of the power data security policy knowledge base comes from the power data security policy documents, which are stored in the power data security policy knowledge base after structured processing and classification;
[0012] The language model is used to parse natural language questions and convert natural language questions into structured queries for knowledge base retrieval;
[0013] The question processing module converts the structured query request into a semantic vector, and searches the knowledge base to retrieve policy clauses related to the natural language question as search results;
[0014] The answer generation module generates a final answer based on the natural language question and the search results of the knowledge base;
[0015] The user output module returns the generated answer to the user as a solution to the natural language question.
[0016] The power data security policy large model question-answering method based on relationship pooling, using the power data security policy large model question-answering system based on relationship pooling, includes the following steps:
[0017] S1. After structured processing and classification of policy documents, they are stored in the power data security policy knowledge base;
[0018] S2. Construct a fine-tuning dataset, including questions related to power data security and their standard answers; use the constructed fine-tuning dataset to further train the pre-trained large language model;
[0019] S3, after receiving the user's question, the question processing module processes the query request by coordinating the language model and the knowledge base, and finally provides relevant policy terms and information support to the answer generation module;
[0020] S4, the answer generation module is responsible for generating the final policy answer based on the retrieval results and natural language questions provided by the question processing module;
[0021] S5. After the answer is generated, the system returns the generated answer to the user through the user output module as a solution to the natural language question; through the explainability report, the system shows the user in detail the decision basis for the answer, including the policy terms used, relevant business rules and explanations.
[0022] Furthermore, the step S1 includes:
[0023] S11, obtaining initial text data of the policy document;
[0024] The original policy file is T, that is, T = {t1, t2, …, t n}, where t i Represents each word in the policy document. The policy document data obtained at this time can be raw text data in formats such as PDF and HTML;
[0025] S12. Automatically extract key policy clauses from the acquired policy documents, convert them into a structured data format, and store them in the power data security policy knowledge base for subsequent retrieval and management;
[0026] (1) Text preprocessing: Perform operations such as word segmentation, stop word removal, and sentence segmentation on the original text T to obtain the processed text set T′, that is,
[0027] T'={t1',t2',…,t m ′}, where m≤n
[0028] Among them, t i ′ represents the text units after preprocessing, which serve as the basic units for subsequent analysis;
[0029] (2) Named Entity Recognition
[0030] The BERT model is used to identify key entities in policy texts and extract core terms related to power data security;
[0031] (3) Relationship modeling and subgraph analysis based on graph neural network
[0032] (3.1) Constructing a policy relationship diagram
[0033] The system represents each policy clause as a node in the graph, and the semantic associations between clauses as edges, constructing a policy clause relationship graph G = (V, E), where: V = {v1, v2, ..., v n} is a set of nodes, each node corresponds to a policy clause; is a set of edges, representing the relationship between nodes;
[0034] The weight of the edge w ij Calculated by the following formula:
[0035] w ij = cosine(e i ,e j )
[0036] Where: e i ,e j For clause v i ,v j The embedding vector of ; cosine(·) represents the cosine similarity, which is used to quantify the semantic similarity between terms;
[0037] (3.2) Relationship Pooling
[0038] In the constructed policy relationship graph G, the system uses relationship pooling to aggregate multiple relationships of nodes. The update of each node is expressed as:
[0039]
[0040] Where: R is a set of relationship types; For node v i The set of neighbor nodes on relation r; is the edge weight under relation r; W r is the transformation matrix of relation r; d i , d j For node v i and v j degree; σ(.) is the activation function; relation pooling generates context-aware clause embedding representation by aggregating information of multiple relation types;
[0041] (3.3) Subgraph GNN
[0042] To further extract local relations of specific topics, the system constructs a local subgraph G′=(V′,E′) based on the global relationship graph, where: is a subset of nodes related to the target topic; is the set of edges in V′;
[0043] Within the subgraph, the system performs a convolutional update on the term embeddings:
[0044]
[0045] (4) Classification label generation
[0046] The term embedding representation h generated by subgraph GNN i , the system uses the classifier to generate classification labels for the terms:
[0047] l i =argmax(softmax(Wc h i +b c ))
[0048] Where: W c and b c are the weights and biases of the classifier; l i Category label for the terms;
[0049] (5) Structured Storage
[0050] The processed policy clauses and their embedded representations, classification labels and relationship structures are stored in the power data security policy knowledge base in the form of a graph; the system also records the time dimension information of the clauses to support subsequent historical queries and dynamic updates;
[0051] S13, performing knowledge classification and label optimization on the policy documents stored in the power data security policy knowledge base;
[0052] In the knowledge classification and label optimization phase, the system further analyzes and processes the policy terms stored in the knowledge base to generate more accurate and detailed classification labels and ensure the dynamic adaptability and accuracy of the label system;
[0053] In the knowledge classification and label optimization phase, the system first uses the BERTopic model for topic modeling, extracts the core topics of policy clauses through deep semantic embedding technology, and generates preliminary classification labels;
[0054] Based on the results of topic modeling, the system uses a deep learning model to replace the traditional SVM model to perform multi-label classification of policy terms;
[0055] S14. Create index
[0056] In order to improve the retrieval efficiency, a quick query index is established for the policy terms. Assume that the set of terms is C = {c1, c2, ..., c n}, each clause c i Contains several keywords w, constructs an inverted index I w as follows:
[0057] I w ={c i |w∈c i},w∈Keywords(C)
[0058] Among them, I w represents the inverted index of keyword w, Keywords(C) is the set of keywords appearing in all clauses;
[0059] S15. Dynamic update of knowledge base
[0060] The system automatically monitors the latest content of the policy publishing platform through regular tasks, and detects and captures newly released policy documents;
[0061] After successfully obtaining the latest policy document, the system uses the Python DiffLib library to perform text difference detection and identify changes in the file content;
[0062] S16. Each time a policy is updated, the system will record detailed change information, including update time, modified content, and operating users, to ensure that the evolution process of each policy content is fully preserved; the system uses Git for version management, and executes git commit to record changes each time an update is made. Through the branch management strategy, the old version of the terms is marked as a "historical version", and the new version of the terms is marked as the "latest version", and the changes in the local database are regularly synchronized to the remote version control system to maintain consistency during queries.
[0063] Furthermore, the step S2 includes:
[0064] The composition of the dataset is as follows;
[0065] Common policy issues: By analyzing industry reports, government documents and expert interviews, we sorted out common policy issues in the field of power data security;
[0066] Complex application scenarios: Design complex application scenarios to simulate actual problems;
[0067] Emergency response measures: Organize emergency response plans for emergencies, including developing specific response processes and responsibility allocation;
[0068] Data labeling and cleaning: Manually review and label the collected questions and answers, use data labeling tools to manually label questions and standard answers; use Label Studio and other tools to clean the data;
[0069] The pre-trained large language model is further trained using the constructed fine-tuning dataset. The specific process is as follows:
[0070] Model selection: Select an appropriate pre-trained large language model based on the application scenario;
[0071] Training framework: Use a deep learning framework to load a pre-trained model and prepare for fine-tuning;
[0072] Hyperparameter tuning: Use grid search or random search methods to optimize hyperparameters. Key parameters include:
[0073] Learning rate: The learning rate η controls the step size of gradient descent. Assuming that the optimization target is the loss function L, the process of updating the parameters through gradient descent is:
[0074]
[0075] in, is the gradient of the loss function with respect to the parameter θ;
[0076] Batch size: Choose 16, 32, or 64, and adjust according to memory limitations and model performance; let Xbatch and Ybatch be the input data and labels of the current batch respectively, then the gradient calculation formula for each batch is,
[0077]
[0078] in, represents the gradient of the i-th sample, X i represents the input data of the i-th sample, Y i Represents X i The corresponding label;
[0079] Number of training rounds: usually between 3 and 5 rounds, depending on the performance of the model on the validation set;
[0080] Training monitoring: Use TensorBoard to monitor the training process in real time, observe the changing trends of loss function and accuracy, and adjust the training strategy in time;
[0081] Validation set and overfitting prevention: Divide the data set into training set, validation set and test set. The validation set is used to evaluate model performance, and the test set is used for final evaluation.
[0082] Furthermore, the step S3 includes:
[0083] S31、User Problem Analysis
[0084] The question processing module receives natural language questions input by users and performs preliminary analysis through the language model;
[0085] S32, Intent Recognition and Semantic Vector Conversion
[0086] After question parsing, the question processing module identifies the intent of the user's question and converts it into a semantic vector that can be processed by the machine;
[0087] Intent identification: By using a deep learning-based intent classification model, the model maps the user question Q to an intent category I, i.e.
[0088] I=Intent(Q)
[0089] Where I is the identified intent category;
[0090] Semantic vector conversion: Use word vectors or context-aware models to convert user questions Q into semantic vectors VQ, that is,
[0091] V Q =Embed(Q)
[0092] S33, Knowledge Base Search
[0093] Based on the generated semantic vector, the question processing module initiates a search request in the knowledge base. The system uses the full-text search function of Elasticsearch and combines it with relevance optimization algorithms such as the BM25 algorithm to calculate the similarity between the semantic vector of the user's question and the vectors of each policy clause in the knowledge base.
[0094] Vector similarity calculation: For each term c in the knowledge base i , convert it into a semantic vector Then calculate the problem vector V Q and the term vector The cosine similarity between
[0095]
[0096] in, represents the dot product of vectors, ||V Q || and are the norms of two vectors respectively;
[0097] S34. Search results integration and filtering
[0098] After obtaining the preliminary search results, the question processing module will integrate and filter these results to ensure the accuracy and relevance of the results; this process includes removing duplicate terms, filtering irrelevant information, and sorting the results by relevance to ensure that users obtain the policy terms that best meet their query needs;
[0099] S35. The result is passed to the answer generation module
[0100] Pass the natural language question and optimized search results to the answer generation module so that the answer generation module can generate logical answers based on the user's specific needs;
[0101] In the problem handling module, reverse reinforcement learning is introduced. The system simulates the decision-making process of experts when handling specific problems, analyzes the real intention behind the user's questions, and provides decision recommendations that are more in line with expert logic;
[0102] Further, the step S4 includes:
[0103] S41. Receive search results and natural language questions input by the user
[0104] The answer generation module first receives the retrieval results delivered by the question processing module; these retrieval results contain policy terms related to the natural language questions;
[0105] S42. Answer construction and contextual reasoning
[0106] Based on the received search results, the answer generation module uses a large language model to generate policy answers. The module uses a Seq2Seq architecture to generate answers that meet user needs through context understanding and logical reasoning. The specific generation process is represented by the following steps:
[0107] Sequence modeling: Convert user questions Q and search results R into vector representations and feed them into the Seq2Seq model for processing; let V Q is the semantic vector representation of question Q, VR is the semantic vector set of retrieval result R:
[0108] V Q =Embed(Q),
[0109] Contextual reasoning: The Seq2Seq model generates the answer A through the decoder, where the output A at each time step t It is determined by the hidden state of the previous time step and the input information; assuming that the answer generated by the model is A = {A1, A2, ..., A n}, where Ai is the i-th word generated;
[0110] h t =Decoder(h t-1 ,V Q ,V R ),A t =Softmax(h t )
[0111] Among them, h t is the hidden state of the decoder, A t is the output of the current time step, and the Softmax layer is used to generate the probability distribution of the next word;
[0112] S43. Generate content optimization
[0113] In the process of generating answers, the module uses generation algorithms such as Beam Search, Top-k Sampling or NucleusSampling to improve the accuracy and richness of the answer content. Through these generation algorithms, the module selects the optimal solution from multiple possible answers to ensure that the answer is logically clear and avoids redundant information.
[0114] S44, post-processing and formatting
[0115] The generated answers go through a post-processing step to ensure their professionalism and readability; the module formats the content, removes redundant information, corrects grammatical errors, and fine-tunes them according to the professional presentation style of policy documents;
[0116] S45. Answer output and feedback record
[0117] After the processing is completed, the answer is passed from the answer generation module to the user output module as the final response provided by the system to the user; the module records the user's feedback and the answer generated by the system, and these data will be used for future model fine-tuning and system improvement; at the same time, in the answer generation module, through transparency technology, the system shows the key terms and policy basis of the user's concern when generating answers, thereby improving the explainability of the answer;
[0118] In the process of answer generation, the system uses an attention mechanism to identify and highlight the policy terms that have the greatest impact on the answer; assuming that for a certain term r i , whose influence score is α i , the weighted influence of the clause is calculated through the attention mechanism to obtain the final weighted score α i :
[0119] α i =Attention(Q,r i )
[0120] The system uses visualization tools to display the key terms and rules that are referenced when generating answers.
[0121] Furthermore, the step S5 comprises:
[0122] In the user output module, through the explainability report function, the system shows the decision basis of the answer in detail to the user, including the policy terms used, relevant business rules and explanations, making the source and logic of each answer more transparent and credible;
[0123] Generate detailed reports: The system generates an explainable report that includes the key policy clauses and rule bases in the answer generation process. The report will list the weight of each clause and explain its role in the answer generation process.
[0124] Policy clause reference function: In the explainability report, the system directly provides reference links to policy clauses related to the answer; users can click to view the detailed content of the corresponding clauses and further understand how the system generates answers based on these clauses.
[0125] The beneficial effects of the present invention are as follows:
[0126] Traditional policy query methods rely on manual review or simple keyword matching, which is inefficient. The present invention parses users' natural language queries through a large language model and combines the knowledge base to quickly retrieve relevant policy clauses. It can parse natural language questions raised by users in a relatively short time and automatically match corresponding policy clauses, greatly improving query efficiency and avoiding the tedious process of manual review of documents.
[0127] Enhanced intelligence in policy interpretation: This invention improves the system's ability to understand complex issues in the field of power data security by fine-tuning the large language model. The system can identify professional terms and complex policy scenarios in user input, and provide accurate answers based on the terms in the knowledge base, avoiding the information misunderstanding problem caused by traditional keyword search; the system can perform contextual understanding and intelligent reasoning to generate accurate policy answers, avoiding the inaccurate interpretation problem caused by relying on keyword matching in the prior art.
[0128] Enhance the explainability of the decision-making process: The present invention introduces inverse reinforcement learning and transparency technology, so that the system not only provides results when generating decisions, but also clearly displays the basis and logic of the decision. The system can simulate the decision-making ideas of experts in the field of power data security, and display the key factors and clause references in the decision-making process through visualization, helping users understand the reasons behind the system's recommendations. Compared with the traditional "black box" model, this system can explain the business rules and policy background behind each step of the choice, ensuring that the decision-making process is transparent, compliant and easy to verify, which significantly improves users' trust and compliance with the system's recommendations.
[0129] Reduce management costs: Traditional policy management methods usually require a lot of manual processing, especially frequently updated policy information. The present invention reduces the necessity of manual intervention through automated policy query and dynamic update mechanisms, effectively reduces the labor cost of policy management, and optimizes the enterprise's policy management process.
[0130] Support dynamic updating of policies: The knowledge base of the present invention has a dynamic updating mechanism, which can automatically capture the latest released power data security policies, parse them and update them to the system, ensuring that the policy information obtained by users is always the latest version, avoiding the compliance risks caused by policy lags in the prior art.
[0131] Supporting intelligent question-answering and multi-round dialogue in complex scenarios: The present invention supports complex multi-round dialogue functions through a fine-tuned large language model, and can handle continuous questions raised by users and maintain the consistency and coherence of the dialogue. This function provides a more flexible solution for complex power data security scenarios, allowing the system to maintain efficiency and accuracy in answering complex questions.
[0132] System scalability and stability: The intelligent question-answering system designed by the present invention has high scalability and stability. The system can adapt to the expansion of the knowledge base, support multiple policy file formats, and can flexibly adapt to policy clause queries in different fields. It has good application prospects and large-scale deployment capabilities. BRIEF DESCRIPTION OF THE DRAWINGS
[0133] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0134] Figure 1 This is a structural diagram of the large-scale question-answering system for power data security policy based on relationship pooling.
[0135] Figure 2 The data flow diagram of the large-scale question-answering system for power data security policy based on relationship pooling is shown in the figure. DETAILED DESCRIPTION
[0136] The present invention will be further described below in conjunction with the accompanying drawings.
[0137] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0138] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0139] The power data security policy large model question-answering system based on relationship pooling of the present invention comprises a power data security policy knowledge base, a language model, a question processing module, an answer generation module and a user output module;
[0140] The data of the power data security policy knowledge base comes from the power data security policy documents, which are stored in the power data security policy knowledge base after structured processing and classification;
[0141] The language model is used to parse natural language questions and convert natural language questions into structured queries for knowledge base retrieval;
[0142] The question processing module converts the structured query request into a semantic vector, and searches the knowledge base to retrieve policy clauses related to the natural language question as search results;
[0143] The answer generation module generates a final answer based on the natural language question and the search results of the knowledge base;
[0144] The user output module returns the generated answer to the user as a solution to the natural language question.
[0145] The power data security policy large model question-answering method based on relationship pooling, using the power data security policy large model question-answering system based on relationship pooling, includes the following steps:
[0146] S1. After structured processing and classification of policy documents, they are stored in the power data security policy knowledge base;
[0147] S2. Construct a fine-tuning dataset, including questions related to power data security and their standard answers; use the constructed fine-tuning dataset to further train the pre-trained large language model;
[0148] S3, after receiving the user's question, the question processing module processes the query request by coordinating the language model and the knowledge base, and finally provides relevant policy terms and information support to the answer generation module;
[0149] S4, the answer generation module is responsible for generating the final policy answer based on the retrieval results and natural language questions provided by the question processing module;
[0150] S5. After the answer is generated, the system returns the generated answer to the user through the user output module as a solution to the natural language question; through the explainability report, the system shows the user in detail the decision basis for the answer, including the policy terms used, relevant business rules and explanations.
[0151] Furthermore, the step S1 includes:
[0152] S11, obtaining initial text data of the policy document;
[0153] In the early stage of knowledge base construction, in order to ensure the integrity and accuracy of all power data security policy documents, the system first collects the original text of policy documents from multiple authoritative sources such as government websites, power regulatory departments and related industry associations through automated tools (such as Python crawlers). This process focuses on collecting initial data, that is, filling the knowledge base with content for the first time, ensuring that all existing policy documents are covered, and laying the foundation for subsequent updates and maintenance.
[0154] The original policy file is T, that is, T = {t1, t2, …, tn}, where t i Represents each word in the policy document. The policy document data obtained at this time can be raw text data in formats such as PDF and HTML;
[0155] The system supports multiple file formats, including PDF, Word, and HTML, to ensure that it can process policy documents from different sources. For scanned documents in PDF format, the system uses the Tesseract OCR text recognition tool for optical character recognition (OCR) to convert the scanned content into processable text data to ensure that all policy information can be fully extracted. Through this initial text data acquisition step, the system builds a complete and structured policy document basic data set, providing a reliable data source for subsequent structured processing, label generation, and knowledge base construction.
[0156] S12. Automatically extract key policy clauses from the acquired policy documents, convert them into a structured data format, and store them in the power data security policy knowledge base for subsequent retrieval and management;
[0157] The system extracts key policy clauses from policy documents through an automated method and converts them into a structured data format. This process uses graph neural network (GNN) technology to construct a relationship graph between policy clauses, and further models the complex relationships between clauses through relationship pooling and subgraph GNN to generate an embedded representation with semantic relevance, which is then stored in a structured manner in the power data security policy knowledge base. The specific process includes:
[0158] (6) Text preprocessing: Perform operations such as word segmentation, stop word removal, and sentence segmentation on the original text T to obtain the processed text set T′, that is,
[0159] T'={t1',t2',…,t m ′}, where m≤n
[0160] Among them, t i ′ represents the text units after preprocessing, which serve as the basic units for subsequent analysis;
[0161] (7) Named Entity Recognition (NER)
[0162] The BERT model is used to identify key entities in the policy text and extract core terms related to power data security (such as "sensitive data", "access control", and "data encryption"); these key entities will serve as the basis for building a policy relationship graph.
[0163] (8) Relationship modeling and subgraph analysis based on graph neural network
[0164] In order to capture the relationship between clauses at a deeper level, the system introduces graph neural network (GNN) technology. The specific steps include:
[0165] (3.1) Constructing a policy relationship diagram
[0166] The system represents each policy clause as a node in the graph, and the semantic associations between clauses (such as causal relationships, similarities, or hierarchical relationships) as edges, constructing a policy clause relationship graph G = (V, E), where: V = {v1, v2, ..., v n} is a set of nodes, each node corresponds to a policy clause; is a set of edges, representing the relationship between nodes;
[0167] The weight of the edge w ij Calculated by the following formula:
[0168] w ij = cosine(e i ,e j )
[0169] Where: e i ,e j For clause v i ,v j The embedding vector of (generated by BERT); cosine(·) represents the cosine similarity, which is used to quantify the semantic similarity between terms;
[0170] (3.2) Relational Pooling
[0171] In the constructed policy relationship graph G, the system uses relationship pooling to aggregate multiple relationships of nodes. The update of each node is expressed as:
[0172]
[0173] Where: R is a set of relationship types; For node v i The set of neighbor nodes on relation r; is the edge weight under relation r; W r is the transformation matrix of relation r; d i , d j For node v i and v j degree; σ(.) is the activation function; relation pooling generates context-aware clause embedding representation by aggregating information of multiple relation types;
[0174] (3.3) Subgraph GNN
[0175] To further extract local relations of specific topics, the system constructs a local subgraph G′=(V′,E′) based on the global relationship graph, where: is a subset of nodes related to the target topic; is the set of edges in V′;
[0176] The construction rules of local subgraphs are:
[0177] a. Starting from the central clause node vc, select the k neighbor nodes with the highest relationship weight;
[0178] b. Keep all valid edges related to the topic.
[0179] Within the subgraph, the system performs a convolutional update on the term embeddings:
[0180]
[0181] Through multiple layers of sub-graph convolution, the system is able to capture contextual information that is highly relevant to the target topic in a local range.
[0182] (9) Classification label generation
[0183] The term embedding representation h generated by subgraph GNN i , the system uses the classifier to generate classification labels for the terms:
[0184] l i =argmax(softmax(W c h i +b c ))
[0185] Where: W c and b c are the weights and biases of the classifier; l i Classification labels for terms, such as "data leakage protection", "authority management", "data encryption", etc.
[0186] (10) Structured Storage
[0187] The processed policy clauses and their embedded representations, classification labels and relationship structures are stored in the power data security policy knowledge base in the form of a graph; the system also records the time dimension information of the clauses to support subsequent historical queries and dynamic updates;
[0188] S13, performing knowledge classification and label optimization on the policy documents stored in the power data security policy knowledge base;
[0189] In the knowledge classification and label optimization phase, the system further analyzes and processes the policy terms stored in the knowledge base to generate more accurate and detailed classification labels and ensure the dynamic adaptability and accuracy of the label system;
[0190] In the knowledge classification and label optimization phase, the system first uses the BERTopic model for topic modeling, extracts the core topics of policy clauses through deep semantic embedding technology, and generates preliminary classification labels;
[0191] Based on the results of topic modeling, the system uses deep learning models (such as BERT or multi-layer perceptron) to replace the traditional SVM model to perform multi-label classification of policy clauses. Through model prediction, each clause can generate multiple labels, thereby supporting multi-dimensional classification needs in complex scenarios. For example, the "data leakage protection" clause can simultaneously generate "data encryption" and "user identity authentication" labels, fully reflecting the multiple attributes of the clause.
[0192] In order to ensure the timeliness and applicability of the label system, the system has designed a dynamic label update mechanism that can automatically detect new policy terms or label mismatches, generate candidate labels, and prompt users for confirmation. In addition, the system records historical versions and update information of labels through the version management function to ensure the traceability and stability of the classification system. Users can also make modification suggestions to classification labels through the front-end interface. The system will automatically record these feedbacks and optimize the classification model in combination with incremental learning, gradually improving the classification accuracy and adaptability.
[0193] Finally, the generated tags are stored in the knowledge base in a hierarchical structure, such as "data protection mechanism" as the top-level tag, which includes "data encryption" and "key management" and other detailed tags. The structured storage and linkage between tags and policy clauses support fast retrieval and semantic analysis, further improving the efficiency of policy query and intelligent answering.
[0194] S14. Create index
[0195] In order to improve the retrieval efficiency, a quick query index is established for the policy terms. Assume that the set of terms is C = {c1, c2, ..., c n}, each clause c i Contains several keywords w, constructs an inverted index I w as follows:
[0196] I w ={c i |w∈c i},w∈Keywords(C)
[0197] Among them, I w represents the inverted index of keyword w, Keywords(C) is the set of keywords appearing in all clauses;
[0198] S15. Dynamic update of knowledge base
[0199] The system automatically monitors the latest content of the policy publishing platform through periodic tasks (for example, using Celery or cron scheduling), detects and crawls newly released policy documents; the web crawler module uses the Scrapy framework to set up scheduled tasks to obtain the latest policy documents from power industry-related websites; the crawler processes HTTP requests and responses through middleware, parses HTML content, and uses XPath or CSS selectors to extract target data; at the same time, the system also supports direct communication with the policy publishing platform through the RESTful API interface, using the requests library to send GET requests to obtain the latest policy data, ensuring that policy data is updated in a timely and accurate manner;
[0200] After successfully obtaining the latest policy file, the system uses the Python DiffLib library to perform text difference detection and identify changes in file content; if content updates are detected, the system only updates the changed parts to reduce data processing. If file content updates are detected, the system only processes the changed parts to avoid repeated operations, significantly reducing data processing and computing resource waste. For new or modified policy content, the system processes it according to the following steps:
[0201] Text preprocessing: Perform operations such as word segmentation, stop word removal, and sentence segmentation on the policy text to ensure that the text content is clear and structured.
[0202] Named Entity Recognition (NER): The fine-tuned BERT model is used to extract key terms from policy texts and identify policy clauses, terms, and important entities related to "power data security".
[0203] Structured storage: Convert the extracted policy terms into a structured data format and add them to the knowledge base.
[0204] Through this dynamic update function, the knowledge base can be kept up to date, ensuring that users obtain the latest policy content when they query. This automated update method improves the efficiency of obtaining policy information, ensuring that the knowledge base can reflect policy changes in real time and meet compliance requirements in the field of power data security.
[0205] S16. Each time a policy is updated, the system will record detailed change information, including update time, modified content, and operating users, to ensure that the evolution process of each policy content is fully preserved; the system uses Git for version management, and executes git commit to record changes each time an update is made. Through the branch management strategy, the old version of the terms is marked as a "historical version", and the new version of the terms is marked as the "latest version", and the changes in the local database are regularly synchronized to the remote version control system to maintain consistency during queries.
[0206] At the database level, the system adds a "version" field and a "status" field to each policy clause in MongoDB, automatically increments the version number each time it is updated, and updates the "status" field to the current version status, while historical versions are marked as "historical versions." Users can query the current or historical versions of the policy through the RESTful API interface, which supports multi-condition queries (such as filtering data by version number, release date, etc.), ensuring that users can easily access policy change records and historical clauses during compliance reviews or policy backtracking.
[0207] At the same time, in the knowledge base module, the rule-based reinforcement learning (RBRL) method is used to ensure that the policy information in the knowledge base complies with the data security business rules of the power industry, and to improve the compliance, accuracy and interpretability of knowledge base retrieval. The core of this method is to use business rules to guide the retrieval process, so that the knowledge base can intelligently prioritize the display of policy clauses that comply with the rules and provide users with answers with more business value.
[0208] Rule embedding: In the structured storage of the knowledge base, each policy clause and information node is assigned a specific business rule label. For each policy clause Ti, the system will label it with a rule label Rj based on its content and application scenario. The label set R covers various specifications in power data security management, for example: R = {"data leakage handling", "authority management", "data encryption", "compliance review"}.
[0209] Reward and penalty mechanism: Design a reward and penalty mechanism so that the knowledge base complies with the priority of business rules in the sorting of search results. When the search results of the knowledge base match the business rules embedded in the system, these terms will be rewarded with priority sorting, so that they will be more prominently displayed in the user's query results; while terms that do not comply with business rules or are irrelevant in the current scenario will be punished and their priority will be reduced accordingly. For example, when a user queries "how to deal with data breaches", the knowledge base will prioritize relevant terms based on the tags and rules related to data breach handling to ensure that users get more compliant answers.
[0210] Reward mechanism: When a term Ti in the knowledge base meets the business rules related to the user query (i.e. ), the system adds a reward value r_policy to the score S(Ti) of the term, thereby improving the ranking of the term in the search results:
[0211] S(T i )=S(T i )+r policy
[0212] Penalty mechanism: For terms that are irrelevant to the user's query, if The system imposes a penalty r_penalty on the term, reducing its ranking priority in the search results:
[0213] S(T i )=S(T i )-r penalty
[0214] Rule explanation interface: In order to enhance the transparency and explanation of the system, a rule explanation interface is added. This interface allows users to click to view the business rules behind the search results when querying the knowledge base. Through this interface, users can understand the reasons for recommending each policy clause, ensuring that the returned content not only meets user needs, but also meets the policy requirements of power data security management. Through the rule explanation interface, users can clearly see the business rules, clause labels and priority basis of each search result, thereby increasing their trust in the system.
[0215] Furthermore, the step S2 includes:
[0216] The composition of the dataset is as follows;
[0217] Common policy issues: By analyzing industry reports, government documents and expert interviews, we sorted out common policy issues in the field of power data security;
[0218] Complex application scenarios: Design complex application scenarios to simulate real-world problems, such as response measures to data breaches, role conflicts in permission management, etc. Each scenario should be accompanied by detailed standard answers to ensure that the model can understand specific requirements in complex contexts.
[0219] Emergency response measures: Organize emergency response plans for emergencies, including developing specific response processes and responsibilities; combine actual cases and industry best practices to ensure the effectiveness of emergency measures.
[0220] Data labeling and cleaning: Manually review and label the collected questions and answers, and use data labeling tools (such as Labelbox, Prodigy, or Amazon SageMaker Ground Truth) to manually label questions and standard answers; use tools such as Label Studio to clean the data;
[0221] The pre-trained large language model is further trained using the constructed fine-tuning dataset. The specific process is as follows:
[0222] Model selection: Select a suitable pre-trained large language model according to the application scenario; the model selected in the present invention is BERT or GPT-3.
[0223] Training framework: Use a deep learning framework such as TensorFlow or PyTorch to load a pre-trained model and prepare for fine-tuning; ensure that the training environment configuration meets the model requirements, including the use of GPU or TPU to accelerate the training process. Assume that the loaded pre-trained model is Mpre, its initial parameters are θpre, and the parameter updates during the training process are performed through the optimizer.
[0224] Hyperparameter tuning: Use grid search or random search methods to optimize hyperparameters. Key parameters include:
[0225] Learning rate: The learning rate η controls the step size of the gradient descent. It is usually tested from 1e-5 to 5e-5 to ensure stable convergence of the model. Assuming the optimization target is the loss function L, the process of updating the parameters through gradient descent is,
[0226]
[0227] in, is the gradient of the loss function with respect to the parameter θ;
[0228] Batch size: Choose 16, 32, or 64, and adjust according to memory limitations and model performance; batch size affects the stability of gradient estimation and the convergence speed of training. Let Xbatch and Ybatch be the input data and labels of the current batch respectively, then the gradient calculation formula for each batch is,
[0229]
[0230] in, represents the gradient of the i-th sample, X i represents the input data of the i-th sample, Y i Represents X i The corresponding label;
[0231] Number of training rounds: usually between 3 and 5 rounds, depending on the performance of the model on the validation set;
[0232] Training monitoring: Use TensorBoard to monitor the training process in real time, observe the changing trends of loss function and accuracy, and adjust the training strategy in time;
[0233] Validation set and overfitting prevention: Divide the data set into training set, validation set and test set. The validation set is used to evaluate model performance, and the test set is used for final evaluation. Use early stopping to prevent overfitting. The fine-tuned model can more accurately analyze user questions and provide more targeted answers in combination with subsequent processes.
[0234] Furthermore, the step S3 includes:
[0235] S31、User Problem Analysis
[0236] The question processing module receives the natural language questions input by the user and performs preliminary analysis through the language model; this process includes natural language processing technologies such as word segmentation, part-of-speech tagging, and sentence parsing to identify key terms and core concepts in the user's questions. For example, the module can extract professional terms related to power data security such as "data leakage" and "access control" to ensure that the key information of the problem is captured and provide accurate semantic clues for the subsequent retrieval process.
[0237] S32, Intent Recognition and Semantic Vector Conversion
[0238] After completing the question parsing, the question processing module identifies the intent of the user's question and converts it into a machine-processable semantic vector; with the help of pre-trained Word Embedding technology or Transformer model, natural language questions are converted into high-dimensional semantic vector representations.
[0239] Intent identification: By using a deep learning-based intent classification model, the model maps the user question Q to an intent category I, i.e.
[0240] I=Intent(Q)
[0241] Where I is the identified intent category;
[0242] Semantic vector conversion: Use word vectors or context-aware models (such as BERT) to convert user questions Q into semantic vectors VQ, that is,
[0243] V Q =Embed(Q)
[0244] In this way, the system not only relies on surface matching of keywords, but also captures deep semantic relationships for more accurate content matching in the knowledge base.
[0245] S33, Knowledge Base Search
[0246] Based on the generated semantic vector, the question processing module initiates a search request in the knowledge base. The system uses the full-text search function of Elasticsearch and combines it with relevance optimization algorithms such as the BM25 algorithm to calculate the similarity between the semantic vector of the user's question and the vectors of each policy clause in the knowledge base.
[0247] Vector similarity calculation: For each term c in the knowledge base i , convert it into a semantic vector Then calculate the problem vector V Q and the term vector The cosine similarity between
[0248]
[0249] in, represents the dot product of vectors, ||V Q || and are the norms of two vectors respectively;
[0250] The module can quickly filter out the policy terms that are most relevant to the user's question, ensuring that the returned content meets the user's needs. This step enables the system to efficiently find policy information that matches the query content in the knowledge base and provide users with accurate terms support.
[0251] S34. Search results integration and filtering
[0252] After obtaining the preliminary search results, the question processing module will integrate and filter these results to ensure the accuracy and relevance of the results; this process includes removing duplicate terms, filtering out irrelevant information, and sorting the results by relevance to ensure that users obtain the policy terms that best meet their query requirements; this step improves the system's answer quality and user experience by optimizing the returned results.
[0253] S35. The result is passed to the answer generation module
[0254] The natural language question and optimized search results are passed to the answer generation module so that the answer generation module can generate logical answers based on the user's specific needs; at this point, the work of the question processing module is basically completed, providing the generation module with the required policy terms and semantic clues support to ensure that the generated answers meet the user's needs.
[0255] In the question processing module, Inverse Reinforcement Learning (IRL) is introduced. The system simulates the decision-making process of experts when dealing with specific problems, analyzes the real intention behind the user's questions, and provides decision recommendations that are more in line with expert logic. In this way, the system can not only provide answers when processing user queries, but also show the logical basis behind the decision, making the answers more professional and authoritative.
[0256] Expert behavior learning: First, the system builds a set of sample data by analyzing the expert's historical query behavior. This data contains the policy terms and decision paths selected by experts in different situations. By learning the expert behavior patterns, the system can understand which terms are more in line with business needs in different problem situations, thereby establishing a reference expert behavior model. This model provides guidance for the system when dealing with similar problems, ensuring that the system's answers can reflect the actual operations and thinking logic of industry experts.
[0257] Decision-making priority mechanism: Based on the expert behavior model, the system has built a reward mechanism to prioritize paths that conform to the expert's decision logic. When a user asks a question, the system automatically matches similar scenarios in the expert's behavior and prioritizes policy clauses with higher relevance. This reward mechanism ensures that the system can follow the expert's preferences when answering user questions, especially in complex scenarios that require reliance on experience and judgment. For example, when a user inquires about "data breach response measures," the system will prioritize the terms commonly used by experts in similar scenarios, thereby providing answers with greater business value.
[0258] Expert decision explanation: When recommending terms, the system uses the expert behavior model established by inverse reinforcement learning to display the basis for the recommendation, allowing users to see the similarity between the term and the expert's decision path. By explaining the decision basis for the recommended terms, the system can not only provide results but also explain the logic of the recommendation. For example, the system can display "this term is the preferred choice of experts in similar situations" to help users understand the reasons for the recommended terms, making the system more credible and explanatory when providing answers.
[0259] Further, the step S4 includes:
[0260] S41. Receive search results and natural language questions input by the user
[0261] The answer generation module first receives the retrieval results passed by the question processing module; these retrieval results contain policy terms related to natural language questions; by integrating this information, the answer generation module can better understand the user's intentions and prepare to generate logical and coherent answers.
[0262] S42. Answer construction and contextual reasoning
[0263] Based on the received search results, the answer generation module uses a large language model to generate policy answers. The module adopts a Seq2Seq (sequence to sequence) architecture to generate answers that meet user needs through context understanding and logical reasoning. The specific generation process is represented by the following steps:
[0264] Sequence modeling: Convert user questions Q and search results R into vector representations and feed them into the Seq2Seq model for processing; let V Q is the semantic vector representation of question Q, VR is the semantic vector set of retrieval result R:
[0265] V Q =Embed(Q),
[0266] Contextual reasoning: The Seq2Seq model generates the answer A through the decoder, where the output A at each time step t It is determined by the hidden state of the previous time step and the input information (including the question and related policy terms); assuming that the answer generated by the model is A = {A1, A2, ..., A n}, where Ai is the i-th word generated;
[0267] h t =Decoder(h t-1 ,V Q ,V R ),A t =Softmax(h t )
[0268] Among them, h t is the hidden state of the decoder, A t is the output of the current time step, and the Softmax layer is used to generate the probability distribution of the next word;
[0269] The language model can understand the context of the user's question and reason with the content in the policy terms to ensure that the answer accurately reflects the policy requirements. For example, when a user asks "how to deal with a data breach", the module can integrate relevant terms information and generate an answer that includes steps and precautions.
[0270] S43. Generate content optimization
[0271] In the process of generating answers, the module uses generation algorithms such as Beam Search, Top-k Sampling or NucleusSampling to improve the accuracy and richness of the answer content; through these generation algorithms, the module selects the optimal solution from multiple possible answers to ensure that the answer is logically clear and avoids redundant information; in addition, the module uses the self-attention mechanism to ensure that the answer remains coherent in structure and logic to avoid punctuation or meaningless content.
[0272] S44, post-processing and formatting
[0273] The generated answers undergo a post-processing step to ensure their professionalism and readability; the module formats the content, removes redundant information, corrects grammatical errors, and fine-tunes them according to the professional expression style of the policy document; this process improves the clarity of the answers, making the answers users receive easy to understand in structure and in line with the terminology and language specifications of the power data security policy.
[0274] S45. Answer output and feedback record
[0275] After the processing is completed, the answer is passed from the answer generation module to the user output module as the final response provided by the system to the user; the module records the user's feedback and the answers generated by the system, and these data will be used for future model fine-tuning and system improvement; ensuring that the generated answers continue to improve their accuracy and responsiveness as user needs change.
[0276] At the same time, in the answer generation module, through transparency technology, the system can show users the key terms and policy basis they are concerned about when generating answers, thereby improving the explainability of the answers;
[0277] In the process of answer generation, the system uses an attention mechanism to identify and highlight the policy terms that have the greatest impact on the answer; assuming that for a certain term r i , whose influence score is α i , the weighted influence of the clause is calculated through the attention mechanism to obtain the final weighted score α i :
[0278] α i =Attention(Q,r i )
[0279] The purpose of this is to allow the system to focus on the most critical information when generating answers. For example, when a user asks "data breach response strategy", the system will highlight the policy terms and handling specifications related to data breaches.
[0280] The system uses visualization tools to display the key clauses and rules that were referenced when generating answers; this allows users to intuitively see what information the system "focused on" when answering, and what role this information played in the answer. For example, users can see that specific "Data Protection Regulation" clauses are cited in the answer and understand how these clauses affect the final answer.
[0281] Users can step through the logic of each decision step in the answer generation process. By clicking on a specific term in the answer, the system can show the reasoning behind its selection and explain how it helps answer the user's question. This step-by-step explanation feature helps users understand the system's process of generating answers layer by layer.
[0282] Furthermore, the step S5 comprises:
[0283] In the user output module, through the explainability report function, the system shows the decision basis of the answer in detail to the user, including the policy terms used, relevant business rules and explanations, making the source and logic of each answer more transparent and credible;
[0284] Generate detailed reports: The system generates an explainable report that includes the key policy clauses and rule bases in the answer generation process. The report will list the weight of each clause and explain its role in the answer generation process.
[0285] Policy clause reference function: In the explainability report, the system directly provides reference links to policy clauses related to the answer; users can click to view the details of the corresponding clauses to further understand how the system generates answers based on these clauses. For example, when answering the question "Compliance management of the power market", the system can directly quote specific compliance regulations to ensure that users understand the legality and policy basis of the answer.
[0286] User feedback mechanism: After reviewing the report, users provide feedback on the clarity and accuracy of the report. This feedback is used for subsequent system optimization to ensure that the answers and report content generated in the future are more in line with user needs.
[0287] The power data security policy large model question-answering system based on relationship pooling of the present invention also includes a user interface and a backend:
[0288] User input processing: The system receives natural language questions input by users through the web interface, and uses the Flask framework to build the backend service. The backend passes the user questions to the fine-tuned large language model for parsing and generates corresponding answers. The system interacts with the fine-tuned large language model through the RESTful API and returns intelligent answers to policy terms.
[0289] Front-end design: The front-end uses React or Vue.js to build a user interface to provide a friendly interactive experience. After the user inputs the question, it is processed by the front-end and the back-end API is called through Ajax to get the answer.
[0290] When a user asks a question, such as "How to deal with power data leakage?", the system will first use the large language model to parse the user's natural language question, identify the core theme of "power data leakage", and understand that the user's intention is to understand the policy's handling methods. During the parsing process, the language model converts the user's natural language question into a structured query request to prepare for the subsequent knowledge retrieval.
[0291] Next, the problem handling module receives this structured query request and searches for relevant policy clauses in the knowledge base. The knowledge base stores structured power data security policy information, and the problem handling module efficiently searches for these policy clauses through tools such as Elasticsearch. For example, it may find a policy clause on "data breach response measures" that details the steps that companies need to take when a data breach occurs.
[0292] The answer generation module then combines the retrieved policy terms with the natural language question to generate a complete and accurate answer in natural language. It may answer: "According to the current power data security policy, when a data leak occurs, the data leak emergency plan should be immediately activated, including reporting to the relevant regulatory authorities, taking measures to prevent the spread of the leak, and notifying affected users." This answer is not only based on the specific policy terms in the knowledge base, but also combined with the model's reasoning ability to ensure the logic and coherence of the answer.
[0293] Finally, the generated answers are presented to users through the user output module, ensuring that users can easily understand and obtain the information they need. In this process, the questions raised by users are automated through the collaboration of various modules in the system, from question parsing to policy retrieval to answer generation, so that users can quickly get clear and policy-compliant answers.
[0294] System testing and optimization include internal testing and performance optimization.
[0295] Internal testing: The system has undergone multiple rounds of internal testing, focusing on verifying response time and question-answer accuracy. JMeter is used for performance testing to simulate multiple concurrent user requests and test the system's performance under high load.
[0296] Performance optimization: Gradually optimize system performance based on test results, adjust database indexes, improve API response time, optimize model inference speed, etc., to ensure stable services can be provided in actual applications.
[0297] Through the above embodiments, the present invention shows in detail how to build a power data security policy knowledge base, fine-tune a large language model, and how to combine these technologies to create an intelligent question-answering system. These technical steps can be effectively reproduced and applied to the actual scenario of power data security policy management.
[0298] The above shows and describes the basic principles, main features and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments, and the above embodiments and descriptions are only for explaining the principles of the present invention. Without departing from the spirit and scope of the present invention, the present invention may have various changes and improvements, and these changes and improvements all fall within the scope of the present invention to be protected.
Claims
1. A large-scale question-answering system for power data security policy based on relational pooling, characterized by: It includes power data security policy knowledge base, language model, question processing module, answer generation module and user output module; The data of the power data security policy knowledge base comes from the power data security policy documents, which are stored in the power data security policy knowledge base after structured processing and classification; The language model is used to parse natural language questions and convert natural language questions into structured queries for knowledge base retrieval; The question processing module converts the structured query request into a semantic vector, and searches the knowledge base to retrieve policy clauses related to the natural language question as search results; The answer generation module generates a final answer based on the natural language question and the search results of the knowledge base; The user output module returns the generated answer to the user as a solution to the natural language question.
2. A power data security policy large model question-answering method based on relationship pooling, using the power data security policy large model question-answering system based on relationship pooling as claimed in claim 1, characterized in that: The following steps are involved: S1. After structured processing and classification of policy documents, they are stored in the power data security policy knowledge base; S2. Construct a fine-tuning dataset, including questions related to power data security and their standard answers; use the constructed fine-tuning dataset to further train the pre-trained large language model; S3, after receiving the user's question, the question processing module processes the query request by coordinating the language model and the knowledge base, and finally provides relevant policy terms and information support to the answer generation module; S4, the answer generation module is responsible for generating the final policy answer based on the retrieval results and natural language questions provided by the question processing module; S5. After the answer is generated, the system returns the generated answer to the user through the user output module as a solution to the natural language question; through the explainability report, the system shows the user in detail the decision basis for the answer, including the policy terms used, relevant business rules and explanations.
3. The power data security policy large model question-answering method based on relationship pooling as claimed in claim 2 is characterized in that: The step S1 comprises: S11, obtaining initial text data of the policy document; The original policy file is T, that is, T = {t1, t2, …, t n }, where t i Represents each word in the policy document. The policy document data obtained at this time can be raw text data in formats such as PDF and HTML; S12. Automatically extract key policy clauses from the acquired policy documents, convert them into a structured data format, and store them in the power data security policy knowledge base for subsequent retrieval and management; (1) Text preprocessing: Perform operations such as word segmentation, stop word removal, and sentence segmentation on the original text T to obtain the processed text set T′, that is, T'={t1',t2',…,t m ′}, where m≤n Among them, t i ′ represents the text units after preprocessing, which serve as the basic units for subsequent analysis; (2) Named Entity Recognition The BERT model is used to identify key entities in policy texts and extract core terms related to power data security; (3) Relationship modeling and subgraph analysis based on graph neural network (3.1) Constructing a policy relationship diagram The system represents each policy clause as a node in the graph, and the semantic associations between clauses as edges, constructing a policy clause relationship graph G = (V, E), where: V = {v1, v2, ..., v n } is a set of nodes, each node corresponds to a policy clause; is a set of edges, representing the relationship between nodes; The weight of the edge w ij Calculated by the following formula: w ij =cosine(e i ,e j ) Where: e i ,e j For clause v i ,v j The embedding vector of ; cosine(·) represents the cosine similarity, which is used to quantify the semantic similarity between terms; (3.2) Relationship Pooling In the constructed policy relationship graph G, the system uses relationship pooling to aggregate multiple relationships of nodes. The update of each node is expressed as: Where: R is a set of relationship types; For node v i The set of neighbor nodes on relation r; is the edge weight under relation r; W r is the transformation matrix of relation r; d i , d j For node v i and v j degree; σ(.) is the activation function; relation pooling generates context-aware clause embedding representation by aggregating information of multiple relation types; (3.3) Subgraph GNN To further extract local relations of specific topics, the system constructs a local subgraph G′=(V′,E′) based on the global relationship graph, where: is a subset of nodes related to the target topic; is the set of edges in V′; Within the subgraph, the system performs a convolutional update on the term embeddings: (4) Classification label generation The term embedding representation h generated by subgraph GNN i , the system uses the classifier to generate classification labels for the terms: l i =argmax(softmax(W c h i +b c )) Where: W c and b c are the weights and biases of the classifier; l i Category label for the terms; (5) Structured Storage The processed policy clauses and their embedded representations, classification labels and relationship structures are stored in the power data security policy knowledge base in the form of a graph; the system also records the time dimension information of the clauses to support subsequent historical queries and dynamic updates; S13, performing knowledge classification and label optimization on the policy documents stored in the power data security policy knowledge base; In the knowledge classification and label optimization phase, the system further analyzes and processes the policy terms stored in the knowledge base to generate more accurate and detailed classification labels and ensure the dynamic adaptability and accuracy of the label system; In the knowledge classification and label optimization phase, the system first uses the BERTopic model for topic modeling, extracts the core topics of policy clauses through deep semantic embedding technology, and generates preliminary classification labels; Based on the results of topic modeling, the system uses a deep learning model to replace the traditional SVM model to perform multi-label classification of policy terms; S14. Create index In order to improve the retrieval efficiency, a quick query index is established for the policy terms. Assume that the set of terms is C = {c1, c2, ..., c n }, each clause c i Contains several keywords w, constructs an inverted index I w as follows: I w ={c i |w∈c i },w∈Keywords(C) Among them, I w represents the inverted index of keyword w, Keywords(C) is the set of keywords appearing in all clauses; S15. Dynamic update of knowledge base The system automatically monitors the latest content of the policy publishing platform through regular tasks, and detects and captures newly released policy documents; After successfully obtaining the latest policy document, the system uses the Python DiffLib library to perform text difference detection and identify changes in the file content; S16. Each time a policy is updated, the system will record detailed change information, including update time, modified content, and operating users, to ensure that the evolution process of each policy content is fully preserved; the system uses Git for version management, and executes git commit to record changes each time an update is made. The old version of the terms is marked as "historical version" and the new version of the terms is marked as "latest version" through the branch management strategy, and the changes in the local database are regularly synchronized to the remote version control system to maintain consistency during queries.
4. The power data security policy large model question-answering method based on relationship pooling as claimed in claim 2, characterized in that: The step S2 comprises: The composition of the dataset is as follows; Common policy issues: By analyzing industry reports, government documents and expert interviews, we sorted out common policy issues in the field of power data security; Complex application scenarios: Design complex application scenarios to simulate actual problems; Emergency response measures: Organize emergency response plans for emergencies, including developing specific response processes and responsibility allocation; Data labeling and cleaning: Manually review and label the collected questions and answers, use data labeling tools to manually label questions and standard answers; use Label Studio and other tools to clean the data; The pre-trained large language model is further trained using the constructed fine-tuning dataset. The specific process is as follows: Model selection: Select a suitable pre-trained large language model based on the application scenario; Training framework: Use a deep learning framework to load a pre-trained model and prepare for fine-tuning; Hyperparameter tuning: Use grid search or random search methods to optimize hyperparameters. Key parameters include: Learning rate: The learning rate η controls the step size of gradient descent. Assuming that the optimization target is the loss function L, the process of updating the parameters through gradient descent is: in, is the gradient of the loss function with respect to the parameter θ; Batch size: Choose 16, 32, or 64, and adjust according to memory limitations and model performance; let Xbatch and Ybatch be the input data and labels of the current batch respectively, then the gradient calculation formula for each batch is, in, represents the gradient of the i-th sample, X i represents the input data of the i-th sample, Y i Represents X i The corresponding label; Number of training rounds: usually between 3 and 5 rounds, depending on the performance of the model on the validation set; Training monitoring: Use TensorBoard to monitor the training process in real time, observe the changing trends of loss function and accuracy, and adjust the training strategy in time; Validation set and overfitting prevention: Divide the data set into training set, validation set and test set. The validation set is used to evaluate model performance, and the test set is used for final evaluation.
5. The power data security policy large model question-answering method based on relationship pooling as claimed in claim 2, characterized in that: The step S3 comprises: S31、User Problem Analysis The question processing module receives natural language questions input by users and performs preliminary analysis through the language model; S32, Intent Recognition and Semantic Vector Conversion After question parsing, the question processing module identifies the intent of the user's question and converts it into a semantic vector that can be processed by the machine; Intent identification: By using a deep learning-based intent classification model, the model maps the user question Q to an intent category I, i.e. I=Intent(Q) Where I is the identified intent category; Semantic vector conversion: Use word vectors or context-aware models to convert user questions Q into semantic vectors VQ, that is, V Q =Embed(Q) S33, Knowledge Base Search Based on the generated semantic vector, the question processing module initiates a search request in the knowledge base. The system uses the full-text search function of Elasticsearch and combines it with relevance optimization algorithms such as the BM25 algorithm to calculate the similarity between the semantic vector of the user's question and the vectors of each policy clause in the knowledge base. Vector similarity calculation: For each term c in the knowledge base i , convert it into a semantic vector Then calculate the problem vector V Q and the term vector The cosine similarity between in, represents the dot product of vectors, ||V Q || and are the norms of two vectors respectively; S34. Search results integration and filtering After obtaining the preliminary search results, the question processing module will integrate and filter these results to ensure the accuracy and relevance of the results; this process includes removing duplicate terms, filtering irrelevant information, and sorting the results by relevance to ensure that users obtain the policy terms that best meet their query needs; S35. The result is passed to the answer generation module Pass the natural language question and optimized search results to the answer generation module so that the answer generation module can generate logical answers based on the user's specific needs; In the problem handling module, reverse reinforcement learning is introduced. The system simulates the decision-making process of experts when dealing with specific problems, analyzes the real intention behind the user's questions, and provides decision recommendations that are more in line with expert logic.
6. The power data security policy large model question-answering method based on relationship pooling as claimed in claim 2, characterized in that: The step S4 comprises: S41. Receive search results and natural language questions input by the user The answer generation module first receives the retrieval results delivered by the question processing module; these retrieval results contain policy terms related to the natural language questions; S42. Answer construction and contextual reasoning Based on the received search results, the answer generation module uses a large language model to generate policy answers. The module uses a Seq2Seq architecture to generate answers that meet user needs through context understanding and logical reasoning. The specific generation process is represented by the following steps: Sequence modeling: Convert user questions Q and search results R into vector representations and feed them into the Seq2Seq model for processing; let V Q is the semantic vector representation of question Q, VR is the semantic vector set of retrieval result R: V Q =Embed(Q), Contextual reasoning: The Seq2Seq model generates the answer A through the decoder, where the output A at each time step t It is determined by the hidden state of the previous time step and the input information; assuming that the answer generated by the model is A = {A1, A2, ..., A n }, where Ai is the i-th word generated; h t =Decoder(h t-1 V Q ,V R ),A t =Softmax(h t ) Among them, h t is the hidden state of the decoder, A t is the output of the current time step, and the Softmax layer is used to generate the probability distribution of the next word; S43. Generate content optimization In the process of generating answers, the module uses generation algorithms such as Beam Search, Top-k Sampling or Nucleus Sampling to improve the accuracy and richness of the answer content. Through these generation algorithms, the module selects the optimal solution from multiple possible answers to ensure that the answer is logically clear and avoids redundant information. S44, post-processing and formatting The generated answers go through a post-processing step to ensure their professionalism and readability; the module formats the content, removes redundant information, corrects grammatical errors, and fine-tunes them according to the professional presentation style of policy documents; S45. Answer output and feedback record After the processing is completed, the answer is passed from the answer generation module to the user output module as the final response provided by the system to the user; the module records the user's feedback and the answer generated by the system, and these data will be used for future model fine-tuning and system improvement; at the same time, in the answer generation module, through transparency technology, the system shows the key terms and policy basis of the user's concern when generating answers, thereby improving the explainability of the answer; In the process of answer generation, the system uses an attention mechanism to identify and highlight the policy terms that have the greatest impact on the answer; assuming that for a certain term r i , whose influence score is α i , the weighted influence of the clause is calculated through the attention mechanism to obtain the final weighted score α i : a i =Attention(Q,r i ) The system uses visualization tools to display the key terms and rules that are referenced when generating answers.
7. The power data security policy large model question-answering method based on relationship pooling as claimed in claim 2, characterized in that: The step S5 comprises: In the user output module, through the explainability report function, the system shows the decision basis of the answer in detail to the user, including the policy terms used, relevant business rules and explanations, making the source and logic of each answer more transparent and credible; Generate detailed reports: The system generates an explainable report that includes the key policy clauses and rule bases in the answer generation process. The report will list the weight of each clause and explain its role in the answer generation process. Policy clause reference function: In the explainability report, the system directly provides reference links to policy clauses related to the answer; users can click to view the detailed content of the corresponding clauses and further understand how the system generates answers based on these clauses.
Citation Information
Cited By
Large model compliance test method and system based on variation strategy
CN119988911A
A Compliance Testing Method and System for Large Models Based on Mutation Strategies
CN119988911B
Incremental policy analysis and dynamic model updating method and system
CN120181066A
Assessment assisting method based on convolutional neural network recommendation algorithm
CN120256613A
Government affair industry intelligent information retrieval and pushing system and method based on large model
CN120336504A