Intelligent retrieval enhanced question and answer generation method and system based on iterative query

Through dynamic FACT extraction and multi-strategy collaborative training, a dynamic context knowledge base is built, and the query strategy is optimized using the FACT selection model, the problem of context breakage in multiple rounds of iterative queries is solved, and the accuracy and efficiency of the answer is improved.

CN120371979APending Publication Date: 2025-07-25BEIJING UNIV OF POSTS & TELECOMM
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510540570.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-27
Publication Date
2025-07-25

AI Technical Summary

Technical Problem

The existing multi-round iterative query system lacks dynamic integration capabilities and precise semantic control of historical contexts, resulting in limited information gain during the iteration process, reduced answer correlation, and it is difficult to generate accurate answers.

Method used

By dynamically developing the optimization mechanism of FACT extraction and multi-strategy collaborative training, the document is deconstructed as an independent fact unit, a dynamically updated context knowledge base is constructed, and multi-dimensional scoring and strategy collaborative optimization are combined with the FACT selection model to generate accurate query rewrite statements.

Benefits of technology

It improves the accuracy and recall rate of multiple rounds of iterative queries, solves the query offset problem caused by context breaks, and ensures the accuracy and efficiency of the answers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120371979A_ABST
    Figure CN120371979A_ABST
Patent Text Reader

Abstract

The invention discloses an iterative query-based intelligent retrieval enhanced question and answer generation method and system. The method comprises the following steps of: generating a query question in the round based on a user question; according to the query problem of this round, retrieving to obtain a related document, and writing all FACT extracted from the document into a user problem FACT set; forming a prompt word by the query question and the related document in the round, and inputting the prompt word into the large model to generate an answer; generating a query strategy according to the user question and the answer of the round, and if the strategy is terminated, ending the query; if the strategy continues to be rewritten, reasoning is carried out based on the retrieved historical context, and a next-round query problem is generated; and if the strategy is a review FACT, inputting the user question FACT set and the query question of this round into an FACT selection model, and then generating the query question of the next round according to the FACT selected by the FACT selection model. The invention relates to the technical field of natural language processing, and can realize dynamic integration and precise semantic control of historical contexts in multiple rounds of iterative queries, enhance the reasoning ability of a large model and ensure the answer accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to an intelligent retrieval enhanced generation question - answering method and system based on iterative query, and relates to the technical field of natural language processing. Background Art

[0002] RAG (Retrieval - Augmented Generation) is a technology that combines information retrieval and text generation. In natural language processing tasks, especially in dialogue systems, the RAG technology enhances the output of the generation model by retrieving relevant information from an external knowledge base. This method enables the generation model to utilize broader and more specific knowledge, thereby generating more accurate and useful answers.

[0003] The core defect of traditional multi - round iterative query systems lies in the lack of dynamic integration ability of historical context and precise semantic control mechanism. At the context management level, the existing technology has not established a cross - round knowledge association system. Each round of retrieval is only executed based on the isolated rewritten queries generated, resulting in the breakage of the logical chain in multi - hop reasoning scenarios. The system cannot effectively capture the key factual elements in the previous retrieval results, and it is even more difficult to dynamically inject them into the semantic construction of subsequent queries, resulting in limited information gain during the iterative process.

[0004] At the semantic control level, the existing solutions overly rely on the original rewriting ability of large models and lack a systematic calibration strategy for synonymous expressions. Due to the lack of a fine - grained semantic constraint framework, the model has insufficient adaptability to complex synonymous substitutions (such as professional term variants, cross - domain concept mappings), which easily leads to implicit semantic drift in query statements. This drift accumulates during the iterative process, resulting in a continuous decrease in the relevance between the retrieval results and the core question, a significant increase in the proportion of irrelevant document interference, and restricting the accuracy and reliability of answer generation.

[0005] Therefore, how to effectively achieve the dynamic integration of historical context and precise semantic control during the multi - round iterative query process, so as to enhance the reasoning ability of large models and ensure the accuracy and efficiency of answers, has become a key technical issue that technicians focus on. Summary of the Invention

[0006] In view of this, the purpose of the present invention is to provide an intelligent retrieval enhanced generation question - answering method and system based on iterative query, which can effectively achieve the dynamic integration of historical context and precise semantic control during the multi - round iterative query process, thereby enhancing the reasoning ability of large models and ensuring the accuracy and efficiency of answers.

[0007] To achieve the above purpose, the present invention provides an intelligent retrieval enhanced generation question - answering method based on iterative query, including:

[0008] Step 1: Reason about the user - input question to generate the query question for this round;

[0009] Step 2: According to the query question in this round, retrieve the relevant documents in this round, then split the relevant documents in this round to extract multiple factual statements FACT, and finally write all the extracted FACT into the user question FACT set;

