Interactive hydraulic engineering scheduling reasoning method fusing knowledge graph and large model
Through the interactive reasoning method of interactive reasoning and large models, the problem of accuracy and explanatory interpretability in the scheduling and reasoning of water conservancy engineering scheduling and reasoning has been solved, and a more efficient and reliable reasoning process is achieved.
Patent Information
- Application Number
- CN202411517635.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-29
- Publication Date
- 2025-01-21
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing scheduling inference methods for water conservancy engineering have problems such as insufficient numerical sensitivity, high requirements for training data, many redundant paths, and the inability to explore potential conditions through multiple rounds of interaction, resulting in limited accuracy and interpretability.
An interactive reasoning method that integrates knowledge graphs and large models is used to extract candidate conditions through deep learning sequence annotation models, conditional linking algorithms to find target condition entities, depth-first and breadth-first subgraph search algorithms to retrieve reasoning paths, and multiple rounds of interactive dialogues. Gradually discover the conditions.
Effectively improve the accuracy and interpretability of the scheduling and reasoning of water conservancy engineering, reduce redundant paths, improve the efficiency of knowledge map query, reduce the consumption of reasoning resources, and enhance the adaptability and generalization ability.
Smart Images

Figure CN119337986A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of water conservancy project scheduling, and specifically is an interactive water conservancy project scheduling reasoning method integrating knowledge graph and large model. Background Art
[0002] In response to the intelligent demand for reasoning in water conservancy project scheduling, traditional reasoning algorithms based on graph neural networks face serious practical problems. First, the numerical sensitivity of reasoning algorithms based on graph neural networks is not strong, so there are many errors in the numerical judgment of water conservancy project scheduling conditions and it is difficult to optimize; secondly, reasoning algorithms based on graph neural networks have high requirements for training data. Water conservancy project scheduling knowledge is summarized from the current status of the project and expert experience, and it is impossible to obtain large-scale and diverse reasoning training data, resulting in limited interpretability and practicality of reasoning algorithms. In this context, large models have strong knowledge understanding, reasoning and dialogue capabilities, which are fundamentally compatible with intelligent scheduling of water conservancy projects. Water conservancy project scheduling reasoning algorithms that integrate large models and knowledge graphs are gradually receiving widespread attention.
[0003] However, existing reasoning methods still have the following limitations:
[0004] 1. The existing knowledge graph query adopts a one-time query mode to retrieve relevant knowledge paths based on user input. There are a large number of redundant paths, which consumes more reasoning resources and brings the risk of misleading reasoning;
[0005] 2. Some knowledge graph queries use rule-based text conversion methods to convert knowledge graph paths into knowledge text. Under limited conversion rules, it is impossible to cover all the knowledge in the professional field, and the algorithm has limitations;
[0006] 3. Again, some knowledge graph queries only use breadth-first knowledge retrieval, which makes it difficult to model long-distance paths, resulting in reduced accuracy of large model reasoning;
[0007] 4. Finally, the existing large model and knowledge graph reasoning technology only performs reasoning based on the user's current input and cannot explore potential reasoning conditions through multiple rounds of interactions, which ultimately leads to limitations in the reasoning results and the inability to obtain the most accurate results. Summary of the invention
[0008] The purpose of the present invention is to provide an interactive water conservancy project scheduling reasoning method that integrates knowledge graph and large model in order to solve the above-mentioned problems.
[0009] The technical solution adopted by the present invention is as follows: an interactive water conservancy project scheduling reasoning method integrating knowledge graph and large model, the method comprising the following steps:
[0010] S1: Obtain the scheduling reasoning requirement text input by the user and use the deep learning sequence labeling model to extract all candidate conditions in the problem;
[0011] S2: Use the conditional linking algorithm to find the most suitable target condition entity for each candidate condition in the specified water conservancy project scheduling knowledge graph and obtain a list of "satisfied conditions";
[0012] S3: With the "satisfied conditions" list as the core, the depth-first and breadth-first subgraph search algorithms are executed respectively to retrieve the complete path from the target condition to the reasoning result as the reasoning path;
[0013] S4: Determine whether the reasoning path condition information has been collected. If so, execute S7; if not, loop through steps S4-S6 until the reasoning path condition information has been collected.
[0014] S5: According to the current reasoning path, obtain the query prompt template, build the query dialog box, call the large model to generate query questions, and ask the user for specific situations;
[0015] S6: According to the current reasoning path, obtain the judgment prompt template, form the judgment prompt words, and call the big model to evaluate whether the user's reply meets the current reasoning condition. If yes, add the corresponding condition to the "satisfied conditions" list, and re-retrieve the reasoning basis path through the "satisfied conditions" list; if not, restart the query dialog box to ask the next reasoning condition.
[0016] S7: Based on the user's historical conversation records and reasoning path, obtain the reasoning prompt template, construct the reasoning prompt words, input them into the big model, and use the big model to analyze and reason to obtain the final reasoning result.
[0017] In a preferred embodiment, the step S1 specifically includes:
[0018] SA1.1: Design a problem seed template based on the water conservancy project scheduling reasoning business, and collect data through knowledge graph entity filling and manual labeling to form a sequence labeling dataset.
[0019] SA1.2: Use the sequence labeling dataset to train a sequence labeling model to identify the exact location of the conditional phrase in the text. The sequence labeling model uses the PRGC-ESP model and adopts the transfer learning method, using the pre-trained Chinese-roberta-wwm-ext model as the text encoder.
[0020] The PRGC-ESP model is a sequence labeling model improved based on PRGC. In the prediction stage, PRGC-ESP uses potential candidate relationships to guide sequence boundary prediction, and achieves better sequence prediction results under the same data set resources by predicting possible relationship labels in the sequence.
[0021] chinese-roberta-wwm-ext is a Chinese pre-trained language model released by the Harbin Institute of Technology iFlytek Joint Laboratory, based on the Roberta architecture. The model combines dynamic masking and WWM technology, and can fully capture the language characteristics of sentences while having good generalization capabilities, and has significant performance advantages in multiple Chinese natural language processing tasks.
[0022] SA1.3: The trained PRGC-ESP model is deployed locally through the flask framework and provides services in the form of a network interface.
[0023] In a preferred embodiment, step S2 comprises:
[0024] SA2.1: The conditional linking algorithm includes element extraction and condition matching, wherein element extraction includes the extraction of water conservancy project scheduling condition subjects, water conservancy project scheduling condition categories and water conservancy project scheduling condition values, which is implemented through regular expressions.
[0025] SA2.2: In the condition matching stage, the Jaccard algorithm is first used to match the water conservancy project scheduling condition subject, and then a judgment is made based on the water conservancy project scheduling condition category and the water conservancy project scheduling condition value, and the condition entity that meets the conditions is selected as the condition link result.
[0026] In a preferred embodiment, step S3 specifically includes:
[0027] SA3.1: Run the depth-first subgraph search algorithm:
[0028] SA3.2: Run the breadth-first subgraph search algorithm: For each path segment of the depth-first subgraph search algorithm, extract the corresponding water conservancy project initial entity from it, and use it as the core to retrieve new k2 paths from the water conservancy project to the scheduling rules. There is no limit on the path length.
[0029] SA3.3: For all depth-first and breadth-first subgraph search results, set prior rules such as removing duplicate path segments and merging subpaths, and further optimize the subgraph search results through clustering and sampling to obtain the final reasoning path.
[0030] In a preferred embodiment, the step SA3.1 specifically includes:
[0031] (1) For any conditional entity V in the "satisfied conditions" list C, obtain its first-order neighbor entity set N V =(V1, V2, V3, ..., V n );
[0032] (2) Starting from the first neighbor entity V1, mark it as visited and obtain the set of all its first-order neighbor entities
[0033] (3) For each unvisited entity if Then use it as the new initial node, mark it as visited, and set the corresponding V i From the entity set N V Otherwise, call the recursive search function until Unique and category belongs to the dispatch rule class.
[0034] (4) The end condition of the depth-first subgraph search algorithm is the entity set N V It is empty. At the same time, the maximum depth supported by the recursive search function is k1, and the retrieved path segment is the marked initial entity segment.
[0035] (5) Specifically, during the implementation of this algorithm, the category of the initial entity can be limited, so as to retrieve the complete path from the water conservancy project to the scheduling rules in the water conservancy project scheduling knowledge graph.
[0036] In a preferred embodiment, step S4 specifically includes: judging whether the reasoning path condition information has been collected by judging whether the "satisfied conditions" list contains all the conditions in the reasoning path; if so, executing S7; if not, looping S4-S6 until the reasoning path condition information has been collected.
[0037] In a preferred embodiment, the step S5 specifically includes the following steps:
[0038] SA5.1: Traverse the current reasoning path, standardize the path, take the first condition of different paths, remove duplicates and get the query condition list.
[0039] SA5.2: Call the inquiry prompt template, combine and construct the inquiry prompt words according to the inquiry condition list, input the inquiry prompt words into the large model to generate an inquiry question, and add the inquiry question to the user's historical conversation record, and simultaneously display it in the front end of the dialog box.
[0040] In a preferred embodiment, the step S6 specifically includes the following steps:
[0041] SA6.1: Call the judgment prompt template, combine and construct the judgment prompt words according to the current query condition list and the user's historical dialogue, and input the judgment prompt words into the big model to require the big model to judge the dialogue information and return the satisfied conditions or "False".
[0042] SA6.2: If a satisfied condition is returned, add the corresponding condition to the "satisfied conditions" list and re-execute S4.
[0043] SA6.3: If "False" is returned, the corresponding condition is removed from the query condition list, and the sub-reasoning path containing the corresponding condition is removed from the current reasoning path, and S5 is re-executed.
[0044] In a preferred embodiment, step S7 specifically includes the following steps: calling the reasoning Prompt template, combining the user's historical dialogue and the current reasoning path, and constructing the reasoning Prompt prompt words, inputting the reasoning Prompt prompt words into the big model, so as to call the big model to generate the final reasoning result, and return it to the user.
[0045] In summary, due to the adoption of the above technical solution, the beneficial effects of the present invention are:
[0046] 1. In the present invention, in order to solve the problem of low accuracy of water conservancy project scheduling reasoning based on graph neural network, this method introduces a large model as the reasoning engine, provides factual knowledge and reasoning knowledge through knowledge graph, and performs conditional reasoning on natural language text, which effectively improves the accuracy and interpretability of the water conservancy project scheduling reasoning method. By mining potential reasoning conditions in an interactive dialogue, more contextual information and background knowledge support are provided for the reasoning method, which effectively alleviates the hallucination problem of the large model reasoning engine and avoids suboptimal results caused by one-time reasoning, further improving the practicality of the present invention; by using the knowledge graph as an external knowledge source and retrieving knowledge paths in a combination of depth-first and breadth-first methods, the dependence of the reasoning algorithm on the ability of the large model itself is reduced. In addition, with the continuous strengthening of the scale of the knowledge graph and the ability of the large model, the adaptability and generalization ability of the present invention will also be significantly enhanced.
[0047] 2. In the present invention, a subgraph search algorithm combining depth-first and breadth-first is used to retrieve knowledge paths, effectively reduce redundant paths, improve knowledge graph query efficiency, and reduce reasoning resource consumption. Emphasize the core role of knowledge graphs in the reasoning process, reduce dependence on the capabilities of large models themselves, and make the reasoning algorithm more stable and reliable. With the continuous strengthening of the scale of knowledge graphs and the capabilities of large models, the adaptability and generalization ability of the present invention will also be significantly enhanced, and effective reasoning can be performed in more scenarios.
[0048] 3. In the present invention, a large model is introduced as an inference engine, and its powerful knowledge understanding, reasoning and dialogue capabilities are used to perform conditional reasoning on natural language texts, which effectively makes up for the shortcomings of traditional algorithms. The knowledge graph is used as an external knowledge source to provide factual knowledge and reasoning knowledge for the reasoning process, and a more accurate reasoning basis is provided for the large model, thereby improving the accuracy and reliability of the reasoning results. At the same time, through multiple rounds of interactive dialogues, potential reasoning conditions are gradually excavated, and more contextual information and background knowledge are provided for the reasoning process, which effectively alleviates the hallucination problem of the large model reasoning engine, avoids suboptimal results caused by one-time reasoning, and further improves the accuracy and practicality of reasoning. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 It is a schematic diagram of the process principle of the present invention. DETAILED DESCRIPTION
[0050] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0051] Example:
[0052] Reference Figure 1 , an interactive water conservancy project scheduling reasoning method integrating knowledge graph and large model, including the following steps:
[0053] S1: Obtain the scheduling reasoning requirement text input by the user and use the deep learning sequence labeling model to extract all candidate conditions in the problem;
[0054] S2: Use the conditional linking algorithm to find the most suitable target condition entity for each candidate condition in the specified water conservancy project scheduling knowledge graph and obtain a list of "satisfied conditions";
[0055] S3: With the "satisfied conditions" list as the core, the depth-first and breadth-first subgraph search algorithms are executed respectively to retrieve the complete path from the target condition to the reasoning result as the reasoning path;
[0056] S4: Determine whether the reasoning path condition information has been collected. If so, execute S7; if not, loop through steps S4-S6 until the reasoning path condition information has been collected.
[0057] S5: According to the current reasoning path, obtain the query prompt template, build the query dialog box, call the large model to generate query questions, and ask the user for specific situations;
[0058] S6: According to the current reasoning path, obtain the judgment prompt template, form the judgment prompt words, and call the big model to evaluate whether the user's reply meets the current reasoning condition. If yes, add the corresponding condition to the "satisfied conditions" list, and re-retrieve the reasoning basis path through the "satisfied conditions" list; if not, restart the query dialog box to ask the next reasoning condition.
[0059] S7: Based on the user's historical conversation records and reasoning path, obtain the reasoning prompt template, construct the reasoning prompt words, input them into the big model, and use the big model to analyze and reason to obtain the final reasoning result.
[0060] Step S1 specifically includes:
[0061] SA1.1: Design a problem seed template based on the business, and collect data through knowledge graph entity filling and manual annotation to form a sequence annotation dataset.
[0062] SA1.2: Use the sequence labeling dataset to train a sequence labeling model to identify the exact location of the conditional phrase in the text. The sequence labeling model uses the PRGC-ESP model and adopts the transfer learning method, using the pre-trained Chinese-roberta-wwm-ext model as the text encoder.
[0063] The PRGC-ESP model is a sequence labeling model improved based on PRGC. In the prediction stage, PRGC-ESP uses potential candidate relationships to guide sequence boundary prediction, and achieves better sequence prediction results under the same data set resources by predicting possible relationship labels in the sequence.
[0064] chinese-roberta-wwm-ext is a Chinese pre-trained language model released by the Harbin Institute of Technology iFlytek Joint Laboratory, based on the Roberta architecture. The model combines dynamic masking and WWM technology, and can fully capture the language characteristics of sentences while having good generalization capabilities, and has significant performance advantages in multiple Chinese natural language processing tasks.
[0065] SA1.3: The trained PRGC-ESP model is deployed locally through the flask framework and provides services in the form of a network interface.
[0066] In a specific implementation, "condition" is the abbreviation of "water conservancy project dispatching condition", which is a phrase consisting of a water conservancy project object and an attribute value. For example, "the inflow of Longtan Reservoir is 3,000 cubic meters per second", "the water level of Xiaoxiang Reservoir is 1,900 meters", etc.
[0067] In a preferred embodiment, the extraction of candidate conditions can also be achieved by combining the large model with the prompt. Specifically, by setting task-specific prompt words, the large model is allowed to extract specific conditions in the sentence in an information extraction manner.
[0068] Step S2 includes:
[0069] SA2.1: The conditional linking algorithm includes element extraction and condition matching, wherein element extraction includes the extraction of water conservancy project scheduling condition subjects, water conservancy project scheduling condition categories and water conservancy project scheduling condition values, which is implemented through regular expressions.
[0070] SA2.2: In the condition matching stage, the Jaccard algorithm is first used to match the water conservancy project scheduling condition subject, and then a judgment is made based on the water conservancy project scheduling condition category and the water conservancy project scheduling condition value, and the condition entity that meets the conditions is selected as the condition link result.
[0071] In a specific implementation, the role of entity linking is to link the initial condition given by the user to a specific entity in the knowledge graph. In addition, a vector similarity determination method based on text embedding can also be used. If the vector similarity between the embedding vector of the candidate condition and a condition in the knowledge graph is greater than a preset threshold, it can be determined that the candidate condition corresponds to a specific condition in the knowledge graph.
[0072] Alternatively, in another specific implementation, the big model can be combined with Prompt to allow the big model to select the top-k specific conditions that best meet the candidate conditions from the entire condition list of the knowledge graph, and further sort and filter them to complete entity linking, etc. This specification does not make specific limitations on this.
[0073] Step S3 specifically includes:
[0074] SA3.1: Run the depth-first subgraph search algorithm:
[0075] SA3.2: Run the breadth-first subgraph search algorithm: For each path segment of the depth-first subgraph search algorithm, extract the corresponding water conservancy project initial entity from it, and use it as the core to retrieve new k2 paths from the water conservancy project to the scheduling rules. There is no limit on the path length.
[0076] SA3.3: For all depth-first and breadth-first subgraph search results, set prior rules such as removing duplicate path segments and merging subpaths, and further optimize the subgraph search results through clustering and sampling to obtain the final reasoning path.
[0077] Step SA3.1 specifically includes:
[0078] (1) For any conditional entity V in the "satisfied conditions" list C, obtain its first-order neighbor entity set N V =(V1, V2, V3, ..., V n );
[0079] (2) Starting from the first neighbor entity V1, mark it as visited and obtain the set of all its first-order neighbor entities
[0080] (3) For each unvisited entity if Then use it as the new initial node, mark it as visited, and set the corresponding V i From the entity set N V Otherwise, call the recursive search function until Unique and category belongs to the dispatch rule class.
[0081] (4) The end condition of the depth-first subgraph search algorithm is the entity set N V It is empty. At the same time, the maximum depth supported by the recursive search function is k1, and the retrieved path segment is the marked initial entity segment.
[0082] (5) Specifically, during the implementation of this algorithm, the category of the initial entity can be limited, so as to retrieve the complete path from the water conservancy project to the scheduling rules in the water conservancy project scheduling knowledge graph.
[0083] Step S4 specifically includes: determining whether the reasoning path condition information has been collected by determining whether the "satisfied conditions" list contains all the conditions in the reasoning path; if so, executing S7; if not, looping through S4-S6 until the reasoning path condition information has been collected.
[0084] Step S5 specifically includes the following steps:
[0085] SA5.1: Traverse the current reasoning path, standardize the path, take the first condition of different paths, remove duplicates and get the query condition list.
[0086] SA5.2: Call the inquiry prompt template, combine and construct the inquiry prompt words according to the inquiry condition list, input the inquiry prompt words into the big model to generate the inquiry question, and add the inquiry question to the user's historical conversation record, and display it synchronously in the front end of the dialog box.
[0087] In a specific implementation, the query prompt template is as follows:
[0088] Prompt:
[0089] You are an AI assistant. Your task is to ask users questions based on basic situations to obtain corresponding information, for example:
[0090] ###Example 1###
[0091] [Basic situation] ["The storage capacity of the Datongxia Reservoir is greater than 32,000 cubic meters"]
[0092] Question: What is the storage capacity of the Datongxia Reservoir?
[0093] ###Example 2###
[0094] [Basic situation] ["The flood water entering the Baise Reservoir has begun to recede"]
[0095] Question: Has the water level of Baise Reservoir started to recede?
[0096] ###Real Conversation###
[0097] ["conditions"]
[0098] Your question:
[0099] Step S6 specifically includes the following steps:
[0100] SA6.1: Call the judgment prompt template, combine and construct the judgment prompt words based on the current query condition list and the user's historical dialogue, and input the judgment prompt words into the big model to require the big model to judge the dialogue information and return the satisfied conditions or "False".
[0101] SA6.2: If a satisfied condition is returned, add the corresponding condition to the "satisfied conditions" list and re-execute S4.
[0102] SA6.3: If "False" is returned, the corresponding condition is removed from the query condition list, and the sub-reasoning path containing the corresponding condition is removed from the current reasoning path, and S5 is re-executed.
[0103] In a specific implementation, the judgment prompt template is as follows:
[0104] Prompt:
[0105] You are an AI assistant, and your task is to select a condition from the given set of conditions that best describes the current situation based on the input questions and answers. Note the following requirements:
[0106] 1. If the condition is found, return the corresponding condition, otherwise return "False" without returning the analysis process and additional characters.
[0107] 2. When making judgments, pay attention to the units of the values, and pay special attention to the relationship between the values.
[0108] ###example###
[0109] [Condition Group]: ['Reservoir water level is less than 100.00 meters', 'Reservoir water level is greater than 100.00 meters and less than 200.00 meters', 'Reservoir water level is greater than 200.00 meters and less than 300.00 meters', 'Inflow flood begins to recede']
[0110]
Condition
[0111] [Answer]: 250 meters
[0112] [Analysis]: Because "the reservoir water level is 250 meters", which is greater than 200 meters and less than 300 meters, it meets the condition of "the reservoir water level is greater than 200.00 meters and less than 300.00 meters", so it returns "the reservoir water level is greater than 200.00 meters and less than 300.00 meters"
[0113] [Result]: The reservoir water level is greater than 200.00 meters and less than 300.00 meters
[0114] ###Real Conversation###
[0115]
Condition group
[0116] [Condition]: query
[0117]
Answer
[0118]
result
[0119] In this embodiment, the purpose of judging the prompt template is to return the conditions that have been met in the path through interactive question-and-answer mode. By strengthening the understanding ability of the large model through prompts, subtasks such as numerical comparison, unit conversion, contextual relationship judgment and object matching can be fully performed, and more sufficient condition judgment can be achieved, making the interactive reasoning process more intelligent and efficient.
[0120] Step S7 specifically includes the following steps: calling the inference Prompt template, combining the user's historical dialogue and the current inference path, and constructing the inference Prompt prompt words, inputting the inference Prompt prompt words into the big model, so as to call the big model to generate the final inference result, and return it to the user.
[0121] In a specific implementation, the inference prompt template is as follows:
[0122] Prompt:
[0123] You are an AI assistant, and you need to summarize a scheduling plan based on the retrieved knowledge graph path and historical conversations with users.
[0124] 1. The last item in the knowledge graph path retrieved is the scheduling plan
[0125] 2. The returned content includes the retrieved knowledge graph path
[0126]
Knowledge Graph Path
[0127]
User history conversation
[0128] Scheduling plan:
[0129] In the present invention, in order to solve the problem of low accuracy of water conservancy project scheduling reasoning based on graph neural network, the method introduces a large model as the reasoning engine, provides factual knowledge and reasoning knowledge through knowledge graph, and performs conditional reasoning on natural language text, which effectively improves the accuracy and interpretability of the water conservancy project scheduling reasoning method. By mining potential reasoning conditions in an interactive dialogue, more contextual information and background knowledge support are provided for the reasoning method, which effectively alleviates the illusion problem of the large model reasoning engine and avoids suboptimal results caused by one-time reasoning, further improving the practicality of the present invention; by using the knowledge graph as an external knowledge source and retrieving knowledge paths in a combination of depth-first and breadth-first methods, the dependence of the reasoning algorithm on the ability of the large model itself is reduced. In addition, with the continuous strengthening of the scale of the knowledge graph and the ability of the large model, the adaptability and generalization ability of the present invention will also be significantly enhanced.
[0130] In the present invention, a subgraph search algorithm combining depth-first and breadth-first is used to retrieve knowledge paths, effectively reduce redundant paths, improve knowledge graph query efficiency, and reduce reasoning resource consumption. The core role of the knowledge graph in the reasoning process is emphasized, and the dependence on the large model's own capabilities is reduced, making the reasoning algorithm more stable and reliable. With the continuous strengthening of the knowledge graph scale and large model capabilities, the adaptability and generalization ability of the present invention will also be significantly enhanced, and effective reasoning can be performed in more scenarios.
[0131] In the present invention, a large model is introduced as an inference engine, and its powerful knowledge understanding, reasoning and dialogue capabilities are used to perform conditional reasoning on natural language texts, effectively making up for the shortcomings of traditional algorithms. By using the knowledge graph as an external knowledge source, factual knowledge and reasoning knowledge are provided for the reasoning process, and a more accurate reasoning basis is provided for the large model, thereby improving the accuracy and reliability of the reasoning results. At the same time, through multiple rounds of interactive dialogues, potential reasoning conditions are gradually excavated, and more contextual information and background knowledge are provided for the reasoning process, effectively alleviating the hallucination problem of the large model reasoning engine, avoiding suboptimal results caused by one-time reasoning, and further improving the accuracy and practicality of reasoning.
[0132] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the term "comprises" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0133] The above description enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. An interactive water conservancy project scheduling reasoning method integrating knowledge graph and large model, characterized by: The method comprises the following steps: S1: Obtain the scheduling reasoning requirement text input by the user and use the deep learning sequence labeling model to extract all candidate conditions in the problem; S2: Use the conditional linking algorithm to find the most suitable target condition entity for each candidate condition in the specified water conservancy project scheduling knowledge graph and obtain a list of "satisfied conditions"; S3: With the "satisfied conditions" list as the core, execute the depth-first and breadth-first subgraph search algorithms respectively to retrieve the complete path from the target condition to the reasoning result as the reasoning path; S4: Determine whether the reasoning path condition information has been collected; if so, execute S7; if not, loop through steps S4-S6 until the reasoning path condition information has been collected; S5: According to the current reasoning path, obtain the query prompt template, build the query dialog box, call the large model to generate query questions, and ask the user for specific situations; S6: According to the current reasoning path, obtain the judgment prompt template, form the judgment prompt words, and call the big model to evaluate whether the user's reply meets the current reasoning condition; if yes, add the corresponding condition to the "satisfied conditions" list, and re-retrieve the reasoning basis path through the "satisfied conditions" list; if no, restart the inquiry dialog box to ask the next reasoning condition; S7: Based on the user's historical conversation records and reasoning path, obtain the reasoning prompt template, construct the reasoning prompt words, input them into the big model, and use the big model to analyze and reason to obtain the final reasoning result.
2. The interactive water conservancy project scheduling reasoning method integrating knowledge graph and large model as claimed in claim 1 is characterized by: The step S1 specifically includes: SA1.1: Design a problem seed template based on the business, and collect data through knowledge graph entity filling and manual annotation to form a sequence annotation dataset; SA1.2: Use the sequence labeling dataset to train a sequence labeling model to identify the exact location of the conditional phrase in the text; the sequence labeling model uses the PRGC-ESP model, and adopts the transfer learning method, using the pre-trained Chinese-roberta-wwm-ext model as the text encoder; SA1.3: The trained PRGC-ESP model is deployed locally through the flask framework and provides services in the form of a network interface.
3. The interactive water conservancy project scheduling reasoning method integrating knowledge graph and large model as claimed in claim 1 is characterized by: The step S2 comprises: SA2.1: The conditional linking algorithm includes element extraction and condition matching, where element extraction includes extraction of water conservancy project dispatching condition subject, water conservancy project dispatching condition category and water conservancy project dispatching condition value, which is realized by regular expressions; SA2.2: In the condition matching stage, the Jaccard algorithm is first used to match the water conservancy project scheduling condition subject, and then a judgment is made based on the water conservancy project scheduling condition category and the water conservancy project scheduling condition value, and the condition entity that meets the conditions is selected as the condition link result.
4. The interactive water conservancy project scheduling reasoning method integrating knowledge graph and large model as claimed in claim 1 is characterized by: The step S3 specifically includes: SA3.1: Run the depth-first subgraph search algorithm: SA3.2: Run the breadth-first subgraph search algorithm: For each path segment of the depth-first subgraph search algorithm, extract the corresponding initial entity of the water conservancy project from it, and use it as the core to retrieve new k2 paths from the water conservancy project to the scheduling rules. There is no limit on the path length; SA3.3: For all depth-first and breadth-first subgraph search results, set prior rules such as removing duplicate path segments and merging subpaths, and further optimize the subgraph search results through clustering and sampling to obtain the final reasoning path.
5. The interactive water conservancy project scheduling reasoning method integrating knowledge graph and large model as claimed in claim 5 is characterized by: The step SA3.1 specifically includes: (1) For any conditional entity V in the "satisfied conditions" list C, obtain its first-order neighbor entity set N V =(V1, V2, V3, ..., V n ); (2) Starting from the first neighbor entity V1, mark it as visited and obtain the set of all its first-order neighbor entities (3) For each unvisited entity if Then use it as the new initial node, mark it as visited, and set the corresponding V i From the entity set N V Otherwise, call the recursive search function until Unique and category belongs to the dispatch rule category; (4) The end condition of the depth-first subgraph search algorithm is the entity set N V It is empty. At the same time, the maximum depth supported by the recursive search function is k1, and the retrieved path segment is the marked initial entity segment.
6. The interactive water conservancy project scheduling reasoning method integrating knowledge graph and large model as claimed in claim 1 is characterized by: The step S4 specifically includes: judging whether the reasoning path condition information has been collected by judging whether the "satisfied conditions" list contains all the conditions in the reasoning path; if so, executing S7; if not, looping S4-S6 until the reasoning path condition information has been collected.
7. The interactive water conservancy project scheduling reasoning method integrating knowledge graph and large model as claimed in claim 1 is characterized by: The step S5 specifically includes the following steps: SA5.1: Traverse the current reasoning path, standardize the path, take the first condition of different paths, remove duplicates and get the query condition list; SA5.2: Call the inquiry prompt template, combine and construct the inquiry prompt words according to the inquiry condition list, input the inquiry prompt words into the large model to generate an inquiry question, and add the inquiry question to the user's historical conversation record, and simultaneously display it in the front end of the dialog box.
8. The interactive water conservancy project scheduling reasoning method integrating knowledge graph and large model as claimed in claim 1 is characterized by: The step S6 specifically includes the following steps: SA6.1: Call the judgment prompt template, combine and construct the judgment prompt words according to the current query condition list and the user's historical dialogue, and input the judgment prompt words into the big model to require the big model to judge the dialogue information and return the satisfied conditions or "False"; SA6.2: If a satisfied condition is returned, add the corresponding condition to the "satisfied conditions" list and re-execute S4; SA6.3: If "False" is returned, the corresponding condition is removed from the query condition list, and the sub-reasoning path containing the corresponding condition is removed from the current reasoning path, and S5 is re-executed.
9. The interactive water conservancy project scheduling reasoning method integrating knowledge graph and large model as claimed in claim 1 is characterized by: The step S7 specifically includes the following steps: calling the inference Prompt template, combining the user's historical dialogue and the current inference path, and constructing the inference Prompt prompt words, inputting the inference Prompt prompt words into the big model, so as to call the big model to generate the final inference result, and return it to the user.
Citation Information
Patent Citations
Multi-round inquiry method based on diagnosis and treatment guidance tree and diagnosis and treatment inference engine
CN117542509A
Large language model enhanced question and answer generation method
CN118013051A
Military question and answer method and system for large language model-driven knowledge graph multi-hop reasoning
CN118036742A
Intelligent question and answer method based on cooperation of large language model and knowledge graph
CN118797017A
Ultra large language models as ai agent controllers for improved ai agent performance in an environment
US20220036153A1
Cited By
Unified representation and dynamic knowledge reasoning method and device for intelligent cluster system
CN120338114A