Power field knowledge question-answering system construction method based on large language model
By constructing a knowledge graph in the power field and optimizing path sorting, combined with a large language model and graph neural network, the problems of hallucination and lack of readability in the knowledge question-answering system in the power field are solved, and a logically reliable and fast fault diagnosis service is provided.
Patent Information
- Application Number
- CN202510887299.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-30
- Publication Date
- 2025-10-17
AI Technical Summary
Existing technologies in knowledge question-answering systems in the power sector lack equipment topology and ontology rule constraints, resulting in frequent hallucinations. Furthermore, the natural language generation capability is insufficient, making it difficult to provide logically credible and readable fault diagnosis results.
A knowledge question-answering system in the power field based on a large language model is constructed. By generating entity-relationship triples and a knowledge graph in the power field, combining attention networks and graph neural networks, the path sorting of the knowledge graph is optimized, and the language model is used for deep semantic completion and natural language generation to ensure the logical credibility and linguistic fluency of the diagnostic results.
It achieves the provision of logically reliable, readable and fast question-answering services in power fault diagnosis, suppresses the hallucination tendency of large language models, fully utilizes the knowledge in unstructured literature, and ensures the accuracy and timeliness of diagnosis results.
Smart Images

Figure CN120804253A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of power knowledge question and answer, in particular to a power field knowledge question and answer system construction method based on a large language model. BACKGROUND
[0002] In the power industry in China, operation procedures, accident reports, maintenance records and other data have been accumulated for many years, forming a large unstructured text library. These documents contain a wealth of device fault mechanisms, disposal measures and operation and maintenance experience, but due to the scattered content and diverse formats, the retrieval and utilization efficiency is very low. When facing sudden failures, front-line operation and maintenance personnel often still need to rely on personal experience or manually review manuals to locate the cause and develop measures, which is time-consuming and easy to miss critical information.
[0003] In recent years, general large language models can directly answer questions through natural language, but they lack power ontology rules and device topology constraints, often appearing "hallucinations", arbitrarily creating non-existent device names, parameters or fault links. Such distorted answers may lead to misoperation and endanger power supply safety. On the other hand, purely relying on manually constructed knowledge graphs has explicit rules, but their reasoning results lack generative semantic completion capabilities, making it difficult to quickly deliver to field personnel in a readable and understandable form.
[0004] At the same time, the safe operation of the power system relies on three major links of device state monitoring, fault diagnosis and maintenance decision-making. Based on historical operation procedures, device manuals, accident reports, maintenance logs and dispatching commands, a large amount of "device-fault mode-disposal measure" knowledge has been accumulated. However, most of these documents are saved in unstructured forms such as PDF, Word, scanned images and free text databases, resulting in very low information retrieval and reuse efficiency. In the event of a sudden failure, front-line operation and maintenance personnel often still need to review paper manuals or rely on personal experience to search for cases, which often takes tens of minutes or even hours. With the large-scale introduction of new energy and flexible direct current transmission, the types of devices are more diverse and the fault mechanisms are more complex, making it difficult for traditional manual retrieval methods to support the power grid's requirement for "minute-level" diagnosis response.
[0005] To shorten the search time and improve the diagnosis accuracy, existing technologies have proposed three types of technical solutions: The first type of solution is to fine-tune a large pre-trained language model on industry corpus. This approach takes advantage of the model's strong natural language understanding and generation capabilities, directly inputting the "fault phenomenon" question into the model and outputting diagnosis and maintenance recommendations. The advantages of this approach are smooth answers, wide coverage, and simple operation for maintenance personnel after deployment. However, due to the lack of device topology and ontology constraints, the model may "hallucinate" non-existent device names or incorrect causal chains, and the answers lack traceable sources, which may lead to misoperation if misused.
[0006] The second type of solution is to build a power knowledge graph and use a rule-based or graph embedding-based retrieval and reasoning engine. The graph stores entities such as "generator," "excitation system," "trip," and "split" and their relationships such as "composition," "causality," and "timing" in the form of triples. When querying, the potential causes and measures are given through path search or logical rule reasoning. This method ensures logical correctness, but the returned results are usually path or node numbers, lacking natural language explanations. Meanwhile, the graph can only capture explicit relationships in the literature, and it lacks coverage of cross-sentence weak causal chains.
[0007] The third type of solution is to train a graph neural network on top of the knowledge graph, sort the confidence of fault-cause-measure through link prediction, and use templates to convert the optimal path into an answer. Graph neural networks can mine potential patterns at the structural level, making them more flexible than pure rule-based reasoning. However, they lack sufficient dependence on weak semantic information, and their template-based output lacks language flexibility. Moreover, if the graph data contains noisy links, the graph neural network may assign high confidence to frequently co-occurring incorrect relationships.
[0008] In summary, existing technologies either lack domain rules leading to hallucinations or lack natural language generation leading to poor readability. There is no mature technology that can provide both "topology-constrained reliable reasoning" and "deep semantic completion of smooth answers."
[0009] Furthermore, when unstructured literature in the power industry is directly input into a large language model fine-tuned on industry corpus, the model first matches the "most relevant" fault link based on its statistical language distribution. Due to the lack of explicit constraints on device topology and ontology rules, it may combine frequently co-occurring word groups into answers during the training process. Once encountering low-frequency or new devices, it tends to "guess" a term or disposal measure based on probability. The root cause of this step is that the model does not have symbolic logic to judge that "device A can only be connected to system B" or "fault mode X must occur before protection action Y." Therefore, hallucinations are inevitably introduced into the results.
[0010] To suppress such illusions, existing technologies rely on rule-based reasoning of knowledge graphs. The graphs enforce the requirement that the query path must actually exist in the triple network. This seems to solve the problem of logical compliance, but this rigid restriction brings new chain consequences: any knowledge that only appears as implicit relationships in the literature, or has not been extracted into triples due to changes in expression, is excluded from the searchable range. As a result, operation and maintenance personnel can only get answers "in the graph" when querying, and the potential causal chains missing in the graph are completely ignored, leaving a knowledge blind spot, and the diagnosis may still be inaccurate.
[0011] Graph neural networks introduce statistical learning on top of graphs, hoping to find hidden patterns through parameterized propagation. However, they are still limited to the edge set of the input graph itself. If the original graph contains data input noise or frequently co-occurring pseudo-relationships, GNN will treat such pseudo-relationships as high-confidence outputs. At the same time, GNN outputs a long list of node or path identifiers, which need to be manually translated into natural language for on-site personnel to quickly understand, further weakening timeliness.
[0012] The causal chain formed by this can be summarized as follows: lack of explicit rules → generation of hallucinations; introduction of hard rules → omission of implicit relationships; reliance on graph learning → noise amplification and lack of readability; and the end point of the chain is that the diagnostic results are still unreliable or difficult to use, and cannot truly replace human experience.
[0013] Currently, no effective solutions have been proposed for the problems in related technologies. Summary of the Invention
[0014] In response to the problems in the related technologies, the present invention proposes a method for constructing a knowledge question-answering system in the power field based on a large language model to overcome the above-mentioned technical problems existing in the existing related technologies.
[0015] To this end, the specific technical solutions adopted in the present invention are as follows: A method for constructing a knowledge question-answering system in the power field based on a large language model includes: Determine the data type of power domain knowledge, and use matching processing technologies to process the power domain knowledge based on the judgment results, generate entity relationship triples, and construct a power domain knowledge graph; Optimize the knowledge graph in the power field based on the attention network, use the optimized knowledge graph in the power field to output the causal path of the solution to the fault problem, and annotate the confidence score of the causal path of the solution; The causal path and confidence score of the answer are input into the language model to obtain the fault question and answer results. The question and answer results are optimized based on the consistency between the fault question and answer results and the knowledge graph in the power field.
[0016] Preferably, the data type of the power field knowledge is judged, and the processing technology is matched according to the judgment result to execute processing on the power field knowledge, generate entity relationship triples, and construct a power field knowledge graph, including: The power field knowledge is acquired, and the data format type of the power field knowledge is judged. According to the judgment result, the data parsing pipeline is used to process the text type power field knowledge, and the text version power field knowledge is output. The optical character recognition technology is used to perform text conversion processing on the picture type power field knowledge, identify the transcription errors in the text conversion result, correct the transcription errors, and output the text version power field knowledge corresponding to the picture type. The text version power field knowledge and the picture type text version power field knowledge are fused, and the recognition model is used to generate entity relationship triples from the fusion result to construct a power field knowledge graph.
[0017] Preferably, the optical character recognition technology is used to perform text conversion processing on the picture type power field knowledge, identify the transcription errors in the text conversion result, correct the transcription errors, and output the text version power field knowledge corresponding to the picture type, including: The picture type power field knowledge is processed by the generative adversarial network model to enlarge the picture, and the convolution filter and the bilateral filter are used to denoise the enlarged picture type power field knowledge. The text detection technology is used to separate the non-text area in the picture type power field knowledge, convert the image text in the picture type power field knowledge into editable text, and identify the distorted text and formula symbol image during the conversion process. The distorted text processing model is used to analyze the inclination angle of the distorted text, identify the vertical text by combining feature analysis and texture direction, and map the irregular text area to a regular rectangle according to the thin plate spline model to correct the state of the distorted text. The spatial relationship of the distorted text is captured according to the correction result and the relative position, the decoder is used to generate a text sequence, the consistency of the text sequence in the context is verified, and the text sequence is adjusted. The optical character recognition technology is used to preprocess the formula symbol image, add semantic states to the formula symbol according to the processing result and the power term injection technology, and combine the text sequence to obtain the picture type text version power field knowledge.
[0018] Preferably, the optical character recognition technology is used to preprocess the formula symbol image, add semantic states to the formula symbol according to the processing result and the power term injection technology, and combine the text sequence to obtain the picture type text version power field knowledge, including: The power symbols and formulas in the formula symbol image are extracted by using an edge detection tool, and after expansion and filling of the breaking position of the power symbols and formulas, the size of the formula symbol image is unified, and the preprocessing of the formula symbol image is completed. According to the preprocessing result, the power symbols and formulas in the formula symbol image are injected with power terms, and the semantic expression accuracy of the injection result is judged to optimize the power term content, and the picture type text power field knowledge is obtained by combining the text sequence.
[0019] Preferably, the text version of the power field knowledge and the picture type text power field knowledge are fused, and the entity relationship triplets are generated by using the recognition model and the fusion result to construct the power field knowledge graph, including: The time and label are added to the text version of the power field knowledge and the picture type text power field knowledge respectively, and the target category entity information is generated by using the natural language processing model according to the label result; The cause-effect relationship is extracted from the text version of the power field knowledge and the picture type text power field knowledge based on the dependency syntax, and the long short-term memory network is used to complete the extraction result to generate candidate triplets; The target category entity information is aligned to the semantic dictionary by hash mapping table for standardization processing, and the triplets are generated by combining the candidate triplets, and the triplets are detected for conflict resolution; According to the detection result, the rejection decision of the triplets is obtained, and the triplets are put into the error library or subjected to secondary review based on the rejection decision to determine the content of the graph database to construct the power field knowledge graph.
[0020] Preferably, the power field knowledge graph is optimized based on the attention network, the answer cause-effect path of the fault problem is output by using the optimized power field knowledge graph, and the confidence score of the answer cause-effect path is labeled, including: The target category entity information in the power field knowledge graph is given a node color, and the cause-effect relationship is given an edge style, and the power field knowledge graph is subjected to average pooling processing according to the given result; The power field knowledge graph after pooling is subjected to convolution operation by using the heterogeneous attention network, the features and rules in the power field knowledge graph are extracted, and the semantic information in the power field knowledge graph is determined; Based on the semantic information, the complete cause-effect link is extracted and marked as a positive example, and the binary cross-entropy is used as a loss function to train the cause-effect recognition model to identify the real cause-effect chain in the power field knowledge graph; The fault problem content is set and input into the power field knowledge graph to obtain the subgraph area corresponding to the real cause-effect chain, and the answer cause-effect path of the fault problem is output based on the subgraph area, and the confidence score of the answer cause-effect path is labeled.
[0021] Preferably, the fault problem content is set, input into the power domain knowledge graph to obtain a subgraph area corresponding to a true causal chain, a fault problem answer causal path is output based on the subgraph area, and a confidence score of the answer causal path is marked, including: The fault problem content is set, core entities and corresponding types are extracted from the fault problem content, and nodes matching the entity types are retained in the power domain knowledge graph, excluding nodes without logical association, to obtain candidate nodes; The candidate nodes and input entities are respectively mapped to a semantic vector space to judge vector similarity, and a clustering algorithm is used to form clusters based on the vector similarity, and a number of clusters with the highest similarity to the input entities are retained; According to the clustering result, a plurality of subgraphs are constructed, a retrieval operation is performed, the most similar candidate nodes are obtained, the retrieval results of the plurality of subgraphs are merged, and a high-confidence subgraph is output after time sequence consistency verification; The high-confidence subgraph is analyzed using a graph neural network, the answer causal path of the fault problem is obtained according to the reasoning result, the confidence of the answer causal path is marked, and the answer causal path is arranged.
[0022] Preferably, the high-confidence subgraph is analyzed using a graph neural network, the answer causal path of the fault problem is obtained according to the reasoning result, the confidence of the answer causal path is marked, and the answer causal path is arranged, including: The embedding vectors of the nodes in the high-confidence subgraph are updated based on the message passing mechanism to capture the dependency relationship between the nodes, and a plurality of answer causal paths meeting the fault problem answer requirements are obtained according to the dependency relationship; The answer causal path is analyzed using a graph neural network, a scoring structure of the answer causal path is obtained to output a confidence ranking, and the top three answer causal paths are selected according to the ranking result; The selected answer causal path is refined into a natural language sentence, the natural language sentence is marked with a corresponding confidence score, and the original path code of the answer causal path is recorded.
[0023] Preferably, the answer causal path and the confidence score are input into a language model to obtain a fault problem question and answer result, and the question and answer result is optimized according to the consistency of the fault problem question and answer result and the power domain knowledge graph, including: The decoding temperature of the language model is set, and the answer causal path and the confidence score are input into the language model to supplement the cross-sentence weak logical relationships not explicitly marked in the power domain knowledge graph; The encoding of the supplemented answer causal path is checked using regular analysis, and the newly added entities and relationships outside the encoding are checked one by one, and it is judged whether the corresponding entities and relationships exist in the power domain knowledge graph; According to the judgment result, the verification result is analyzed, the fault question and answer result is output, and a graph view is generated based on the fault question and answer result and pushed to the front end for display.
[0024] Preferably, according to the judgment result, the verification result is analyzed, the fault question and answer result is output, and a graph view is generated based on the fault question and answer result and pushed to the front end for display, including: If there is no corresponding entity and relationship in the power field knowledge graph, the confidence of the graph neural network is judged, and when the confidence is greater than a threshold, the causal path of the answer is temporarily stored as a candidate triple, and after manual review, it is written into the power field knowledge graph; If there is a corresponding entity and relationship in the power field knowledge graph, it means that the verification is passed, and after converting the causal path of the answer into a markup language format, the fault question and answer result is output, a graph view is generated, and pushed to the front end for display.
[0025] The beneficial effects of the present application are: 1. The present application uses an artificially constructed and continuously updated power knowledge graph as a base, provides ontology-level constraints with a graph structure, performs confidence reasoning on the graph with a graph neural network, makes the path ordering closer to the real causal distribution of historical accidents, and at the same time, abstracts high-confidence paths to a large language model for deep semantic completion and natural language generation, retains graph entity identifiers during the generation process to trace back to the source triple, and through consistency verification, compares the expression of the large language model with the confidence distribution of the graph neural network, and eliminates any fragments that violate the topological rules or lack sufficient confidence support, ensuring that the diagnosis returned to the operation and maintenance personnel is not only logically reliable, but also fluent in language, and can be quickly adopted and executed on the fault site.
[0026] 2. The present application fully activates the knowledge in large-scale unstructured literature in the power industry while maintaining the rigor of fault diagnosis logic and the traceability of results, so that the system can provide accurate, fluent and compliant with power grid safe operation specifications for operation and maintenance personnel in real time, effectively suppress the illusion tendency of general large language models, and avoid the short board of the knowledge graph in natural language generation. BRIEF DESCRIPTION OF DRAWINGS
[0027] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed in the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0028] Figure 1 is a flowchart of a power field knowledge question and answer system construction method based on a large language model according to an embodiment of the present application; Figure 2is a whole architecture diagram of a large language model-based power field knowledge question answering system construction method according to an embodiment of the present application; Figure 3 is an image text processing flowchart of a large language model-based power field knowledge question answering system construction method according to an embodiment of the present application, in which SVTR and TrOCR models are fused; Figure 4 is a data normalization and knowledge extraction layer flowchart of a large language model-based power field knowledge question answering system construction method according to an embodiment of the present application; Figure 5 is an OCR character recognition and correction flowchart of a large language model-based power field knowledge question answering system construction method according to an embodiment of the present application; Figure 6 is a graph neural network inference layer flowchart of a large language model-based power field knowledge question answering system construction method according to an embodiment of the present application; Figure 7 is a vector retrieval and subgraph screening flowchart of a large language model-based power field knowledge question answering system construction method according to an embodiment of the present application; Figure 8 is a high-confidence path screening and prompt rewriting layer flowchart of a large language model-based power field knowledge question answering system construction method according to an embodiment of the present application; Figure 9 is a large language model semantic completion layer flowchart of a large language model-based power field knowledge question answering system construction method according to an embodiment of the present application; Figure 10 is a consistency checking and result returning layer flowchart of a large language model-based power field knowledge question answering system construction method according to an embodiment of the present application; Figure 11 is a knowledge graph construction flowchart of a large language model-based power field knowledge question answering system construction method according to an embodiment of the present application. DETAILED DESCRIPTION
[0029] To further explain the embodiments, the present application provides drawings which are part of the disclosure of the present application, mainly used to illustrate the embodiments, and can explain the operating principle of the embodiments in conjunction with the related description of the specification. With reference to these contents, those skilled in the art should understand other possible implementations and advantages of the present application.
[0030] According to an embodiment of the present application, a large language model-based power field knowledge question answering system construction method is provided.
[0031] The present application will be further described in conjunction with the drawings and specific embodiments, such as Figure 1As shown, the power field knowledge question answering system construction method based on the large language model according to the embodiment of the application comprises: In step S1, the data type of the power field knowledge is judged, and the processing technology is matched according to the judgment result to execute processing on the power field knowledge, generate entity relationship triples, and construct a power field knowledge graph.
[0032] In one embodiment, when judging the data type of the power field knowledge and executing processing on the power field knowledge according to the judgment result, generating entity relationship triples, and constructing a power field knowledge graph, the power field knowledge can be obtained, the data format type of the power field knowledge is judged, the text type power field knowledge is processed using a data analysis pipeline according to the judgment result, and the text version power field knowledge is output; the picture type power field knowledge is processed using an optical character recognition technology, transcription errors in the recognition result are identified and corrected, and the corresponding picture type text power field knowledge is output; the text version power field knowledge and the picture type text power field knowledge are fused, and entity relationship triples are generated using a recognition model and the fusion result to construct a power field knowledge graph.
[0033] In one embodiment, when judging the data type of the power field knowledge and executing processing on the power field knowledge according to the judgment result, generating entity relationship triples, and constructing a power field knowledge graph, the power field knowledge can be obtained, the data format type of the power field knowledge is judged, the text type power field knowledge is processed using a data analysis pipeline according to the judgment result, and the text version power field knowledge is output; the picture type power field knowledge is processed using an optical character recognition technology, transcription errors in the recognition result are identified and corrected, and the corresponding picture type text power field knowledge is output; the text version power field knowledge and the picture type text power field knowledge are fused, and entity relationship triples are generated using a recognition model and the fusion result to construct a power field knowledge graph.
[0034] Specifically, in the formula symbol image is preprocessed based on optical character recognition technology, and according to the processing result and the power term injection technology, the semantic state of the formula symbol is added, and the picture class text power field knowledge is obtained by combining the text sequence. The edge detection tool can be used to extract the power symbol and formula in the formula symbol image, and after the expansion and fracture position filling processing of the power symbol and formula, the size of the formula symbol image is unified, and the preprocessing of the formula symbol image is completed. According to the preprocessing result, the power symbol and formula in the formula symbol image are injected with power terms, and the semantic expression accuracy of the injection result is judged, the power term content is optimized, and the picture class text power field knowledge is obtained by combining the text sequence.
[0035] In the process of fusing the text version power field knowledge and the picture class text power field knowledge, and using the recognition model and the fusion result to generate entity relationship triplets, and constructing the power field knowledge graph, the time and label can be added to the text version power field knowledge and the picture class text power field knowledge respectively, and the target category entity information can be generated by using the natural language processing model according to the label result; the cause-effect relationship is extracted from the text version power field knowledge and the picture class text power field knowledge based on the dependency syntax, and the long short-term memory network is used to complete the extraction result to generate candidate triplets; the target category entity information is aligned to the semantic dictionary by hash mapping table for standardization processing, and the triplets are generated by combining the candidate triplets, and the triplets are detected for conflict resolution; the rejection decision of the triplets is obtained according to the detection result, the triplets are put into the error library or are processed for secondary review based on the rejection decision, and the content of the graph database is determined to construct the power field knowledge graph.
[0036] Step S2, based on attention network optimization of power field knowledge graph, using the optimized power field knowledge graph to output the solution causal path of the fault problem, and labeling the confidence score of the solution causal path.
[0037] In one embodiment, when optimizing the electric power field knowledge graph based on the attention network, using the optimized electric power field knowledge graph to output the causal path of the solution to the fault problem, and marking the confidence score of the causal path of the solution, the target category entity information in the electric power field knowledge graph can be assigned a node color, the causal relationship can be assigned an edge style, and the electric power field knowledge graph can be average pooled according to the assigned results; the pooled electric power field knowledge graph is convolved using a heterogeneous attention network to extract the features and rules in the electric power field knowledge graph and determine the semantic information in the electric power field knowledge graph; based on the semantic information, the complete causal link is extracted and marked as a positive example, and the causal recognition model is trained with the binary cross entropy as the loss function to identify the real causal chain in the electric power field knowledge graph; the fault problem content is set and input into the electric power field knowledge graph to obtain the subgraph area corresponding to the real causal chain, the causal path of the solution to the fault problem is output based on the subgraph area, and the confidence score of the causal path of the solution is marked.
[0038] Among them, when setting the fault problem content, inputting it into the electric power field knowledge graph to obtain the subgraph area corresponding to the real causal chain, outputting the causal path of the solution to the fault problem based on the subgraph area, and marking the confidence score of the causal path of the solution, the fault problem content can be set, and the core entities and corresponding types can be extracted from the fault problem content, and the nodes matching the entity type are retained in the electric power field knowledge graph, and the nodes without logical association are excluded to obtain candidate nodes; the candidate nodes and the input entities are respectively mapped to the semantic vector space to judge the vector similarity, and clustering clusters are formed based on the vector similarity using a clustering algorithm, and several clusters with the highest similarity to the input entity are retained; several subgraphs are constructed according to the clustering results, and a search operation is performed to obtain the most similar candidate nodes, the search results of several subgraphs are merged, and temporal consistency verification is performed to output a high-confidence subgraph; the high-confidence subgraph is reasoned and analyzed using a graph neural network, and the causal path of the solution to the fault problem is obtained according to the reasoning results, and the credibility of the causal path of the solution is marked, and the causal path of the solution is arranged.
[0039] Among them, when using graph neural networks to perform reasoning analysis on high-confidence subgraphs, the causal path of the solution to the fault problem is obtained based on the reasoning results, and the credibility of the causal path of the solution is marked. When arranging the causal paths of the solution, the embedding vectors of the nodes in the high-confidence subgraph can be updated based on the message passing mechanism, the dependency relationship between the nodes can be captured, and several causal paths of the solution that meet the requirements of the fault problem solution can be obtained based on the dependency relationship; the graph neural network is used to perform reasoning analysis on the causal path of the solution, and the scoring structure of the causal path of the solution is obtained to output the confidence ranking, and the top three causal paths of the solution are selected according to the ranking results; the selected causal paths of the solution are refined into natural language short sentences, and the corresponding confidence scores are marked for the natural language short sentences, and the original path encoding of the causal path of the solution is recorded at the same time.
[0040] Step S3, input the answer causal path and the confidence score into the language model, obtain the fault question and answer result, and optimize the question and answer result according to the consistency of the fault question and answer result and the power field knowledge graph.
[0041] In one embodiment, when the answer causal path and the confidence score are input into the language model, the fault question and answer result is obtained, and the question and answer result is optimized according to the consistency of the fault question and answer result and the power field knowledge graph, the decoding temperature of the language model can be set, and the answer causal path and the confidence score are input into the language model to supplement the cross-sentence weak logical relationship not explicitly labeled in the power field knowledge graph; the encoding of the supplemented answer causal path is compared and analyzed by using regular analysis, the newly added entities and relationships appearing outside the encoding are checked piece by piece, and it is judged whether there are corresponding entities and relationships in the power field knowledge graph; the judgment result is analyzed and verified, the fault question and answer result is output, and a graph view is generated based on the fault question and answer result and pushed to the front end for display.
[0042] In one embodiment, when the answer causal path and the confidence score are input into the language model, the fault question and answer result is obtained, and the question and answer result is optimized according to the consistency of the fault question and answer result and the power field knowledge graph, the decoding temperature of the language model can be set, and the answer causal path and the confidence score are input into the language model to supplement the cross-sentence weak logical relationship not explicitly labeled in the power field knowledge graph; the encoding of the supplemented answer causal path is compared and analyzed by using regular analysis, the newly added entities and relationships appearing outside the encoding are checked piece by piece, and it is judged whether there are corresponding entities and relationships in the power field knowledge graph; the judgment result is analyzed and verified, the fault question and answer result is output, and a graph view is generated based on the fault question and answer result and pushed to the front end for display.
[0043] As shown in Figure 2 The bottom layer is the data normalization and knowledge extraction layer, in which various types of raw data such as operation procedures, accident reports, maintenance logs and SCADA data segments are sent to a unified data analysis pipeline for processing; for PDF format files or scanned copies, the improved optical character recognition (OCR) technology is used to convert the text in the picture into editable text, and the recognition errors are corrected to ensure the accuracy of the text content. Through the improvement of each link in the traditional OCR process, the problem of low accuracy and high manual review cost in the traditional process in the processing of power documents is solved, and the demand of the industry for high-precision data extraction is met.
[0044] Improving each link in the traditional OCR process can solve the problems of low accuracy and high manual review cost in traditional process in power document processing, and meet the industry's demand for high-precision data extraction. The "use of vectors to perform local k-NN (k-NN) retrieval operations in the knowledge graph to filter out the subgraph area with the highest similarity to the input description". The retrieval strategy here is improved to a hierarchical retrieval strategy, which narrows down the search range and improves the accuracy of subgraph matching through multi-level screening strategy, and combines semantic similarity and power system topology constraints to significantly improve the accuracy and efficiency of knowledge graph retrieval.
[0045] Traditional OCR technology is mainly used to convert text in images into editable text, and the core process is divided into four links: image preprocessing, text detection, text recognition, and error correction. The image preprocessing stage relies on basic grayscale and simple filtering, which is difficult to repair the low resolution and blur problems of old archives. The text detection uses a general algorithm, which is insufficient in analyzing the multi-column layout and picture-text mixed layout structure of power regulations. The recognition stage relies on traditional CNN models, which cannot accurately process power-specific symbols such as "kV" and "Ω" and small font text. The error correction mechanism only uses dictionary matching and rule checking, which lacks semantic understanding ability and is difficult to correct context-related errors. These defects result in low accuracy and high manual review cost in traditional process in power document processing, which is difficult to meet the industry's demand for high-precision data extraction.
[0046] To solve the above problems, the improved OCR process realizes innovation through multi-link technology, and its specific implementation includes: Step one, introduce super-resolution magnification technology, use ESRGAN model to magnify low-resolution images by 2 times, effectively reconstruct character details, such as improving the fuzzy "circuit breaker operation instructions" text from difficult to recognize to clear and visible, combined with convolution-Laplacian filter and bilateral filter, remove scanning noise (such as paper creases, ink spots) while preserving the clarity of text edges, avoid the problem of stroke sticking caused by traditional filtering. Finally, through angle detection and cropping, the skewed or deformed page is straightened, and the text arrangement is more regular.
[0047] Step two, use PaddleOCR's PP-StructureV3 model to accurately locate text blocks using DifferentiableBinarization (DBNet) algorithm, and separate non-text areas such as tables and pictures to reduce the miss rate.
[0048] Step three, responsible for converting image text into editable text, encountering distorted, vertical or mixed font text, use SVTR model processing; encounter formulas, power symbols (such as "500kV", "current transformer ratio") and other complex content, use TrOCR model, and through light fine-tuning to make it understand power professional terms better, and introduce "cross-modal semantic guidance" technology, combined with power equipment coding knowledge, to make the model accurately identify professional vocabulary.
[0049] As shown in Figures 3 to 5 When processing distorted or vertical text in the power inspection scene, SVTR adopts four-step optimization strategy to achieve high-precision recognition: Step one, through adaptive histogram equalization to improve the clarity of low-contrast images, combined with σ =1.0 Gaussian blur effectively reduces noise interference in inspection images, traditional methods use DB text detection model to locate text area, and set fixed detection threshold to filter pseudo text in device background, this step may miss weak boundary text by using fixed detection threshold, and the scene processing of device nameplate with similar background color is not good, so four threshold values of 0.5, 0.6, 0.7 and 0.8 are selected for fusion, the detection results under different threshold values are generated and weighted combined, and the context perception mechanism is introduced to use the device position information in the picture to assist detection.
[0050] Step two, based on the angle regression branch of EAST model to predict the text tilt angle, and through HOG feature analysis to accurately identify vertical text, use TPS thin plate spline model to map irregular text area to regular rectangle, and add control points to the edge of power equipment label to significantly improve the correction accuracy of distorted text.
[0051] Step three, replace ResNet-50 with HRNet backbone network to extract multi-scale features, ResNet-50 has insufficient ability to extract detailed features of power symbols, while HRNet network can maintain high-resolution feature maps to retain symbol details, and strengthen edge detection to highlight "kV" and other power symbols; The Transformer encoder uses 8-head self-attention mechanism to process feature sequences, combined with relative position encoding to better capture the spatial relationship of distorted text, and when using CTC decoder to generate text sequences, introduce power terminology dictionary to constrain the decoding process, and prefer to select professional terms such as "circuit breaker" and "transformer".
[0052] Step four, verify the recognition result through knowledge graph, check whether the symbols such as "500kV" match the device code, and use device type constraints to ensure the consistency of terms such as "circuit breaker" and "switch" in the same device context, finally realize high-precision recognition of distorted / vertical text in the power field.
[0053] In processing the formulas and professional symbols in power inspection images, the TrOCR model adopts a deep domain adaptation strategy to achieve high-precision recognition. I. TrOCR processing flowchart image preprocessing: Using color differences (such as blue formulas) and edge detection tools, the part containing power symbols and formulas is precisely circled to avoid interference from irrelevant content; for "Ω" and "℃" such power symbols, through image dilation processing, the broken strokes are filled to make the symbol outline clearer and more complete; at the same time, the image is uniformly adjusted to 384x384 pixels, and the light and dark contrast between the symbol and the background is enhanced, making professional content such as "kV" and "current transformer ratio" more eye-catching, which can better help the TrOCR model accurately recognize power professional symbols and formulas.
[0054] II. Light fine-tuning: Based on the Microsoft / TrOCR-large-handwritten pre-training model, the VisionTransformer encoder is retained and the text decoder is replaced; by freezing 95% of the pre-training parameters, only the last two layers of Transformer are fine-tuned, and the LoRA (Low-Rank Adaptation) technology is used to reduce the trainable parameter amount to 0.5%, significantly improving the fine-tuning efficiency.
[0055] Microsoft / TrOCR-large-handwritten pre-training model is a handwritten text recognition model (HTR) that belongs to the TrOCR series. Based on deep learning technology, it is mainly used to solve the problem of handwritten text recognition in images, and can also handle some printed text.
[0056] Vision Transformer encoder is a visual feature extraction model based on Transformer architecture, which can divide the original image into fixed-size "image blocks" and learn the global relationship between these image blocks through a mechanism to extract high-level semantic features of the image.
[0057] LoRA (Low-Rank Adaptation) is an efficient parameter fine-tuning technology that introduces a small number of trainable low-rank matrices into the pre-trained model, significantly reducing the number of parameters that need to be updated, while reducing the demand for computing resources and maintaining or even improving the model's performance on specific tasks.
[0058] III. Power terminology injection: When constructing the synthetic dataset, the power symbols such as "500kV" and "CT ratio" are fused with random backgrounds, and the real formula area in the power manual is rotated and scaled for enhancement; in the loss function, the professional vocabulary such as "current transformer" and "insulation resistance" is given a weight of 2 times, and the recognition consistency of "Ω" and "ohm" is ensured through symbol consistency constraints.
[0059] Four, cross-modal semantic guidance: To further improve the recognition accuracy of power professional symbols, the system deeply embeds the device encoding vector in the knowledge graph (such as "line 5001") into the model training process, and innovatively introduces a symbol-specific attention head in the TrOCR decoder. This attention head is customized for high-frequency symbols in the power field (such as "kV", "Ω", "CT"), and through the reinforcement of attention weight distribution on symbol features, it can more sensitively capture power symbol information in the text. At the same time, with the cross-modal attention layer, it realizes the bidirectional interaction and deep fusion of text visual features and device semantic knowledge, effectively solves the problems of easy confusion and missed detection of professional symbols, and significantly improves the recognition accuracy and stability of the model for complex symbols and terms in the power industry.
[0060] Five, post-processing optimization: Through the symbol standardization module, automatic conversion of non-standard expressions such as "ω→Ω" and "kva→kVA" is realized; a physical law verification mechanism is introduced to check the rationality of the formula (such as P=UI), and a unit consistency check is performed to ensure that "500kV" is not misrecognized as "500kW", finally forming an end-to-end power professional text recognition solution.
[0061] The final step of error correction and semantic calibration ensures accurate and error-free text, which mainly includes three steps of error correction: first, use the power industry-specific dictionary to find homophonic and homographic errors such as "hezhan", then use the BERT model to check the context and exclude semantically incoherent expressions such as "voltage overhang", and finally use the BART model to polish and modify the sentence, such as changing "the protection device misoperation should be due to loose wiring" to the correct expression. After completing the error correction, the results are compared with the State Grid device coding table, and the low-confidence words are marked out for manual review to continuously improve the professional term library.
[0062] Subsequently, the Chinese NER-BERT model trained specifically for the power industry is used to deeply analyze the processed text, extracting key entities such as "device - component - failure mode - disposal measures" and four types of logical relationships between entities such as "composition, timing, causality, and dependency". The extracted entity relationships are presented in the form of triples, such as (Device A, Composition, Component B) and (Fault Event X, Causality, Disposal Measure Y).
[0063] Finally, the triple data is aligned with the State Grid equipment coding table and the semantic dictionary of IEC61970 / 61968 standard, the terminology and data format are unified, and the data ambiguity is eliminated. The aligned data will be written into the graph database, and the power knowledge graph will be gradually constructed and continuously updated, providing a structured knowledge base for the upper system.
[0064] As shown in Figure 11 The power field knowledge graph is constructed in nine sequential links in a closed loop iteration, each link is presented as a rectangular node in the figure and connected by a one-way arrow, forming a complete pipeline from data aggregation to quality assurance, the process is as follows: I. Data source aggregation: Operation procedures, accident reports, maintenance logs and SCADA real-time messages are imported into the unified staging area through the ETL pipeline, PDF and scanned files are kept in TIFF format, database records are saved in CSV / JSON, and all data are labeled with time and version tags to lay the foundation for subsequent incremental updates.
[0065] II. Preprocessing: Text files are recovered to paragraph level through OCR and layout analysis, SCADA messages are first parsed according to the communication protocol, and then the key fields are mapped to readable text, producing a "clean text + metadata" structure, and the encoding is unified to UTF-8.
[0066] III. Entity extraction: The power-specific NER-BERT model is used in conjunction with CRF to label six types of entities: "equipment, components, failure modes, operation measures, measurement points, and parameters"; low-confidence fragments trigger rule compensation (such as regular equipment model capture).
[0067] IV. Relation extraction: Based on dependency syntax and template matching, five types of relationships are extracted: "composition, causality, timing, constraints, and action"; long-sentence cross-sentence causality uses an LSTM-based inter-sentence relationship model to complete, generating candidate triples.
[0068] V. Mapping and normalization: All entities are aligned to the State Grid equipment coding (SG-DB) and IEC61970 / 61968 dictionary through the hash mapping table, nodes with the same name but different codes or different names but the same code are merged, and the version traceability field is retained.
[0069] VI. Triple generation: Normalized entities and verified relationships are combined into 〈subject, predicate, object〉 triples and written into the graph database Neo4j, while recording the source document ID, sentence offset, and confidence for each edge.
[0070] VII. Conflict detection and resolution: Offline batch tasks periodically scan the graph and discover self-consistency conflicts (such as circular causality) or attribute conflicts (such as different device ratings). The system calls the GraphQL interface to list conflict candidates for experts to merge or reject in the visualization panel.
[0071] 8. Human-machine collaborative verification: The decision confirmed by the experts is written back into the “Decision Form”, and 5% of high-confidence triples are sampled for secondary review. The rejected content is entered into the error library for the next round of extraction model fine-tuning.
[0072] 9. Incremental Writing and Quality Assurance The merged triplets are appended to the main graph in batch mode, simultaneously updating the vector index and GNN training samples. A quality assurance script enforces 20 consistency assertions on the new content (e.g., device-component hierarchy integrity), automatically rolling back and generating an alert if any assertion fails.
[0073] The above nine steps form a daily closed loop: document storage during the day, extraction in the evening, conflict resolution and incremental writing at night. By the next morning, the graph is already in the latest state and can be instantly called by the GNN reasoning layer and question-answering system, realizing the full-link automation of "document update → knowledge injection → simultaneous improvement of diagnostic capabilities".
[0074] like Figure 6 As shown in the figure, after the electric power knowledge graph is constructed, it enters the second layer - the graph neural network inference layer. In this layer, in order to facilitate the distinction and processing of different types of information, each entity in the knowledge graph (such as equipment, faults, measures, etc.) is assigned a specific node color, and different styles of edges are used to represent the relationship between entities (such as causal relationships, composition relationships, etc.). In this way, the entire knowledge graph becomes intuitive and easy to understand.
[0075] This layer uses the Hetero-GAT (Hetero-GAT) to perform in-depth analysis of the knowledge graph. Specifically, the model performs K convolution operations on the graph to extract and learn the features and patterns in the graph. The initial feature vector of each node is obtained by averaging the sentence vectors of the relevant document context. This method allows the node to better "remember" the semantic information of the surrounding text.
[0076] The model was trained on confirmed complete causal links of "cause-fault-measure." A binary cross-entropy loss function with temperature modulation was used during training. Existing causal links were labeled as positive examples (labeled 1), while non-existent links were randomly selected from the graph as negative examples (labeled 0). After 30 training iterations, the model achieved an AUC of 0.93 on the validation set, demonstrating that the model can accurately identify true causal relationships and assign them a high degree of confidence, making them more reliable for reasoning.
[0077] The third layer is a high-confidence path screening and prompt rewriting layer. When an operation and maintenance personnel inputs a fault description such as “No. 3 generator excitation tripping and filter temperature rise abnormality” in a front-end interface, the resolver first converts the text into a vector form, maps it into a vector space, and performs a local k-neighbor (k-NN) retrieval operation in the knowledge graph using the vector. The retrieval strategy is improved to a hierarchical retrieval strategy. Through a multi-level screening strategy, the accuracy and efficiency of knowledge graph retrieval are significantly improved in combination with semantic similarity and power system topology constraints, and the implementation process is described in detail.
[0078] Then, the vector is used to perform a hierarchical retrieval strategy in the knowledge graph to screen out the subgraph area with the highest similarity to the input description. A graph neural network (GNN) analyzes and reasons these subgraphs, and outputs several “cause-fault-measure” paths with the highest confidence, such as “excitation control board short circuit → excitation tripping → repair excitation control board”.
[0079] The text vector conversion step converts the natural language fault description into a vector containing power field semantics, laying the foundation for retrieval and reasoning. It includes the following steps: Step one, unify device names and units of measurement, and split complex faults into independent faults. Extract entities and types through the power field NER model.
[0080] Step two, use the power field contrast learning encoder to encode the text into a 768-dimensional vector, while injecting entity type labels (such as “device” and “fault”). Concatenate the device encoding with the topology vector of the device in the knowledge graph to enhance the spatial relevance of the vector.
[0081] As shown in Figure 7 The traditional global k-NN retrieval in vector retrieval and subgraph screening may introduce irrelevant nodes, such as devices that co-occur with “filter” but are not related to faults. Therefore, the hierarchical retrieval strategy is adopted. Through a multi-level screening strategy, the accuracy and efficiency of knowledge graph retrieval are significantly improved in combination with semantic similarity and power system topology constraints.
[0082] The first layer of entity type constraint filtering can quickly narrow the search range and exclude nodes that are not related to the input entity type. It includes three steps: entity type identification, type index filtering, and topology constraint filtering. Specifically, entity type identification extracts core entities and their types from the input text, such as devices, faults, and parameters. Type index filtering retains only nodes that match the entity type in the knowledge graph. Topology constraint filtering excludes nodes that have no physical connection or logical association with the input device.
[0083] The second layer semantic clustering and subspace division is a semantic clustering based on fault types in the retained candidate nodes to form a subspace with clear theme and narrow the search range, which specifically includes the following steps: Step one, map the candidate nodes and the input entity to a semantic vector space respectively; Step two, use DBSCAN or hierarchical clustering algorithm to form a clustering cluster according to the vector similarity; Step three, retain the top K clusters with the highest similarity to the input entity for clustering evaluation and screening.
[0084] The third layer subspace k-NN fine search: in each subspace formed by the semantic clustering, perform local k-NN search to obtain high-precision matching, which specifically includes the following steps: Step one, based on the clustering screened in the second layer, construct an independent subgraph; Step two, perform k-NN in each subgraph to obtain the most similar node; Step three, merge the search results of each subgraph and sort according to the similarity and topological correlation.
[0085] The fourth layer is the time sequence constraint verification and path pruning: verify whether the search result meets the time sequence logic of power system fault propagation, which specifically includes the following steps: Step one, extract the time sequence constraint relationship between nodes from the knowledge graph; Step two, check whether the search path meets the time sequence constraint; Step three, exclude the paths that do not meet the time sequence logic, retain the effective paths, and finally output the high-confidence subgraph.
[0086] As shown in Figure 8 , the graph neural network inference and path sorting is to infer the causal path with high confidence in the input high-confidence subgraph, and quantify the credibility of each path, which specifically includes the following steps: Step one, update the embedding vector of the subgraph node through the message passing mechanism to capture the dependency relationship between nodes, such as the causal strength of "short circuit" to "excitation trip", the GNN model trained based on historical accident data scores all possible "cause-fault-measure" paths and outputs the confidence ranking.
[0087] Step two, the top three paths are refined into short natural language sentences that are easy to understand, and each sentence is marked with a corresponding confidence score and path ID, such as 〈path #A93, confidence 0.82〉. The path summary and the original query text are transmitted to the fourth layer large language model. When generating prompts, the system uses a specific template that retains the path ID placeholder and requires the large language model to elaborate in a structured framework of "reason-mechanism-measures". At the end of each elaboration paragraph, the original path is referenced through the [ID] tag to ensure traceability and logical consistency of the content.
[0088] As shown in Figure 9 , the fourth layer is the large language model semantic completion layer. In this embodiment, the Llama-3-13B model is selected after 8-bit quantization processing, and the decoding temperature is set to 0.2. Under this configuration, the model can generate complete text paragraphs covering background principles, inspection priorities, and specific operation guidelines within about 1 second. Since the input content has specified three reasoning paths with their confidence scores, the model's generated content is basically limited to the range allowed by the preset rules. However, the model can still supplement the cross-sentence weak logical relationships not explicitly labeled in the knowledge graph, such as when there is a "synchronous generator voltage transient drop exceeding 15% and filter temperature rise exceeding limit" situation, the model can infer the deeper causal relationship of "control board short circuit further causing excitation out-of-step".
[0089] As shown in Figure 10 , the fifth layer is the consistency verification and result return layer. The generated text is first parsed by regular expressions to compare all path IDs. If a new entity or relationship appears outside the ID, it is checked piece by piece: if it does not exist in the graph and the GNN confidence is below the threshold of 0.3, the text is rejected and a local rewrite is triggered; if the confidence is NULL only because the graph is missing edges, the candidate triple is temporarily stored and can be written back to the graph after manual review. After verification, the answer is pushed to the front end in Markdown format, along with a graph view of the three high-confidence paths, allowing operations personnel to click and view detailed triples and historical cases. The average time for a complete query is about 2.8 seconds, of which 0.5 seconds is data retrieval, 0.7 seconds is GNN reasoning, 1.0 seconds is LLM generation, and the rest is verification and serialization.
[0090] Through the above five-layer process, this embodiment achieves complementarity between graph topology constraints and language completion: GNN ensures mechanism logic compliance, and LLM is responsible for completing weak relationships and natural language expression; the verification layer forms a closed loop to further eliminate residual illusions. This combination not only provides symbol-level traceability but also maintains human-friendly text readability, fully meeting the business needs of fast and accurate fault diagnosis in the power grid.
[0091] In the closed reasoning link of "graph topology constraint - graph neural inference - large language model semantic completion - consistency verification" proposed by this embodiment, each link is indispensable and cooperates with each other. The core protection points include the following aspects: (1) The explicit ontology constraint provided by the power domain knowledge graph is used to limit the decoding search space of the large language model, rather than simply checking the results after answering. Instead, the link confidence of the graph is inferred by means of the graph neural network before generation, and the candidate fault causal chain is compressed to a high-confidence set consistent with the power equipment topology and operation mechanism, thereby fundamentally suppressing the "illusion" tendency of the large language model to fabricate non-existent devices, relationships or disposal measures.
[0092] (2) The high-confidence candidate path is dynamically written in the form of "summary + path ID + confidence" in the prompt, retaining a symbol-level index inside the large language model. This makes the key conclusions in the generated text one-to-one correspond to the graph triples and traceable. Moreover, this prompt rewriting strategy does not expose the entire graph to avoid context inflation, and ensures that the model has sufficient domain prior to complete deep semantic completion, which is not compatible with traditional retrieval enhancement (only concatenating original text fragments) or template generation (only outputting fixed formats).
[0093] (3) The output consistency verification forms a real-time closed loop by comparing the large language model text with the graph neural network confidence distribution. Any entity or relationship that appears in the text but is missing from the graph and has insufficient confidence threshold will trigger local rewriting or manual annotation. Weak causes across sentences completed by the LLM can be written back into the graph after being approved by humans. With this forward filtering and reverse incremental mechanism, the system not only ensures the accuracy of immediate diagnosis, but also has the ability to evolve.
[0094] (4) The knowledge graph construction pipeline and the reasoning link maintain a unified identification at the level of "entity specification name + path ID". From document OCR, entity recognition to triple storage, to GNN inference and LLM answer, the information is complete and unique in semantics throughout the whole process, ensuring that each diagnostic suggestion can be traced back to the original literature paragraph and accident record, providing a technical basis for safety audit and responsibility tracing in the operation site.
[0095] On the basis of the topology constraint provided by the power knowledge graph, this embodiment first screens high-confidence causal chains using graph neural networks, then drives the large language model to perform semantic completion generation with path-indexed prompts, and establishes a consistency verification closed loop by comparing confidence distributions, thereby outputting fault diagnosis suggestions that are consistent with the theoretical mechanism and have natural language readability.
[0096] Compared with the existing single LLM, pure knowledge graph reasoning, or graph neural network templated output, this embodiment has irreplaceable comprehensive advantages. After introducing the topological constraints of the power knowledge graph and graph neural network, the screening of high-confidence causal chains is completed before the generation phase begins. Therefore, the large language model no longer needs to "guess" the fault mechanism in the global vocabulary space. In theory, this improvement can reduce the source of hallucinations by orders of magnitude; this is confirmed in offline playback experiments: the unconstrained model misdiagnosis rate of the same test set was 28%, which dropped to below 4% after adding topological filtering.
[0097] Secondly, although graphs and GNNs can ensure mechanism compliance, they inherently lack natural language expression capabilities. This embodiment retains the large language model as the core of semantic completion and text generation, making the answers not only accurate but also logically smooth and contextually coherent. They can be read and adopted directly by operation and maintenance personnel on on-site work orders or mobile terminals, eliminating the previous secondary review process of "reading the number first, then flipping through the manual". In addition, the path ID embedded in the prompt establishes a symbolic alignment relationship, and the output can only be returned after consistency verification. This allows each diagnostic suggestion to be traced back to the specific triple and original document paragraph, and the complete source can be given during audits, training, or accident replays. This solves the pain point that general LLM cannot explain the reasoning process. The reverse write-back mechanism in the final verification link gives the system the ability to self-evolve: if the large language model proposes a weak causal relationship that is not explicitly connected in the graph but does exist in the literature, it can be written back into the graph after manual confirmation and included in the next round of reasoning. This closed loop of forward filtering and reverse increment complementarity enables the system accuracy to increase with use, avoiding the bottleneck of traditional graphs that "build and become obsolete". Comprehensively considering the four dimensions of accuracy, readability, traceability and self-evolution, this embodiment is significantly superior to any existing single-path solution, thus demonstrating unique and quantifiable technical advantages in the scenario of smart power operation and maintenance.
[0098] At the same time, this embodiment systematically lists and explains alternative technical paths that can essentially achieve the same purpose.
[0099] First, in the topology constraint link, if graph neural networks are not used, rule-based path search engines or random walk-PageRank scorers can also be used. As long as high-confidence candidate links that comply with the power ontology rules can be obtained on the knowledge graph structure and passed to the subsequent generation module in the form of confidence vectors, it is an equivalent implementation. At the same time, in the semantic completion and natural language generation links, the large language model can be completely replaced by the retrieval generation (RAG) framework: first map the high-confidence path back to the source document paragraph, and then perform template fragment splicing or small industry-specific Transformer generation on the paragraph, and readable text can also be output; as long as the text generation stage still explicitly relies on the previous topology filtering results and retains the path index, it falls within the scope of protection of the present invention.
[0100] Again, if the knowledge graph is modified to use a traditional relational database plus a view layer, it can also play the same role of explicit rules, or compress triples into low-dimensional embedding and store them in a vector database, and then use nearest neighbor recall combined with logical rule filtering to achieve the same topological constraint effect. As for consistency checking closed loop, logical program synthesis engine, type system checker, and even constraint verification based on SMT solver, as long as they are responsible for comparing the consistency of "text-path-confidence" before the result is returned, they can be considered as equivalent technical means of the present application. Finally, in the deployment form, whether the process is encapsulated as a monolithic service, container orchestration, serverless function, or split into a hybrid architecture of edge-cloud collaboration, as long as it follows the core link of "topological filtering first, then semantic completion, and finally consistency checking", it cannot deviate from the essential spirit of the present embodiment.
[0101] In the above embodiments, GNN represents a graph neural network; Prompt represents in the field of artificial intelligence and natural language processing, Prompt (prompt) refers to the text input provided by the user to the model (such as a large language model) to guide the model to generate a specific type of response or complete a specific task. It is the core way of human and model interaction. Through precise design of Prompt, users can make the model understand the intention, execute the instruction, generate the content or answer the question.
[0102] SCADA fragment represents a part of the function, code or data set in the data acquisition and monitoring control system (Supervisory Control And Data Acquisition, SCADA for short), and OCR represents the abbreviation of Optical Character Recognition, which is a technology that converts the text image in paper documents, pictures or screen content into editable and searchable electronic text through optical equipment such as scanners, cameras, etc.
[0103] The above only describes the preferred embodiments of the present application and is not intended to limit the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A method for constructing a knowledge question-answering system in the power field based on a large language model, characterized by: The construction method includes: Determine the data type of power domain knowledge, and use matching processing technologies to process the power domain knowledge based on the judgment results, generate entity relationship triples, and construct a power domain knowledge graph; Optimize the knowledge graph in the power field based on the attention network, use the optimized knowledge graph in the power field to output the causal path of the solution to the fault problem, and annotate the confidence score of the causal path of the solution; The causal path and confidence score of the answer are input into the language model to obtain the fault question and answer results. The question and answer results are optimized based on the consistency between the fault question and answer results and the knowledge graph in the power field.
2. The method for constructing a knowledge question-answering system in the electric power field based on a large language model according to claim 1 is characterized in that: The method of determining the data type of the electric power domain knowledge and performing processing on the electric power domain knowledge by matching processing technologies according to the determination results to generate entity relationship triples and construct the electric power domain knowledge graph includes: Acquire power domain knowledge, determine the data format type of the power domain knowledge, process the text-based power domain knowledge using the data parsing pipeline based on the determination result, and output the text-based power domain knowledge; Use optical character recognition technology to convert image-based power domain knowledge into text, identify transcription errors in the text conversion results, correct the transcription errors, and output the text-based power domain knowledge corresponding to the image; The text-based electricity domain knowledge and the image-based text-based electricity domain knowledge are integrated, and the recognition model and fusion results are used to generate entity relationship triples to construct a knowledge graph in the electricity domain.
3. The method for constructing a knowledge question-answering system in the electric power field based on a large language model according to claim 2, characterized in that: The method of converting the image-based power domain knowledge into text using optical character recognition technology, identifying transcription errors in the text conversion results, correcting the transcription errors, and outputting the text-based power domain knowledge corresponding to the image-based knowledge includes: Based on the generative adversarial network model, the image of the power domain knowledge is magnified, and the amplified image of the power domain knowledge is denoised using convolutional filters and bilateral filters. Use text detection technology to separate non-text areas in images of power domain knowledge, convert image text in images of power domain knowledge into editable text, and identify deformed text and formula symbol images during the conversion process; The deformed text processing model is used to analyze the tilt angle of the deformed text, and the texture direction is combined with feature analysis to identify vertical text. The irregular text area is mapped into a regular rectangle based on the thin plate spline model to correct the state of the deformed text. The spatial relationship of the deformed text is captured based on the correction results and relative positions, and the decoder is used to generate a text sequence. The consistency of the text sequence in the context is verified and the text sequence is adjusted. The formula symbol images are preprocessed based on optical character recognition technology, and semantic states are added to the formula symbols according to the processing results and the power terminology injection technology. Combined with the text sequence, the picture-based text power field knowledge is obtained.
4. The method for constructing a knowledge question-answering system in the electric power field based on a large language model according to claim 3 is characterized in that: The optical character recognition technology is used to pre-process the formula symbol image, and the semantic state is added to the formula symbol based on the processing results and the power terminology injection technology. The image-based text power domain knowledge is obtained by combining it with the text sequence, including: The power symbols and formulas in the formula symbol image are extracted using edge detection tools, and after the power symbols and formulas are expanded and the broken positions are filled, the size of the formula symbol image is unified to complete the preprocessing of the formula symbol image; Based on the preprocessing results, power terminology is injected into the power symbols and formulas in the formula symbol image, and the semantic expression accuracy of the injected results is judged. The power terminology content is optimized and combined with the text sequence to obtain image-based text power domain knowledge.
5. The method for constructing a knowledge question-answering system in the electric power field based on a large language model according to claim 4 is characterized in that: The integration of text-based electricity domain knowledge and image-based electricity domain knowledge, and the use of recognition models and fusion results to generate entity relationship triples to construct the electricity domain knowledge graph include: Add time and labels to the text version of power domain knowledge and the picture version of power domain knowledge, and use the natural language processing model to generate target category entity information based on the labeling results; Based on dependency syntax, causal relationships are extracted from textual and pictorial power domain knowledge, and long-term short-term memory networks are used to complete the extraction results and generate candidate triples. The target category entity information is aligned to the semantic dictionary through a hash map for normalization, the candidate triples are combined to generate triples, and the triples are subjected to conflict resolution and detection. According to the detection results, the rejection resolution of the triple is obtained, and based on the rejection resolution, the triple is stored in the error library or subjected to a secondary review process, and the content of the graph database is determined to construct a knowledge graph in the power field.
6. The method for constructing a knowledge question-answering system in the electric power field based on a large language model according to claim 1, characterized in that: The method of optimizing the knowledge graph in the electric power field based on the attention network, using the optimized knowledge graph in the electric power field to output the causal path of the solution to the fault problem, and marking the confidence score of the causal path of the solution includes: Assign node colors to target category entity information in the power field knowledge graph, assign edge styles to causal relationships, and perform average pooling on the power field knowledge graph based on the assigned results; The heterogeneous attention network is used to perform convolution operations on the pooled electric power knowledge graph to extract the features and patterns within the electric power knowledge graph and determine the semantic information within the electric power knowledge graph. Based on semantic information, complete causal links are extracted and marked as positive examples. The causal recognition model is trained using binary cross entropy as a loss function to identify the true causal chain in the knowledge graph of the power industry. Set the fault problem content and input it into the power field knowledge graph to obtain the subgraph area corresponding to the real causal chain. Based on the subgraph area, output the causal path to solve the fault problem and mark the confidence score of the causal path.
7. The method for constructing a knowledge question-answering system in the electric power field based on a large language model according to claim 6, characterized in that: The fault problem content is set and input into the power field knowledge graph to obtain the subgraph area corresponding to the real causal chain. The causal path to the fault problem solution is output based on the subgraph area, and the confidence score of the causal path is marked. Set the fault problem content, extract the core entities and corresponding types from the fault problem content, retain the nodes that match the entity type in the power field knowledge graph, exclude the nodes without logical association, and obtain the candidate nodes; Map the candidate nodes and the input entity into the semantic vector space to determine the vector similarity, and use the clustering algorithm to form clusters based on the vector similarity, and retain the clusters with the highest similarity to the input entity; Construct several subgraphs based on the clustering results, perform retrieval operations to obtain the most similar candidate nodes, merge the retrieval results of several subgraphs, and perform temporal consistency verification to output high-confidence subgraphs; Graph neural networks are used to perform reasoning analysis on high-confidence subgraphs. Based on the reasoning results, the causal path to the solution of the fault problem is obtained, the credibility of the causal path is marked, and the causal paths are arranged.
8. The method for constructing a knowledge question-answering system in the electric power field based on a large language model according to claim 7, characterized in that: The graph neural network is used to perform reasoning analysis on the high-confidence subgraph, obtain the causal path of the solution to the fault problem based on the reasoning result, and mark the credibility of the causal path of the solution. The arrangement of the causal path of the solution includes: Update the embedding vectors of nodes in high-confidence subgraphs based on a message passing mechanism, capture the dependencies between nodes, and obtain several causal paths that meet the requirements of fault problem solving based on the dependencies. Use graph neural networks to perform reasoning analysis on the causal paths of the solutions, obtain the scoring structure of the causal paths, output the confidence ranking, and select the top three causal paths based on the ranking results; The screened causal paths of the solutions are refined into natural language sentences, and the corresponding confidence scores are annotated for the natural language sentences. At the same time, the original path codes of the causal paths of the solutions are recorded.
9. The method for constructing a knowledge question-answering system in the electric power field based on a large language model according to claim 1, characterized in that: The causal path and confidence score of the answer are input into the language model to obtain the fault question answering result. Based on the consistency between the fault question answering result and the knowledge graph in the power field, the question answering result is optimized, including: Set the decoding temperature of the language model and input the causal path and confidence score of the answer into the language model to supplement the weak cross-sentence logical relationships that are not clearly marked in the knowledge graph of the power field; The coding of the supplemented causal path is compared using regular expression analysis, and the newly added entities and relationships that appear outside the coding are checked one by one, and it is determined whether there are corresponding entities and relationships in the knowledge graph of the power field; Analyze the verification results based on the judgment results, output the fault question and answer results, and generate a graph view based on the fault question and answer results, and push it to the front-end for display.
10. The method for constructing a knowledge question-answering system in the electric power field based on a large language model according to claim 9, characterized in that: The steps of analyzing the verification results according to the judgment results, outputting the fault question and answer results, generating a graph view based on the fault question and answer results, and pushing the graph view to the front-end for display include: If the corresponding entity and relationship do not exist in the power sector knowledge graph, the confidence of the graph neural network is determined. If the confidence is greater than the threshold, the causal path of the solution is temporarily stored in the candidate triple and written into the power sector knowledge graph after manual review. If corresponding entities and relationships exist in the knowledge graph of the power field, it means that the verification is passed. After the causal path of the answer is converted into a markup language format, the fault question and answer results are output, a graph view is generated, and pushed to the front-end display.
Citation Information
Cited By
Industrial software enhancement system with rational number fusion
CN121091784A
Financial problem analysis method and device based on large language model, equipment and medium
CN121233980A
Business handling reservation state query method based on knowledge graph
CN121412395A
A business handling reservation state query method based on a knowledge graph
CN121412395B
Interactive big and small model collaborative public service complex document analysis method and device
CN121415423A