[0010] Step 3: Use the query question in this round and the relevant documents in this round to form a prompt, and input it into the large model to generate the answer in this round;

[0011] Step 4: Based on the user question and the answer in this round, generate a query strategy using the large model. If the query strategy is to terminate, it means that the user question has been answered, the answer in this round is the final answer, and the iterative query process for this time ends; if the query strategy is to continue rewriting, perform reasoning based on the historical context retrieved previously to generate the query question for the next round, and then turn to Step 2 to continue the query for the next round; if the query strategy is to review FACT, input the user question FACT set and the query question in this round into the FACT selection model. The FACT selection model is used to select several FACT from the user question FACT set based on multiple selection strategies, and then generate the query question for the next round based on the multiple FACT output by the FACT selection model. Finally, turn to Step 2 to continue the query for the next round.

[0012] To achieve the above object, the present invention also provides an intelligent retrieval enhanced generation question-answering system based on iterative query, including:

[0013] A user question rewriting device, which is used to reason about the user input question to generate the query question for the first round;

[0014] A FACT retrieval device, which is used to retrieve relevant documents according to the query question in each round, then split the relevant documents to extract multiple factual statements FACT, and finally write all the extracted FACT into the user question FACT set;

[0015] An intelligent question-answering device, which is used to form a prompt with the query question in each round and the retrieved relevant documents, and input it into the large model to generate the answer in each round;

[0016] A strategy judgment device is used to generate a query strategy based on a large model according to the user's question and each round of answers. If the query strategy is to terminate, the current answer is the final answer; if the query strategy is to continue rewriting, it reasons based on the historical context retrieved previously to generate the next round of query questions, and then notifies the FACT retrieval device to continue the next round of query; if the query strategy is to review FACT, the user question FACT set and the current round of query questions are input into the FACT selection model. The FACT selection model is used to select several FACTS from the user question FACT set based on multiple selection strategies, and then reason to generate the next round of query questions according to the multiple FACTS output by the FACT selection model, and finally notify the FACT retrieval device to continue the next round of query.

[0017] To achieve the above object, the present invention also provides a computing device, including:

[0018] a memory and a processor;

[0019] The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions. When the computer-executable instructions are executed by the processor, the steps of the intelligent retrieval enhanced generation question-answering method based on iterative query are implemented.

[0020] To achieve the above object, the present invention also provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are executed by the processor, the steps of the intelligent retrieval enhanced generation question-answering method based on iterative query are implemented.

[0021] Compared with the prior art, the beneficial effects of the present invention are as follows: Through the dynamic FACT extraction and multi-strategy collaborative training optimization mechanism, the present invention realizes the precise control of multi-round query iteration. In the FACT extraction layer, atomic fact units (such as entity attributes, event relationships, etc.) are deconstructed from the retrieved documents in each round, thereby constructing a dynamically updated context knowledge base. Specifically, through semantic parsing technology, the document content is disassembled into independent and complete knowledge fragments, and the content of the knowledge base is automatically updated after each round of iteration, retaining the core facts strongly related to the user's question, while filtering redundant or low-confidence information. These FACTS directly serve the semantic enhancement of the query statement. Through the dynamic combination of fact elements, these FACTS are selectively evaluated and selected to generate a rewritten query containing a clear retrieval intention. The present invention also performs multi-dimensional scoring (such as semantic matching degree, temporal relevance, information contribution degree) on the FACTS in the knowledge base based on the current query target and historical context, screens out the key fact units most likely to complement the query intention, and finally generates a rewritten statement that accurately points to the answer. This progressive semantic completion mechanism based on fact units effectively solves the query deviation problem caused by context breakage in multi-round retrieval, and improves the accuracy and recall rate of the rewritten statement in the iterative query process. The FACT selection model realizes the collaborative optimization of strategies through a contrastive learning framework. During the training process, the model constrains the positive sample FACTS to have the equivalent ability to rewrite homologous queries, and the negative samples are used to identify interference information, thereby establishing the ability to perceive differences between strategies. Specifically, the model simulates the complex query requirements in the scenario of multi-round iteration, and learns the applicability rules of different strategies in different contexts. For example, in the scenario where cross-document association is required, the model will preferentially activate the historical relevance strategy, and when dealing with fuzzy queries, the weight of the semantic relevance strategy will be dynamically increased. By quantifying the collaborative effect between different strategies, the weights of each strategy are dynamically allocated to make the FACT selection closely fit the rewritten requirements of the current query. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 FIG. is a flowchart of an intelligent retrieval enhanced generation question-answering method based on iterative query shown in an exemplary embodiment of the present invention.

