A Query Graph-Driven Multi-Turn Reasoning Question Answering Method and System
By using a query graph-driven multi-round reasoning question-answering method, the problem of inconsistency between questions and answers caused by independent training of modules in the RAG framework system is solved. This method enables multi-module collaboration and interpretable reasoning, improves the systematicity and interpretability of the question-answering system, ensures the coherence and traceability of answer generation, and solves the problems of structural expression and path optimization in existing question-answering systems.
Patent Information
- Application Number
- CN202511213133.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-28
- Publication Date
- 2025-11-14
- Estimated Expiration
- 2045-08-28
AI Technical Summary
Existing RAG framework systems suffer from several problems in multi-round reasoning question answering, including independent module training leading to inconsistencies between subquery decomposition and answer synthesis, lack of explicit intermediate reasoning structures, difficulty in interpretation and auditing, inability to perform path optimization and error backtracking, resulting in missing structural expressions in the output content of the question answering system and untraceable reasoning processes.
A query graph-driven multi-turn reasoning question answering method is adopted. By constructing a query graph, enhancing retrieval control, generating sub-answers, memorizing answers, and synthesizing answers, it achieves multi-module collaboration, dynamic retrieval judgment, and closed-loop question answering capabilities with interpretable reasoning. It utilizes a joint judgment mechanism of static knowledge classification and dynamic entropy estimation, combined with a structured reasoning representation framework and a module structure-aware loss function, to ensure the contextual coherence and logical consistency of answer generation.
It significantly improves the systematicness and interpretability of complex problem handling, enhances the balance between knowledge utilization efficiency and answer quality, achieves transparency and traceability of reasoning paths, reduces training resource consumption and deployment complexity, and ensures the quality of multi-round reasoning question-and-answer results.
Smart Images

