Block-based optimization method for power knowledge enhanced intelligent question answering
Patent Information
- Application Number
- CN202611058637.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-16
- Publication Date
- 2026-10-09
AI Technical Summary
尽管取得了初步成效,但传统的常规RAG方法在面向电力专业场景落地时,容易引发检索漂移,从而导致问答不准确
[0044]上述基于区块优化的电力知识增强智能问答方法,基于用户输入的当前需求文本的敏感词、文本长度和最大字符重复率执行第一级异常校验;若第一级异常校验通过,则根据当前需求文本的当前需求向量与当前平均索引向量的语义相似度进行第二级异常校验;当前平均索引向量为当前存储的所有历史需求向量的平均值;若第二级异常校验通过、且当前需求文本是正常需求文本,则判定针对当前需求文本的回复是以大语言模型的外部知识检索为主还是以大语言模型的自身先验知识检索为主;若是以外部知识检索为主,则从预先构建的向量化电力知识库中提取与当前需求向量匹配的候选语义区块,并从候选语义区块中筛选出满足语义相似条件的目标语义区块;基于目标语义区块驱动大语言模型生成当前需求文本的初始答复文本;将初始答复文本分割为多个答复片段,并通过比对预先构建的电力动态知识图谱以将多个答复片段划分为正常片段和幻觉片段;根据幻觉片段的上下文信息和目标语义区块,对幻觉片段进行纠偏与语义修正,获得修正片段,并将正常片段和修正片段进行拼接,获得目标答复文本。相较于传统的问答方法,本申请通过三层递进式校验机制,有效过滤异常输入与检索漂移,确保触发知识检索的每一条需求均具备高可信度;同时,通过引入答复片段级幻觉检测与动态知识图谱比对修正,在保留大模型生成能力的基础上,精准识别并纠偏电力专业场景下的事实性错误。最终实现了对电网实时拓扑与告警数据的准确溯源与融合,显著降低了基层员工的取数用数门槛,提升了故障响应效率与答复可靠性,克服了传统RAG在电力领域中因检索漂移和模型幻觉导致的应用瓶颈。
Smart Images