[0023] Figure 2 FIG. is a specific training flowchart of the FACT selection model shown in an exemplary embodiment of the present invention.

[0024] Figure 3 FIG. is a schematic structural diagram of an intelligent retrieval enhanced generation question-answering system based on iterative query shown in an exemplary embodiment of the present invention.

[0025] Figure 4 FIG. is a schematic structural diagram of a computer device shown in an exemplary embodiment of the present invention. DETAILED DESCRIPTION OF THE INVENTION

[0026] To make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings.

[0027] As Figure 1 shown, the present invention proposes an intelligent retrieval enhanced generation question-answering method based on iterative query, including:

[0028] Step 1: Reason about the user input question to generate the query question for this round.

[0029] Step 2: According to the query question for this round, retrieve the relevant documents for this round, then split the relevant documents for this round to extract multiple factual statements FACT, and finally write all the extracted FACT into the user question FACT set.

[0030] Step 3: Use the query question for this round and the relevant documents for this round to form a prompt, and input it into the large model to generate the answer for this round.

[0031] Step 4: Based on the user question and the answer for this round, generate a query strategy using the large model. The query strategy can include termination, continue to rewrite, review FACT, etc. If the query strategy is termination, it means that the user question has been answered, the answer for this round is the final answer, and the iterative query process for this time ends. If the query strategy is continue to rewrite, reason based on the historical context retrieved previously to generate the query question for the next round, and then turn to Step 2 to continue the next round of query. If the query strategy is review FACT, input the user question FACT set and the query question for this round into the FACT selection model. The FACT selection model is used to select several FACT from the user question FACT set based on multiple selection strategies, then reason and generate the query question for the next round according to the multiple FACT output by the FACT selection model, and finally turn to Step 2 to continue the next round of query.

[0032] There is some valid information in the relevant documents retrieved in each round, which will not be noticed during the iterative process. FACT is used to record this valid information in the documents. During the reasoning process of iterative query questions in multiple rounds, each round of retrieved documents will bring a batch of potential FACT. However, not all FACT are useful for subsequent reasoning, and these FACT need to be selectively evaluated and selected to ensure that a high reasoning accuracy and efficiency can still be maintained under a limited number of queries or information usage. Traditional methods often rely on simple keyword matching or vector retrieval (Embedding similarity), but this is not sufficient to solve the high-level judgment of "whether it can truly solve the problem" in multi-hop scenarios. Therefore, the present invention designs a FACT selection model that integrates multiple strategies, and defines a strategy space in the FACT selection model For example, the strategy space It includes four selection strategies: Among them, s sem represents the selection strategy based on semantic relevance, and s pos represents the selection strategy based on positive sample association, and s rel represents the selection strategy based on historical FACT association, and s imp represents the selection strategy based on importance (the contribution of a certain intermediate fact to the final answer). In this way, the FACT selection model is trained based on the triplet learning method. After the model is trained, appropriate FACTs are selected from the user question FACT set based on multiple selection strategies for question rewriting. As Figure 2 shown, the specific training process of the FACT selection model is as follows:

