Construction method, system and equipment of power dispatching knowledge question-answering system and storage medium
By introducing large language models and knowledge graphs in the field of power scheduling, the shortcomings of the RAG method in cross-document information integration are solved, and a power scheduling knowledge question-and-answer system has been built, which has achieved more accurate and comprehensive information support and improved the information of power scheduling Level of query and decision support.
Patent Information
- Application Number
- CN202411378565.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-01-14
AI Technical Summary
The traditional search-enhanced generation (RAG) method is poor in cross-document information synthesis in the field of power scheduling and cannot effectively respond to complex and diverse knowledge needs, resulting in insufficient levels of information query and decision support.
The power scheduling knowledge question and answer system based on large language models and knowledge graphs is adopted. By segmenting and combining power scheduling semantic documents, identifying entities and relationships, building local and global graphs, improving the comprehensive information and semantic understanding capabilities, and generating more accurate and comprehensive answers.
It significantly improves the comprehensive information ability and retrieval accuracy, reduces the loss of information and the introduction of irrelevant information, provides more efficient, accurate and reliable knowledge support, and improves the level of information query and decision support during power scheduling.
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of electric power dispatching, and specifically relates to a construction method, system, device and storage medium of an electric power dispatching knowledge question and answer system. Background Art
[0002] In modern power systems, power dispatching is a key link to ensure safe and stable operation of the power grid. As the scale and complexity of power systems increase, dispatchers need to obtain and process a large amount of information related to power grid operation in real time to make correct decisions. However, traditional power dispatching information query and decision support systems often rely on keyword retrieval and static rule bases, which cannot meet the dispatchers' information needs for real-time, accuracy and comprehensiveness.
[0003] In this context, the development of natural language processing technology, especially the question-answering system based on large-scale language model (LLM), has begun to be applied to the field of power dispatching. These systems aim to provide dispatchers with accurate and timely knowledge support through natural language interaction. However, the traditional retrieval-augmented generation (RAG)-based method has exposed some obvious shortcomings in dealing with the complex and diverse knowledge needs in the field of power dispatching.
[0004] The core of the RAG method is to supplement the answering ability of the generative model by retrieving relevant document fragments, which is suitable for finding answers within a specific text area. However, in the field of power dispatching, information is often distributed in multiple documents from different sources, and there may be complex correlations between these documents. It is difficult to synthesize new insights by relying solely on the RAG method. Specifically, RAG performs poorly in synthesizing information across documents. Power dispatching knowledge usually involves content across multiple documents. When synthesizing new insights from these documents and generating systematic answers, the RAG method is easily limited by its reliance on a single document fragment. Summary of the invention
[0005] Purpose of the invention: In order to solve the problem that the traditional method based on Retrieval-Augmented Generation (RAG) performs poorly in cross-document integrated information and cannot cope with the complex and diverse knowledge needs in the field of power dispatching, the present invention proposes a construction method, system, device and storage medium for a power dispatching knowledge question-answering system based on a large language model and knowledge graph; the present invention aims to improve the retrieval and generation mechanism of the traditional RAG and introduce the power dispatching knowledge graph to enhance the system's ability to process cross-document information, summarize semantic concepts and understand information associations, thereby providing more accurate, comprehensive and timely knowledge support for power dispatching. This innovative system can not only effectively solve the deficiencies in the existing technology, but also greatly improve the level of information query and decision support in the power dispatching process.
[0006] Technical solution: A method for constructing a power dispatching knowledge question-answering system, comprising the following steps:
[0007] Obtain the power dispatching semantic documents that the power dispatching knowledge question answering system needs to process;
[0008] Based on the large language model and related prompt words, the power dispatch semantic document is sequentially segmented based on characters, transformed into propositions, and merged into propositions to obtain multiple text blocks.
[0009] Based on the large language model and relevant prompt words, entities related to power dispatching and the relationships between entities are identified and extracted from each text block;
[0010] Based on the large language model and related prompt words, a local graph is constructed for each text block based on the entities extracted from each text block and the relationship between the entities; and each text block is traversed to merge all local graphs into a global graph;
[0011] Based on the large language model and relevant prompt words, according to the type of question queried by the user, the corresponding reply text is generated by matching the most relevant minimum local graph in the global graph.
[0012] Further, the character-based segmentation includes: segmenting the power dispatch semantic document into paragraphs using control characters;
[0013] The proposition conversion includes: using a large language model and related prompt words to decompose a paragraph into one or more propositions, and the decomposed propositions meet the following conditions:
[0014] Condition 1: Each proposition should correspond to a unique meaning unit in the power dispatch semantic document, and the combination of these propositions represents the semantics of the entire power dispatch semantic document;
[0015] Condition 2: A proposition is minimal and cannot be further transformed into separate propositions;
[0016] Condition 3: A proposition includes all necessary contexts from the power dispatch semantic document.
[0017] Furthermore, the proposition merging includes:
[0018] Sequential analysis is used to merge propositions. Multiple propositions are merged to obtain a text block. Each text block has only one unique identification ID.
[0019] During the proposition merging process, a large language model and related prompt words are used to determine whether the current proposition should be merged with the existing text block or a new text block should be created.
[0020] Furthermore, based on the large language model and related prompt words, entities related to power dispatching and the relationships between entities are identified and extracted from each text block. The specific operations include:
[0021] Based on the predefined entity types in the power dispatch semantic document that need to be identified, the large language model is specified to identify specific types of entities in the text block through relevant prompt words. The text block now consists of propositions.
[0022] Through entity and relationship extraction prompt words, a large language model is used to identify and extract entities and the relationships between entities from each text block;
[0023] For each identified entity, the large language model extracts its entity name, type and description; the entity name is the original text or common term in the power dispatch semantic document, the type is selected from a predefined table, and the description is the explanation of the entity given by the large language model based on the text block;
[0024] For each identified relation, the large language model extracts its relation name, source entity, target entity, and relation description.
[0025] Furthermore, the traversal of each text block and merging all local graphs into a global graph specifically includes:
[0026] Summarize the content of each local graph according to predefined power dispatch categories using a large language model; generate a summary derived from the content of the local graph for each local graph, and use the generated summary to form a label list, which is used to describe the content of the local graph;
[0027] Use the text vector model to vectorize the label list content to obtain a vectorized label list;
[0028] Based on the vectorized label list, the cosine similarity algorithm is used to calculate the distance between each pair of local graphs, and the local graphs with the highest similarity are selected to merge to form a new graph, and the original local graphs and label lists are retained; when merging local graphs, relevant prompt words are used to guide the large language model to merge entities representing the same meaning. On the basis of merging entities, the entities on the new graph are linked to other entities according to the relationship between the entities, and then combined with the new graph to generate a new label list, and the content of the label list is vectorized, and this step is repeated until only one global graph remains.
[0029] Furthermore, based on the large language model and related prompt words, according to the type of question queried by the user, by matching the most relevant minimum local graph in the global graph, a corresponding reply text is generated, and the specific operations include:
[0030] Based on relevant prompt words, guide the large language model to determine the type of question the user is querying;
[0031] If the question type queried by the user is a local type, the reply text is generated according to the following steps:
[0032] A large language model is used to generate a summary based on the user's query content, and the generated summary is used to form a tag list, which is used to describe the content of the user's query;
[0033] Using this label list, we gradually index from the global graph to its contained local graphs from top to bottom until we reach the smallest local layer.
[0034] Collect all entities and their related contents from the smallest local layer, wherein the related contents include the contents of the entity itself, its relations, and the contents of any associated entities; in addition, extract multiple text blocks that are most relevant to the user's query content from the text blocks, use them as candidate text blocks, prioritize and filter the candidate text blocks, and select multiple text blocks with the highest similarity;
[0035] The large language model generates reply text using all entities and their related content collected from the smallest local layer and multiple text blocks with the highest similarity.
[0036] Furthermore, if the question type queried by the user is of a global type, the reply text is generated according to the following steps:
[0037] A large language model is used to generate a summary based on the user's query content, and the generated summary is used to form a tag list, which is used to describe the content of the user's query;
[0038] Using this label list, we gradually index from the global graph to its contained local graphs from top to bottom until we reach the smallest local layer.
[0039] Collect all entities and their related contents from the smallest local layer, wherein the related contents include the contents of the entity itself, its relations, and the contents of any associated entities; in addition, extract multiple text blocks that are most relevant to the user's query content from the text blocks, use them as candidate text blocks, prioritize and filter the candidate text blocks, and select multiple text blocks with the highest similarity;
[0040] The large language model uses all entities and their related content collected from the smallest local layer and multiple text blocks with the highest similarity to generate an intermediate response text;
[0041] The intermediate reply text is combined with the content information of the graph on the previous level of the smallest local layer, layer by layer, until the highest layer is reached, and finally a reply text is generated.
[0042] The present invention also discloses a power dispatching knowledge question and answer system, which is constructed by adopting the above disclosed method for constructing a power dispatching knowledge question and answer system.
[0043] The present invention also discloses a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the method for constructing a power dispatching knowledge question and answer system disclosed above are implemented.
[0044] The present invention also discloses a storage medium, which stores a construction program of a power dispatching knowledge question and answer system. When the construction program of the power dispatching knowledge question and answer system is executed by at least one processor, the steps of the construction method of the power dispatching knowledge question and answer system disclosed above are implemented.
[0045] Beneficial effects: The method of the present invention combines knowledge graph with RAG (Retrieval-Augmented Generation) to construct a knowledge question-answering system for power dispatching, which has significantly improved the accuracy compared with the existing technology; compared with the traditional RAG method, the system shows better performance in processing large power dispatching data sets and integrating multi-source information. The main advantages include:
[0046] (1) Improved information integration capability: By constructing a knowledge graph for power dispatching, the present invention overcomes the problem of insufficient integration capability between different information fragments in the traditional RAG method. By constructing entities and their relationships in the power dispatching data into a knowledge graph, the system can effectively integrate information from multiple different documents to generate more comprehensive and accurate answers. This advantage stems from the knowledge graph technology, which ensures that the semantic associations between information are fully preserved and utilized.
[0047] (2) Enhanced context understanding and retrieval accuracy: The knowledge question-answering method of the present invention performs comprehensive information retrieval through knowledge graphs (structured data) and texts (unstructured data), significantly improving the accuracy in large-scale data sets. Compared with traditional methods, this strategy achieves accurate answers to power dispatching questions by combining global context and local information, reducing information loss and the introduction of irrelevant information. This improvement mainly comes from the retrieval method that combines knowledge graphs (structured data) with texts (unstructured data). This method not only considers the accuracy of local information during the retrieval process, but also improves the relevance of retrieval results through the global perspective of the knowledge graph.
[0048] (3) The method of the present invention combines the knowledge graph with the RAG method in the power dispatching knowledge question and answer system, which not only improves the system's knowledge integration capability and retrieval accuracy, but also effectively reduces the deviation and error of the generated content. Compared with the existing technology, the answer accuracy, information integration capability and semantic understanding capability of the power dispatching knowledge question and answer system are significantly improved, thereby providing more efficient, accurate and reliable knowledge support for power dispatching work. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical solutions and advantages of the present invention clearer, a method for constructing a power dispatching knowledge question and answer system based on a large language model and a knowledge graph proposed in the present invention is further explained.
[0050] This embodiment proposes a method for constructing a power dispatching knowledge question-answering system based on a large language model and a knowledge graph, which mainly includes the following steps:
[0051] Step 1: Segmentation of power dispatch semantic documents: The power dispatch knowledge question-answering system needs to process a large number of power dispatch semantic documents, which usually contain multiple topics or complex content. In order to effectively use these power dispatch semantic documents, they need to be segmented to meet the limitations of the large language model (LLM) processing context. The large language model (LLM) used in this embodiment can be, but is not limited to, the Tongyi Qianwen large language model.
[0052] Specific operations include:
[0053] Character-based preliminary segmentation: Use control characters (such as line break symbols) to segment the power dispatch semantic document into paragraphs for further processing.
[0054] Paragraph conversion to propositions: Based on the initial character-based segmentation, the paragraph is decomposed into a series of clear and simple propositions using proposition conversion prompts to ensure that the converted propositions can be interpreted out of context. The converted propositions must meet the following conditions:
[0055] Condition 1: Each proposition should correspond to a unique unit of meaning in the text, and the combination of these propositions should represent the semantics of the entire text.
[0056] Condition 2: A proposition should be minimal, that is, it cannot be further transformed into separate propositions.
[0057] Condition 3: A proposition should be contextual and self-contained. A proposition should include all the necessary context (e.g., referential relations) from the text to interpret its meaning.
[0058] In the above operation, the proposition conversion prompt can be:
[0059] You are a linguist who is responsible for converting the content of a paragraph into a proposition. Each proposition should meet the following conditions:
[0060] Independent meaning: Each proposition should express an independent fact in the text. The combination of all propositions should fully express the semantics of the paragraph.
[0061] Minimalism: A proposition should be the smallest semantic unit that cannot be further decomposed into smaller propositions.
[0062] Self-contained: The proposition should contain all necessary contextual information so that the reader can understand its meaning without referring to the original text. Replace all pronouns with their corresponding entities (e.g. "it" is replaced with a concrete noun). Follow the steps below to generate the proposition:
[0063] Break down complex sentences into concise independent sentences, keeping the main wording of the original text.
[0064] If there are named entities and their attached descriptions in the paragraph, these description information are extracted separately to form independent propositions.
[0065] Make sure the propositions are self-contained, making the meaning of each proposition clear by adding necessary modifiers or replacing pronouns.
[0066] The final output is a list of strings in JSON format, with each proposition being a string.
[0067] Proposition merging: In order to maintain semantic consistency, sequential analysis technology is used to merge propositions. The propositions of five paragraphs are processed at a time, the first paragraph is removed and the next paragraph is added to ensure semantic continuity. During the merging process, specific prompts are designed to allow the large language model to determine whether each proposition should be merged with the existing text block or a new text block is created. The general process is: At the beginning, a new text block is created, which consists of the propositions of the first paragraph to be merged. Then the propositions of the second paragraph and the propositions of the first paragraph are input into the large language model, and finally the large language model will give an output value of merging or not merging. If it is merged, the proposition of the second paragraph is merged with the first paragraph. After merging, the newly merged text block and the next paragraph are handed over to the large model to determine whether to merge. If not merged, the proposition of the next paragraph is constructed as a new text block.
[0068] When creating a new text block, the text vector model will be used to vectorize the previous text block, which is only used for local type question retrieval in step 4. For knowledge source tracking, each block will be given a unique identification ID. If the length of the text block has reached 1 / 2 of the large language model input window, the merging will also stop. Create a new block to merge into the merged paragraph proposition.
[0069] In the above steps, the tips that can be used are:
[0070] You are a linguist in charge of a set of text blocks, each of which represents a group of sentences discussing similar topics. Your task is to decide whether two given propositions should be merged into the same text block, based on the propositions' meaning, direction, or intent. A good decision would consider whether the two propositions discuss the same or closely related topics. If so, merge them into one text block. Each proposition should satisfy the following criteria:
[0071] Independent meaning: Each proposition should express an independent fact in the text. The combination of all propositions should fully express the semantics of the paragraph.
[0072] Minimalism: A proposition should be the smallest semantic unit that cannot be further decomposed into smaller propositions.
[0073] Self-contained: The proposition should contain all the necessary contextual information so that the reader can understand its meaning without referring to the original text. Replace all pronouns with their corresponding entities (such as "it" replaced by a concrete noun). You will get two propositions. Your job is to analyze these two propositions and decide whether they should be merged into the same text block or remain separate. If they should be merged, return "Merge". If they should not be merged, return "Don't merge".
[0074] Step 2: Power dispatch entity and relationship extraction: After completing the power dispatch semantic document segmentation, identify and extract power dispatch related entities and relationships from each text block.
[0075] Specific operations include:
[0076] Information Extraction: LLM is used to identify and extract entities and relations from each text block through the designed entity and relation extraction prompts. For each identified entity, LLM extracts its entity name, type, and description. The entity name can be the original text or common terms in the document; the type is selected from a predefined table; and the description is the explanation of the entity given by LLM based on the text block. For each identified relationship, LLM extracts its relationship name, source entity, target entity, and description.
[0077] In the above operations, the entity and relationship extraction prompts can be:
[0078] -Target-
[0079] Given a text document that may be related to this activity and a list of entity types, identify all these types of entities and their relationships to each other from the text.
[0080] The given list of entity types is as follows:
[0081] [{Entity Type}]
[0082] -step-
[0083] 1. Identify all entities. For each identified entity, extract the following information:
[0084] -Entity Name: Entity name, capitalized
[0085] -EntityType: One of [{entityType}]
[0086] -Entity Description: A comprehensive description of the entity's attributes and activities
[0087] The format is ("entity"<entity_name> [SEP]<entity_type> [SEP]<entity_description> )
[0088] 2. From the entities identified in step 1, identify all clearly related entity pairs (source_entity, target_entity).
[0089] For each pair of related entities, extract the following information:
[0090] -Source Entity: The name of the source entity identified in step 1
[0091] -Target entity: The name of the target entity identified in step 1
[0092] - Relationship description: explains why the source and target entities are considered related to each other
[0093] -Relationship strength: A numerical score indicating the strength of the relationship between the source and target entities
[0094] The format is
[0095] ("relationship"[SEP]<source_entity> [SEP]<target_entity> [SEP]<relationship_descriptio n> [SEP]<relationship_strength> )
[0096] 3. Return a list of all entities and relations identified in steps 1 and 2.
[0097] In order to improve the quality of entity extraction and reduce noise and variance, this step will repeat the extraction process multiple times. This iterative approach encourages the LLM to detect any entities and relationships that may have been overlooked in the past. The decision to continue or stop the iterative process is also made by the LLM itself.
[0098] Through the above steps, a local graph is constructed for each text block.
[0099] Step 3: Build a knowledge graph for power dispatching: The specific operations include:
[0100] Each text block is traversed to merge each local graph into a global graph. First, the content of each local graph is summarized according to the predefined power dispatch categories (such as equipment type, line name, etc.) using LLM to form a label list that concisely describes the main content of the local graph. Subsequently, the label list content is vectorized using the text vector model.
[0101] Then, based on the vectorized label list, the cosine similarity algorithm is used to calculate the distance between each pair of local graphs, and the local graphs with the highest similarity are selected for merging. The merged graph becomes a new graph, but its original local graph and label list are retained. When merging, the entity nodes representing the same meaning are merged using the large language model through the corresponding prompt. Based on the merged entity nodes, all relationships involving these entities in the two local graphs are checked and merged. A new list of summary label information is then generated for the new graph and vectorized, and its similarity with other local graphs is recalculated for further merging. This process can be repeated until only one global graph remains.
[0102] In the above merge operation, the prompt used can be:
[0103] You are an intelligent assistant responsible for helping users merge entities and relationships in two graphs. Each graph contains entity nodes and their relationships, and some entity nodes may have the same meaning and need to be merged.
[0104] ·Target:
[0105] According to the given two graphs, the entity nodes that represent the same meaning are first merged, and then these entity nodes are correctly connected according to the relationships between them and other entities.
[0106] ·step:
[0107] Entity node merging:
[0108] For entity nodes in both graphs that represent the same meaning, identify these entities and merge them into one node. For each merged entity node, generate the following information:
[0109] The name of the merged entity (use a more general or accurate name).
[0110] Entity type.
[0111] The attribute description of the merged entity includes all the descriptive information related to the entity in the original graph. If there is any conflict, please resolve it and generate a comprehensive description.
[0112] Relationship Merge:
[0113] (1) Based on the merged entity nodes, check and merge all the relationships involving these entities in the two graphs. (2) For each pair of related entities, generate the following information:
[0114] The source entity name.
[0115] The target entity name.
[0116] Relationship description, explaining the connection between source and target entities.
[0117] Tie strength. If there are multiple tie strength values, take the average or select a more representative value.
[0118] Output:
[0119] Generate a graph containing the merged entities and relationships. Use the following format to represent the merged entities and relationships:
[0120] The merged entity format is:
[0121] ("entity"[SEP]<entity_name> [SEP]<entity_type> [SEP]<entity_description> )
[0122] The format of the relationship after the merger is:
[0123] ("relationship"[SEP]<source_entity> [SEP]<target_entity> [SEP]<relationship_description> [S EP]<relationship_strength> )
[0124] Step 4: Power dispatch knowledge retrieval (user query generation): Specific operations include:
[0125] First, given a prompt, let LLM determine the type of user question;
[0126] For local type questions, the following method is used: generate summary label descriptions for the user query, the same as step 3, and use these summary label descriptions to identify the most relevant graphs through a top-down matching process. This process starts with a larger graph and gradually indexes the small graphs it contains. This matching process is repeated until the smallest local layer is reached. All entities and their related content are then collected, including the entity's own content, relationships, and the content of any associated entities. In addition, the relevant text blocks that are most relevant to the user's query content are extracted from the vectorized text blocks. These candidate text blocks are then prioritized and filtered, and the top 5 blocks with the highest similarity are taken. Finally, LLM uses the information collected from the smallest local layer and the information of the most similar matched text blocks to generate the final response.
[0127] For global questions, the following additional steps are taken: the LLM is prompted to generate an intermediate response text using the information collected from the smallest local layer and the information of the most similar text block matched. This intermediate response text is retained and combined with the summary label information of the higher-level graph to generate a more detailed or refined response. The LLM repeats this response generation process in the upward process until it reaches the highest level and generates the final response. This approach not only allows the LLM to fully understand all the data, but also maintains accuracy by accessing less relevant data in an abbreviated form.
[0128] Examples of global issues:
[0129] question:
[0130] "Please provide an analysis of the load change trend of the entire power grid in the past week and its overall impact on the stability of power supply."
[0131] reply:
[0132] "In the past week, the overall load of the power grid showed the following trend: from Monday to Wednesday, the load was relatively stable, with the peak occurring on xxxx every day.
[0133] Examples of locality issues:
[0134] question:
[0135] "xxx power plant failure, how to deal with it"
[0136] reply:
[0137] To deal with this emergency, the dispatch center took the following measures: xxxx
[0138] The prompt used in the above operation can be:
[0139] You are an intelligent assistant responsible for determining whether the question raised by the user is a global or local question.
[0140] Global issues:
[0141] Global questions usually involve overall analysis, summaries, trends, or content with broad impact. They usually ask about the overall situation or the relationship between multiple entities or large-scale data.
[0142] Examples of keywords: "overall situation", "trend", "all", "whole system", "global analysis", "comprehensive", "holistic", "summarize", "compare different".
[0143] Local issues:
[0144] Local problems involve specific entities, single events, or limited scope of analysis. They usually focus on one entity, one data point, or a specific subset.
[0145] Examples of keywords: "specific", "single", "single", "concrete", "one", "local", "local analysis", "part".
[0146] ·Target:
[0147] Based on the question raised by the user, determine whether the problem is a global problem or a local problem.
[0148] ·step:
[0149] Analyze the keywords and semantic structure of the question.
[0150] If the problem involves multiple entities, overall trends or comprehensive analysis, it is considered a global problem.
[0151] If the problem only involves a specific entity or a local scope of content, it is considered a local problem.
[0152] Returns the type of question.
[0153] Output format:
[0154] If it is a global problem, return "Global Problem".
[0155] If it is a local problem, return "local problem".
[0156] This embodiment constructs an efficient knowledge question-answering system for power dispatching by segmenting documents, extracting entities and relationships, constructing knowledge graphs, optimizing retrieval strategies, etc. The system can not only accurately process complex power dispatching semantics, but also perform intelligent retrieval and generate responses based on graph knowledge and text knowledge, thus providing strong support for the intelligent management of power dispatching.
[0157] Embodiment 2:
[0158] This embodiment discloses a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps disclosed in any of the above embodiments are implemented.
[0159] Embodiment 3:
[0160] This embodiment discloses a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps disclosed in any of the above embodiments are implemented.
[0161] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0162] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0163] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A method for constructing a power dispatching knowledge question-answering system, characterized in that: The following steps are involved: Obtain the power dispatching semantic documents that the power dispatching knowledge question answering system needs to process; Using a large language model and related prompt words, the power dispatch semantic document is sequentially segmented based on characters, transformed into propositions, and merged into propositions to obtain multiple text blocks. Using a large language model and relevant prompt words, entities related to power dispatching and the relationships between entities are identified and extracted from each text block; Using a large language model and related prompt words, a local graph is constructed for each text block based on the entities extracted from each text block and the relationships between the entities. Each text block is traversed and all local graphs are merged into a global graph. Using a large language model and related prompt words, according to the type of question the user queries, the corresponding reply text is generated by matching the most relevant minimum local graph in the global graph.
2. The method for constructing a power dispatching knowledge question-answering system according to claim 1, characterized in that: The character-based segmentation includes: segmenting the power dispatch semantic document into paragraphs using control characters; The proposition conversion includes: using a large language model and relevant prompt words to decompose a paragraph into one or more propositions, and the decomposed propositions meet the following conditions: Condition 1: Each proposition should correspond to a unique meaning unit in the power dispatch semantic document, and the combination of these propositions represents the semantics of the entire power dispatch semantic document; Condition 2: A proposition is minimal and cannot be further transformed into separate propositions; Condition 3: A proposition includes all necessary contexts from the power dispatch semantic document.
3. The method for constructing a power dispatching knowledge question-answering system according to claim 1, characterized in that: The proposition combination includes: Sequential analysis is used to merge propositions. Multiple propositions are merged into a text block. Each text has only one unique identification ID. During the proposition merging process, a large language model and related prompt words are used to determine whether the current proposition should be merged with the existing text block or a new text block should be created.
4. The method for constructing a power dispatching knowledge question-answering system according to claim 1, characterized in that: Based on the large language model and related prompt words, entities related to power dispatching and the relationships between entities are identified and extracted from each text block. The specific operations include: Based on the predefined entity types in the power dispatch semantic document that need to be identified, the large language model is specified to identify specific types of entities in the text block through relevant prompt words; Through entity and relationship extraction prompt words, the relationship between entities is extracted from each text block using a large language model; For each identified entity, the large language model extracts its entity name, type and description; the entity name is the original text or common term in the power dispatch semantic document, the type is selected from a predefined table, and the description is the explanation of the entity given by the large language model based on the text block; For each identified relation, the large language model extracts its relation name, source entity, target entity, and relation description.
5. The method for constructing a power dispatching knowledge question-answering system according to claim 1, characterized in that: The above-mentioned traversal of each text block and merging all local graphs into a global graph includes: Summarize the content of each local graph according to predefined power dispatch categories using a large language model; generate a summary derived from the content of the local graph for each local graph, and use the generated summary to form a label list, which is used to describe the content of the local graph; Use the text vector model to vectorize the label list content to obtain a vectorized label list; Based on the vectorized label list, the cosine similarity algorithm is used to calculate the distance between each pair of local graphs, and the local graphs with the highest similarity are selected to merge to form a new graph, and the original local graphs and label lists are retained; when merging local graphs, relevant prompt words are used to guide the large language model to merge entities representing the same meaning. On the basis of merging entities, the entities on the new graph are linked to other entities according to the relationship between the entities, and then combined with the new graph to generate a new label list, and the content of the label list is vectorized, and this step is repeated until only one global graph remains.
6. The method for constructing a power dispatching knowledge question-answering system according to claim 1, characterized in that: Based on the large language model and related prompt words, according to the type of question queried by the user, by matching the smallest local graph that is most relevant to it in the global graph, a corresponding reply text is generated. The specific operations include: Based on relevant prompt words, guide the large language model to determine the type of question the user is querying; If the question type queried by the user is a local type, the reply text is generated according to the following steps: A large language model is used to generate a summary based on the user's query content, and the generated summary is used to form a tag list, which is used to describe the content of the user's query; Using this label list, we gradually index from the global graph to its contained local graphs from top to bottom until we reach the smallest local layer. Collect all entities and their related contents from the smallest local layer, wherein the related contents include the contents of the entity itself, its relations, and the contents of any associated entities; in addition, extract multiple text blocks that are most relevant to the user's query content from the text blocks, use them as candidate text blocks, prioritize and filter the candidate text blocks, and select multiple text blocks with the highest similarity; The large language model generates reply text using all entities and their related content collected from the smallest local layer and multiple text blocks with the highest similarity.
7. The method for constructing a power dispatching knowledge question-answering system according to claim 6, characterized in that: If the question type queried by the user is a global type, follow the steps below to generate the reply text: A large language model is used to generate a summary based on the user's query content, and the generated summary is used to form a tag list, which is used to describe the content of the user's query; Using this label list, we gradually index from the global graph to its contained local graphs from top to bottom until we reach the smallest local layer. Collect all entities and their related contents from the smallest local layer, wherein the related contents include the contents of the entity itself, its relations, and the contents of any associated entities; in addition, extract multiple text blocks that are most relevant to the user's query content from the text blocks, use them as candidate text blocks, prioritize and filter the candidate text blocks, and select multiple text blocks with the highest similarity; The large language model uses all entities and their related content collected from the smallest local layer and multiple text blocks with the highest similarity to generate an intermediate response text; The intermediate reply text is combined with the content information of the graph on the previous level of the smallest local layer, layer by layer, until the highest layer is reached, and finally a reply text is generated.
8. A power dispatching knowledge question-answering system, characterized by: The system is constructed by adopting the method for constructing a power dispatching knowledge question and answer system as described in any one of claims 1 to 7.
9. A computer device, characterized in that: It comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the method for constructing a power dispatching knowledge question and answer system as claimed in any one of claims 1 to 7 are implemented.
10. A storage medium, characterized in that: The storage medium stores a construction program of a power dispatching knowledge question and answer system, and when the construction program of the power dispatching knowledge question and answer system is executed by at least one processor, the steps of a construction method of a power dispatching knowledge question and answer system described in any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Document question and answer method and device based on hypergraph
CN120030103A
A hypergraph-based document question answering method and device
CN120030103B
Customer service question and answer processing method and device
CN120353902A
Knowledge graph-based text processing method, device and equipment in field of power dispatching
CN120930741A