A power knowledge question and answer system and method based on a large language model generation
By constructing a question-answering system that combines a power knowledge graph and a large language model, the shortcomings of existing power knowledge question-answering systems in complex semantic understanding and logical reasoning are addressed, achieving efficient and accurate power knowledge question answering.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- POWERCHINA BEIJING ENG CORP
- Filing Date
- 2025-09-12
- Publication Date
- 2026-04-17
AI Technical Summary
Existing power knowledge question answering systems suffer from low accuracy and efficiency when dealing with complex semantic understanding and deep logical reasoning. They cannot effectively utilize the entity associations and hierarchical relationships in the power field, leading to information omissions and logical breaks.
A structured power knowledge graph is constructed, and semantic parsing and logical reasoning are performed by combining a large language model. Efficient retrieval and generation are achieved through dual indexing, and the optimal answer is evaluated and optimized through a reflective model.
It significantly improves the accuracy, comprehensiveness, and response efficiency of electricity knowledge Q&A, and can handle complex multi-step reasoning problems, with a 37% increase in retrieval efficiency and a 58% reduction in error rate.
Smart Images

Figure CN121168650B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of artificial intelligence technology application technology, specifically relating to a power knowledge question-answering system and method based on a large language model. Background Technology
[0002] In the application of knowledge-based question-answering systems in the power sector, existing technical solutions mainly revolve around two technical paths: traditional retrieval methods or basic language models. The core limitation of traditional methods lies in their knowledge storage and retrieval patterns: they typically store professional knowledge in the power sector as unstructured text, and the retrieval process relies on keyword matching mechanisms. This mechanism cannot effectively handle the complex semantic understanding needs of user queries, nor can it support deep logical reasoning tasks. Ultimately, this results in a low level of accuracy and response efficiency in the system, failing to meet the basic requirements for precise information acquisition in power scenarios.
[0003] While solutions based on basic language models can overcome the limitations of traditional retrieval methods and generate answers that conform to natural language expression habits, they still have significant technical shortcomings: on the one hand, such models lack sufficient depth of understanding of professional knowledge in the power field (such as equipment parameters, fault mechanisms, industry standard terminology, etc.); on the other hand, their long-chain reasoning ability is weak, and when dealing with complex queries involving multiple entity associations or dense professional terms, they are prone to information omissions, logical breaks, or even factual errors.
[0004] Furthermore, existing technologies lack a systematic graph structure in knowledge organization, making it impossible to effectively utilize entity associations and hierarchical relationships in the power sector for retrieval enhancement, and thus failing to meet the power industry's actual needs for accurate and efficient knowledge-based question answering.
[0005] In view of this, the present invention is hereby proposed. Summary of the Invention
[0006] To address the aforementioned technical problems in existing technologies, this invention provides a power knowledge question-answering system and method based on a large language model. By constructing a structured power knowledge graph and combining it with the strong reasoning capabilities of the large language model, it achieves accurate understanding, efficient retrieval, and reliable generation of user queries, significantly improving the accuracy, comprehensiveness, and response efficiency of power knowledge question-answering.
[0007] To achieve the above objectives, the technical solution of the present invention is as follows:
[0008] Firstly, a power knowledge question-answering system based on a large language model includes:
[0009] Question-and-answer knowledge base module: used to build a knowledge graph in the power industry and establish a dual index;
[0010] Query rewriting module: It is used to perform semantic parsing and logical reasoning on the original query input by the user based on a large language model, supplement implicit information and correct expression defects, and output a rewritten query that meets the retrieval requirements.
[0011] Knowledge retrieval module: used to obtain highly relevant knowledge based on the rewritten query, recall candidate knowledge items through two methods: literal matching and semantic vector matching, and output Top-K retrieval results after rearrangement;
[0012] Content generation module: It is used to generate an initial answer based on the large language model and the Top-K search results. The quality of the initial answer is evaluated by the reflection model. If there are problems, the query is corrected and the search and generation are retried until the optimal answer is obtained.
[0013] Furthermore, the question-and-answer knowledge base module includes:
[0014] Multi-source data acquisition and preprocessing unit: used to clean and preprocess multi-source data such as power industry standards and specifications, equipment technical manuals, and operation and maintenance records, and to extract key terms and concepts;
[0015] Entity Relation Extraction Unit: Used to extract entity relations using a large language model, transforming unstructured text into structured triples, and constructing a knowledge graph in the power industry.
[0016] Matching Index Unit: Used to construct literal matching index and vector matching index using inverted index and knowledge graph embedding model respectively, supporting efficient keyword retrieval and semantic retrieval.
[0017] Furthermore, the expression for entity relation extraction is:
[0018]
[0019] in, Indicates the first Each entity corresponds to a device name, technical parameters, and fault type.
[0020] Furthermore, the semantic parsing includes identifying key entities and query intent in the original query;
[0021] The logical reasoning described is a multi-step logical reasoning based on entity relationships in a knowledge graph.
[0022] Furthermore, the literal matching uses an inverted index to retrieve entities and relationships containing the query keywords;
[0023] The semantic vector matching uses the BGE model to encode the rewritten query into a vector, and retrieves semantically similar entities and relationships from the vector index;
[0024] The reordering is the result of merging literal matching and semantic vectors, and the reordering is performed based on semantic similarity calculation. The Top-K candidates are selected as the search results.
[0025] Furthermore, the semantic vector matching employs cosine similarity, with the specific formula as follows:
[0026]
[0027] in, For semantic vectors, For vectors and dot product, For vectors and The length of the mold, To measure the degree of semantic matching, Used to filter the set of the top k most similar knowledge base entries;
[0028] The rearrangement uses a comprehensive score function, the specific formula of which is:
[0029]
[0030] in, These are the weighting coefficients. For literal matching similarity, For semantic vector similarity, as a candidate All sets of relations involved Candidate results The set of relationships with the queried entity.
[0031] Furthermore, the reflective model evaluation involves a multi-dimensional assessment of the generated results, defining a logical consistency score. Information integrity score The specific formula is as follows:
[0032]
[0033] in, To answer the question of the intersection of effective triples and standard triples, Valid triples extracted from the answer. To answer the question about the intersection of the covered entity and the core entity being queried, To answer the covered query entities, To rewrite the key entities in the query.
[0034] Furthermore, the optimal answer is determined by a comprehensive score. The overall score is used to make a judgment. The calculation formula is:
[0035]
[0036] in, As weight; when the overall score When the value falls below a preset threshold, query correction is triggered, and a new query is generated. When the value exceeds a preset threshold, an answer is output.
[0037] Secondly, a power knowledge question-answering method based on a large language model includes:
[0038] S1. Construct a knowledge graph in the power sector and establish a dual index; the knowledge graph consists of triples of entities, relations, and attribute transformations from multi-source heterogeneous power data; the dual index includes an index for literal matching and a vector index for semantic matching;
[0039] S2. Based on the large language model, perform semantic parsing and logical reasoning on the original query, supplement implicit information and correct expression defects, and output a rewritten query that meets the retrieval requirements.
[0040] S3. Based on the rewritten query, obtain highly relevant knowledge, recall candidate knowledge items through two methods: literal matching and semantic vector matching, and output the Top-K search results after rearrangement.
[0041] S4. Generate an initial answer based on the large language model and the Top-K search results. Evaluate the quality of the initial answer through a reflective model. If there are problems, revise the query and re-trigger the search and generation until the optimal answer is obtained.
[0042] Compared with existing technologies, the present invention provides a power knowledge question-answering system and method based on a large language model. The system includes a question-answering knowledge base for constructing a power knowledge graph and a dual index; a query rewriting module that parses the user's original query and outputs a standardized rewritten query; a knowledge retrieval module with dual recall and ranking that outputs Top-K results; and a content generation module that generates answers and performs closed-loop optimization after reflection and evaluation. The method includes constructing a power knowledge graph and dual index, rewriting the original query based on a large language model, obtaining Top-K results through dual recall and ranking, and reflectively generating and optimizing answers. This addresses the problems of weak semantic understanding in existing power knowledge question-answering technologies, insufficient professionalism and reasoning ability of the basic language model, and lack of a systematic knowledge organization structure. Attached Figure Description
[0043] Figure 1 This is an architecture diagram of the power knowledge question-and-answer system provided in an embodiment of the present invention. Detailed Implementation
[0044] The technical solution of the present invention will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are not all embodiments of the present invention. All other embodiments obtained by those skilled in the art without creative effort are within the protection scope of the present invention.
[0045] It should be noted that, unless otherwise specifically stated, the relative arrangement and numerical expressions of the components and steps described in these embodiments should not be construed as limiting the scope of the invention.
[0046] The following description of exemplary embodiments is merely illustrative and is not intended to limit the invention or its application or use in any way. Techniques, methods, and apparatus known to those skilled in the art may not be discussed in detail herein, but where applicable, such techniques, methods, and apparatus should be considered part of this specification.
[0047] Example 1
[0048] See Figure 1 , Figure 1 This is an architecture diagram of a power knowledge question-answering system based on a large language model proposed in this invention. This system constructs a structured power knowledge graph and combines it with Deepseek's strong reasoning capabilities to achieve accurate understanding, efficient retrieval, and reliable generation of user queries, significantly improving the accuracy, comprehensiveness, and response efficiency of power knowledge question-answering. Specifically, it may include:
[0049] M1, Question-Answer Knowledge Base Module: Used to construct a knowledge graph in the power industry and establish a dual index; the construction of the power industry knowledge graph includes:
[0050] M11, Multi-source Data Acquisition and Preprocessing Unit: Used to clean and preprocess multi-source data such as power industry standards and specifications, equipment technical manuals, and operation and maintenance records, and extract key terms and concepts; preprocessing operations include text cleaning, word segmentation, and entity recognition.
[0051] The multi-source data selection includes heterogeneous data from multiple sources in the power sector, including 1,370 power grid equipment technical manuals (such as transformer and generator operation and maintenance manuals), 4,854 fault handling records (such as transmission line tripping and main transformer oil temperature abnormality records), and 198 industry standards and specifications (such as national standards related to power transformers).
[0052] Text cleaning uses regular expressions to remove redundant symbols (such as "Appendix Notes" and "Non-technical Notes"), garbled characters, and duplicate entries from the data, while retaining core content such as fault descriptions, technical parameters, and processing steps.
[0053] Word segmentation and entity recognition were performed using the spaCy tool, which loaded a customized dictionary for the power industry (containing professional terms such as "inter-turn insulation" and "grounding resistance"). After word segmentation, key terms and concepts were extracted, and entity types (equipment, fault, and parameter) were defined, laying the foundation for subsequent knowledge graph construction.
[0054] M12, Entity Relation Extraction Unit: Used to extract entity relations using a large language model, transforming unstructured text into structured triples, and constructing a knowledge graph in the power industry.
[0055] Entity and relation extraction was performed using the Deepseek large language model. A prompt template for the power industry was constructed, such as "Extract equipment name, fault type, and their relationship from the following text: {text}". For the text "Generator stator winding short-circuit fault due to insulation aging", the model outputs a triple (generator stator winding, due to, insulation aging) or (insulation aging, resulting in, short-circuit fault). Approximately 110,000 triples were generated, constructing a power knowledge graph containing approximately 80,000 entities and 40,000 relations.
[0056] In the knowledge graph extraction stage, drawing inspiration from LightRAG, we leveraged the natural language processing capabilities of the Deepseek large language model to perform deep semantic analysis on the preprocessed text. Entities related to the power industry were extracted using named entity recognition technology. Its mathematical representation is:
[0057]
[0058] in Indicates the first One entity, This serves as the serial number identifier for the entity. This represents the total number of entities; corresponding semantic units include equipment name, technical parameters, and fault type. The relation extraction process can be formalized as a triple generation problem, i.e., for entity pairs... The model calculates its membership in the relation. probability The specific formula is as follows:
[0059]
[0060] in, For relational characteristic functions, It is the total set of relation types. Let R be any candidate relation; semantic associations between entity pairs are learned through a deep neural network. The final constructed knowledge graph is formalized as follows: ,in For a set of triples, satisfying .
[0061] M13, Matching Index Unit: Used to construct literal matching index and vector matching index using inverted index and knowledge graph embedding model respectively, supporting efficient keyword retrieval and semantic retrieval.
[0062] Literal matching indexes are implemented using Elasticsearch and are primarily used for precise or string-based searches. During setup, entity names and relationship descriptions undergo preprocessing such as special character removal and word segmentation. Elasticsearch then automatically builds an inverted index, recording the correspondence between terms and documents. To optimize search performance, the EdgeN-gram tokenizer is configured to support prefix matching, a thesaurus is set to handle equivalent words, and the BM25 similarity algorithm is used for sorting.
[0063] The vector matching index relies on a pre-trained BPE model to extract entity and relation vectors. Entity names and relation descriptions are input into the model, and pooling operations yield 1024-dimensional vector representations. These vectors are then stored in the FAISS index repository, which supports fast large-scale vector retrieval. Appropriate index types such as IVFFlat can be selected as needed, and vector quantization reduces memory usage. During retrieval, the query is converted into a vector, and similar vectors are found in the FAISS index, returning the corresponding content.
[0064] During the index building phase, the literal matching index with a dual-index structure uses inverted index technology for keywords. The corresponding entity set is represented as:
[0065]
[0066] in, For the total collection of entities in the power sector, For a single entity, Keywords used for retrieval, It is the set of attributes of an entity; the vector matching index maps entities and relations to a pre-trained model. In a semantic space, feature vectors are obtained. and This provides a foundation for subsequent similarity calculations.
[0067] M2, Query Rewriting Module: Used to perform semantic parsing and logical reasoning on the original query based on the large language model, supplement implicit information and correct expression defects, and output a rewritten query that meets the retrieval requirements;
[0068] The original query entered by the user may contain incomplete expressions, semantic ambiguity, or inaccurate use of technical terms. The large language model uses the Deepseek large language model to parse the query layer by layer through thought chain reasoning, first identifying the core entity set. and query intent ,in:
[0069]
[0070] in, For named entity recognition functions, from the query Extract entities from the power sector; This is a query intent classification function used to determine the core needs of a user's query.
[0071] For complex queries involving multi-step reasoning, the model decomposes them into a sequence of subqueries. Satisfying logical dependencies For example, to query "the cause of abnormal vibration in a certain type of generator under high temperature conditions", entity recognition can be used to obtain... And generate subqueries through the rules engine:
[0072] q1′ = Query the range of operating parameters of the generator under high temperature environment;
[0073] q2′ = Query the components and causes of abnormal vibration;
[0074] Finally, the subqueries are combined into a canonical search expression using logical operators. This significantly improves search and matching efficiency.
[0075] For example, a user inputs the query "How to handle a power transmission line tripping". The Deepseek model first identifies the entity "power transmission line" and the query intent "handling method". Based on the knowledge graph, it infers that the tripping may be related to causes such as "lightning strike", "equipment aging", and "overload", rewriting the query as "emergency handling steps and preventive measures for power transmission line tripping caused by lightning strike". During retrieval, literal matching recalls entities and relationships containing "power transmission line", "lightning strike", and "tripping", while vector matching encodes the rewritten query into a vector using the BGE model, retrieving the most similar Top-5 candidates, including knowledge items such as "emergency handling process for power transmission line tripping due to lightning strike" and "damage mechanism of lightning strike to power transmission line equipment".
[0076] M3, Knowledge Retrieval Module: Used to obtain highly relevant knowledge based on the rewritten query, recall candidate knowledge entries through two methods: literal matching and semantic vector matching, and output Top-K retrieval results after rearrangement; the retrieval process combines literal matching and vector matching.
[0077] Literal matching uses an inverted index to retrieve entities and relationships containing the query keywords; the literal matching recall set... Generated by keyword matching:
[0078]
[0079] in, This is an inverted list of keyword k. To standardize the query The set of keywords in For a single keyword in the keyword set.
[0080] Semantic vector matching uses the BGE model to encode the rewritten query into a vector, and retrieves semantically similar entities and relations from the vector index; the reordering is to merge the results of literal matching and semantic vector, and perform reordering based on semantic similarity calculation, and select Top-K candidates as the retrieval results.
[0081] Vector matching recall set The selection is based on cosine similarity calculation, and the specific formula is as follows:
[0082]
[0083] in, For semantic vectors, For vectors and dot product, For vectors and The length of the mold, To measure the degree of semantic matching, Used to filter the set of the top k most similar knowledge base entries.
[0084] The initial recall set after fusion When rearranging using the BGE model, the overall quality score The calculation formula is:
[0085]
[0086] in, These are the weighting coefficients. For literal matching similarity, For semantic vector similarity, as a candidate All sets of relations involved Candidate results The set of relationships with the query entity; determined through adaptive weight optimization (such as gradient descent). The optimal value is determined to ensure that highly relevant results are output first.
[0087] M4, Content Generation Module: This module generates an initial response based on the large language model and the Top-K search results. It evaluates the quality of the initial response using a reflective model. If problems are found, the query is corrected and the search and generation process is retried until the optimal response is obtained.
[0088] M41. Initial Response Generation: The Deepseek large language model is used to generate the input sequence. The specific calculation formula is as follows:
[0089]
[0090] in, For the original query, For the classification label of the model, For the model's separator, For the 1st to the 1st X is a candidate entry. Input X into the Deepseek decoder, which generates a preliminary answer A based on the search results, consistent with the function of "generating" and outputting a "preliminary answer". For example, for "How to handle a power transmission line trip", the preliminary answer A is: "After a power transmission line trips, the line equipment should be checked immediately for damage, with a focus on checking the insulators and conductor connections."
[0091] The answer is generated by the decoder. conditional probability value for:
[0092]
[0093] in, The initial answer generated by the model, Let t be the t-th token, and let t be based on the previous t. Given a token and input X, generate The conditional probability.
[0094] M42. Reflective Model Evaluation: In the reflective mechanism, the reflective model evaluates the generated results from multiple dimensions and defines a logical consistency score. Information integrity score :
[0095]
[0096] in, To answer the question of the intersection of effective triples and standard triples, Valid triples extracted from the answer. To answer the question about the intersection of the covered entity and the core entity being queried, To answer the covered query entities, To rewrite the key entities in the query.
[0097] M43. Comprehensive Judgment and Closed-Loop Correction: The optimal answer is determined by the overall quality score. The specific calculation formula is as follows:
[0098]
[0099] in, As weight; when the overall score When the value falls below a preset threshold, query correction is triggered, and a new query is generated. When the value exceeds a preset threshold, an answer is output. The specific judgment is as follows:
[0100] The preset threshold is set to ,like If the "reflection verification failed", it indicates that A has "missing information" (failed to mention lightning arrester inspection in the lightning strike scenario), triggering query correction and generating a new query. For example: After a lightning strike causes a transmission line to trip, how to check and restore equipment operation; re-enter q' into the "Query Rewrite Module" and repeat the "Rewrite → Retrieve → Generate → Evaluate" process until... ≥θ.
[0101] Secondly, the present invention proposes a power knowledge question-answering method based on a large language model, the specific steps of which include:
[0102] S1. Construct a knowledge graph in the power sector and establish a dual index; the knowledge graph consists of triples of entities, relations, and attribute transformations from multi-source heterogeneous power data; the dual index includes an index for literal matching and a vector index for semantic matching;
[0103] S2. Based on the large language model, perform semantic parsing and logical reasoning on the original query, supplement implicit information and correct expression defects, and output a rewritten query that meets the retrieval requirements.
[0104] S3. Based on the rewritten query, obtain highly relevant knowledge, recall candidate knowledge items through two methods: literal matching and semantic vector matching, and output the Top-K search results after rearrangement.
[0105] S4. Generate an initial answer based on the large language model and the Top-K search results. Evaluate the quality of the initial answer through a reflective model. If there are problems, revise the query and re-trigger the search and generation until the optimal answer is obtained.
[0106] Example 2
[0107] This embodiment details the specific implementation process of power knowledge question answering based on a large language model. The whole process, including knowledge base construction, query rewriting and retrieval, content generation and reflection and correction, experimental verification and sample study, fully presents the technical implementation path and application effect of the system.
[0108] B1. Data Sources and Preprocessing
[0109] The raw data consisted of 1370 power grid equipment technical manuals, 4854 fault handling records, and 198 industry standards and specifications. SpaCy was used for word segmentation and named entity recognition, defining power sector entity types as equipment (e.g., "transformer," "reactor"), faults (e.g., "overvoltage," "short circuit"), and parameters (e.g., "power generation," "impedance value"). For unstructured text, key information was extracted using regular expressions and rule matching; for example, from "transformer rated voltage is 110kV," the entity "transformer," the attribute "rated voltage," and the value "110kV" were extracted.
[0110] B2. Knowledge Graph Extraction
[0111] Entity-relationship extraction was performed using the Deepseek-v3 model. A prompt template for the power industry was constructed, such as "Extract equipment name, fault type, and their relationship from the following text: {text}". For the text "Generator stator winding short-circuit fault due to insulation aging", the model outputs a triple (generator stator winding, due to, insulation aging) or (insulation aging, resulting in, short-circuit fault). Approximately 110,000 triples were generated, constructing a power knowledge graph containing approximately 80,000 entities and 40,000 relationships.
[0112] B3. Index Building
[0113] In this solution's 'dual indexing', the literal matching index is implemented based on Elasticsearch, and the semantic vector matching index is implemented based on FAISS. The two are linked through a search result fusion module. The literal matching index is used to handle precise or string-based searches. During setup, entity names and relationship descriptions undergo preprocessing such as removing special characters and word segmentation. Then, Elasticsearch automatically builds an inverted index, recording the correspondence between terms and documents. To optimize search performance, the EdgeN-gram segmenter is configured to support prefix matching, a thesaurus is set to handle equivalent words, and the BM25 similarity algorithm is used for sorting.
[0114] The vector matching index relies on a pre-trained BPE model to extract entity and relation vectors. Entity names and relation descriptions are input into the model, and pooling operations yield 1024-dimensional vector representations. These vectors are then stored in the FAISS index repository, which supports fast large-scale vector retrieval. Appropriate index types such as IVFFlat can be selected as needed, and vector quantization reduces memory usage. During retrieval, the query is converted into a vector, and similar vectors are found in the FAISS index, returning the corresponding content.
[0115] B4. Examples of Query Rewriting and Retrieval
[0116] The user inputs the query "How to handle power transmission line tripping"; the Deepseek model first identifies the entity "power transmission line" and the query intent "handling method", and then infers based on the knowledge graph that the tripping may be related to reasons such as "lightning strike", "equipment aging", and "overload", rewriting the query as "emergency handling steps and preventive measures for power transmission line tripping caused by lightning strike"; during retrieval, literal matching recalls entities and relationships containing "power transmission line", "lightning strike", and "tripping", and vector matching encodes the rewritten query into a vector through the BGE model, retrieving the most similar Top-5 candidates (including knowledge items such as "emergency handling process for power transmission line tripping due to lightning strike" and "damage mechanism of lightning strike to power transmission line equipment").
[0117] B5. Examples of Content Generation and Reflection / Revision
[0118] The generation module generates a preliminary answer based on the search results: "After a transmission line trips, the line equipment should be checked immediately for damage, with a focus on insulators and conductor connections." The reflection model checks and finds that the answer does not mention the special characteristics of the lightning strike scenario (such as the need to check the status of surge arresters), indicating incomplete information, thus triggering a correction mechanism. The query is further rewritten as "After a lightning strike causes a transmission line to trip, how to check and restore equipment operation?" A complete answer including steps such as surge arrester inspection and grounding resistance testing is generated and output after the reflection model confirms its accuracy.
[0119] B6. Experimental Verification
[0120] A dataset containing approximately 20,000 power-related question-and-answer pairs was constructed for testing. The questions cover areas such as equipment operation and maintenance, fault diagnosis, and technical specifications, with simple factual questions and complex reasoning questions each accounting for 50%.
[0121] Accuracy, BLEU-4, ROUGE-L, and average inference steps were used as evaluation metrics. Accuracy calculates the proportion of questions answered correctly; BLEU-4 and ROUGE-L measure the semantic similarity between the generated text and the standard answer; and average inference steps reflect the system's ability to handle complex questions.
[0122] Compared with existing systems (Graph-RAG, LangchainRAG), this invention demonstrates superior performance across all metrics, as shown in the table below:
[0123] Table 1 Output Results
[0124]
[0125] In tests on complex reasoning problems, the accuracy rate of this invention reached 89.1%, significantly higher than the comparison systems (Graph-RAG 75.3%, LangchainRAG 73.2%), demonstrating its clear advantage in handling power-related problems requiring multi-step logical reasoning. Furthermore, this also shows that the multi-path recall, query rewriting, and reflection modules proposed in this solution can effectively improve the accuracy of knowledge-based question answering.
[0126] B7. Verification of the effectiveness of the generation and reflection mechanism
[0127] In the generation experiment, the system of this invention was compared with existing mainstream LLM models. The evaluation indicators included answer accuracy, logical consistency, and correctness of technical terms. Using 2000 real question-and-answer data points for testing, the experimental results showed that the system of this invention achieved an accuracy rate of 92.2% for simple queries and 89.4% for complex queries, both higher than the existing models' 83.1% and 74.2%, respectively.
[0128] In the test of the reflective mechanism, generated results containing erroneous information were intentionally introduced to observe the accuracy and correction effect of the reflective model. The results show that the reflective model can accurately identify 85% of the incorrect answers, and by rewriting the query and regenerating the results, the error rate of the final answer is reduced to below 10%, effectively improving the reliability of the system.
[0129] B8. Case Studies
[0130] In complex problem testing (such as multi-factor analysis of equipment failure), the system of this invention can accurately reference the causal relationships of failures in the knowledge graph and generate answers with detailed reasoning steps. Baseline-RAG systems often suffer from broken reasoning chains or factual errors, as shown in the following typical examples:
[0131] B81. User inquiry: "What are the possible causes of abnormally high main transformer oil temperature, and how should they be handled?"
[0132] B82. This invention answers: "Abnormal rise in main transformer oil temperature may be caused by the following reasons: 1. Cooling system failure, such as fan damage or heat sink blockage, leading to decreased heat dissipation efficiency; 2. Winding short circuit or inter-turn insulation damage, causing increased internal losses; 3. Overload, causing the transformer operating current to exceed the rated value; 4. Oil deterioration or insufficient oil quantity, affecting heat dissipation performance. The corrective measures include: first, checking the cooling system's operating status through the monitoring system, cleaning the heat sink and repairing damaged components; if it is an overload, adjusting the power grid operation mode to reduce the transformer load; for winding faults or oil quality problems, immediate power outage and repair, insulation testing and oil sample analysis, and replacement of windings or transformer oil if necessary."
[0133] B83, Langchain-RAG replied: "The rise in main transformer oil temperature may be due to insufficient cooling system efficiency or short-term overload. It is recommended to first check whether the cooling fan is operating normally, and try restarting the fan control system to improve heat dissipation capacity; if it is due to overload, the load distribution of surrounding lines needs to be temporarily adjusted through the dispatch system to observe whether the oil temperature drops. If the problem persists, maintenance personnel need to be arranged to inspect the transformer's appearance and oil level on-site."
[0134] The Langchain-RAG system omits key fault factors such as damaged winding insulation and deteriorated oil quality, and its handling measures do not provide fundamental solutions to deep-seated faults (e.g., it does not mention professional testing procedures for electrical insulation performance). The present invention, through thought chain-driven query rewriting and deep knowledge graph retrieval, can comprehensively uncover multi-dimensional fault causes, and combined with a reflection mechanism, ensures the professionalism and completeness of the handling solutions.
[0135] In summary, the present invention has the following advantages:
[0136] 1. Based on the Deepseek large language model, it can handle complex multi-step reasoning in the power field, and supports more than 5 steps of deep reasoning in equipment fault diagnosis scenarios, improving the reasoning accuracy by more than 16%.
[0137] 2. By transforming unstructured power knowledge into a structured entity relationship network through knowledge graphs, the retrieval efficiency is improved by 37% compared to traditional keyword matching. The average retrieval response time in the knowledge base of tens of thousands of entities is less than 200ms, and it can also capture deep knowledge relationships.
[0138] 3. By combining retrieval enhancement generation and reflection correction mechanisms, the BLEU-4 score on the public electricity question-answering dataset reached 0.824, which is 15% higher than the existing RAG system and the factual error rate was reduced by 58%.
[0139] The above specific embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to examples, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A power knowledge question and answer system based on a large language model generation, characterized in that, include: Question-and-answer knowledge base module: used to build a knowledge graph in the power industry and establish a dual index; Query rewriting module: It is used to perform semantic parsing and logical reasoning on the original query input by the user based on a large language model, supplement implicit information and correct expression defects, and output a rewritten query that meets the retrieval requirements. Knowledge The retrieval module is used to obtain highly relevant knowledge based on the rewritten query, recall candidate knowledge items through two methods: literal matching and semantic vector matching, and output the Top-K retrieval results after rearrangement. The semantic vector matching uses cosine similarity, and the specific formula is as follows: in, For semantic vectors, For vectors and dot product, For vectors and The length of the mold, To measure the degree of semantic matching, Used to filter the set of the top k most similar knowledge base entries; The rearrangement uses a comprehensive score function, the specific formula of which is: in, These are the weighting coefficients. For literal matching similarity, For semantic vector similarity, as a candidate All sets of relations involved Candidate results The set of relationships with the query entity; Content generation module: used to generate an initial answer based on the large language model and the Top-K search results, evaluate the quality of the initial answer through a reflective model, and if there are problems, correct the query and re-trigger the search and generation until the optimal answer is obtained; The reflexive model evaluation involves a multi-dimensional assessment of the generated results, defining a logical consistency score. Information integrity score The specific formula is as follows: in, To answer the question of the intersection of effective triples and standard triples, Valid triples extracted from the answer. To answer the question about the intersection of the covered entity and the core entity being queried, To answer the covered query entities, To rewrite the key entities in the query.
2. The power knowledge question-answering system based on a large language model as described in claim 1, characterized in that, The question-and-answer knowledge base module includes: Multi-source data acquisition and preprocessing unit: used to clean and preprocess multi-source data such as power industry standards and specifications, equipment technical manuals, and operation and maintenance records, and to extract key terms and concepts; Entity Relation Extraction Unit: Used to extract entity relations using a large language model, transforming unstructured text into structured triples, and constructing a knowledge graph in the power industry. Matching Index Unit: Used to construct literal matching index and vector matching index using inverted index and knowledge graph embedding model respectively, supporting efficient keyword retrieval and semantic retrieval.
3. The power knowledge question-answering system based on a large language model as described in claim 2, characterized in that, The expression for extracting the entity relationship is: in, Indicates the first Each entity corresponds to a device name, technical parameters, and fault type.
4. The power knowledge question-answering system based on a large language model as described in claim 1, characterized in that, The semantic parsing includes identifying key entities and query intent in the original query; The logical reasoning described is a multi-step logical reasoning based on entity relationships in a knowledge graph.
5. The power knowledge question-answering system based on a large language model as described in claim 1, characterized in that, The literal matching uses an inverted index to retrieve entities and relationships containing the query keywords; The semantic vector matching uses the BGE model to encode the rewritten query into a vector, and retrieves semantically similar entities and relationships from the vector index; The reordering is the result of merging literal matching and semantic vectors, and the reordering is performed based on semantic similarity calculation. The Top-K candidates are selected as the search results.
6. The power knowledge question-answering system based on a large language model as described in claim 1, characterized in that, The optimal answer is determined by a comprehensive score. The overall score is used to make a judgment. The calculation formula is: in, As weight; when the overall score When the value falls below a preset threshold, query correction is triggered, and a new query is generated. When the value exceeds a preset threshold, an answer is output.
7. A power knowledge question-answering method based on a large language model, characterized in that, An electrical knowledge question-answering system based on a large language model, as described in any one of claims 1-6, comprises: S1. Construct a knowledge graph in the power sector and establish a dual index; the knowledge graph consists of triples of entities, relations, and attribute transformations from multi-source heterogeneous power data; the dual index includes an index for literal matching and a vector index for semantic matching; S2. Based on the large language model, perform semantic parsing and logical reasoning on the original query, supplement implicit information and correct expression defects, and output a rewritten query that meets the retrieval requirements. S3. Based on the rewritten query, obtain highly relevant knowledge, recall candidate knowledge items through two methods: literal matching and semantic vector matching, and output the Top-K search results after rearrangement. S4. Generate an initial answer based on the large language model and the Top-K search results. Evaluate the quality of the initial answer through a reflective model. If there are problems, revise the query and re-trigger the search and generation until the optimal answer is obtained.
Citation Information
Patent Citations
Semantic feature based semantic relation mode acquisition method and system
CN105808521A
Knowledge question-answering system based on large language model
CN119396975A