[0033] Step A1: Select a query question and the corresponding anchor FACT from the pre-set FACT dataset, and then, according to each selection strategy in the policy space , select several positive sample FACTs and several negative sample FACTs for the anchor FACT from the FACT dataset, so as to generate multiple triplet samples under each selection strategy: Among them, represents a triplet sample under the z-th selection strategy, are the anchor FACT, positive sample FACT, and negative sample FACT respectively. At the same time, set the initial value of the FACT vector FX = [fx1, fx2,..., fx W . FX is used to represent whether each selection strategy in the policy space is enabled. fx1, fx2,..., fx W represent whether the 1st, 2nd,..., W-th selection strategies in the policy space are enabled respectively. Its value of 1 means enabled, and its value of 0 means not enabled. W is the number of selection strategies in the policy space ;

[0034] The FACT dataset records different query questions and the corresponding anchor FACTs. Under various different selection strategies, positive sample FACTs and negative sample FACTs for the anchor FACT can be selected from the FACT dataset. Among them, the positive sample FACT is the one that can play a similar role to the anchor FACT, that is, the FACT that makes the question rewriting effect better, and the negative sample FACT is the opposite, that is, the FACT that plays the opposite role to the anchor FACT;

[0035] During the training process, FX will be continuously adjusted and updated. The w-th element value fx wThe update method is as follows: Determine the answer source document R for the query problem, obtain the positive sample FACT under the w-th selection strategy, rewrite the query problem using the positive sample FACT, and then perform document recall using the vector similarity method based on the query problem and the rewritten query problem respectively. Judge whether the sorting position of R in the recalled documents based on the rewritten query problem is before the sorting position in the recalled documents based on the query problem. If so, it means the w-th selection strategy is effective, and set fx w to 1. If not, it means the w-th selection strategy is ineffective, and set fx w to 0;

[0036] Step A2: Calculate the triplet loss value between every two selection strategies according to the distances among the anchor FACT, positive sample FACT, and negative sample FACT in the triplet samples: L triplet (s i , s j ) is the triplet loss value between selection strategies s i and s j . denotes the expected value over all triplet sample distributions, denotes the triplet sample distribution composed of all triplet samples under selection strategies s i and s j , denotes a triplet sample drawn from the triplet sample distribution under selection strategies s i and s j . respectively denote the anchor FACT, positive sample FACT, and negative sample FACT under the l-th selection strategy. f(·) represents the feature mapping function, are respectively vector representations. Their initial values can be generated using an embedding model and then continuously adjusted and optimized during the training process. is the squared Euclidean distance between vectors, representing the distance between similar samples. is and the squared Euclidean distance between, representing the distance between dissimilar samples. α ij is the dynamic margin threshold, and its value can be adaptively adjusted according to the interaction effect between selection strategies s i and s j . If the cooperation degree between these two selection strategies is high, then α ij can be set larger, thus requiring a stricter discrimination degree. max(0,·) represents the ReLU operation to ensure that the triplet loss value is non-negative;

[0037] Step A3: Combine the anchor FACTs, positive sample FACTs, and negative sample FACTs under each selection strategy to form the FACT set under each selection strategy. Then, calculate the FACT similarity scores between every two selection strategies based on the vector similarity, keyword similarity, hit rate, and recall rate of each FACT set.

[0038] Step A4: Calculate the cooperation degree between every two selection strategies: a ij =S(s i , s j ) + exp(-L triplet (s i , s j ))), where S(s i , s j ) is the FACT similarity score between selection strategies s i and s j . Based on this, generate a strategy interaction matrix A, where each element A[i, j] = a ij .