Figure CN120687579B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of reasoning question answering, and in particular relates to a query graph-driven multi-turn reasoning question answering method and system. Background Technology
[0002] The statements in this section are merely background information related to the present invention and do not necessarily constitute prior art.
[0003] Large Language Models (LLMs) are widely used in open-domain question answering, dialogue systems, and knowledge reasoning. However, the knowledge in large language models is still mainly internalized in the form of static parameters, which makes it difficult to flexibly cope with real-time changing external information and complex multi-hop problems (such as insufficient factual information, incomplete answers, or logical incoherence), thus making them unsuitable for knowledge-intensive tasks.
[0004] To enhance the capabilities of large language models in knowledge-intensive tasks, a Retrieval-Augmented Generation (RAG) framework is proposed. This framework combines an external knowledge base with a retrieval module to dynamically access non-parametric knowledge, thereby improving the accuracy and verifiability of the generated content. However, the RAG framework is a single-round pipeline structure. To meet the needs of multi-hop reasoning and solving complex problems, sub-modules such as a query rewriting module, a retrieval control module, and an inference execution module are introduced to decompose the input query in multiple rounds and provide dynamic feedback, thereby improving the flexibility and accuracy of the overall inference path.
[0005] However, current RAG framework systems that incorporate sub-modules such as query rewriting, retrieval control, and inference execution still employ a phased training strategy. This results in independent training of sub-modules and a lack of collaborative optimization, making it difficult to achieve a closed loop of information flow between inference paths. Consequently, inconsistencies arise between subquery decomposition and answer synthesis, affecting the quality of the final output. Furthermore, this leads to a lack of explicit intermediate inference structure representation, making the question-answering system difficult to interpret and audit, hindering path optimization and error backtracking. Ultimately, this results in a lack of structural representation in the output content of the question-answering system and an untraceable inference process. Summary of the Invention
[0006] To address the aforementioned technical problems, this invention provides a query graph-driven multi-turn reasoning question-answering method and system, which enables closed-loop question-answering capabilities including multi-module collaboration, dynamic retrieval and judgment, and interpretable reasoning, while ensuring the quality of question-answering output.
[0007] To achieve the above objectives, the present invention adopts the following technical solution:
[0008] The first aspect of the present invention provides a query graph-driven multi-turn reasoning question answering method.
[0009] A query graph-driven multi-turn reasoning question answering method includes:
[0010] The problem is receiving raw natural language.
[0011] The original natural language question is processed using a multi-turn reasoning question-answering model to obtain the final response answer; wherein, the multi-turn reasoning question-answering model includes:
[0012] The query graph building module is used to parse the original natural language question and build the query graph;
[0013] The enhanced retrieval control module is used to evaluate the static probability that each round of subqueries in the query graph needs to retrieve external knowledge, and then combine it with the information entropy estimate output by the language model to determine whether to introduce external knowledge.
[0014] The sub-answer generation module is used to perform reasoning based on internal knowledge or by integrating external knowledge, generate sub-answers corresponding to each sub-query, and record the reasoning path;
[0015] The answer memory module is used to structurally store the corresponding sub-answers and their reasoning paths for each round of sub-queries;
[0016] The new query generation module is used to dynamically evaluate the semantic coverage, logical consistency and information closure of the reasoning path of existing sub-answers, and to determine whether sub-queries need to be added.
[0017] The answer synthesis module is used to read all sub-answers and reasoning paths from the structured storage, perform structured comprehensive reasoning according to the query graph, and generate the final response answer.
[0018] As one implementation method, the process of constructing a query graph is as follows:
[0019] The original natural language problem is broken down into several sub-problems, each of which is a local query node, i.e., a subquery;
[0020] The semantics and dependencies between the subqueries are analyzed. Based on the dependencies, it is determined whether to add a directed edge between any two subqueries to determine the order of reasoning, thus forming a directed acyclic graph, which is the query graph.
[0021] The advantages of the above technical solution are that the graph structure not only expresses the semantic organization of subqueries, but also has executable semantics, thus providing a clear execution path for subsequent information retrieval and answer generation; during the reasoning process, the subquery nodes are executed sequentially according to the graph topology, and the placeholder references are replaced with values at each step according to the binding rules, which can ensure the contextual coherence and logical consistency of answer generation.
[0022] As one implementation method, the process of determining whether to introduce external knowledge is as follows:
[0023] The static probability of needing to retrieve external knowledge in each round of subqueries is evaluated using a static knowledge classification model.
[0024] By utilizing the probability distribution of the language model's own output under limited answer conditions, an information entropy estimate is obtained to reflect the subjective uncertainty of the language model.
[0025] The static probability and the information entropy estimate are weighted and calculated to generate a decision probability for whether to retrieve external knowledge. This probability is then compared with a preset threshold to determine whether to introduce external knowledge.
[0026] The advantages of the above technical solution are that by adopting a joint judgment mechanism of static knowledge classification and dynamic entropy estimation, it can effectively avoid the model from skipping necessary retrievals due to overconfidence or local errors, and can also skip redundant calls when the model has clear knowledge, thus achieving a dual guarantee of knowledge utilization efficiency and answer quality.
[0027] As one implementation method, when it is determined that the subquery does not require the introduction of external knowledge, the language model performs self-consistent reasoning based on the internal knowledge base, using the subquery as input; when it is determined that the subquery requires the introduction of external knowledge, the subquery is concatenated with the retrieved external knowledge and used as input to guide the model to perform a fusion-based answer in combination with the context.
[0028] The advantage of the above technical solution is that by determining whether the language model has sufficient internal knowledge to answer directly when faced with a specific subquery, or whether it needs to rely on external knowledge resources for assisted retrieval, it achieves a dual guarantee of knowledge utilization efficiency and answer quality.
[0029] As one implementation method, a structured reasoning representation framework is used to record the reasoning path; the reasoning path includes three stages: the language model's understanding of the current problem and the explicit expression of the solution intention; the operational strategy adopted; and the intermediate feedback content.
[0030] The advantages of the above technical solution are that the structured reasoning representation framework used to record the reasoning path can not only be used for subsequent answer fusion, error detection and reflection optimization, but also improve the transparency and robustness of the system in multi-hop problem scenarios.
[0031] As one implementation method, in each round of reasoning, it is determined whether there are any subsequent sub-problems available for execution based on the current query graph node status and the answer generation result; if the current graph path has been completely traversed, the process is terminated.
[0032] The advantage of the above technical solution is that it can ensure the inference convergence and execution efficiency of the system during actual operation.
[0033] As one implementation method, when the number of nodes traversed exceeds the preset maximum subquery rounds threshold, the current inference chain is forcibly terminated, and the final answer synthesis stage is entered.
[0034] The advantage of the above technical solution is that it can prevent the model from continuously generating invalid subqueries or getting stuck in path loops during multiple rounds of decomposition, ensuring that the inference chain closes naturally within a finite number of steps.
[0035] As one implementation method, the loss function during the training process of a multi-turn reasoning question answering model is:
[0036] ;
[0037] in, This represents the loss function; N represents the number of modules contained in the sample. This refers to the j-th target token (identifier) in the k-th module. Indicates the number of target tokens; The set of structure fields specified for the k-th module; This is a binary loss mask function that takes a value of 1 only within the range of the structure fields; This represents the language model prediction probability under the conditions of frozen backbone parameters θ and trainable role token embeddings δ. This represents the input of the k-th module; This represents the role token corresponding to the k-th module.
[0038] The advantage of the above technical solution is that by introducing a module structure-aware loss function, loss calculation is performed only on the tokens involved in the prediction in the structure field, which can avoid interference from invalid tokens and semantic confusion between modules, and ensure the quality of the reasoning and answering results of the multi-turn reasoning question answering model.
[0039] A second aspect of the present invention provides a query graph-driven multi-turn reasoning question-answering system.
[0040] A query graph-driven multi-turn reasoning question-answering system includes:
[0041] The question receiving unit is used to receive raw natural language questions.
[0042] A question-answering reasoning unit is used to process the original natural language question using a multi-turn reasoning question-answering model to obtain the final response answer; wherein, the multi-turn reasoning question-answering model includes:
[0043] The query graph building module is used to parse the original natural language question and build the query graph;
[0044] The enhanced retrieval control module is used to evaluate the static probability that each round of subqueries in the query graph needs to retrieve external knowledge, and then combine it with the information entropy estimate output by the language model to determine whether to introduce external knowledge.
[0045] The sub-answer generation module is used to perform reasoning based on internal knowledge or by integrating external knowledge, generate sub-answers corresponding to each sub-query, and record the reasoning path;
[0046] The answer memory module is used to structurally store the corresponding sub-answers and their reasoning paths for each round of sub-queries;
[0047] The new query generation module is used to dynamically evaluate the semantic coverage, logical consistency and information closure of the reasoning path of existing sub-answers, and to determine whether sub-queries need to be added.
[0048] The answer synthesis module is used to read all sub-answers and reasoning paths from the structured storage, perform structured comprehensive reasoning according to the query graph, and generate the final response answer.
[0049] A third aspect of the present invention provides an electronic device.
[0050] An electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the query graph-driven multi-turn reasoning question-answering method described above.
[0051] Compared with the prior art, the beneficial effects of the present invention are:
[0052] (1) This invention parses the original natural language question and constructs a query graph, determines whether to retrieve external knowledge, generates sub-answers corresponding to each sub-query and records the reasoning path, performs structured comprehensive reasoning on the semantic coverage, logical consistency and information closure of the reasoning path and according to the order of the query graph, and forms a multi-stage question-and-answer process of "query decomposition - retrieval judgment - sub-answer generation - reasoning closure - final synthesis", which overcomes the limitations of traditional RAG methods in terms of structural expression ability and path control, and significantly improves the systematicness and interpretability of complex problem processing.
[0053] (2) The present invention adopts a joint judgment mechanism of static knowledge classification and dynamic entropy estimation, which can effectively avoid the model from skipping necessary retrieval due to overconfidence or local errors, and can also skip redundant calls when the model has clear knowledge. This significantly improves the balance between resource utilization efficiency and knowledge response capability of the system, and achieves dual guarantee of knowledge utilization efficiency and answer quality.
[0054] (3) The present invention uses a structured reasoning representation framework to record the reasoning path, and records the internal thinking process, operation behavior and external observation results of the model in a structured way, which significantly improves the transparency and traceability of the generation process. Combined with a multi-round state recording mechanism, it can not only support reasoning path backtracking and behavior auditing, but also provide a unified and stable semantic foundation for downstream new query generation and final answer synthesis.
[0055] (4) This invention proposes a joint training method for multi-module structures. Combining role token guidance and structure field awareness loss masking strategy, under the premise of freezing language model parameters, by introducing a module structure awareness loss function, loss calculation is performed only on tokens involved in prediction in the structure field. This can avoid interference from invalid tokens and semantic confusion between modules, achieve efficient customized capability transfer, significantly reduce training resource consumption and deployment complexity, and at the same time maintain cross-module behavioral consistency and output style uniformity, ensuring the quality of reasoning and answering results of multi-round reasoning question answering models. Attached Figure Description
[0056] The accompanying drawings, which form part of this invention, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute an improper limitation of the invention.
[0057] Figure 1 This is a flowchart illustrating the query graph-driven multi-turn reasoning question answering method according to an embodiment of the present invention.
[0058] Figure 2 This is a schematic diagram of the query graph construction module according to an embodiment of the present invention;
[0059] Figure 3 This is a schematic diagram of the enhanced retrieval control module according to an embodiment of the present invention;
[0060] Figure 4 This is a schematic diagram of the sub-answer generation module according to an embodiment of the present invention;
[0061] Figure 5 This is a schematic diagram of the new query generation module in an embodiment of the present invention;
[0062] Figure 6 This is a schematic diagram of the answer synthesis module according to an embodiment of the present invention;
[0063] Figure 7 This is a schematic diagram of an electronic device according to an embodiment of the present invention. Detailed Implementation
[0064] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0065] It should be noted that the following detailed description is illustrative and intended to provide further explanation of the invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.
[0066] It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the scope of exemplary embodiments according to the invention. As used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise. Furthermore, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof.
[0067] To address the problems existing in current RAG systems, such as loosely coupled modules, untraceable reasoning paths, inaccurate retrieval and judgment, and redundant generation processes, this invention provides a query graph-driven multi-round reasoning question-answering method and system, achieving closed-loop question-answering capabilities with multi-module collaboration, dynamic retrieval and judgment, and interpretable reasoning.
[0068] Figure 1 This is a flowchart illustrating a query graph-driven multi-turn reasoning question-answering method according to an embodiment of the present invention, as shown below. Figure 1 The query graph-driven multi-turn reasoning question answering method shown in this embodiment may include the following steps, and the specific implementation process of each step is as follows:
[0069] Step 1: Receive the original natural language question.
[0070] In the specific implementation process, the original natural language question can be set according to the actual situation. For example, the original natural language question can be set as: Were Li Bai and Du Fu born in the same dynasty?
[0071] Step 2: Process the original natural language question using a multi-turn reasoning question-answering model to obtain the final response answer.
[0072] In its implementation, the multi-turn reasoning question-answering model includes the following modules:
[0073] (1) Query graph construction module:
[0074] The query graph construction module is used to parse the original natural language question and construct a query graph, which represents the semantics and dependencies of each subquery. Combined with... Figure 2 As shown, the process of constructing a query graph in this embodiment of the invention is as follows:
[0075] Step a1: Decompose the original natural language problem into several sub-problems, each of which is a local query node, i.e., a subquery;
[0076] Step a2: Analyze the semantics and dependencies between each subquery (e.g., whether there is information passing, variable sharing, contextual inheritance, etc.), determine whether to add a directed edge between any two subqueries based on the dependencies, in order to determine the order of reasoning, and form a directed acyclic graph, which is the query graph.
[0077] In the specific implementation of step a2, when it is detected that the expression or solution process of a certain subquery depends on the result of another subquery, a directed edge is added to the graph from the former to the latter, clarifying the order of reasoning. Furthermore, to support cross-node data referencing, a placeholder reference mechanism is introduced in the subquery, allowing subsequent nodes to dynamically reference the output value of preceding nodes using formats such as Q1.answer or Q1.result. This graph structure not only expresses the semantic organization of subqueries but also possesses executable semantics.
[0078] The graph structure in this embodiment not only expresses the semantic organization of subqueries, but also has executable semantics, thus providing a clear execution path for subsequent information retrieval and answer generation. During the reasoning process, subquery nodes are executed sequentially according to the graph's topology, and placeholder references are replaced with values at each step according to binding rules, which ensures the contextual coherence and logical consistency of answer generation.
[0079] (2) Enhanced search control module:
[0080] The enhanced retrieval control module is used to evaluate the static probability that external knowledge needs to be retrieved in each round of subqueries, and then combine it with the information entropy estimate output by the language model to determine whether to introduce external knowledge.
[0081] like Figure 3 As shown, in each round of reasoning, the enhanced retrieval control module takes the subquery output by the query graph construction module as input, and combines it with the current system state and historical answer records to estimate the confidence level of the language model on the sub-question. To improve the accuracy and stability of the judgment, the system adopts a joint judgment mechanism of static knowledge classification and dynamic entropy estimation.
[0082] In the specific implementation process, the process of determining whether to introduce external knowledge is as follows:
[0083] Step b1: Use a static knowledge classification model to evaluate the static probability that external knowledge needs to be retrieved in each round of subqueries;
[0084] Step b2: Utilize the probability distribution of the language model's output under limited answer conditions to obtain an estimated value of information entropy, in order to reflect the subjective uncertainty of the language model;
[0085] Step b3: The static probability and the information entropy estimate are weighted and calculated to generate a decision probability of whether to retrieve external knowledge, and then compared with a preset threshold to determine whether to introduce external knowledge.
[0086] This embodiment adopts a joint judgment mechanism of static knowledge classification and dynamic entropy estimation, which can effectively prevent the model from skipping necessary searches due to overconfidence or local errors, and can also skip redundant calls when the model has clear knowledge, thus achieving a dual guarantee of knowledge utilization efficiency and answer quality.
[0087] (3) Sub-answer generation module:
[0088] The sub-answer generation module is used to perform reasoning based on internal knowledge or by integrating external knowledge, generate sub-answers corresponding to each sub-query, and record the reasoning path.
[0089] The sub-answer generation module is a key module in the system used to execute specific subquery solutions and construct reasoning trajectories, undertaking the dual functions of knowledge generation and intermediate thinking construction.
[0090] like Figure 4 As shown, in each round of reasoning, this module receives local query tasks from the query graph construction module and, combined with the retrieval decision signals output by the "enhanced retrieval control module," selects an appropriate execution path to complete the knowledge-based answer and procedural expression for the sub-question. When processing each sub-query, the module adopts the following two strategies depending on whether external knowledge retrieval is triggered:
[0091] When it is determined that the subquery does not require the introduction of external knowledge, the language model performs self-consistent reasoning based on its internal knowledge base, using the subquery as input. When it is determined that the subquery requires the introduction of external knowledge, the subquery is concatenated with the retrieved external knowledge and used as input to guide the model to provide a fusion-based answer in conjunction with the context. In this way, by determining whether the language model has sufficient internal knowledge to answer directly when faced with a specific subquery, or whether it needs to rely on external knowledge resources for assisted retrieval, a dual guarantee of knowledge utilization efficiency and answer quality is achieved.
[0092] To enhance the interpretability and traceability of the generation process, the module introduces a structured reasoning representation framework: TAO (Thought–Action–Observation). This framework records the reasoning path and divides the model's reasoning process into three stages: the language model's understanding of the current problem and explicit expression of its solution intent; the operational strategies adopted; and intermediate feedback content.
[0093] This embodiment adopts a structured TAO representation to record the reasoning process, thereby improving the interpretability and subsequent usability of the answer. The recorded reasoning process can not only be used for subsequent answer fusion, error detection and reflection optimization, but also improves the transparency and robustness in multi-hop problem scenarios.
[0094] (4) Answer memorization module:
[0095] The answer memory module is used to structurally store the corresponding sub-answers and their reasoning paths for each round of sub-queries.
[0096] It should be noted here that the structured storage information includes the query content, whether the retrieval is invoked, the summary of the retrieved document, the generated sub-answers and the corresponding reasoning structure information, etc., and is stored in structured JSON format to provide a unified semantic context for subsequent modules.
[0097] The answer memory module is responsible for storing and organizing the processing results of each sub-query in real time during multi-round reasoning, forming a unified intermediate knowledge state view. This module continuously maintains all sub-answers generated in the reasoning path, their source information, and behavioral trajectories in the form of structured data, providing a stable and reliable semantic foundation for subsequent new query generation and final answer synthesis.
[0098] The answer memory module automatically records the following items after each round of subquery execution: subquery text (Query), whether a retrieval was triggered (Retrieved: true / false), retrieval result summary (Docs, optional), sub-answer content (Answer), reasoning structure information (TAO: Thought, Action, Observation), and the subquery's position and ID in the query graph. All records are uniformly stored in a structured dictionary format, supporting JSON-based reading and writing and modular referencing. The memory item uses the subquery ID as the primary key, ensuring traceability and consistency in result binding. As a "shared semantic memory" spanning all stages, the answer memory module not only records factual results but also preserves behavioral paths and decision-making motivations, serving as a core support module for achieving end-to-end interpretability. By structurally storing the execution records and reasoning trajectories of each subquery, this module supports traceable results, reproducible paths, and interpretable behavior, providing native support capabilities for the transparency, visualization, and behavior auditing of reasoning question answering.
[0099] The answer memory module is maintained in memory in real time as a structured JSON dictionary, serving as a shared semantic state module in the multi-round inference process. Each record corresponds to a subquery execution unit, containing core fields such as the subquery text, whether a retrieval was triggered, the generated sub-answer, the document summary used, the TAO inference structure, and its position in the query graph. All fields are organized using the subquery ID as an index, supporting efficient reading and updating between modules, and can be exported as standard JSON for debugging, replay, or evaluation as needed.
[0100] To enhance the system's knowledge accumulation capabilities and historical information reuse efficiency in real-world operation, after successfully completing the entire reasoning chain and generating the final answer, the system will semantically encode the entire reasoning process of this round: including the original question, each subquery and its sub-answers, supporting documents, and the final answer, into the E5 embedding model, generate vector representations, and write them into the Milvus vector database as recall candidates for subsequent similar queries or supplementary follow-up questions.
[0101] (5) New query generation module:
[0102] The new query generation module is used to dynamically evaluate the semantic coverage, logical consistency, and information closure of the reasoning path of existing sub-answers, determine whether sub-queries need to be added, and feed back to the query graph for expansion until no more sub-queries need to be added.
[0103] The new query generation module is a key control module used to dynamically evaluate the integrity of the inference chain and initiate supplementary queries when necessary, aiming to ensure the coverage, coherence, and information loop of the entire inference process. For example... Figure 5 As shown, the function of this module is to systematically review the existing intermediate answers after all the subqueries in the first round have been executed, to determine whether they can fully support the final answer to the original question. If key information is found to be missing, a new supplementary subquery is automatically generated and sent back to the query graph module to expand the reasoning path.
[0104] The core input to the new query generation module is an answer memory dictionary. This structure systematically records the content of each subquery, whether a search was performed, the supporting documents obtained, the generated answer content, and the complete reasoning trajectory (such as a TAO structure). Based on this, a three-stage judgment logic is executed:
[0105] Semantic coverage analysis: Evaluates whether the current set of sub-answers adequately covers all the core semantic elements of the original question;
[0106] Logical consistency check: Analyze whether there are jumps, omissions or breaks in causal relationships in the existing reasoning chain;
[0107] Information gap identification and completion generation: If the system determines that there is a key reasoning gap, it will automatically construct a new and explicit supplementary query based on the semantic features of the missing part and the contextual logical structure to complete the knowledge chain.
[0108] The evaluation results are output as structured JSON, supporting only two types of responses: If the existing sub-answers fully support the final answer, the module outputs a confirmation signal. If there are information gaps, the module outputs a new, specific supplementary query.
[0109] To ensure process stability and controllability, the module outputs only one new query per round, avoiding inference oscillations or process crashes caused by continuous cascading generation. The new query will participate in the standard execution process of the next round after being added to the query graph, possessing a feedback loop capability of "self-diagnosis - self-completion".
[0110] (6) Answer synthesis module:
[0111] The answer synthesis module is used to read all sub-answers and reasoning paths from the structured storage, perform structured comprehensive reasoning according to the query graph order, and generate the final response answer.
[0112] The answer synthesis module is responsible for generating the final response to the original user query based on the intermediate information accumulated in the answer memory after all subqueries have been executed.
[0113] like Figure 6 As shown, this module takes the original query Q and a structured answer memory dictionary as input, which includes the natural language content of each subquery, whether the retrieval is invoked, the generated sub-answers, the corresponding document summary, and the complete TAO reasoning trajectory.
[0114] First, the subquery results are sorted according to the topology of the query graph to establish a logical progression path. Then, all intermediate sub-answers and their semantic intents are organized into a unified context to guide the language model in performing structured comprehensive reasoning.
[0115] To enhance the interpretability and structural consistency of the output, the module injects pre-recorded TAO expressions into the prompts, guiding the model to integrate information according to the reasoning sequence of "thinking – operating – observing". Simultaneously, it retains the reference relationship to subquery numbers when generating answers, constructing a backtrackable reasoning chain to support subsequent answer auditing and path tracing.
[0116] As the final step in the reasoning process, the answer synthesis module takes the original query Q and the updated answer memory structure M as input to deduce and generate the final answer A. Thanks to the complete sub-query content, corresponding sub-answers, and their supporting evidence retained in the answer memory, it can generate a well-founded and semantically closed response to the original question based on sufficient information fusion.
[0117] To ensure the convergence and efficiency of reasoning during real-world operation, in each round of reasoning, based on the current query graph node status and the answer generation result, it is determined whether there are any subsequent sub-questions available for execution; if the current graph path has been completely traversed, the process terminates. For example, if the subquery returns... <finish>Alternatively, use a no-operation flag to determine if the current graph path has been fully traversed.
[0118] To prevent the model from continuously generating invalid subqueries or getting stuck in path loops during multiple rounds of decomposition, and to ensure that the inference chain closes naturally within a finite number of steps, when the number of nodes traversed exceeds the preset maximum subquery round threshold (e.g., set to 4 rounds), the current inference chain is forcibly terminated, and the final answer synthesis stage begins.
[0119] The training process of a multi-round reasoning question-answering model is given below:
[0120] In training the multi-turn reasoning question-answering model, to construct a high-quality dataset supporting multi-module collaborative training, an initial question set was first built based on several publicly available high-quality question-answering datasets, such as Natural Question (NQ), TriviaQA, StrategyQA, HotpotQA, and 2WikiMQA. The QWQ-32B model was used to simulate the complete multi-stage question-answering process. To ensure the separability of input and output for each module, structured prompt templates were designed for different modules. The roles of each module were clearly defined through Prompt control, and the input, behavior, and output content of each stage were explicitly recorded during the reasoning process.
[0121] The quality of the final answer is used as a proxy signal for the correct execution of the process. Specifically, the final answer A generated by the expert model is compared with the "golden answer" provided in the original dataset. Compare and calculate automated evaluation indicators. (Using F1 scores), only samples with scores s higher than a set threshold α are retained as high-quality data indicating "successful process execution," and their intermediate process records are used as training samples for each module. This "result-reward" selection strategy effectively filters out invalid data caused by inference failures or model misjudgments, constructing a high-quality, weakly supervised module training set. Table 1 shows the scale of the collected data and the input and output formats of the training data for each module:
[0122] Table 1. Input and output content and number of training samples for each module;
[0123]
[0124] This invention proposes a language model training method for multi-module structured reasoning systems, combining a role token guidance mechanism with a module structure-aware loss masking strategy. This method introduces a small number of module-specific control tokens to activate the language model's behavioral styles under different tasks, while only performing supervision signal calculation on keyword elements related to structural fields in the output, thereby achieving an efficient, decoupled, and structurally controllable training process.
[0125] Define a role control token for each module of the multi-turn reasoning question answering model, such as<ROLE_QG> (Query graph construction module)<ROLE_RC> (Enhanced search and judgment module)<ROLE_ANS> (Sub-answer generation module)<ROLE_RQ> (New query generation module)<ROLE_SYN> (Answer synthesis module), etc., and add these tokens to the language model vocabulary.
[0126] The embedding vectors of the tokens constitute a unique set of trainable parameters δ, with dimensions n×d, where n is the number of tokens for a role and d is the embedding dimension (e.g., 4096). The core parameters θ of the language model are kept frozen to avoid large-scale updates, thereby achieving efficient customized training of parameters while preserving the original general capabilities of the model.
[0127] The training samples consist of the input to each module. And the structured output S^{(k)} = [ , ..., The output is composed of [structures]. The output explicitly labels structural semantic fields (such as Thought, Action, Observation, Answer, etc.), with each module corresponding to an independent set of supervised fields. To activate task features, each module input must be preceded by its corresponding role token. ], final model input The format is:
[0128] ;
[0129] The input is fed into the frozen backbone language model, where the generation module's task behavior is controlled by role tokens. During output training, to avoid interference from invalid tokens and semantic confusion between modules, this invention introduces a module structure-aware loss function, calculating the loss only on tokens involved in prediction within the structure fields. The loss function during the training process of the multi-turn reasoning question-answering model is as follows:
[0130] ;
[0131] in, This represents the loss function; N represents the number of modules contained in the sample. This refers to the j-th target token in the k-th module. Indicates the number of target tokens; The set of structure fields specified for the k-th module; This is a binary loss mask function that takes a value of 1 only within the range of the structure fields; This represents the language model prediction probability under the conditions of frozen backbone parameters θ and trainable role token embedding δ; This represents the input of the k-th module; This represents the role token corresponding to the k-th module.
[0132] The structure fields used for loss mask calculation include: query graph construction module.<ROLE_QG> The Subquestion field in the retrieval and judgment module.<ROLE_RC> The fields Retrieval Need and Decision; sub-answer generation module<ROLE_ANS> The fields Thought, Action, Observation, and Answer; the new query generation module.<ROLE_RQ> The fields Reformulated Query and Reason; and the answer synthesis module.<ROLE_SYN> The fields FinalAnswer and Justification in the document.
[0133] A unified Supervised Fine-Tuning (SFT) strategy is adopted, and five core modules are jointly trained on the basis of a complete inference chain: query graph construction module, enhanced retrieval control module, sub-answer generation module, new query generation module, and answer synthesis module. The following example uses GLM-4 9B as the language model foundation, with each module driven by a prompt. Under the premise of unified model parameter freezing, the integrated modeling of multi-module capabilities is achieved by inserting control tokens and structured label hints.
[0134] Each training sample corresponds to a complete system execution flow, in the following form:
[0135] ;
[0136] Where q represents the original natural language problem. It is the input and output structure of the i-th module, which includes: module name, input field, output field, and control token;
[0137] During training, supervised loss is applied only to the structural fields in the module outputs; the remaining tokens are masked. All module samples are mixed and input into a unified training process. The language model parameters remain frozen, and only the embedding vector δ corresponding to each control token is updated.
[0138] The enhanced retrieval control module makes decisions on whether external knowledge retrieval is needed for each round of subqueries by combining static knowledge judgment with language model uncertainty estimation.
[0139] The module design integrates two signal sources: first, the "prior judgment" obtained through the static knowledge classification module; and second, the uncertainty entropy estimate output by the language model itself. First, a lightweight static classification module is used to determine the input question q, outputting the probability of whether the question needs to be retrieved. This probability reflects the model's confidence level in knowing the answer to the question based on experience, without further reasoning. Subsequently, the question q is input into the language model, prompting it to choose only "know" or "unknown" as the answer, to explicitly test the boundaries of its subjective judgment. At the first output position, the system records the softmax probability distribution of "know" and "unknown" for the language model. ,in The probability of the model selecting "know" is defined as:
[0140] ;
[0141] This indicates the probability that the model selects "unknown"; and These represent the original logical outputs of the language model for "know" and "unknown," respectively. To assess the subjective uncertainty of the language model itself, information entropy is calculated. It is represented using softmax entropy:
[0142] ;
[0143] The larger the entropy value, the less certain the model is about the answer to the current question.
[0144] To map uncertainty to a uniform probability scale, the Sigmoid function is used to standardize the entropy value, yielding the dynamic path decision probability. :
[0145] ;
[0146] in It is a Sigmoid function, and the output range is guaranteed to be [0,1].
[0147] By weighted fusion of static prior judgments and dynamic uncertainty estimates, a joint probability is generated for the final decision on whether or not to retrieve external knowledge is needed. :
[0148] ;
[0149] Among them, the fusion weight This is an adjustable hyperparameter used to balance the influence of the two types of information sources. If the final fusion probability exceeds a preset fixed threshold... If the model can answer the question, a retrieval operation is triggered; otherwise, it is assumed that the model can directly answer the current question. That is:
[0150] .
[0151] To determine the optimal configuration of the above parameters, a parameter tuning mechanism based on the replay analysis of the complete inference chain behavior was constructed. Compared with traditional static validation set parameter tuning methods, this mechanism better reflects the behavior and resource allocation logic of the model during actual operation. A validation set was constructed by collecting 3000 complete inference process samples from the system's internal execution logs. Each sample record includes: multi-round sub-query text, whether a retrieval operation was performed in each round, the corresponding final answer and the gold standard answer (used to calculate the F1 score), and the output of intermediate modules generated by the actual system (used for replay). This dataset is used to simulate module behavior in a real-world operating environment. The system is respectively... , A grid search was performed within the parameter range. For each parameter combination, the inference process was replayed on the validation set, and the following four key evaluation metrics were recorded: Retrieval-judgment consistency rate: whether the module output is consistent with the expert reference judgment; Answer retention rate (F1≥0.75): the proportion of samples whose final output answer achieves a reasonable accuracy; Average retrieval count: the number of retrieval calls triggered in each inference chain; Judgment volatility: whether the judgments are consistent across consecutive rounds, reflecting the module's stability. The results are shown in Table 2.
[0152] Table 2 Threshold Determination;
[0153]
[0154] As can be seen from the table, when the fusion weight is set to λ=0.6 and the trigger threshold is θ=0.52, the system performs well across all evaluation metrics. Considering the performance in terms of judgment accuracy, response capability retention, and resource allocation efficiency, this parameter configuration was ultimately adopted.
[0155] In one or more embodiments, the query graph-driven multi-turn reasoning question-answering system provided by the present invention can be implemented in software. The functions of each software module in the query graph-driven multi-turn reasoning question-answering system are described below:
[0156] The question receiving unit is used to receive raw natural language questions.
[0157] The question-answering reasoning unit is used to process the original natural language question using a multi-turn reasoning question-answering model to obtain the final response answer.
[0158] It should be noted that the implementation process in the question receiving unit and the question answering reasoning unit is the same as the specific implementation process of steps 1 and 2 in the query graph-driven multi-turn reasoning question answering above, and will not be repeated here.
[0159] The multi-turn reasoning question-answering model includes:
[0160] The query graph building module is used to parse the original natural language question and build the query graph;
[0161] The enhanced retrieval control module is used to evaluate the static probability that each round of subqueries in the query graph needs to retrieve external knowledge, and then combine it with the information entropy estimate output by the language model to determine whether to introduce external knowledge.
[0162] The sub-answer generation module is used to perform reasoning based on internal knowledge or by integrating external knowledge, generate sub-answers corresponding to each sub-query, and record the reasoning path;
[0163] The answer memory module is used to structurally store the corresponding sub-answers and their reasoning paths for each round of sub-queries;
[0164] The new query generation module is used to dynamically evaluate the semantic coverage, logical consistency and information closure of the reasoning path of existing sub-answers, and to determine whether sub-queries need to be added.
[0165] The answer synthesis module is used to read all sub-answers and reasoning paths from the structured storage, perform structured comprehensive reasoning according to the query graph, and generate the final response answer.
[0166] It should be noted that the specific implementation process of each unit in the embodiments of the present invention is the same as that of each step in the query graph-driven multi-turn reasoning question answering method described above, and will not be repeated here.
[0167] The query graph-driven multi-turn reasoning question-answering system of this invention first parses the original question into multiple logically dependent subqueries through a query graph construction module, organizing them in a directed acyclic graph (DAG) to clarify the execution order and dependency structure between subqueries. Each subquery is then assessed by an enhanced retrieval control module to determine whether external knowledge support is needed. This module integrates static classification and language model subjective entropy judgment, outputting a unified retrieval trigger probability. Upon entering the sub-answer generation module, the query graph-driven multi-turn reasoning question-answering system generates sub-answers based on whether a retrieval has been performed, using either internal language model knowledge or document enhancement methods. The generation process employs a TAO (Thought–Action–Observation) structure to model the reasoning path, enhancing interpretability. All sub-answers and their process information are recorded in the answer memory module, constituting the system's unified semantic state. If the system finds the information incomplete, the new query generation module analyzes the current memory content and the original question requirements to determine whether additional queries are needed, achieving closed-loop control of the reasoning process. Finally, the answer synthesis module merges the sub-answers according to the query graph structure, constructing a coherent overall answer and outputting a structured reasoning chain, ensuring the accuracy and traceability of the results.
[0168] This invention addresses the shortcomings of existing intelligent question-answering systems in complex query processing, inference path transparency, and retrieval control accuracy by proposing a query graph-driven multi-turn reasoning question-answering system and its implementation method. Through modular design, structured reasoning representation, and joint training strategies, this system significantly improves the accuracy, process controllability, and interpretability of responses under complex tasks, providing an efficient and reliable solution for intelligent question-answering technology in various application scenarios.
[0169] This invention significantly improves the performance, control, and interpretability of intelligent question-answering systems in complex scenarios by introducing structured query graph modeling, dynamic retrieval and judgment mechanisms, interpretable reasoning expressions, and module joint training strategies. Compared to traditional RAG systems, this invention has significant advantages in reasoning path expression, resource allocation efficiency, problem adaptability, and system maintainability, and possesses broad application prospects and industrialization potential.
[0170] The structure of the electronic device according to an embodiment of the present invention will be described in detail below. Figure 7 This is a schematic diagram of the composition structure of an electronic device provided in an embodiment of the present invention. It can be understood that... Figure 7 The diagram shows only an exemplary structure of the electronic device, not the entire structure. Some or all of the structures shown may be implemented as needed.
[0171] The electronic device provided in this embodiment of the invention includes: at least one processor 701, a memory 702, a user interface 703, and at least one network interface 704. The various components in the query graph-driven multi-turn reasoning question-answering system are coupled together via a bus system 705. It can be understood that the bus system 705 is used to implement communication between these components. In addition to a data bus, the bus system 705 also includes a power bus, a control bus, and a status signal bus. However, for clarity, in... Figure 7 The general labeled all buses as Bus System 705.
[0172] The user interface 703 may include a monitor, keyboard, mouse, trackball, click wheel, buttons, touchpad, or touch screen.
[0173] It is understood that memory 702 can be volatile memory or non-volatile memory, or both. In this embodiment of the invention, memory 702 is capable of storing data to support the operation of the terminal. Examples of this data include any computer programs used to operate on the terminal, such as operating systems and applications. The operating system includes various system programs, such as framework layers, core library layers, driver layers, etc., used to implement various basic services and handle hardware-based tasks. Applications can include various applications.
[0174] In some embodiments, the query graph-driven multi-turn reasoning question answering system provided in this invention can be implemented using a combination of hardware and software. As an example, the query graph-driven multi-turn reasoning question answering system provided in this invention can be a processor in the form of a hardware decoding processor, programmed to execute the query graph-driven multi-turn reasoning question answering method provided in this invention. For example, the processor in the form of a hardware decoding processor can employ one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), or other electronic components.
[0175] As an example, processor 701 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., wherein the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0176] As an example of the hardware implementation of the query graph-driven multi-turn reasoning question answering system provided in this embodiment of the invention, the device provided in this embodiment of the invention can be directly executed by a processor 701 in the form of a hardware decoding processor. For example, it can be executed by one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), or other electronic components to implement the query graph-driven multi-turn reasoning question answering method provided in this embodiment of the invention.
[0177] The memory 702 in this embodiment of the invention is used to store various types of data to support the operation of a query graph-driven multi-turn reasoning question-answering system, or to store data for execution. Figure 1 The program code for the method shown. Examples of this data include: any executable instructions for operating on a query graph-driven multi-turn reasoning question answering system, such as executable instructions that can be included in the executable instructions for implementing the query graph-driven multi-turn reasoning question answering method of the embodiments of the present invention.
[0178] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program including functions for executing... Figure 1 The program code for the method shown. In such an embodiment, the computer program can be downloaded and installed from a network via a communication component, and / or installed from a removable medium. When the computer program is executed by the central processing unit, it performs the various functions defined in the apparatus of this application.
[0179] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, as well as combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0180] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.< / finish>
Claims
1. A query graph-driven multi-turn reasoning question-answering method, characterized in that, include: The problem is receiving raw natural language. The original natural language question is processed using a multi-turn reasoning question-answering model to obtain the final response answer; wherein, the multi-turn reasoning question-answering model includes: The query graph building module is used to parse the original natural language question and build the query graph; The enhanced retrieval control module is used to evaluate the static probability that each round of subqueries in the query graph needs to retrieve external knowledge, and then combine it with the information entropy estimate output by the language model to determine whether to introduce external knowledge. The process of determining whether to introduce external knowledge is as follows: The static probability of needing to retrieve external knowledge in each round of subqueries is evaluated using a static knowledge classification model. By utilizing the probability distribution of the language model's output under limited answer conditions, an estimate of the information entropy is obtained. The static probability and the information entropy estimate are weighted and calculated to generate a decision probability of whether to retrieve external knowledge, and then compared with a preset threshold to determine whether to introduce external knowledge. The sub-answer generation module is used to perform reasoning based on internal knowledge or by integrating external knowledge, generate sub-answers corresponding to each sub-query, and record the reasoning path; The answer memory module is used to structurally store the corresponding sub-answers and their reasoning paths for each round of sub-queries; The new query generation module is used to dynamically evaluate the semantic coverage, logical consistency and information closure of the reasoning path of existing sub-answers, and to determine whether sub-queries need to be added. The answer synthesis module is used to read all sub-answers and reasoning paths from the structured storage, perform structured comprehensive reasoning according to the query graph, and generate the final response answer.
2. The query graph-driven multi-turn reasoning question-answering method as described in claim 1, characterized in that, The process of constructing a query graph is as follows: The original natural language problem is broken down into several sub-problems, each of which is a local query node, i.e., a subquery; The semantics and dependencies between the subqueries are analyzed. Based on the dependencies, it is determined whether to add a directed edge between any two subqueries to determine the order of reasoning, thus forming a directed acyclic graph, which is the query graph.
3. The query graph-driven multi-turn reasoning question-answering method as described in claim 1, characterized in that, When it is determined that the subquery does not require the introduction of external knowledge, the language model performs self-consistent reasoning based on the internal knowledge base, using the subquery as input. When it is determined that the subquery requires the introduction of external knowledge, the subquery is concatenated with the retrieved external knowledge and used as input to guide the model to perform a fusion-based answer in combination with the context.
4. The query graph-driven multi-turn reasoning question-answering method as described in claim 1, characterized in that, A structured reasoning representation framework is used to record the reasoning path; the reasoning path includes three stages: the language model's understanding of the current problem and the explicit expression of the solution intention; the operational strategy adopted; and the intermediate feedback content.
5. The query graph-driven multi-turn reasoning question answering method as described in claim 1, characterized in that, In each round of reasoning, based on the current query graph node status and the answer generation result, it is determined whether there are any subsequent sub-problems that can be executed; if the current graph path has been completely traversed, the process is terminated.
6. The query graph-driven multi-turn reasoning question answering method as described in claim 1, characterized in that, When the number of nodes traversed exceeds the preset maximum subquery rounds threshold, the current inference chain is forcibly terminated, and the final answer synthesis stage begins.
7. The query graph-driven multi-turn reasoning question answering method as described in claim 1, characterized in that, The loss function during the training process of a multi-turn reasoning question answering model is: ; in, This represents the loss function; N represents the number of modules contained in the sample. This refers to the j-th target token in the k-th module. Indicates the number of target tokens; The set of structure fields specified for the k-th module; This is a binary loss mask function that takes a value of 1 only within the range of the structure fields; This represents the language model prediction probability under the conditions of frozen backbone parameters θ and trainable role token embedding δ; This represents the input of the k-th module; This represents the role token corresponding to the k-th module.
8. A query graph-driven multi-turn reasoning question-answering system, characterized in that, include: The question receiving unit is used to receive raw natural language questions. A question-answering reasoning unit is used to process the original natural language question using a multi-turn reasoning question-answering model to obtain the final response answer; wherein, the multi-turn reasoning question-answering model includes: The query graph building module is used to parse the original natural language question and build the query graph; The enhanced retrieval control module is used to evaluate the static probability that each round of subqueries in the query graph needs to retrieve external knowledge, and then combine it with the information entropy estimate output by the language model to determine whether to introduce external knowledge. The process of determining whether to introduce external knowledge is as follows: The static probability of needing to retrieve external knowledge in each round of subqueries is evaluated using a static knowledge classification model. By utilizing the probability distribution of the language model's output under limited answer conditions, an estimate of the information entropy is obtained. The static probability and the information entropy estimate are weighted and calculated to generate a decision probability of whether to retrieve external knowledge, and then compared with a preset threshold to determine whether to introduce external knowledge. The sub-answer generation module is used to perform reasoning based on internal knowledge or by integrating external knowledge, generate sub-answers corresponding to each sub-query, and record the reasoning path; The answer memory module is used to structurally store the corresponding sub-answers and their reasoning paths for each round of sub-queries; The new query generation module is used to dynamically evaluate the semantic coverage, logical consistency and information closure of the reasoning path of existing sub-answers, and to determine whether sub-queries need to be added. The answer synthesis module is used to read all sub-answers and reasoning paths from the structured storage, perform structured comprehensive reasoning according to the query graph, and generate the final response answer.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the query graph-driven multi-turn reasoning question answering method as described in any one of claims 1-7.
Citation Information
Patent Citations
Dynamic and static combined retrieval enhancement generation method and equipment
CN120179795A