Multi-round search enhanced generation method and device, equipment and storage medium
By using a multi-round retrieval enhancement generation method, dynamically decomposing and rewriting query requests, and combining the reflection-retrieval-reasoning loop mechanism of the large-scale reasoning model, the problems of misleading and incomplete answers in complex query requests of the RAG method are solved, and more accurate and in-depth answer generation is achieved.
Patent Information
- Application Number
- CN202510956443.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-11
- Publication Date
- 2026-02-24
- Estimated Expiration
- 2045-07-11
AI Technical Summary
Existing RAG methods are prone to being misled by intermediate inference results when handling complex query requests, leading to error accumulation. They are also unable to cover the deep semantics or implicit intentions of the original question, and require a high level of instruction understanding from large models. Furthermore, their decomposition strategies are unclear, resulting in poor answer performance.
A multi-round retrieval enhancement generation method is adopted, which dynamically rewrites the query request through preliminary retrieval, subquery request division, query request rewriting, and reflection-retrieval-reasoning loop mechanism until a complete answer result is formed.
It improves the accuracy and depth of answers, avoids problems such as excessively long response times and unresponsive waiting, effectively uncovers omissions in existing answers and retrieves more relevant context, and supports advanced query requirements with complex and multi-causal logic.
Smart Images

Figure CN120950634B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent question answering technology, and in particular to a multi-turn retrieval enhancement generation method, apparatus, device, and storage medium. Background Technology
[0002] With the continuous development of large language model technology, retrieval-augmented generation (RAG) has gradually become the main technical approach for enterprises to build intelligent question-answering systems in their private knowledge bases. When faced with complex and semantically rich query requirements, the system is expected to not only accurately understand the intent but also provide comprehensive and in-depth answers.
[0003] In related technologies, current methods for RAG to solve complex query requests can be categorized as follows: The CoT (Chain-of-Thought) strategy uses a large model to generate a thought chain that progressively refines and reconstructs the query. Each step generates a new query based on the previous retrieval results and reasoning path. However, this thought chain approach is susceptible to being misled by intermediate reasoning results, leading to error accumulation. Furthermore, although this strategy incorporates some feedback mechanisms, it still relies on the original query for retrieval, making it difficult for subsequent processes to escape the semantic limitations of the initial retrieval. This often results in the final answer failing to cover the deeper semantics or implicit intent of the original question. The ReACT (Reason+Act) strategy uses a large model to explicitly generate "thinking" and "action" instructions, calling the retrieval or API in the action step, and then continuing reasoning based on new information. However, this approach requires a high level of instruction comprehension from the large model, the decomposition strategy is unclear, and the answer quality is easily affected by the decomposition quality.
[0004] Based on the above analysis of the development status of this technology field, the existing technology lacks a DeepSearch semantic retrieval engine architecture that combines a large reasoning model with a multi-round RAG retrieval enhancement generation method to decompose complex query requests and dynamically rewrite them through multiple rounds of reasoning, ultimately forming a complete answer result. Summary of the Invention
[0005] The purpose of this invention is to provide a multi-round retrieval enhancement generation method, apparatus, device, and storage medium, aiming to solve the above-mentioned problems in the prior art.
[0006] According to a first aspect of the present invention, a multi-round retrieval enhancement generation method is provided, comprising:
[0007] Step 1: Use the original query request to perform a preliminary search from the knowledge base, and use the preliminary search results as initial reference materials;
[0008] Step 2: Based on the initial reference materials, determine whether the large reasoning model can provide a complete answer. If not, divide the original query request into subquery requests; otherwise, proceed directly to step 5.
[0009] Step 3: Eliminate the dependencies of the subquery requests to obtain the rewritten query request, use the rewritten query request to supplement the retrieval and use the inference big model to update the answer, and supplement the initial reference data based on the updated answer to obtain the first data;
[0010] Step 4: Based on the first data and the rewritten query request, reflect on whether the reasoning model can provide a complete answer. If not, update the rewritten query request to an optimized query request for omissions, use the optimized query request to supplement the retrieval, and use the reasoning model to update the answer. Based on the updated answer, supplement the first data to obtain the second data. Repeat Step 4 until the preset number of cycles is reached or a complete answer can be provided.
[0011] Step 5: Provide feedback on the final answer.
[0012] According to a second aspect of the present invention, a multi-round retrieval enhancement generation apparatus is provided, comprising:
[0013] The raw retrieval module is used to perform a preliminary retrieval from the knowledge base using a raw query request, and the preliminary retrieval results are used as initial reference materials;
[0014] The query request decomposition module is used to determine whether the large reasoning model can provide a complete answer based on the initial reference materials. If not, the original query request is divided into sub-query requests; otherwise, the summary answer module is executed directly.
[0015] The subquery request iteration module is used to eliminate the dependencies of subquery requests to obtain rewritten query requests, use the rewritten query requests to supplement the retrieval and use the inference big model to update the answer, and supplement the initial reference data based on the updated answer to obtain the first data;
[0016] The reflection retrieval reasoning module is used to reflect on whether the large inference model can provide a complete answer based on the first data and the rewritten query request. If not, it updates the rewritten query request to an optimized query request for omissions, uses the optimized query request to supplement the retrieval, and uses the large inference model to update the answer. Based on the updated answer, it supplements the first data to obtain the second data. The reflection retrieval reasoning module is repeated until the preset number of cycles is reached or a complete answer can be provided.
[0017] The summary and answer module is used to provide feedback on the final answer results.
[0018] According to a third aspect of the present invention, an electronic device is provided, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the multi-round retrieval enhancement generation method provided in the first aspect of the present disclosure.
[0019] According to a fourth aspect of the present invention, a computer-readable storage medium is provided, on which an information transmission implementation program is stored, which, when executed by a processor, implements the steps of the multi-round retrieval enhancement generation method provided in the first aspect of the present disclosure.
[0020] The technical solution provided by this invention has the following beneficial effects: it determines whether decomposition is needed based on the retrieval effect of the original query request, avoiding excessively long response times caused by decomposing overly simple original query statements; it uses a large reasoning model to output the results of thinking and reasoning at each stage in real time, and also has functions such as outputting query decomposition and rewriting, which are fully functional and have superior performance, effectively avoiding the problem of no response and waiting; and it sets up a reflection-retrieval-reasoning loop mechanism to deeply explore the omissions in existing answers and retrieve as much relevant context as possible; overall, the solution can achieve a logical and in-depth summary answer.
[0021] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in one or more embodiments of this specification or in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 This is a flowchart of the multi-round retrieval enhancement generation method according to an embodiment of the present invention;
[0024] Figure 2 This is a schematic diagram of the reasoning framework of an embodiment of the present invention;
[0025] Figure 3 This is a schematic diagram of a multi-round retrieval enhancement generation device according to an embodiment of the present invention;
[0026] Figure 4 This is a schematic diagram of an electronic device according to an embodiment of the present invention. Detailed Implementation
[0027] To enable those skilled in the art to better understand the technical solutions in one or more embodiments of this specification, the technical solutions in one or more embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this specification, and not all of the embodiments. Based on one or more embodiments of this specification, all other embodiments obtained by those skilled in the art without creative effort should fall within the protection scope of this document.
[0028] Method Example 1
[0029] According to embodiments of the present invention, a multi-round retrieval enhancement generation method is provided. Figure 1 This is a flowchart of the multi-round retrieval enhancement generation method according to an embodiment of the present invention, such as... Figure 1 As shown, the multi-round retrieval enhancement generation method according to an embodiment of the present invention specifically includes:
[0030] In step S110, an initial search is performed using the original query request to retrieve information from the knowledge base. The initial search results are used as initial reference materials, specifically including:
[0031] The original query request is used to perform a preliminary search from the knowledge base, which provides the main basis for step S120 to determine whether query decomposition is needed, and retrieves the context information to obtain the initial reference materials in the form of fragments.
[0032] In step S120, based on the initial reference data, it is determined whether the large inference model can provide a complete answer. If not, the original query request is divided into subquery requests; otherwise, step 5 is executed directly, which specifically includes:
[0033] Based on the initial reference materials and the original query request, it is determined whether a complete answer can be obtained. If the original query request cannot be divided into subquery requests in the form of queries using the large inference model, all subsequent query requests are in the form of queries, and the number of divisions does not exceed the preset maximum number of divisions. In this embodiment of the invention, the preset maximum number of divisions is 3.
[0034] In this embodiment of the invention, the large inference model is a large language model such as GPT-4, Claude3, or Llama3. In addition to generating answers, it also integrates functions such as sentence decomposition and inference recognition. Preferably, the large inference model can also output the integrity judgment and the decomposition process of the original query request in streaming form, and provide timely feedback for external researchers to refer to.
[0035] In step S130, the dependencies of the subquery request are eliminated to obtain the rewritten query request. The rewritten query request is used to supplement the retrieval, and the answer is updated using the inference big model. Based on the updated answer, the initial reference data is supplemented to obtain the first data, specifically including:
[0036] If step S120 outputs a list including each subquery request, then each subquery request is updated sequentially using an iterative serial processing method, that is, the rewriting of the retrieval reasoning is performed serially. The serial execution takes into account the possible dependencies between the subquery requests.
[0037] In each iteration, the large inference model is used to eliminate pronouns and handle semantic incompleteness based on the dependencies between the current subquery request to be processed and the rewritten query requests obtained in the previous iterations. The subquery request is then processed into the corresponding rewritten query request, so that the current subquery has independent semantics.
[0038] The rewritten query requests are used to retrieve context fragments from the knowledge base. Based on the newly retrieved context fragments, the inference big model is used to update the answer. All rewritten query requests and their corresponding updated answers are added to the initial reference materials to obtain the first material. Since the purpose of this step is only to remove semantic dependencies and not to fill knowledge gaps, the context fragments are not directly added to the material.
[0039] Preferably, the inference big model feeds back the update process of the subquery request and the inference phase to the user in a streamlined manner.
[0040] In step S140, based on the first data and the rewritten query request, the reasoning model is evaluated to determine if it can provide a complete answer. If not, the rewritten query request is updated to an optimized query request to address any omissions. The optimized query request is used to supplement the retrieval, and the reasoning model is used to update the answer. The first data is supplemented based on the updated answer to obtain the second data. Step S140 is repeated until a preset number of iterations is reached or a complete answer can be provided. Specifically, this includes:
[0041] After the iteration process in step S130 is completed, the reflection-retrieval-reasoning loop mechanism is activated.
[0042] If the reasoning model cannot provide a complete answer, a new optimized query request is generated based on the missing parts of the answer. The optimized query request is then used to retrieve context fragments from the knowledge base and add them to the first data to obtain the missing supplementary data. Since part of the purpose of reflection optimization is to fill knowledge gaps, entirely new content that has not been covered by the previous steps is added to the data.
[0043] Based on the missing supplementary information, the inference model is used to update the answer. All optimized query requests and their corresponding updated answers are added to the missing supplementary information to obtain the second set of information.
[0044] The cycle then restarts with reflection, repeating the reflection-retrieval-reasoning process. The second set of data and the optimized query request are used as the first set of data and the rewritten query request for the next cycle. If the reflection phase determines that a complete answer can be given or the maximum preset number of cycles has been reached, the cycle exits. The reflection and reasoning phases output data in a continuous stream to provide users with immediate feedback.
[0045] In step S150, the final answer result is fed back, specifically including:
[0046] Based on the final version of the data and query request, the final answer is output using the inference big model as the answer to the original query request. The final answer is fed back to the user in a streaming manner. The output final answer is more accurate than the answer obtained by executing RAG after only using the original query request, and the answer is more in-depth and logical.
[0047] The above technical solutions of the embodiments of the present invention will be illustrated with reference to the following accompanying drawings.
[0048] Figure 2 This is a schematic diagram of the reasoning framework of an embodiment of the present invention, as shown below. Figure 2 As shown, the overall architecture of multi-round retrieval enhancement generation to output the final answer is demonstrated. "Sub-query iterative retrieval and reasoning" is equivalent to iterative serial update, forming the DeepSearch architecture, which includes decomposition of the original query request, division of the original query request, serial iterative update, reflection-retrieval-reasoning loop mechanism and streaming output.
[0049] Method Example 2
[0050] Original query request: What is a "version space" in machine learning?
[0051] Preliminary retrieval of contextual information fragments:
[0052] Excerpt 1: In machine learning, the hypothesis space is the set of all possible hypotheses, while the version space is a subset of the hypotheses that are consistent with the training data. Each hypothesis in the version space can correctly classify all samples in the training set. For example, in the watermelon problem, the hypothesis space consists of hypotheses of the form "(color = ?)^(stem = ?)^(sound = ?)", while the version space is the portion of these hypotheses that are consistent with the training set.
[0053] Segment 2: Version space can be represented by two types of boundaries: general boundaries (G-boundaries) and specific boundaries (S-boundaries). The G-boundary contains the most general assumptions in the version space, while the S-boundary contains the most specific assumptions. These two boundaries allow us to effectively represent the entire version space. For example, in Boolean concept learning, the G-boundary and S-boundary can help us quickly determine which assumptions are consistent with the training data.
[0054] Segment 3: When searching for suitable hypotheses in the version space, a top-down (from general to specific) or bottom-up (from specific to general) approach can be used. For example, starting from the G boundary, the hypotheses are gradually refined until a hypothesis consistent with the training data is found; or starting from the S boundary, the hypotheses are gradually generalized until a hypothesis consistent with the training data is found. This search strategy is called the candidate elimination algorithm, which is a classic version space search method.
[0055] Segment 4: When a learning algorithm selects a final hypothesis in the version space, it is influenced by inductive bias. Inductive bias refers to the learning algorithm's tendency to choose hypotheses, such as a preference for simple hypotheses or hypotheses with strong generalization ability. Different inductive biases may lead to different search results. For example, according to Occam's Razor, a learning algorithm may prefer the simplest hypothesis in the version space.
[0056] Segment 5: Version space supports incremental learning, meaning that it can be dynamically updated when new training data arrives to reflect the information brought by the new data. This ability to dynamically update gives version space a significant advantage when dealing with dynamically changing data environments. For example, when new training samples are added, the version space can be updated by removing hypotheses that are inconsistent with the new samples.
[0057] Segment 6: While version spaces have theoretical advantages, they also face some limitations in practical applications. For example, the representation and search of version spaces can be very complex, especially when the hypothesis space is large or the training data is plentiful. Furthermore, the size of the version space can grow rapidly with increasing training data, leading to a decrease in search efficiency.
[0058] Segment 7: Version space has wide applications in practical machine learning. For example, in decision tree learning, the concept of version space is used to guide the pruning and growth of decision trees. By searching for suitable decision tree structures in the version space, the generalization ability of decision trees can be effectively improved. In rule-based learning, version space is used to generate and optimize rule sets.
[0059] Segment 8: To overcome the limitations of version space in practical applications, researchers have proposed several improvement methods. For example, they have introduced regularization techniques to limit the complexity of hypotheses, thereby reducing the size of the version space. They have also improved the search efficiency of the version space by using heuristic search strategies. Finally, they have enhanced the model's generalization ability by employing ensemble learning methods to combine hypotheses from multiple version spaces.
[0060] Segment 9: In the watermelon problem, suppose we have the following training data:
[0061] (Color = bluish-green; Stem = curled up; Sound = dull) Good melon
[0062] (Color = jet black; stem = curled up; sound = dull) A good melon
[0063] (Color = bluish-green; Stem = firm; Sound = crisp) Bad melon
[0064] (Color = jet black; Stem = slightly curled; Sound = dull) Bad melon
[0065] Assumptions in the version space may include:
[0066] Good melon: (Color = *)^(Stem = Curled up)^(Sound = Dull when tapped)
[0067] Good melon: (Color = green)^(Stem =)^(Sound when tapped =)
[0068] Good melon: (color =)^(stem =)^(sound when tapped = dull)
[0069] Segment 10: Version space is an important concept in machine learning. By constraining the search range of the hypothesis space, it enables learning algorithms to find suitable hypotheses more efficiently. Although version space faces some challenges in practical applications, these challenges can be effectively overcome by introducing regularization techniques, heuristic search strategies, and ensemble learning methods, making version space still of significant value in modern machine learning.
[0070] Decomposing the large inference model: Although the document mentions the definition of version space and a specific example, it does not explain in detail the role of version space in machine learning, or how to use version space to select the final hypothesis.
[0071] The original query request was divided into subquery requests, and their dependencies were handled to obtain a rewritten query request: 1. What is the role of version space in machine learning? 2. How can version space be used to select the final hypothesis?
[0072] Rewrite the response to query request query1:
[0073] 1. Constrained search space: The version space narrows the scope of the hypothesis space, so that the learning algorithm only needs to search for suitable hypotheses in the version space, rather than searching the entire hypothesis space, thereby improving learning efficiency.
[0074] 2. Providing candidate hypotheses: Each hypothesis in the version space is consistent with the training set, and therefore they are all potential candidate hypotheses. The learning algorithm can determine the final hypothesis from the version space through further evaluation and selection.
[0075] Rewrite the response to query request query2:
[0076] 1. Inductive bias: Learning algorithms typically select the final hypothesis based on some inductive bias. For example, they may choose the simplest hypothesis (Occam's razor) or the hypothesis with the strongest generalization ability.
[0077] 2. Validation set evaluation: The best-performing hypothesis in the version space is selected as the final hypothesis by evaluating the performance of each hypothesis on the validation set.
[0078] Reflection 1: The role of version space did not mention "supporting incremental learning," and further details are needed to make it a complete answer.
[0079] Optimize query request query1: Does the version space support incremental learning?
[0080] The answer to query 1 is: Version space does indeed support incremental learning. By dynamically updating the version space, it's possible to effectively adapt to new training samples, maintaining the model's accuracy and generalization ability. Although some challenges exist in practical applications, these can be effectively overcome by introducing regularization techniques, heuristic search strategies, and ensemble learning methods, making version space a valuable tool in incremental learning.
[0081] Reflection 2: The question of how to choose the final hypothesis did not mention "cross-validation," and needs further elaboration to be considered a complete answer.
[0082] Optimize query request query2: Can cross-validation be used to select the final hypothesis in the version space?
[0083] The answer to the new query 2 is yes, cross-validation can be used to select the final hypothesis from the version space. Cross-validation allows for a more accurate evaluation of the generalization ability of each hypothesis, selecting the best-performing hypothesis as the final hypothesis. Cross-validation effectively reduces overfitting, improves the model's generalization ability, and provides a fair evaluation for each hypothesis in the version space. In practical applications, attention needs to be paid to the dataset partitioning method, computational cost, and the choice of k-value to ensure the effectiveness and accuracy of cross-validation.
[0084] The final answer is displayed after the loop ends, as shown below:
[0085] Version space definition
[0086] The version space refers to the set of all hypotheses consistent with the training set. In machine learning, especially inductive learning, we aim to find a hypothesis that correctly classifies all samples in the training set. The version space contains all possible such hypotheses. For example, in the watermelon problem, there are multiple hypotheses consistent with the training set.
[0087] The role of version space
[0088] 1. Constraint the search space:
[0089] Narrowing the scope: The version space narrows the scope of the hypothesis space, so that the learning algorithm only needs to search for suitable hypotheses in the version space, rather than searching the entire hypothesis space, thereby improving learning efficiency.
[0090] Reduce complexity: The hypothesis space can be very large or even infinite. Version space greatly reduces the number of hypotheses that need to be considered by eliminating hypotheses that are inconsistent with the training data.
[0091] 2. Provide candidate hypotheses:
[0092] Potential candidates: Each hypothesis in the version space is consistent with the training set, and therefore they are all potential candidate hypotheses. The learning algorithm can determine the final hypothesis from the version space through further evaluation and selection.
[0093] Variety: Assumptions in the version space may have different complexities and generalization capabilities, providing variety for selection.
[0094] Supports incremental learning:
[0095] a. Dynamic Updates: In incremental learning, new training samples are continuously added, and the version space can be dynamically updated to reflect the information brought by the new samples. This ability to dynamically update gives the version space a significant advantage when dealing with dynamically changing data environments.
[0096] b. Adaptability: The version space can adapt to new data and maintain consistency with the training data, thereby improving the model's adaptability and generalization ability.
[0097] How to choose the final hypothesis
[0098] 1. Inductive bias:
[0099] Occam's Razor: Choose the simplest hypothesis. According to Occam's Razor, if multiple hypotheses are consistent with the training data, choose the simplest one. This helps reduce model complexity and improve generalization ability.
[0100] Generalization ability: Select the hypothesis with the strongest generalization ability. By evaluating the performance of the hypotheses on unseen data, select the hypothesis with the strongest generalization ability as the final hypothesis.
[0101] Validation set evaluation:
[0102] a. Performance Evaluation: The best-performing hypothesis in the version space is selected as the final hypothesis by evaluating its performance on the validation set. The validation set is a dataset independent of the training set used to evaluate the model's generalization ability.
[0103] b. Avoid overfitting: Validation set evaluation can effectively avoid overfitting and ensure that the model performs well on new data.
[0104] Cross-validation:
[0105] a. Multiple Evaluations: Cross-validation is used to evaluate hypotheses in the version space. Cross-validation more accurately evaluates model performance by dividing the dataset into multiple subsets and training and testing the model multiple times.
[0106] b. Select the optimal hypothesis: Choose the hypothesis that performs best in cross-validation as the final hypothesis. Cross-validation can reduce the variance of the evaluation results and improve the reliability of the evaluation results.
[0107] Summarize
[0108] Version space is an important concept in machine learning. It provides candidate hypotheses by constraining the search range of the hypothesis space and supports incremental learning, thereby improving the efficiency and generalization ability of learning algorithms. Through methods such as inductive preference, validation set evaluation, and cross-validation, the final hypothesis can be selected from the version space, ensuring that the model performs well on new data. Version space has wide applications in practical machine learning, especially in dealing with dynamically changing data environments, where its dynamic updating capability makes it invaluable.
[0109] In summary, to address the existing problems, this invention proposes a multi-round retrieval enhancement generation method. It determines whether decomposition is necessary based on the retrieval performance of the original query request, avoiding excessively long response times caused by decomposing overly simple original queries. Furthermore, it clarifies the judgment mechanism for whether decomposition is appropriate. A large-scale reasoning model is used to output the results of each stage of thinking and reasoning in real time. It also features query decomposition and rewriting functions, offering comprehensive functionality and superior performance, effectively avoiding unresponsive waiting issues. Based on the dependencies between subquery requests and already iterated query requests, it generates semantically independent rewritten query requests. A reflection-retrieval-reasoning loop mechanism is established to deeply uncover omissions in existing answers and retrieve as much relevant context as possible, avoiding limitations on the retrieval scope. The overall solution is continuously optimized during the execution of multiple rounds of RAG, effectively supporting advanced query requirements such as complex, multi-hop, and multi-causal logic, and obtaining logically sound and in-depth summary answers.
[0110] Device Examples
[0111] According to embodiments of the present invention, a multi-round retrieval enhancement generation apparatus is provided. Figure 3 This is a schematic diagram of a multi-round retrieval enhancement generation device according to an embodiment of the present invention, such as... Figure 3 As shown, the multi-round retrieval enhancement generation apparatus according to an embodiment of the present invention specifically includes:
[0112] The initial retrieval module 30 is used to perform a preliminary retrieval from the knowledge base using an initial query request, and uses the preliminary retrieval results as initial reference materials. Specifically, it is used for:
[0113] A preliminary search is performed on the knowledge base using the original query request, and contextual information is retrieved to obtain initial reference materials in fragment form.
[0114] Query request decomposition module 32 is used to determine whether the large reasoning model can provide a complete answer based on the initial reference materials. If not, the original query request is divided into sub-query requests; otherwise, the summary answer module is executed directly. Specifically, it is used for:
[0115] The original query request is divided into subquery requests in the form of queries using a large inference model, and the number of subqueries does not exceed the preset maximum number of subqueries.
[0116] The subquery request iteration module 34 is used to eliminate the dependencies of subquery requests to obtain a rewritten query request. The rewritten query request is used to supplement the retrieval, and the answer is updated using the large inference model. Based on the updated answer, initial reference materials are supplemented to obtain the first data. Specifically, it is used for:
[0117] Each subquery request is updated sequentially using an iterative serial processing method.
[0118] In each iteration, the inference big model is used to eliminate pronouns and handle semantic incompleteness based on the dependencies between the current subquery request and the rewritten query requests obtained in the previous iterations, thus transforming the subquery request into a corresponding rewritten query request. The rewritten query request is then used to retrieve context fragments from the knowledge base. Based on the newly retrieved context fragments, the inference big model is used to update the answer. All rewritten query requests and their corresponding updated answers are added to the initial reference materials to obtain the first set of references.
[0119] The reflective retrieval and reasoning module 36 is used to reflect on whether the large-scale reasoning model can provide a complete answer based on the first data and the rewritten query request. If not, it updates the rewritten query request to an optimized query request to address any omissions, uses the optimized query request to supplement the retrieval, and updates the answer using the large-scale reasoning model. Based on the updated answer, it supplements the first data to obtain the second data. The reflective retrieval and reasoning module is cyclical until a preset number of cycles is reached or a complete answer can be provided. Specifically, it is used for:
[0120] The optimized query requests are used to retrieve context fragments from the knowledge base and add them to the first data to obtain the missing supplementary data. Based on the missing supplementary data, the inference big model is used to update the answer, and all optimized query requests and their corresponding updated answers are added to the missing supplementary data to obtain the second data.
[0121] Summary and Answer Module 38 is used to provide feedback on the final answer results, specifically for:
[0122] The final answer is provided to the user in a streaming output format.
[0123] In summary, addressing the existing problems, this invention presents a multi-round retrieval enhancement generation device. It determines whether decomposition is necessary based on the retrieval effect of the original query request, avoiding excessively long response times caused by decomposing overly simple original query statements. Furthermore, it clarifies the judgment mechanism for whether decomposition is appropriate. Using a large-scale reasoning model, it outputs the results of each stage of thinking and reasoning in real time, and also features query decomposition and rewriting functions. Its comprehensive functionality and superior performance effectively avoid unresponsive waiting issues. Based on the dependencies between subquery requests and already iterated query requests, it generates semantically independent rewritten query requests. A reflection-retrieval-reasoning loop mechanism is set up to deeply uncover omissions in existing answers and retrieve as much relevant context as possible, avoiding limitations on the retrieval scope. The overall solution is continuously optimized during the execution of multiple rounds of RAG, effectively supporting advanced query requirements such as complex, multi-hop, and multi-causal logic, and obtaining logically sound and in-depth summary answers.
[0124] Electronic device examples
[0125] Figure 4 This is a schematic diagram of an electronic device according to an embodiment of the present invention. The electronic device 400 may include at least one processor 410 and a memory 420. The processor 410 can execute instructions stored in the memory 420. The processor 410 is communicatively connected to the memory 420 via a data bus. In addition to the memory 420, the processor 410 can also be communicatively connected to an input device 430, an output device 440, and a communication device 450 via the data bus.
[0126] Processor 410 can be any conventional processor, such as a commercially available CPU. The processor may also include, for example, a Graphics Processing Unit (GPU), a Field Programmable Gate Array (FPGA), a System on Chip (SOC), an Application Specific Integrated Circuit (ASIC), or a combination thereof.
[0127] The memory 420 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk.
[0128] In this embodiment of the present disclosure, the memory 420 stores executable instructions, and the processor 410 can read the executable instructions from the memory 420 and execute the instructions to implement all or part of the steps of any of the multi-round retrieval enhancement generation methods in the above exemplary embodiments.
[0129] Computer-readable storage medium embodiments
[0130] In addition to the methods and apparatus described above, exemplary embodiments of this disclosure may also be a computer program product or a computer-readable storage medium storing the computer program product, the computer product including computer program instructions that can be executed by a processor to implement all or part of the steps described in any of the multi-round retrieval enhancement generation methods in the exemplary embodiments described above.
[0131] Computer program products can be written in any combination of one or more programming languages to perform the operations of the embodiments of this application. Programming languages include object-oriented programming languages such as Java and C++, as well as conventional procedural programming languages such as C or similar languages, and scripting languages (e.g., Python). The program code can be executed entirely on the user's computing device, partially on the user's device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0132] Computer-readable storage media may take the form of any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may, for example, include, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or devices, or any combination thereof. More specific examples of readable storage media include: static random access memory (SRAM) having one or more electrically connected wires, electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk, or any suitable combination thereof.
[0133] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A multi-round retrieval enhancement generation method, characterized in that, include: Step 1: Use the original query request to perform a preliminary search from the knowledge base, and use the preliminary search results as initial reference materials; Step 2: Based on the initial reference data, determine whether the reasoning model can provide a complete answer. If not, divide the original query request into sub-query requests; otherwise, proceed directly to step 5. Step 3: Eliminate the dependencies of the subquery requests to obtain the rewritten query request, use the rewritten query request to supplement the retrieval and use the inference big model to update the answer, and supplement the initial reference data based on the updated answer to obtain the first data; Step 4: Based on the first data and the rewritten query request, reflect on whether the reasoning big model can provide a complete answer. If not, update the rewritten query request to an optimized query request for omissions, use the optimized query request to supplement the retrieval, and use the reasoning big model to update the answer. Based on the updated answer, supplement the first data to obtain the second data. Repeat Step 4 until the preset number of cycles is reached or a complete answer can be provided. Step 5: Provide feedback on the final answer.
2. The method according to claim 1, characterized in that, The initial retrieval from the knowledge base using the original query request, and the use of the initial retrieval results as initial reference materials, specifically includes: A preliminary search is performed on the knowledge base using the original query request, and contextual information is retrieved to obtain initial reference materials in fragment form.
3. The method according to claim 1, characterized in that, The step of dividing the original query request into sub-query requests specifically includes: The original query request is divided into subquery requests in the form of queries using a large inference model, and the number of subqueries does not exceed the preset maximum number of subqueries.
4. The method according to claim 1, characterized in that, The process of eliminating the dependencies of the subquery request to obtain the rewritten query request specifically includes: Each subquery request is updated sequentially using an iterative serial processing method. In each iteration, the large inference model is used to eliminate pronouns and handle semantic incompleteness based on the dependencies between the current subquery request to be processed and the rewritten query requests obtained in the previous iterations, and then the subquery request is processed into the corresponding rewritten query request.
5. The method according to claim 1, characterized in that, The process of using the rewritten query request to supplement the retrieval and updating the answer using the large inference model, and supplementing the initial reference materials based on the updated answer to obtain the first data specifically includes: The rewritten query request is used to retrieve context fragments from the knowledge base. Based on the new retrieved context fragments, the answer is updated using a large inference model. All rewritten query requests and their corresponding updated answers are added to the initial reference materials to obtain the first material.
6. The method according to claim 1, characterized in that, The process of using optimized query requests to supplement the retrieval and using a large inference model to update the answer, and then supplementing the first data with the updated answer to obtain the second data, specifically includes: Optimized query requests are used to retrieve context fragments from the knowledge base and add them to the first data to obtain missing supplementary data; based on the missing supplementary data, the answer is updated using a large inference model, and all optimized query requests and their corresponding updated answers are added to the missing supplementary data to obtain the second data.
7. The method according to claim 1, characterized in that, The feedback of the final answer specifically includes: providing the user with the final answer in a streaming output manner.
8. A multi-round retrieval enhancement generation device, characterized in that, include: The raw retrieval module is used to perform a preliminary retrieval from the knowledge base using a raw query request, and the preliminary retrieval results are used as initial reference materials; The query request decomposition module is used to determine whether the reasoning model can provide a complete answer based on the initial reference materials. If not, the original query request is divided into sub-query requests; otherwise, the summary answer module is executed directly. The subquery request iteration module is used to eliminate the dependencies of the subquery requests to obtain a rewritten query request, use the rewritten query request to supplement the retrieval and use the inference big model to update the answer, and supplement the initial reference data based on the updated answer to obtain the first data; The reflection retrieval reasoning module is used to reflect on whether the reasoning big model can completely answer the question based on the first data and the rewritten query request. If not, the rewritten query request is updated to an optimized query request for omissions. The optimized query request is used to supplement the retrieval and the reasoning big model is used to update the answer. The first data is supplemented according to the updated answer to obtain the second data. The reflection retrieval reasoning module is cyclically repeated until the preset number of cycles is reached or a complete answer can be obtained. The summary and answer module is used to provide feedback on the final answer results.
9. An electronic device, characterized in that, include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the multi-round retrieval enhancement generation method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores an implementation program for information transmission, which, when executed by a processor, implements the steps of the multi-round retrieval enhancement generation method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Model testing method and device
CN119537876A
Method and device for generating reply, equipment, medium and program product
CN120086334A