[0039] Step A5: Set an overall optimization objective function to calculate the overall loss value: L(Θ) = max(0, -P T AP +

[0040] ∑ ij L triplet (s i , s j ) + βH(P)), that is, through training, find the optimal parameter combination Θ to minimize the overall loss value. Here, Θ are all the trainable parameters of the model, including the weights of the neural network itself, the feature mapping function f(·), and the strategy probability distribution vector P. In multiple rounds of iterative query inference, P = [p1, p2,..., p W represents the usage ratio of all selection strategies in the current strategy space , and p w is the usage ratio of the w-th selection strategy. For example: P = [p sem , p pos , p rel , p imp , p sem , p pos , p rel , p imprespectively represent the usage ratios of the selection strategy based on semantic relevance, the selection strategy based on positive sample association, the selection strategy based on historical FACT association, and the selection strategy based on importance. If P = [0.3, 0.3, 0.2, 0.2], it means that at the current moment, the usage ratios of the selection strategies based on semantic relevance and positive sample association are both 30%, while the usage ratios of the selection strategies based on historical FACT association and importance are each 20%. β is a hyperparameter used to control the influence of the diversity regularization term. Its value can be set according to actual business needs. Then, the gradient of the overall loss value with respect to the model parameters is calculated and backpropagated to adjust the parameter combination of the model until the overall loss value reaches the minimum.

[0041] In step A3, using the selection strategies s i and s j as an example, calculating the FACT similarity scores between every two selection strategies may further include:

[0042] Step A31: Calculate the vector similarity between the FACT sets of the selection strategies s i and s j :

[0043] F-Num i and F-Num j are the total numbers of elements in the FACT sets under the selection strategies s i and s j respectively. is the u-th element in the FACT set of the selection strategy s i . is the v-th element in the FACT set of the selection strategy s j . represents 's vector, and cos(·) represents calculating the cosine value between vectors;

[0044] Step A32: Calculate the keyword similarity between the FACT sets of the selection strategies s i and s j :

[0045] Among them, respectively represent 's keyword sets. respectively represent the total numbers of elements when taking the union and intersection operations on ;

[0046] Step A33: Calculate respectively for the selection strategies s i and s jHit rate and recall rate of the FACT set: H r , Pre are the hit rate and recall rate respectively, and F Used is s i or s j is the total number of positive sample FACTS and negative sample FACTS used by the answer corresponding to the query question in the FACT set of s Total is s i or s j is the total number of FACTS in the FACT set of s i or s j is the total number of positive sample FACTS used by the answer in the FACT set of s i or s j is the total number of positive sample FACTS not used by the answer in the FACT set of s i 、s j Harmonic score of the FACT set: Thus, the selection strategy s i and s j is obtained for the average harmonic score F(s i , s j ), that is, the average value of the harmonic scores of the FACT sets of the selection strategies s i 、s j ;

[0047] Step A34. Calculate the FACT similarity score between the selection strategies s i and s j : S(s i , s j ) = μ * C(s i , s j ) + π *

[0048] J(s i , s j ) + ρ * F(s i , s j ), where μ, π, and ρ are weight parameters respectively, and μ + π + ρ = 1. For example, μ = 0.2, π = 0.3, and ρ = 0.5 can be set.

[0049] After the FACT selection model is trained, in step four, the FACT selection model selects several FACTS from the user question FACT set based on multiple selection strategies, which can further include:

[0050] Step B1. Calculate the strategy selection proportion vector FS: FS = FX * P T = [fs1, fs2, …, fsW , and calculate the number of FACT selections corresponding to each selection strategy accordingly: fs1, … fs W represent the values of the 1st, …, Wth elements in FS, NUM is the total number of FACTS preset in advance, and num g is the number of FACT selections corresponding to the gth selection strategy;

[0051] Step B2: According to the query problem in this round and the number of FACT selections corresponding to the calculated selection strategy, respectively select the corresponding number of FACTS from the user question FACT set using each selection strategy. If the number of FACT selections is 0, then do not use the corresponding selection strategy. Finally, output the FACTS selected by all selection strategies.

[0052] For example, the total number of FACTS preset in advance is 10, and P = [p sem , p pos , p rel , p imp = [0.4, 0.3, 0.2, 0.1]. When FX = [1, 1, 1, 1], using s sem returns 4 FACTS, using s pos returns 3 FACTS, using s rel returns 2 FACTS, using s imp returns 1 FACT; while when FX = [1, 0, 0, 1], using s sem returns 8 FACTS, using s pos returns 8 FACTS, using s imp returns 2 FACTS, s pos and s rel are not used.

[0053] To more clearly explain the present invention, an embodiment of applying the present invention is shown below:

[0054] User input question: "Where did the husband of Berenguer Navarro die?"

[0055] 1. The first-round query process is as follows:

[0056] Inference: "To answer this question, I need to find out who the husband of Berenguer Navarro is and the place where he died."

[0057] Generate the first-round query question: "Who is the husband of Berenguer Navarro?"

[0058] According to the first-round query question, the retrieved document D1: Berenguela of Navarre (1170 - 1230) was the Queen of the Kingdom of Navarre. She was married to Richard I, the King of England known as "Richard the Lionheart". Richard I was famous for his bravery, participated in the Third Crusade, and died in 1199.

[0059] Extract the following FACTS from D1:

[0060] F1: Berenguela of Navarre was the Queen of the Kingdom of Navarre.

[0061] F2: Berenguela of Navarre's husband was Richard I, the King of England.

[0062] F3: Richard I participated in the Third Crusade.

[0063] F4: Richard I died in 1199.

[0064] F5: Richard I had the nickname "Richard the Lionheart".

[0065] Inference: "Document D1 confirms that Berenguela of Navarre's husband was Richard I, and he had the nickname 'Richard the Lionheart', but does not provide the place of death."

[0066] Generate a query strategy: Continue to rewrite and generate the second-round query question: "Where did Richard I die?"

[0067] 2. The second-round query process is as follows:

[0068] According to the second-round query question, the retrieved document D2: Richard I participated in a siege in 1199. He was injured outside a certain castle in France, which ultimately led to his death.

[0069] Extract the following FACTS from D2:

[0070] F6: Richard I participated in a siege in 1199.

[0071] F7: Richard I was injured outside a certain castle in France.

[0072] F8: Richard I's injuries led to his death.

[0073] Inference: "Document D2 provides the background of Richard I's death, but still does not give the specific place of death. I may have overlooked other key information."

[0074] Generate query strategy: Review FACT, then recall from the FACT set of the user question the content F5 that is more helpful for answering the question: "Richard I had the nickname 'the Lionheart'." Finally, generate the third-round query question: "Where did the Lionheart die?"

[0075] 3. The process of the third-round query is as follows:

[0076] According to the third-round query question, retrieve the document D3: "The Lionheart" was shot in the shoulder by an archer during the siege of Chalus Castle in France in 1199, and then died of an infected wound. Part of his remains was buried in the Abbey of Fontevraud.

[0077] Extract the following FACT from D3:

[0078] F9: The Lionheart was injured at Chalus Castle in France.

[0079] F 10 : The place where the Lionheart died was Chalus Castle.

[0080] Inference: "Document D3 mentions that 'the Lionheart' died at Chalus Castle. Combining the fact in Document D3 - Richard I had the nickname 'the Lionheart', I can infer that the place where Richard I died was Chalus Castle."

[0081] Generate query strategy: Terminate.

[0082] As Figure 3 shown, an intelligent retrieval enhanced generation Q&A system based on iterative query of the present invention includes:

[0083] A user question rewriting device for reasoning about the user input question to generate the first-round query question;

[0084] A FACT retrieval device for retrieving relevant documents according to each round of query questions, then splitting the relevant documents to extract multiple factual statements FACT, and finally writing all the extracted FACT into the user question FACT set;

[0085] An intelligent Q&A device for forming a prompt word with each round of query questions and the retrieved relevant documents and inputting them into a large model to generate each round of answers;

[0086] A policy judgment device is configured to generate a query policy based on a large model according to a user question and each round of answers. If the query policy is to terminate, the current answer is the final answer; if the query policy is to continue rewriting, it reasons based on the historical context retrieved previously to generate the next round of query questions, and then notifies the FACT retrieval device to continue the next round of query; if the query policy is to review FACT, the user question FACT set and the current round of query questions are input into the FACT selection model. The FACT selection model is used to select several FACTS from the user question FACT set based on multiple selection strategies, and then reasons based on the multiple FACTS output by the FACT selection model to generate the next round of query questions, and finally notifies the FACT retrieval device to continue the next round of query.

[0087] See Figure 4 , Figure 4 is a structural block diagram of a computing device 400 shown in an exemplary embodiment of this specification. The components of the computing device 400 include, but are not limited to, a memory 410 and a processor 420. The processor 420 is connected to the memory 410 through a bus 430, and a database 450 is used to store data.

[0088] The computing device 400 further includes an access device 440, and the access device 440 enables the computing device 400 to communicate via one or more networks 460. Examples of these networks include a Public Switched Telephone Network (PSTN), a Local Area Network (LAN), a Wide Area Network (WAN), a Personal Area Network (PAN), or a combination of communication networks such as the Internet. The access device 440 may include one or more of any type of wired or wireless network interfaces (e.g., a Network Interface Card (NIC)), such as an IEEE802.11 Wireless Local Area Network (WLAN) wireless interface, a Worldwide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, a Near Field Communication (NFC) interface, and so on.

[0089] In an embodiment of this specification, the above components of the computing device 400 and Figure 4Other components not shown may also be connected to each other, for example, via a bus. It should be understood that Figure 4 The block diagram of the computing device shown is for illustrative purposes only and is not a limitation on the scope of this specification. Those skilled in the art can add or replace other components as needed.

[0090] The computing device 400 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or PCs. The computing device 400 can also be a mobile or stationary server or cloud server, etc.

[0091] The processor 420 is used to execute the following computer-executable instructions, which when executed by the processor implement the steps of the above-mentioned intelligent retrieval enhancement generation Q&A method based on iterative queries.

[0092] The above is a schematic solution of a computing device in this embodiment. It should be noted that the technical solution of this computing device and the technical solution of the above-mentioned intelligent retrieval enhancement generation Q&A method based on iterative queries belong to the same concept. For the details not described in detail in the technical solution of the computing device, reference can be made to the description of the technical solution of the above-mentioned intelligent retrieval enhancement generation Q&A method.

[0093] An embodiment of this specification also provides a computer-readable storage medium, which stores computer-executable instructions that, when executed by a processor, implement the steps of the above-mentioned intelligent retrieval enhancement generation Q&A method based on iterative queries.

[0094] The above is a schematic solution of a computer-readable storage medium in this embodiment. It should be noted that the technical solution of this storage medium and the above-mentioned intelligent retrieval enhancement generation Q&A method belong to the same concept. For the details not described in detail in the technical solution of the storage medium, reference can be made to the description of the technical solution of the above-mentioned intelligent retrieval enhancement generation Q&A method or system.

[0095] An embodiment of this specification also provides a computer program, wherein when the computer program is executed on a computer, the computer is made to execute the steps of the above-mentioned intelligent retrieval enhancement generation Q&A method based on iterative queries.

[0096] The above is a schematic solution of a computer program according to this embodiment. It should be noted that the technical solution of this computer program and the technical solution of the above intelligent retrieval enhanced generation question-answer method based on iterative query belong to the same concept. For the details not described in detail in the technical solution of the computer program, reference can be made to the description of the technical solution of the above intelligent retrieval enhanced generation question-answer method or system.

[0097] The above describes specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve the desired result. Additionally, the processes depicted in the drawings do not necessarily require the particular order or sequential order shown to achieve the desired result. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0098] The computer instructions include computer program code, which can be in the form of source code, object code, executable files, or some intermediate forms, etc. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disc, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc.

[0099] It should be noted that for the foregoing method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations. However, those skilled in the art should know that the embodiments of this specification are not limited by the described action sequence, because according to the embodiments of this specification, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential for the embodiments of this specification.

[0100] The above is only the preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included within the scope of protection of the present invention.

Claims

1. An intelligent retrieval enhanced generation question-answering method based on iterative query, characterized in that It includes: Step 1: Reason about the user input question to generate the current round of query question. Step 2: According to the current round of query question, retrieve the relevant documents of the current round, then split the relevant documents of the current round to extract multiple factual statements FACT, and finally write all the extracted FACT into the user question FACT set. Step 3: Use the current round of query question and the relevant documents of the current round to form a prompt, and input it into the large model to generate the answer of the current round. Step 4: Based on the user question and the answer of the current round, generate a query strategy based on the large model. If the query strategy is to terminate, it means that the user question has been answered, the answer of the current round is the final answer, and the current iteration query process ends. If the query strategy is to continue rewriting, reason based on the historical context retrieved before to generate the next round of query question, and then turn to Step 2 to continue the next round of query. If the query strategy is to review FACT, input the user question FACT set and the current round of query question into the FACT selection model. The FACT selection model is used to select several FACT from the user question FACT set based on multiple selection strategies, and then reason to generate the next round of query question according to the multiple FACT output by the FACT selection model, and finally turn to Step 2 to continue the next round of query.

2. The method according to claim 1, wherein The specific training process of the FACT selection model is as follows: Step A1: Select a query problem and the corresponding anchor FACT from a pre-set FACT dataset, and then, according to each selection strategy in the strategy space , select several positive sample FACTS and several negative sample FACTS from the FACT dataset for the anchor FACT, so as to generate multiple triple samples under each selection strategy: Among them, represents a triple sample under the z-th selection strategy, are the anchor FACT, the positive sample FACT, and the negative sample FACT respectively. At the same time, set the initial value of the FACT vector FX = [fx1, fx2,..., fx W . FX is used to represent whether each selection strategy in the strategy space is enabled. fx1, fx2,..., fx W represent whether the 1st, 2nd,..., W-th selection strategies in the strategy space are enabled respectively. The value of 1 means enabled, and the value of 0 means not enabled. W is the number of selection strategies in the strategy space ; Step A2. Calculate the triplet loss value between every two selection strategies according to the distances among the anchor FACT, positive sample FACT, and negative sample FACT in the triplet samples: L triplet (s i ,s j ) is the triplet loss value between selection strategies s i and s j . denotes the expected value over all triplet sample distributions, denotes the triplet sample distribution composed of all triplet samples under selection strategies s i and s j . denotes a triplet sample drawn from the triplet sample distribution under selection strategies s i and s j . respectively represent the anchor FACT, positive sample FACT, and negative sample FACT under the l-th selection strategy, and f(·) represents the feature mapping function. are respectively 's vector representations. is the squared Euclidean distance between vectors, representing the distance between similar samples. is and the squared Euclidean distance between them, representing the distance between dissimilar samples. α ij is the dynamic margin threshold, and max(0,·) represents the ReLU operation. Step A3: Combine the anchor FACT, positive sample FACT, and negative sample FACT under each selection strategy to form the FACT set under each selection strategy, and then calculate the FACT similarity score between every two selection strategies according to the vector similarity, keyword similarity between the FACT sets, and the hit rate and recall rate of each FACT set. Step A4. Calculate the cooperation degree between every two selection strategies: a ij = S(s i , s j ) + exp(-L triplet (s i , s j ))), where S(s i , s j ) is the FACT similarity score between selection strategies s i and s j . Generate a strategy interaction matrix A based on this, and each element A[i, j] = a ij ; Step A5. Set the overall optimization objective function to calculate the overall loss value: L(Θ) = max(0, -P T AP + ∑ ij L triplet (s i ,s j ) + βH(P)), where Θ are all the trainable parameters of the model, including the weights of the neural network itself, the feature mapping function f(·), and the policy probability distribution vector P, P = [p1, p2, …, p W , and p w is the usage ratio of the w-th selection strategy, β is a hyperparameter. Then, after calculating the gradient of the overall loss value with respect to the model parameters, backpropagation is performed to adjust the parameter combination of the model until the overall loss value reaches the minimum.

3. The method according to claim 2, wherein The value of the w-th element fx in FX w is updated as follows: Determine the source document R of the answer to the query problem, obtain the positive sample FACT under the w-th selection strategy, and use the positive sample FACT to rewrite the query problem. Then, respectively based on the query problem and the rewritten query problem, use the vector similarity method for document recall. Judge whether the ranking position of R in the recalled documents based on the rewritten query problem is before the ranking position in the recalled documents based on the query problem. If so, it means that the w-th selection strategy is effective, and set fx w to 1. If not, it means that the w-th selection strategy is ineffective, and set fx w to 0.

4. The method according to claim 2, wherein In step A3, calculate the FACT similarity score between the selection strategies s i and s j as follows: Step A31, calculate the vector similarity between the selection strategy s i and the FACT set of s j : F-Num i , F-Num j is the total number of elements in the FACT set under the selection strategy s i , s j , and is the u-th element in the FACT set of the selection strategy s i , is the v-th element in the FACT set of the selection strategy s j , denotes the vector, and cos(·) denotes calculating the cosine value between vectors; Step A32, calculate the keyword similarity between the selection strategy s i and s j and the FACT set: Among them, respectively represent the keyword sets of respectively represent the total number of elements when performing union and intersection operations on Step A33: Calculate the hit rate and recall rate of the FACT sets of the selection strategies s i and s j respectively: H r and Pre are the hit rate and recall rate respectively, and F Used is the total number of positive sample FACTS and negative sample FACTS used by the answer corresponding to the query problem in the FACT set of s i or s j . F Total is the total number of FACTS in the FACT set of s i or s j . TP is the total number of positive sample FACTS used by the answer in the FACT set of s i or s j . FP is the total number of positive sample FACTS not used by the answer in the FACT set of s i or s j . Calculate the harmonic scores of the FACT sets of the selection strategies s i and s j respectively according to the hit rate and recall rate: Thus, obtain the average harmonic score F(s i , s j ) of the FACT sets of the selection strategies s i and s j , that is, the average value of the harmonic scores of the FACT sets of the selection strategies s i and s j ; Step A34, calculate the selection strategy s i and s j the FACT similarity score between: S(s i , s j ) = μ * C(s i , s j ) + π * J(s i ,s j ) + ρ * F(s i ,s j ), where μ, π, and ρ are weight parameters respectively, and μ + π + ρ = 1.

5. The method according to claim 2, wherein When the FACT selection model is trained, in Step 4, the FACT selection model selects several FACT from the user question FACT set based on multiple selection strategies, which further includes: Step B1. Calculate the strategy selection proportion vector FS: FS = FX * P T = [fs1, fs2, …, fs W , and calculate the number of FACT selections corresponding to each selection strategy accordingly: fs1, … fs W represent the 1st, …, Wth element values in FS, NUM is the total number of FACTS preset in advance, and num g is the number of FACT selections corresponding to the gth selection strategy; Step B2: According to the current round of query question and the calculated number of FACT selected corresponding to the selection strategy, select the corresponding number of FACT from the user question FACT set using each selection strategy respectively. If the number of FACT selected is 0, the corresponding selection strategy is not used, and finally output all the FACT selected by the selection strategies.

6. An intelligent retrieval enhanced generation question answering system based on iterative query, characterized in that, It includes: A user question rewriting device, which is used to reason about the user input question to generate the first round of query question. A FACT retrieval device, which is used to retrieve relevant documents according to each round of query question, then split the relevant documents to extract multiple factual statements FACT, and finally write all the extracted FACT into the user question FACT set. An intelligent question answering device, which is used to form a prompt with each round of query question and the retrieved relevant documents, and input it into the large model to generate the answer of each round. A strategy judgment device, which is used to generate a query strategy based on the large model according to the user question and the answer of each round. If the query strategy is to terminate, the current answer is the final answer. If the query strategy is to continue rewriting, then inference is performed based on the historical context retrieved previously to generate the next round of query questions, and then the FACT retrieval device is notified to continue the next round of query; if the query strategy is to review FACT, then the user question FACT set and the current round of query questions are input into the FACT selection model. The FACT selection model is used to select several FACTS from the user question FACT set based on multiple selection strategies, and then based on the multiple FACTS output by the FACT selection model, the next round of query questions is inferred and generated. Finally, the FACT retrieval device is notified to continue the next round of query.

7. A computing device, characterized in that, Including: A memory and a processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions. When the computer-executable instructions are executed by the processor, the steps of the intelligent retrieval enhanced generation question-answering method based on iterative query according to any one of claims 1-5 are implemented.

8. A computer-readable storage medium, characterized in that, It stores computer-executable instructions, and when the computer-executable instructions are executed by the processor, the steps of the intelligent retrieval enhanced generation question-answering method based on iterative query according to any one of claims 1-5 are implemented.

Citation Information

Cited By

  • Intelligent agent-based self-adaptive retrieval enhancement generation method and system

    CN122240751A