Figure CN122885164A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a block-optimized intelligent question-answering method for enhancing power knowledge. Background Technology
[0002] In their daily work, frontline power company employees frequently face tedious information retrieval and data processing tasks. When faced with sudden power grid system malfunctions, rapid troubleshooting not only requires employees to be familiar with the principles of electrical engineering from different disciplines, but also forces them to overcome extremely high technical barriers in "data retrieval and data utilization." For example, they need to be proficient in using complex IT software, or even manually write SQL or Python scripts to extract and clean the necessary equipment alarm data. This workload, caused by outdated knowledge retrieval methods and excessively high data processing barriers, severely restricts the efficiency of real-time data analysis and the response speed to system faults.
[0003] To address the aforementioned industry pain points, the introduction of large language models, such as ChatGPT, to build enterprise-level intelligent assistants has become a mainstream research direction in recent years. However, solutions relying solely on general large models have exposed many problems in the power sector. First, the fixed parameters of large language models prevent them from grasping the latest topology and alarm data generated by the power grid at every moment, resulting in severe timeliness delays. Second, power industry terminology is obscure and logically rigorous, making it easy for general models to create the "illusion" of "seemingly reasonable but actually violating the rules." To overcome these shortcomings, the industry has widely begun to adopt Retrieval Augmentation (RAG) technology, which aims to attach a factual knowledge base to the large model and input relevant retrieved literature as contextual prompts into the model. Although initial successes have been achieved, traditional conventional RAG methods are prone to retrieval drift when applied to power industry scenarios, leading to inaccurate question answers. Summary of the Invention
[0004] Therefore, it is necessary to provide a block-optimized intelligent question-answering method for power knowledge enhancement that can improve the accuracy of question answering, addressing the aforementioned technical problems.
[0005] Firstly, this application provides a block-optimized power knowledge-enhanced intelligent question-answering method, the method comprising:
[0006] The first level of anomaly check is performed based on the sensitive words, text length, and maximum character repetition rate of the current requirement text input by the user.
[0007] If the first level of anomaly check passes, then the second level of anomaly check is performed based on the semantic similarity between the current demand vector and the current average index vector of the current demand text; the current average index vector is the average of all historical demand vectors currently stored.
[0008] If the second-level anomaly check passes and the current requirement text is a normal requirement text, then it is determined whether the response to the current requirement text is mainly based on external knowledge retrieval of the large language model or mainly based on the prior knowledge retrieval of the large language model itself.
[0009] If the primary method is external knowledge retrieval, then candidate semantic blocks matching the current demand vector are extracted from the pre-built vectorized power knowledge base, and target semantic blocks that meet the semantic similarity conditions are selected from the candidate semantic blocks.
[0010] Based on the target semantic block, the large language model is driven to generate the initial response text for the current requirement text;
[0011] The initial response text is segmented into multiple response fragments, and the multiple response fragments are classified into normal fragments and hallucination fragments by comparing them with a pre-constructed power dynamics knowledge graph.
[0012] Based on the contextual information of the hallucination fragment and the target semantic block, the hallucination fragment is corrected and semantically modified to obtain a corrected fragment. The normal fragment and the corrected fragment are then concatenated to obtain the target response text.
[0013] In one embodiment, the method further includes:
[0014] The acquired basic power data is converted into raw text in a unified format, and a dynamic power knowledge graph is constructed based on the raw text.
[0015] The original text is divided into multiple coarse-grained text blocks according to a preset word count threshold;
[0016] For each coarse-grained text block, the large language model is used to split the coarse-grained text block into multiple fine-grained text blocks according to its internal logical semantics, and a corresponding context summary and simulated association question are generated for each fine-grained text block;
[0017] For each fine-grained text block, the fine-grained text block is concatenated with its corresponding context summary and simulated association question to obtain the final semantic block corresponding to the fine-grained text block;
[0018] The semantic vector and key information extraction results of the final semantic block are determined, and the semantic vector and key information extraction results are associated with the graph entities in the power dynamic knowledge graph and stored to construct a vectorized power knowledge base.
[0019] In one embodiment, the first-level anomaly check based on the sensitive words, text length, and maximum character repetition rate of the current requirement text input by the user includes:
[0020] If the current requirement text matches a sensitive word in the preset system security rule library or the preset power industry sensitive word library, or if the text length of the current requirement text does not fall within the preset valid requirement length range, or if the maximum character repetition rate of the current requirement text is higher than the preset security threshold, then the first level of anomaly check for the current requirement text is determined to fail; otherwise, the first level of anomaly check is determined to pass.
[0021] In one embodiment, the second-level anomaly check based on the semantic similarity between the current demand vector and the current average index vector of the current demand text includes:
[0022] Determine the semantic similarity between the current demand vector and the current average index vector of the current demand text;
[0023] Based on the semantic similarity, the deviation between the current demand vector and the current average index vector is determined;
[0024] If the deviation is greater than the preset drift threshold, the second-level anomaly check for the current requirement text is determined to fail; otherwise, the second-level anomaly check is determined to pass.
[0025] In one embodiment, the method further includes:
[0026] Determine the deviation between the current demand vector and the current average index vector of the current demand text, and determine the sensitive word parameter and the repeated character parameter of the current demand text; wherein, if there are no sensitive words in the current demand text, the sensitive word parameter is 0, otherwise it is 1; if the maximum character repetition rate of the current demand text is less than a preset security threshold, the repeated character parameter is 0, otherwise it is 1.
[0027] Configure a first risk factor, a second risk factor, and a third risk factor for the sensitive word parameter, the repeated character parameter, and the deviation, respectively;
[0028] Based on the first risk factor, the second risk factor, and the third risk factor, the sensitive word parameter, the repeated character parameter, and the deviation are weighted and summed to obtain the composite risk score of the current demand text;
[0029] If the composite risk score is less than or equal to a preset first risk threshold, then the current requirement text is determined to be a normal requirement text.
[0030] If the composite risk score is greater than or equal to a preset second risk threshold, then the current requirement text is determined to be an abnormal requirement text; wherein, the second risk threshold is greater than the first risk threshold;
[0031] If the composite risk score is greater than the first risk threshold and less than the second risk threshold, a follow-up question is sent to the user, and the follow-up response to the follow-up question is used as a new demand text for cyclical scoring until the latest demand text is determined to be a normal demand text or an abnormal demand text. If the latest demand text is determined to be a normal demand text, the search and response generation process is initiated based on the latest demand text.
[0032] In one embodiment, the step of filtering target semantic blocks that satisfy semantic similarity conditions from the candidate semantic blocks includes:
[0033] The current demand text is concatenated with each of the matched candidate semantic blocks, and the concatenation result is input into a cross-encoder model embedded with power industry constraint rules to determine the initial relevance score between the current demand text and each of the candidate semantic blocks.
[0034] For each candidate semantic block, if the physical entity or operating conditions involved in the candidate semantic block violate the hard constraints of the power dynamic knowledge graph, then the attenuation penalty coefficient of the candidate semantic block is determined, and the target relevance score of the candidate semantic block is determined based on the initial relevance score of the candidate semantic block and the attenuation penalty coefficient.
[0035] Based on the target relevance scores of each candidate semantic block, the candidate semantic blocks are sorted in descending order, and the top-ranked preset number of candidate semantic blocks are taken as the target semantic blocks.
[0036] Secondly, this application provides a block-optimized intelligent question-answering device for enhancing electricity knowledge, the device comprising:
[0037] The verification module is used to perform a first-level anomaly verification based on the sensitive words, text length, and maximum character repetition rate of the current demand text input by the user; if the first-level anomaly verification passes, a second-level anomaly verification is performed based on the semantic similarity between the current demand vector and the current average index vector of the current demand text; the current average index vector is the average value of all historical demand vectors currently stored.
[0038] The determination module is used to determine whether the response to the current requirement text is based on external knowledge retrieval of the large language model or on prior knowledge retrieval of the large language model itself, if the second-level anomaly check passes and the current requirement text is a normal requirement text.
[0039] The filtering module is used to extract candidate semantic blocks that match the current demand vector from a pre-built vectorized power knowledge base if the main focus is on external knowledge retrieval, and to filter out target semantic blocks that meet the semantic similarity conditions from the candidate semantic blocks.
[0040] The generation module is used to drive the large language model to generate an initial response text for the current requirement text based on the target semantic block; to segment the initial response text into multiple response fragments, and to classify the multiple response fragments into normal fragments and illusion fragments by comparing them with a pre-constructed power dynamic knowledge graph; to correct and semantically modify the illusion fragments according to the context information of the illusion fragments and the target semantic block, to obtain corrected fragments, and to concatenate the normal fragments and the corrected fragments to obtain the target response text.
[0041] Thirdly, this application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the various method embodiments of this application.
[0042] Fourthly, this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps in the various method embodiments of this application.
[0043] Fifthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the steps in the various method embodiments of this application.
[0044] The aforementioned block-optimized power knowledge-enhanced intelligent question-answering method performs a first-level anomaly check based on the sensitive words, text length, and maximum character repetition rate of the user-input current request text. If the first-level anomaly check passes, a second-level anomaly check is performed based on the semantic similarity between the current request vector and the current average index vector of the current request text. The current average index vector is the average of all currently stored historical request vectors. If the second-level anomaly check passes and the current request text is a normal request text, it determines whether the response to the current request text is primarily based on external knowledge retrieval from the large language model or on its own prior knowledge retrieval. If it is based on external knowledge retrieval... The method primarily relies on knowledge retrieval. It extracts candidate semantic blocks matching the current demand vector from a pre-built vectorized power knowledge base, and then selects target semantic blocks that meet semantic similarity criteria from these candidate blocks. Based on the target semantic blocks, it drives a large language model to generate an initial response text for the current demand text. The initial response text is then segmented into multiple response fragments, and these fragments are further divided into normal fragments and illusion fragments by comparing them with a pre-built dynamic power knowledge graph. Based on the contextual information of the illusion fragments and the target semantic blocks, the illusion fragments are corrected and semantically modified to obtain corrected fragments. The normal fragments and corrected fragments are then concatenated to obtain the target response text. Compared to traditional question-answering methods, this application employs a three-layer progressive verification mechanism to effectively filter abnormal inputs and retrieval drift, ensuring that every demand triggering knowledge retrieval has high credibility. Simultaneously, by introducing response fragment-level illusion detection and dynamic knowledge graph comparison and correction, it accurately identifies and corrects factual errors in power-related professional scenarios while retaining the large model's generation capabilities. Ultimately, it achieved accurate tracing and fusion of real-time power grid topology and alarm data, significantly reducing the threshold for data acquisition and usage for grassroots employees, improving fault response efficiency and response reliability, and overcoming the application bottlenecks of traditional RAG in the power field caused by retrieval drift and model illusion. Attached Figure Description
[0045] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0046] Figure 1 This is a diagram illustrating the application environment of a block-optimized power knowledge-enhanced intelligent question-answering method in one embodiment.
[0047] Figure 2 This is a flowchart illustrating a block-optimized power knowledge-enhanced intelligent question-answering method in one embodiment;
[0048] Figure 3 This is a structural block diagram of a block-optimized power knowledge-enhanced intelligent question-answering device in one embodiment;
[0049] Figure 4 This is an internal structural diagram of a computer device in one embodiment;
[0050] Figure 5 This is a diagram of the internal structure of a computer device in another embodiment. Detailed Implementation
[0051] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0052] The block-optimized power knowledge-enhanced intelligent question-answering method provided in this application can be applied to, for example... Figure 1 In the application environment shown, terminal 102 communicates with server 104 via a network. The data storage system can be set up separately and can store the data that server 104 needs to process. The data storage system can be integrated into server 104 or placed in the cloud or on other servers. Terminal 102 can be, but is not limited to, various desktop computers, laptops, smartphones, tablets, vehicle terminals, etc. Server 104 can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, cloud security, host security and other network security services, CDN, and basic cloud computing services such as big data and artificial intelligence platforms. Terminal 102 and server 104 can be directly or indirectly connected via wired or wireless communication, which is not limited herein.
[0053] Server 104 can perform a first-level anomaly check based on the sensitive words, text length, and maximum character repetition rate of the current demand text input by the user on terminal 102. If the first-level anomaly check passes, server 104 can perform a second-level anomaly check based on the semantic similarity between the current demand vector and the current average index vector of the current demand text. The current average index vector is the average of all historical demand vectors currently stored. If the second-level anomaly check passes and the current demand text is a normal demand text, server 104 can determine whether the response to the current demand text is primarily based on external knowledge retrieval from the large language model or on prior knowledge retrieval from the large language model itself. If it is primarily based on external knowledge retrieval, then the response will be based on the pre-constructed vectorized power... The knowledge base extracts candidate semantic blocks that match the current demand vector, and selects target semantic blocks that meet the semantic similarity conditions from the candidate semantic blocks; the server 104 can drive the large language model to generate the initial response text of the current demand text based on the target semantic blocks; the server 104 can segment the initial response text into multiple response fragments, and divide the multiple response fragments into normal fragments and hallucination fragments by comparing them with the pre-built power dynamic knowledge graph; the server 104 can correct and semantically modify the hallucination fragments according to the context information of the hallucination fragments and the target semantic blocks to obtain the corrected fragments, and splice the normal fragments and the corrected fragments to obtain the target response text, and send the target response text to the terminal 102 for display.
[0054] It is understood that this embodiment does not impose any limitations on this. Figure 1 The application scenarios shown are for illustrative purposes only and are not limited to these.
[0055] In one embodiment, such as Figure 2 As shown, a block-optimized intelligent question-answering method for enhancing electricity knowledge is provided. This method can be applied to computer devices, which can be terminals or servers. That is, the method can be executed independently by the terminal or server, or it can be implemented through interaction between the terminal and the server. This embodiment illustrates the application of this method to a computer device as an example, including the following steps:
[0056] Step 202: Perform Level 1 anomaly checks based on the sensitive words, text length, and maximum character repetition rate of the current requirement text input by the user.
[0057] Here, text length refers to the number of characters contained in the current requirement text. Maximum character repetition rate refers to the proportion of the total number of characters in the current requirement text that is the single character that appears most frequently in a row.
[0058] Specifically, the computer device can acquire the current requirement text input by the user and perform a first-level anomaly check based on the sensitive words, text length, and maximum character repetition rate of the current requirement text. The result of the first-level anomaly check includes whether the first-level anomaly check passes or fails.
[0059] Step 204: If the first level of anomaly check passes, then perform the second level of anomaly check based on the semantic similarity between the current demand vector and the current average index vector of the current demand text; the current average index vector is the average of all historical demand vectors currently stored.
[0060] Step 206: If the second-level anomaly check passes and the current requirement text is a normal requirement text, then determine whether the response to the current requirement text is mainly based on external knowledge retrieval from the large language model or on prior knowledge retrieval from the large language model itself.
[0061] Specifically, if the second-level anomaly check passes, the computer device can determine whether the current request text is a normal request text. If the current request text is normal, the computer device can determine whether the response to the current request text is primarily based on external knowledge retrieval from the large language model or on prior knowledge retrieval from the large language model itself. If the current request text is an abnormal request text, the computer device can intercept the current request text and terminate the question-and-answer process.
[0062] Step 208: If the main focus is on external knowledge retrieval, then candidate semantic blocks that match the current demand vector are extracted from the pre-built vectorized power knowledge base, and target semantic blocks that meet the semantic similarity conditions are selected from the candidate semantic blocks.
[0063] Step 210: Generate the initial response text of the current requirement text based on the target semantic block-driven large language model.
[0064] Specifically, the computer device can construct prompt words for a large language model based on the target semantic blocks, and input the prompt words into the large language model to generate an initial response text for the current request text.
[0065] Step 212: The initial response text is segmented into multiple response fragments, and the multiple response fragments are classified into normal fragments and hallucination fragments by comparing them with a pre-constructed power dynamics knowledge graph.
[0066] Specifically, the computer device can segment the initial response text into multiple response fragments. For each response fragment, if the fragment can be found in a pre-built power dynamics knowledge graph, it is considered a normal fragment; otherwise, it is considered a hallucination fragment.
[0067] Step 214: Based on the contextual information of the hallucination fragment and the target semantic block, the hallucination fragment is corrected and semantically modified to obtain the corrected fragment. The normal fragment and the corrected fragment are then spliced together to obtain the target response text.
[0068] The contextual information of the hallucination fragment refers to the normal fragments adjacent to the hallucination fragment in the initial response text, which are used to provide coherent contextual anchors for the semantic correction of the hallucination fragment.
[0069] In the aforementioned block-optimized power knowledge-enhanced intelligent question-answering method, a first-level anomaly check is performed based on the sensitive words, text length, and maximum character repetition rate of the user-input current demand text. If the first-level anomaly check passes, a second-level anomaly check is performed based on the semantic similarity between the current demand vector and the current average index vector of the current demand text. The current average index vector is the average of all historical demand vectors currently stored. If the second-level anomaly check passes and the current demand text is a normal demand text, it is determined whether the response to the current demand text is primarily based on external knowledge retrieval from the large language model or on its own prior knowledge retrieval. If it is based on external knowledge retrieval... The primary method is knowledge retrieval. Candidate semantic blocks matching the current demand vector are extracted from a pre-built vectorized power knowledge base, and target semantic blocks satisfying semantic similarity conditions are selected from these candidate blocks. Based on the target semantic blocks, a large language model is used to generate an initial response text for the current demand text. This initial response text is segmented into multiple response fragments, and these fragments are further divided into normal and illusionary fragments by comparing them with a pre-built dynamic power knowledge graph. Based on the contextual information of the illusionary fragments and the target semantic blocks, the illusionary fragments are corrected and semantically modified to obtain corrected fragments. The normal and corrected fragments are then concatenated to obtain the target response text. Compared to traditional question-answering methods, this application employs a three-layer progressive verification mechanism to effectively filter abnormal inputs and retrieval drift, ensuring high credibility for every demand triggering knowledge retrieval. Simultaneously, by introducing response fragment-level illusion detection and dynamic knowledge graph comparison and correction, factual errors in power-related scenarios are accurately identified and corrected while retaining the large model's generation capabilities. Ultimately, it achieved accurate tracing and fusion of real-time power grid topology and alarm data, significantly reducing the threshold for data acquisition and usage for grassroots employees, improving fault response efficiency and response reliability, and overcoming the application bottlenecks of traditional RAG in the power field caused by retrieval drift and model illusion.
[0070] In one embodiment, the method further includes: converting the acquired power basic data into raw text in a unified format, and constructing a power dynamic knowledge graph based on the raw text; dividing the raw text into multiple coarse-grained text blocks according to a preset word count threshold; for each coarse-grained text block, using a large language model to split the coarse-grained text block into multiple fine-grained text blocks according to its internal logical semantics, and generating a corresponding context summary and simulated association question for each fine-grained text block; for each fine-grained text block, concatenating the fine-grained text block with its corresponding context summary and simulated association question to obtain the final semantic block corresponding to the fine-grained text block; determining the semantic vector and key information extraction results of the final semantic block, and associating and storing the semantic vector and key information extraction results with the graph entities in the power dynamic knowledge graph to construct a vectorized power knowledge base.
[0071] In the above embodiments, a semantically rich and precisely aligned vectorized power knowledge base is constructed by uniformly formatting and coarse- and fine-grained hierarchical segmentation of power data, combined with contextual summaries and simulated questions generated by a large language model. This knowledge base is stored in association with entities in a dynamic knowledge graph, significantly improving the semantic matching accuracy and recall rate of subsequent retrievals. It effectively avoids the retrieval drift problem of traditional RAGs and provides a high-quality data foundation for generating highly reliable and low-illusion power-related professional responses.
[0072] In one embodiment, a first-level anomaly check is performed based on the sensitive words, text length, and maximum character repetition rate of the current requirement text input by the user. This includes: if the current requirement text matches a sensitive word in a preset system security rule library or a preset power industry sensitive word library, or if the text length of the current requirement text does not fall within a preset valid requirement length range, or if the maximum character repetition rate of the current requirement text is higher than a preset security threshold, then the first-level anomaly check for the current requirement text is determined to fail; otherwise, the first-level anomaly check is determined to pass.
[0073] In the above embodiments, multi-dimensional first-level anomaly verification—namely, sensitive word hit detection, effective text length range determination, and maximum character repetition rate threshold filtering—enables rapid rejection of malicious injections, invalid inputs, and abnormally redundant requests. This mechanism, acting as a pre-emptive security barrier, can intercept a large number of illegal or low-quality requests with minimal computational overhead, effectively ensuring the purity of input in subsequent retrieval and generation stages, reducing system resource waste, and improving the overall security and operational efficiency of the question-and-answer process.
[0074] In one embodiment, a second-level anomaly check is performed based on the semantic similarity between the current demand vector and the current average index vector of the current demand text. This includes: determining the semantic similarity between the current demand vector and the current average index vector of the current demand text; determining the deviation between the current demand vector and the current average index vector based on the semantic similarity; if the deviation is greater than a preset drift threshold, the second-level anomaly check for the current demand text is deemed to have failed; otherwise, the second-level anomaly check is deemed to have passed.
[0075] In the above embodiments, by calculating the semantic deviation between the current demand vector and the historical average index vector, a second, precise interception of abnormal demands or retrieval drift is achieved. This mechanism uses the dynamic historical average as a reference benchmark, effectively identifying inputs that deviate from the normal semantic distribution and avoiding erroneous knowledge recall due to demand ambiguity or retrieval bias. Compared to single static filtering, this scheme has adaptive capabilities, significantly improving the purity of knowledge matching and the overall reliability of question answering during the retrieval stage while ensuring the pass rate of normal demands.
[0076] In one embodiment, the method further includes: determining the deviation between the current demand vector and the current average index vector of the current demand text, and determining the sensitive word parameter and the repeated character parameter of the current demand text; wherein, if there are no sensitive words in the current demand text, the sensitive word parameter is 0, otherwise it is 1; if the maximum character repetition rate of the current demand text is less than a preset security threshold, the repeated character parameter is 0, otherwise it is 1; configuring a first risk factor, a second risk factor, and a third risk factor for the sensitive word parameter, the repeated character parameter, and the deviation, respectively; and weighting and summing the sensitive word parameter, the repeated character parameter, and the deviation based on the first risk factor, the second risk factor, and the third risk factor to obtain the current demand. The text undergoes a composite risk score. If the composite risk score is less than or equal to a preset first risk threshold, the current request text is determined to be a normal request text. If the composite risk score is greater than or equal to a preset second risk threshold, the current request text is determined to be an abnormal request text. The second risk threshold is greater than the first risk threshold. If the composite risk score is greater than the first risk threshold but less than the second risk threshold, a follow-up question is sent to the user, and the follow-up response to the follow-up question is used as a new request text for cyclical scoring until the latest request text is determined to be a normal or abnormal request text. If the latest request text is determined to be a normal request text, the search and response generation process begins based on the latest request text.
[0077] In the above embodiments, a composite risk scoring mechanism is constructed by comprehensively quantifying sensitive word parameters, repeated character parameters, and semantic deviation, and configuring differentiated risk factors for weighted fusion. This scheme introduces a proactive follow-up loop between two levels of risk thresholds, dynamically clarifying and iteratively verifying ambiguous requests until a clear judgment is obtained. Compared to single-threshold filtering, this scheme can significantly reduce false rejection and false negative rates, balancing security interception with accurate capture of user intent, and significantly improving the robustness and usability of question-and-answer interaction in complex power scenarios.
[0078] In one embodiment, selecting target semantic blocks that meet semantic similarity conditions from candidate semantic blocks includes: concatenating the current demand text with each matched candidate semantic block, and inputting the concatenation result into a cross-encoder model embedded with power industry constraint rules to determine the initial relevance score between the current demand text and each candidate semantic block; for each candidate semantic block, if the physical entity or operational conditions involved in the candidate semantic block violate the graph hard constraint conditions in the power dynamic knowledge graph, determining the attenuation penalty coefficient of the candidate semantic block, and determining the target relevance score of the candidate semantic block based on the initial relevance score and the attenuation penalty coefficient; sorting each candidate semantic block in descending order based on the target relevance score of each candidate semantic block, and selecting the top-ranked preset number of candidate semantic blocks as the target semantic blocks.
[0079] In the above embodiments, by fusing hard constraints of the power graph through a cross-encoder, candidate semantic blocks are scored for relevance and penalized for violations, achieving precise ranking of knowledge retrieval. This mechanism superimposes professional rule verification on top of semantic matching, ensuring that the selected target blocks strictly comply with power physics logic and operational specifications, effectively filtering out semantically similar but professionally non-compliant interference items, significantly improving the accuracy and compliance of knowledge retrieval, and providing high-confidence input support for subsequent response generation.
[0080] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially, these steps are not necessarily executed in that order. Unless otherwise expressly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some of the steps in the above embodiments may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least a portion of the sub-steps or stages of other steps.
[0081] Based on the same inventive concept, this application also provides a block-optimized intelligent question-answering device for implementing the block-optimized intelligent question-answering method for enhancing power knowledge described above. The solution provided by this device is similar to the solution described in the above method. Therefore, the specific limitations of one or more embodiments of the block-optimized intelligent question-answering device for enhancing power knowledge provided below can be found in the limitations of the block-optimized intelligent question-answering method for enhancing power knowledge described above, and will not be repeated here.
[0082] In one embodiment, such as Figure 3 As shown, a block-optimized power knowledge-enhanced intelligent question-answering device 300 is provided, which specifically includes:
[0083] The verification module 302 is used to perform a first-level anomaly verification based on the sensitive words, text length and maximum character repetition rate of the current demand text input by the user; if the first-level anomaly verification passes, a second-level anomaly verification is performed based on the semantic similarity between the current demand vector and the current average index vector of the current demand text; the current average index vector is the average of all historical demand vectors currently stored.
[0084] The judgment module 304 is used to determine whether the response to the current requirement text is based on external knowledge retrieval of the large language model or on prior knowledge retrieval of the large language model itself if the second-level anomaly check passes and the current requirement text is a normal requirement text.
[0085] The filtering module 306 is used to extract candidate semantic blocks that match the current demand vector from the pre-built vectorized power knowledge base if the main focus is on external knowledge retrieval, and to filter out target semantic blocks that meet the semantic similarity conditions from the candidate semantic blocks.
[0086] The generation module 308 is used to generate the initial response text of the current requirement text based on the target semantic block-driven large language model; the initial response text is divided into multiple response fragments, and the multiple response fragments are divided into normal fragments and hallucination fragments by comparing with the pre-built power dynamic knowledge graph; according to the context information of the hallucination fragments and the target semantic block, the hallucination fragments are corrected and semantically modified to obtain the corrected fragments, and the normal fragments and the corrected fragments are spliced together to obtain the target response text.
[0087] In one embodiment, the apparatus further includes:
[0088] The module is used to convert the acquired basic power data into raw text in a unified format and to construct a dynamic power knowledge graph based on the raw text. The raw text is divided into multiple coarse-grained text blocks according to a preset word count threshold. For each coarse-grained text block, a large language model is used to further divide it into multiple fine-grained text blocks according to its internal logical semantics, and a corresponding context summary and simulated association question are generated for each fine-grained text block. For each fine-grained text block, its corresponding context summary and simulated association question are concatenated to obtain the final semantic block. The semantic vector and key information extraction results of the final semantic block are determined, and these results are associated and stored with the graph entities in the dynamic power knowledge graph to construct a vectorized power knowledge base.
[0089] In one embodiment, the verification module 302 is further configured to determine that the first-level anomaly verification for the current requirement text fails if the current requirement text matches a sensitive word in the preset system security rule library or the preset power industry sensitive word library, or if the text length of the current requirement text does not fall within the preset effective requirement length range, or if the maximum character repetition rate of the current requirement text is higher than the preset security threshold; otherwise, the first-level anomaly verification passes.
[0090] In one embodiment, the verification module 302 is further configured to determine the semantic similarity between the current demand vector and the current average index vector of the current demand text; based on the semantic similarity, determine the deviation between the current demand vector and the current average index vector; if the deviation is greater than a preset drift threshold, it is determined that the second-level anomaly verification for the current demand text fails; otherwise, it is determined that the second-level anomaly verification passes.
[0091] In one embodiment, the determination module 304 is further configured to determine the deviation between the current demand vector and the current average index vector of the current demand text, and to determine the sensitive word parameter and the repeated character parameter of the current demand text; wherein, if there are no sensitive words in the current demand text, the sensitive word parameter is 0, otherwise it is 1; if the maximum character repetition rate of the current demand text is less than a preset security threshold, the repeated character parameter is 0, otherwise it is 1; a first risk factor, a second risk factor, and a third risk factor are configured for the sensitive word parameter, the repeated character parameter, and the deviation, respectively; based on the first risk factor, the second risk factor, and the third risk factor, the sensitive word parameter, the repeated character parameter, and the deviation are weighted and summed to obtain the current... The system performs a composite risk score on the request text. If the composite risk score is less than or equal to a preset first risk threshold, the current request text is determined to be a normal request text. If the composite risk score is greater than or equal to a preset second risk threshold, the current request text is determined to be an abnormal request text. The second risk threshold is greater than the first risk threshold. If the composite risk score is greater than the first risk threshold but less than the second risk threshold, a follow-up question is sent to the user, and the follow-up response is used as a new request text for cyclical scoring until the latest request text is determined to be a normal or abnormal request text. If the latest request text is determined to be a normal request text, the system proceeds to the retrieval and response generation process based on the latest request text.
[0092] In one embodiment, the filtering module 306 is further configured to concatenate the current demand text with each matched candidate semantic block, and input the concatenation result into a cross-encoder model embedded with power industry constraint rules to determine the initial relevance score between the current demand text and each candidate semantic block; for each candidate semantic block, if the physical entity or operating conditions involved in the candidate semantic block violate the graph hard constraint conditions in the power dynamic knowledge graph, the attenuation penalty coefficient of the candidate semantic block is determined, and the target relevance score of the candidate semantic block is determined based on the initial relevance score and the attenuation penalty coefficient; the candidate semantic blocks are sorted in descending order based on the target relevance scores of each candidate semantic block, and the first preset number of candidate semantic blocks are taken as the target semantic blocks.
[0093] The aforementioned block-optimized power knowledge-enhanced intelligent question-answering device performs a first-level anomaly check based on the sensitive words, text length, and maximum character repetition rate of the user-input current request text. If the first-level anomaly check passes, a second-level anomaly check is performed based on the semantic similarity between the current request vector and the current average index vector of the current request text. The current average index vector is the average of all currently stored historical request vectors. If the second-level anomaly check passes and the current request text is a normal request text, it determines whether the response to the current request text is primarily based on external knowledge retrieval from the large language model or on the large language model's own prior knowledge retrieval. If it is based on external knowledge retrieval... The method primarily relies on knowledge retrieval. It extracts candidate semantic blocks matching the current demand vector from a pre-built vectorized power knowledge base, and then selects target semantic blocks that meet semantic similarity criteria from these candidate blocks. Based on the target semantic blocks, it drives a large language model to generate an initial response text for the current demand text. The initial response text is then segmented into multiple response fragments, and these fragments are further divided into normal fragments and illusion fragments by comparing them with a pre-built dynamic power knowledge graph. Based on the contextual information of the illusion fragments and the target semantic blocks, the illusion fragments are corrected and semantically modified to obtain corrected fragments. The normal fragments and corrected fragments are then concatenated to obtain the target response text. Compared to traditional question-answering methods, this application employs a three-layer progressive verification mechanism to effectively filter abnormal inputs and retrieval drift, ensuring that every demand triggering knowledge retrieval has high credibility. Simultaneously, by introducing response fragment-level illusion detection and dynamic knowledge graph comparison and correction, it accurately identifies and corrects factual errors in power-related professional scenarios while retaining the large model's generation capabilities. Ultimately, it achieved accurate tracing and fusion of real-time power grid topology and alarm data, significantly reducing the threshold for data acquisition and usage for grassroots employees, improving fault response efficiency and response reliability, and overcoming the application bottlenecks of traditional RAG in the power field caused by retrieval drift and model illusion.
[0094] The modules in the aforementioned block-optimized power knowledge enhancement intelligent question-answering device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the corresponding operations of each module.
[0095] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 4As shown, this computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media to run. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements a block-optimized power knowledge-enhanced intelligent question-answering method.
[0096] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 5 As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a block-optimized power knowledge-enhanced intelligent question-answering method. The display unit of the computer device is used to form a visually visible image. It can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.
[0097] Those skilled in the art will understand that Figure 4 and Figure 5The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0098] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.
[0099] In one embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0100] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0101] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0102] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.
[0103] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0104] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A block-optimized intelligent question-answering method for enhancing electricity knowledge, characterized in that, The method includes: The first level of anomaly check is performed based on the sensitive words, text length, and maximum character repetition rate of the current requirement text input by the user. If the first level of anomaly check passes, then the second level of anomaly check is performed based on the semantic similarity between the current demand vector and the current average index vector of the current demand text; the current average index vector is the average of all historical demand vectors currently stored. If the second-level anomaly check passes and the current requirement text is a normal requirement text, then it is determined whether the response to the current requirement text is mainly based on external knowledge retrieval of the large language model or mainly based on the prior knowledge retrieval of the large language model itself. If the primary method is external knowledge retrieval, then candidate semantic blocks matching the current demand vector are extracted from the pre-built vectorized power knowledge base, and target semantic blocks that meet the semantic similarity conditions are selected from the candidate semantic blocks. Based on the target semantic block, the large language model is driven to generate the initial response text for the current requirement text; The initial response text is segmented into multiple response fragments, and the multiple response fragments are classified into normal fragments and hallucination fragments by comparing them with a pre-constructed power dynamics knowledge graph. Based on the contextual information of the hallucination fragment and the target semantic block, the hallucination fragment is corrected and semantically modified to obtain a corrected fragment. The normal fragment and the corrected fragment are then concatenated to obtain the target response text.
2. The method according to claim 1, characterized in that, The method further includes: The acquired basic power data is converted into raw text in a unified format, and a dynamic power knowledge graph is constructed based on the raw text. The original text is divided into multiple coarse-grained text blocks according to a preset word count threshold; For each coarse-grained text block, the large language model is used to split the coarse-grained text block into multiple fine-grained text blocks according to its internal logical semantics, and a corresponding context summary and simulated association question are generated for each fine-grained text block; For each fine-grained text block, the fine-grained text block is concatenated with its corresponding context summary and simulated association question to obtain the final semantic block corresponding to the fine-grained text block; The semantic vector and key information extraction results of the final semantic block are determined, and the semantic vector and key information extraction results are associated with the graph entities in the power dynamic knowledge graph and stored to construct a vectorized power knowledge base.
3. The method according to claim 1, characterized in that, The first-level anomaly check is performed based on the sensitive words, text length, and maximum character repetition rate of the current requirement text input by the user, including: If the current requirement text matches a sensitive word in the preset system security rule library or the preset power industry sensitive word library, or if the text length of the current requirement text does not fall within the preset valid requirement length range, or if the maximum character repetition rate of the current requirement text is higher than the preset security threshold, then the first level of anomaly check for the current requirement text is determined to fail; otherwise, the first level of anomaly check is determined to pass.
4. The method according to claim 1, characterized in that, The second-level anomaly verification based on the semantic similarity between the current demand vector and the current average index vector of the current demand text includes: Determine the semantic similarity between the current demand vector and the current average index vector of the current demand text; Based on the semantic similarity, the deviation between the current demand vector and the current average index vector is determined; If the deviation is greater than the preset drift threshold, the second-level anomaly check for the current requirement text is determined to fail; otherwise, the second-level anomaly check is determined to pass.
5. The method according to claim 1, characterized in that, The method further includes: Determine the deviation between the current demand vector and the current average index vector of the current demand text, and determine the sensitive word parameter and the repeated character parameter of the current demand text; wherein, if there are no sensitive words in the current demand text, the sensitive word parameter is 0, otherwise it is 1; if the maximum character repetition rate of the current demand text is less than a preset security threshold, the repeated character parameter is 0, otherwise it is 1. Configure a first risk factor, a second risk factor, and a third risk factor for the sensitive word parameter, the repeated character parameter, and the deviation, respectively; Based on the first risk factor, the second risk factor, and the third risk factor, the sensitive word parameter, the repeated character parameter, and the deviation are weighted and summed to obtain the composite risk score of the current demand text; If the composite risk score is less than or equal to a preset first risk threshold, then the current requirement text is determined to be a normal requirement text. If the composite risk score is greater than or equal to a preset second risk threshold, then the current requirement text is determined to be an abnormal requirement text; wherein, the second risk threshold is greater than the first risk threshold; If the composite risk score is greater than the first risk threshold and less than the second risk threshold, a follow-up question is sent to the user, and the follow-up response to the follow-up question is used as a new demand text for cyclical scoring until the latest demand text is determined to be a normal demand text or an abnormal demand text. If the latest demand text is determined to be a normal demand text, the search and response generation process is initiated based on the latest demand text.
6. The method according to claim 1, characterized in that, The step of selecting target semantic blocks that meet the semantic similarity criteria from the candidate semantic blocks includes: The current demand text is concatenated with each of the matched candidate semantic blocks, and the concatenation result is input into a cross-encoder model embedded with power industry constraint rules to determine the initial relevance score between the current demand text and each of the candidate semantic blocks. For each candidate semantic block, if the physical entity or operating conditions involved in the candidate semantic block violate the hard constraints of the power dynamic knowledge graph, then the attenuation penalty coefficient of the candidate semantic block is determined, and the target relevance score of the candidate semantic block is determined based on the initial relevance score of the candidate semantic block and the attenuation penalty coefficient. Based on the target relevance scores of each candidate semantic block, the candidate semantic blocks are sorted in descending order, and the top-ranked preset number of candidate semantic blocks are taken as the target semantic blocks.
7. A block-optimized intelligent question-answering device for enhancing electricity knowledge, characterized in that, The device includes: The verification module is used to perform a first-level anomaly verification based on the sensitive words, text length, and maximum character repetition rate of the current demand text input by the user; if the first-level anomaly verification passes, a second-level anomaly verification is performed based on the semantic similarity between the current demand vector and the current average index vector of the current demand text; the current average index vector is the average value of all historical demand vectors currently stored. The determination module is used to determine whether the response to the current requirement text is based on external knowledge retrieval of the large language model or on prior knowledge retrieval of the large language model itself, if the second-level anomaly check passes and the current requirement text is a normal requirement text. The filtering module is used to extract candidate semantic blocks that match the current demand vector from a pre-built vectorized power knowledge base if the main focus is on external knowledge retrieval, and to filter out target semantic blocks that meet the semantic similarity conditions from the candidate semantic blocks. The generation module is used to drive the large language model to generate an initial response text for the current requirement text based on the target semantic block; to segment the initial response text into multiple response fragments, and to classify the multiple response fragments into normal fragments and illusion fragments by comparing them with a pre-constructed power dynamic knowledge graph; to correct and semantically modify the illusion fragments according to the context information of the illusion fragments and the target semantic block, to obtain corrected fragments, and to concatenate the normal fragments and the corrected fragments to obtain the target response text.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.