RAG multi-hop question answering method based on question splitting and mixed retrieval

By constructing a hybrid index and an iterative decomposition strategy, combined with sparse inverted index and dense vector retrieval, the problems of information dilution and retrieval limitations in multi-hop question answering are solved, achieving higher accuracy and interpretability.

CN121833679APending Publication Date: 2026-04-10NORTHEASTERN UNIV CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-24
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

Existing RAG technology suffers from retrieval bias and information dilution due to complex semantics when handling multi-hop question answering tasks, as well as the limitations of a single retrieval method. It is difficult to cover different types of information needs simultaneously in complex multi-hop problems, resulting in recall results containing noise and erroneous inferences.

Method used

We employ a problem decomposition and hybrid retrieval approach. By constructing sparse inverted indexes and dense vector indexes, combined with structured prompt templates and iterative decomposition strategies, we use a large language model to generate answers to sub-questions and introduce verification and reflection mechanisms to ensure the reliability of the reasoning chain.

Benefits of technology

It significantly improves the accuracy and interpretability of multi-hop question answering in complex scenarios, reduces reasoning complexity, and enhances the comprehensiveness of document recall and the credibility of answers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121833679A_ABST
    Figure CN121833679A_ABST
Patent Text Reader

Abstract

The invention provides an RAG multi-hop question answering method based on question splitting and mixed retrieval, and relates to the field of multi-hop question answering, a complex question is split into a plurality of sub-questions through an iterative question, and the answers of the sub-questions are retrieved in combination with the mixed retrieval of sparse and dense vectors, so that the reasoning complexity is reduced, and the reasoning efficiency is improved. And meanwhile, the comprehensiveness of document recall is improved, a verification and reflection mechanism is further introduced to construct a robust reasoning chain, high-confidence evidence for searching the sub-problems is verified, the reflection mechanism is triggered under the condition that verification is not passed, the sub-problems are modified, and the retrieval efficiency of the sub-problems is improved. Therefore, the accuracy and the interpretability of the multi-hop question and answer in a complex scene are remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application relates to the field of multi-hop question answering, and particularly relates to a RAG multi-hop question answering method based on question decomposition and mixed retrieval. BACKGROUND

[0002] In recent years, large language models have shown excellent capabilities in general question answering and text generation tasks. Intelligent question answering systems based on large language models have made significant progress in open-domain question answering, knowledge retrieval, and text reasoning tasks. However, in multi-hop question answering tasks that require reasoning across multiple knowledge points and rely on multi-source evidence information, simply relying on internal parameterized knowledge of the model often fails to obtain reliable and accurate answers, and there is a "hallucination" problem.

[0003] To compensate for the shortcomings of the model in long-tail knowledge and timeliness, retrieval-augmented generation (RAG) technology is widely used. The RAG framework usually consists of a retriever and a generator: the retriever searches for relevant information fragments from a pre-constructed external knowledge base. The construction of the external knowledge base includes converting documents of various formats into a unified text document format, dividing the documents into blocks, and then using embedding models (such as text-embedding-ada-002, bge-base) to store the text blocks into a vector database using a specific indexing mechanism. The retriever relies on a specific search algorithm to retrieve the most relevant text fragments from the vector database. The generator combines the retrieved content with the original question and inputs it into the large language model to generate the final answer.

[0004] With the deepening of application scenarios, multi-hop question answering (Multi-hop QA) has gradually become a core difficulty. Unlike single-hop question answering, multi-hop question answering requires the system to perform complex logical reasoning when answering questions, often requiring the system to cross multiple documents, associate scattered entities or concepts, and gradually collect evidence chains to arrive at an answer. For example, in financial analysis, legal consultation, or medical decision-making scenarios, a complete question often implies multiple sub-tasks (such as first confirming entity attributes, then comparing attribute values), which poses extremely high requirements on the accuracy and breadth of the retrieval system.

[0005] The existing RAG technology has made some progress, but there are still the following main defects in dealing with complex multi-hop questions and answers: 1. Retrieval bias and information dilution caused by complex semantics: Multi-hop problems usually contain multiple entities, complex constraints and implicit logical relationships. If the existing technology directly encodes the original long and difficult problem into a vector, the key entity information and logical constraints will be semantically diluted in the vector space (Information Dilution). The retriever tends to match documents that are similar in overall semantics but do not match key details such as time and specific attributes, resulting in recall results containing a large amount of noise. Such high noise ratio retrieval results not only waste the context window of the generation model, but also mislead the model to produce false reasoning chains. 2. Limitations of single retrieval method: Single retrieval methods such as dense vector retrieval or sparse keyword retrieval cannot cover different types of information needs in complex multi-hop problems. For example, some retrieval stages need to rely on entity-level information, while some stages need to capture semantic relevance. Therefore, single retrieval methods are prone to incomplete retrieval coverage and excessive information noise, thereby affecting the final answer quality. SUMMARY

[0006] In view of the deficiencies of the prior art, the purpose of the present application is to provide a RAG multi-hop question and answer method based on problem decomposition and mixed retrieval, comprising: Obtain multi-source heterogeneous original document data, generate a plurality of text blocks, and construct a sparse inverted index and a dense vector index of the text blocks; Obtain the original multi-hop question input by the user, and define the reasoning state as ; Wherein, represents the reasoning state of the tth iteration, represents the original multi-hop question, represents a plurality of key-value pairs determined at the (t-1)th iteration, the key-value pairs including sub-questions and sub-answers of the sub-questions; Construct a structured prompt template, the structured prompt template including role setting, constraint condition, few-shot enhancement and context input; Set the initial iteration number t=1, and initialize to empty, and take the initial iteration number as the current iteration number; Fill the reasoning state of the current iteration number t into the context input of the structured prompt template to obtain a complete structured prompt, input the complete structured prompt into a large language model, and output a sub-question or a termination identifier; When the large language model outputs a sub-question, generate a sub-answer of the sub-question, add the sub-question and the sub-answer to , let t+1, and return to execute: fill the reasoning state of the current iteration number t filling in the context input of the structured prompt template; when the large language model outputs a termination identifier, inputting the large language model to generate a complete answer to the original multi-hop question.

[0007] Optionally, a plurality of original document data of multiple sources and heterogeneous types are acquired to generate a plurality of text blocks, and a sparse inverted index and a dense vector index of the text blocks are constructed, including: The original document data of multiple sources and heterogeneous types are acquired, document content is extracted from the original document data by using a document parsing technique, and the document content is subjected to data cleaning and data conversion to obtain text data; According to a preset segmentation strategy, the text data is segmented to obtain a plurality of text blocks, and the text blocks have context semantic association, and each text block is provided with an id; The segmentation strategy includes sliding window segmentation based on fixed character length or semantic segmentation based on paragraphs and periods; For each text block, a plurality of word items are obtained by performing word segmentation on the text block, the frequency of the word items in the text block is calculated to obtain a word frequency, the frequency of the word items in all text blocks is calculated to obtain an inverse document frequency statistic, a BM25 score is calculated according to the word frequency, the inverse document frequency statistic, the total number of text blocks and the average length of the text blocks, as a keyword of the text block, and a sparse inverted index is constructed based on the id and the keyword of the text block; The text blocks are input into a pre-trained embedding model to obtain a dense vector index of the text blocks.

[0008] Optionally, the role setting is used to prompt that the original multi-hop question needs to be gradually disassembled, the constraint conditions include determining the next operation based on the current input reasoning state, further include prompting that only one sub-question can be asked at a time, further include prompting that only the question can be disassembled and the final answer cannot be generated, further include outputting a termination identifier when the original multi-hop question is disassembled, the few-sample enhancement includes a plurality of preset standard disassembly examples, and the context input is the reasoning state.

[0009] Optionally, a sub-answer of the sub-question is generated, including: The sparse inverted index and the dense vector index are called to acquire high-confidence evidence of the sub-question The high-confidence evidence is verified to obtain a target evidence set, the target evidence set is spliced with the sub-question to obtain a spliced vector, and the spliced vector is input into the large language model to obtain the sub-answer.

[0010] Optionally, the sparse inverted index and the dense vector index are called to acquire high-confidence evidence of the sub-question , including: Based on the sparse inverted index, a first candidate set is generated, based on the dense vector index, a second candidate set is generated, the first candidate set and the second candidate set are merged and deduplicated to obtain a mixed set, and an inverted ranking fusion algorithm is used to recalculate the fusion score of each text block, which is specifically realized by the following formula: ; Wherein, represents the fusion score of the text block d , k is a smoothing constant. represents the ranking position of the text block d in the mixed set; Sort all fusion scores from high to low to obtain the top L text blocks to form a reordering candidate set, concatenate each text block in the reordering candidate set with the sub-problem to obtain L input pairs, input each input pair into the reordering model to obtain a relevance Logits score, and sort the L relevance Logits scores from high to low to obtain the top M text blocks to form a high-confidence evidence .

[0011] Optionally, based on the sparse inverted index, a first candidate set is generated, including: Input the sub-problem into the match query interface of Elasticsearch, segment the sub-problem, calculate the similarity score of the segmented sub-problem and each text block in the sparse inverted index based on the BM25 algorithm, sort all similarity scores from high to low, and obtain the top L text blocks to form the first candidate set.

[0012] Optionally, based on the dense vector index, a second candidate set is generated, including: Encode the sub-problem to obtain a dense vector , calculate the cosine similarity of each text block with the dense vector index, sort all cosine similarities from high to low, and obtain the top L text blocks to form the second candidate set.

[0013] Optionally, the high-confidence evidence is verified to obtain a target evidence set, including: Construct a verification prompt for the sub-problem and the high-confidence evidence , input the verification prompt into the large language model, and output a judgment result, when the judgment result is yes, the high-confidence evidence is taken as the target evidence set, and when the judgment result is no, the judgment result also contains a failure reason, and the failure reason is that the query cannot be found or the entity is ambiguous; When the failure reason is that the query cannot be found, one or more adjectives in the sub-problem are deleted to obtain a modified sub-problem; when the failure reason is entity ambiguity, the entity in the sub-problem is modified to obtain a modified sub-problem; based on the modified sub-problem, the sparse inverted index and the dense vector index are called to obtain the target evidence set of the sub-problem; When the number of sub-problem modifications exceeds the preset maximum threshold, the sub-problem is input into the large language model to obtain the target evidence set.

[0014] The beneficial effects produced by the above technical solutions are as follows: The present application decomposes complex problems into multiple sub-problems through iterative problems, combines sparse and dense vector hybrid retrieval to retrieve the answers to the sub-problems, reduces the reasoning complexity, improves the comprehensiveness of document recall, introduces a verification and reflection mechanism to build a robust reasoning chain, verifies the high-confidence evidence of the sub-problem retrieval, and triggers the reflection mechanism to modify the sub-problem in the case of verification failure, thereby significantly improving the accuracy and explainability of the multi-hop question answering in complex scenarios. BRIEF DESCRIPTION OF DRAWINGS

[0015] Figure 1 Figure 1 is a flowchart of a RAG multi-hop question answering method based on problem decomposition and hybrid retrieval according to an embodiment of the present application; Figure 2 Figure 2 is a flowchart of another RAG multi-hop question answering method based on problem decomposition and hybrid retrieval according to an embodiment of the present application; Figure 3 Figure 3 is a flowchart of a dynamic reasoning and error correction mechanism based on reflection verification according to an embodiment of the present application; Figure 4 Figure 4 is a processing flowchart of a bimodal hybrid retrieval and reordering according to an embodiment of the present application. DETAILED DESCRIPTION

[0016] The specific embodiments of the present application will be further described in detail below in conjunction with the drawings and examples. The following examples are used to illustrate the present application, but are not used to limit the scope of the present application.

[0017] To solve the problems in the prior art, the present application provides a RAG multi-hop question answering method based on problem decomposition and mixed retrieval, which aims to reduce the reasoning complexity through an iterative problem decomposition strategy, improve the comprehensiveness of document recall by combining mixed retrieval of sparse and dense vectors, and introduce a verification and reflection mechanism to build a robust reasoning chain, thereby significantly improving the accuracy and explainability of multi-hop question answering in complex scenarios. It includes the following processing methods: S1, multi-granularity mixed index knowledge base construction; S2, multi-hop problem iterative decomposition and subquery generation; S3, dual-mode mixed retrieval and adaptive fusion; S4, dynamic reflection verification and answer generation.

[0018] Specifically, in combination with Figure 1 and Figure 2 The RAG multi-hop question answering method based on problem decomposition and mixed retrieval provided by the present application can include the following steps: Step 1: Multi-granularity mixed index knowledge base construction, this step aims to construct an external knowledge base with high structure and comprehensive semantic coverage, solving the problem of knowledge fragmentation and context loss in traditional RAG systems. Specifically, obtain multi-source heterogeneous raw document data, generate multiple text blocks, and construct sparse inverted index and dense vector index of the text blocks; Step 1.1: Obtain multi-source heterogeneous raw document data, which covers multiple file formats and sources. Use document parsing technology to extract document content from the raw document data, and perform data cleaning and data conversion on the document content. Specifically, apply a pre-set cleaning rule to remove garbled characters, special symbols and irrelevant format noise, and uniformly convert unstructured data into standard format plain text data to obtain text data; In the specific implementation process, the present application downloads the latest version of Wikipedia XML Dump (such as enwiki-latest-pages-articles.xml.bz2) as the original input. Use parsing tools (such as wikiextractor or custom XML parsing scripts) to traverse the Dump file. Identify the <text>The content within the tag is treated as the entity document content.

[0019] Filter out non-entry pages, including but not limited to: Redirects, Disambiguation pages, user discussion pages, and metadata pages, only keep entries with actual knowledge content.

[0020] Step 1.2: According to the preset segmentation strategy, the text data is segmented to obtain a plurality of text blocks, the text blocks have context semantic association, and each text block is provided with an id; The segmentation strategy includes fixed character length based sliding window segmentation or semantic segmentation based on paragraphs and periods.

[0021] In the specific implementation process, the RecursiveCharacterTextSplitter recursive blocker in LangChain is used to first segment by paragraph line feed, then check the size of the blocks. If the size does not exceed a certain threshold, the block is retained. For blocks whose size exceeds the standard, single line feed is used for further segmentation. After multiple verifications, in the multi-hop question and answer scenario, the set block size is 300 words.

[0022] The segmented text blocks are serialized and stored, each unit containing: { "id": global unique ID, "text": fixed size text content, "source_id": source document ID}.

[0023] Step 1.3: For each text block, the Standard Analyzer (for English) built-in Elasticsearch is used to segment the text block and remove stop words (Stop Words), to obtain a plurality of terms, a mapping relationship from the term to the text block ID (Chunk ID) is established, the frequency of the term appearing in the text block is calculated, the term frequency is obtained, the frequency of the term appearing in all text blocks is calculated, the inverse document frequency statistics is obtained, according to the term frequency, the inverse document frequency statistics, the total number of text blocks and the average length of the text blocks, the BM25 score is calculated, as the keyword of the text block, based on the id and the keyword of the text block, a sparse inverted index is constructed; In this embodiment, the BM25 parameters are set as =1.2, =0.75.

[0024] The text block is input into the pre-trained embedding model to obtain a dense vector index of the text block. Wherein, the embedding model uses a contriever-msmarco model based on the BERT architecture, which is trained in a contrastive learning manner and uses the MS MARCO dataset to fine-tune the neural network model for the re-ranking task. Its loss function is: ; Wherein, is a text block; is a positive sample of text block matching; is other samples in Batch as negative samples. Sim() is a similarity function that calculates the cosine similarity of two vectors. is the temperature coefficient (Temperature), a hyperparameter that controls the sensitivity of the model to negative samples, and N represents the number of text blocks.

[0025] Store the embedding vector obtained by the text block through the embedding model into the Elasticsearch vector database. Use the dense_vector field type of Elasticsearch to store the 768-dimensional vector generated by the embedding model, and set the index parameter to true and the similarity parameter to cosine (cosine similarity). The underlying uses HNSW graph index to accelerate nearest neighbor search.

[0026] Multi-hop problem iteration decomposition and subquery generation; this step is the logical hub of the multi-hop question answering system. The system maintains a dynamic reasoning state machine, uses a large language model (LLM) as a "decomposer", and decomposes the original complex problem Q into T consecutive reasoning steps. Details are described in Step 2.

[0027] Step 2: Obtain the user's input of the original multi-hop question, and define the reasoning state as , represents the reasoning state of the tth iteration, represents the original multi-hop question, for example: "In the history of the Champions League final, which player scored the last goal in the largest reversal of the winning team?" ; represents multiple key-value pairs determined in the t-1th iteration, including sub-questions and sub-answers to sub-questions, in the format [(q1, a1), (q2, a2), …]. The initial state is empty; Step 3: Build a structured prompt template, and the structured prompt targets include role setting, constraint condition, few-shot enhancement, and context input; The role setting is used to prompt that the original multi-hop problem needs to be broken down step by step; the constraints include determining the next operation based on the reasoning state of the current input, and prompting that only one sub-question can be asked at a time to ensure the atomicity and accuracy of the retrieval; it also includes prompting that only the problem can be broken down and the final answer cannot be generated, and outputting the termination flag "That's enough" when the original multi-hop problem is broken down; Few-Shot Demonstrations include multiple pre-set standard decomposition examples, covering different types such as "multi-entity attribute queries," "comparison queries," and "logic reasoning queries." For example, an example input might be: "What awards did the director of the movie *Wearing Velvet Slippers Under a Golden Umbrella* receive?" The example output process might be: first, ask "Who is the director?", obtain the answer "Wunna," then ask "What awards has Wunna received?", and output "That's enough." These examples allow the model to learn how to resolve entity references and perform multi-round logical progression.

[0028] The context input is the reasoning state; Step 4: Set the initial iteration count t=1 and initialize. If empty, the initial iteration count will be used as the current iteration count; Step 5: Combining Figure 3 The reasoning state of the current iteration number t Fill in the context input of the structured prompt template to obtain the assembled structured prompt. Input the assembled structured prompt into the large language model and output the sub-problem or termination flag. In this example, the large language model used is GPT-4o.

[0029] When the output of the large language model is a sub-question, such as "Which team won the 2005 UEFA Champions League final?", then sub-answers to the sub-question are generated, and bimodal hybrid retrieval and adaptive fusion are performed. Specifically, sparse inverted indexes and dense vector indexes are invoked to obtain high-confidence evidence for the sub-question. For high-confidence evidence Verification is performed to obtain the target evidence set. This target evidence set is then concatenated with the sub-questions to obtain a concatenated vector. This vector is then input into the large language model to obtain the sub-answers. Finally, the sub-questions and sub-answers are added to... Let t+1, then return to execute: change the inference state of the current iteration number t. Enter the context input for the structured prompt template; Specifically, sparse inverted indexes and dense vector indexes are used to obtain high-confidence evidence for subproblems. , combined Figure 4 ,include: Step A1: Generate the first candidate set based on the sparse inverted index; Specifically, the sub-problem is input into the Elasticsearch match query interface, and the sub-problem is segmented and stop words are removed. Based on the BM25 algorithm, the similarity score between the segmented sub-problem and each text block in the sparse inverted index is calculated. The BM25 algorithm comprehensively considers term frequency (TF), inverse document frequency (IDF), and text length normalization factor. All similarity scores are sorted from high to low, and the text blocks with the top L scores are selected to form the first candidate set. In this invention, L=20. This path is designed to ensure that documents containing specific names of people, places, or proper nouns are accurately retrieved.

[0030] Step A2: Generate a second candidate set based on dense vector indices; The subproblems are encoded using the Contriever-MSMARCO embedding model, which is of the same origin as that used during index construction, resulting in a 768-dimensional dense vector. ,calculate The cosine similarity with the dense vector index of each text block is used to accelerate the search process. All cosine similarities are sorted from high to low, and the text blocks with the top L cosine similarities are selected to form the second candidate set. This approach aims to recall generalization evidence that is semantically relevant but uses inconsistent terminology.

[0031] Step A3: Merge the first candidate set and the second candidate set to remove duplicates. Since the same text block may appear in both sets, the system removes duplicates based on the text block ID, forming a mixed set. The inverted sorting fusion algorithm is then used to recalculate the fusion score of each text block, specifically through the following formula: ; in, Represents a text block d The fusion score, Represents a text block d In the ranking position of the mixed set, k is a smoothing constant. In this embodiment, k=60.

[0032] Sort all fusion scores from highest to lowest, and select the top L text blocks to form a reordering candidate set. Concatenate each text block in the reordering candidate set with the sub-problem to obtain L input pairs. Input each input pair into the reordering model to obtain the relevance Logits score. Sort the L relevance Logits scores from highest to lowest, and select the top M text blocks to form high-confidence evidence. In the present application, M = 5; The present application selects BAAI / bge-reranker-large as the reordering model. Unlike the double tower model (Bi-Encoder), the cross-encoding model can perform deep interaction attention calculation on the "query-document" pair, capturing subtle semantic matching features.

[0033] Among them, the high-confidence evidence is verified to obtain the target evidence set, aiming to establish an adaptive verification closed loop of the retrieval result, ensure the reliability of the evidence in the reasoning chain through the model self-reflection mechanism, and generate the final answer based on the accumulated effective information. Specifically, it includes: This sub-step introduces a "validator" based on a large language model to evaluate the effectiveness of the high-confidence evidence set (namely, the top-5 text blocks after reordering).

[0034] Construct a verification prompt for the sub-problem and the high-confidence evidence , input the verification prompt into the large language model, and output the judgment result. When the judgment result is yes, it is determined that the current retrieval is successful, and the high-confidence evidence is taken as the target evidence set. When the judgment result is no, it is determined that the information retrieved is insufficient to support the reasoning, triggering the reflection mechanism (Rethink), and the judgment result also includes the failure reason. The failure reason is that the query cannot be found or the entity is ambiguous; When the failure reason is that the query cannot be found, one or more adjectives in the sub-problem are deleted to obtain a modified sub-problem. When the failure reason is entity ambiguity, the entity in the sub-problem is modified, for example, "Jordan" is modified to "Michael Jordan" or "Jordan country" to obtain a modified sub-problem. Based on the modified sub-problem, the sparse inverted index and the dense vector index are called to obtain the target evidence set of the sub-problem; When the number of sub-problem modifications exceeds the preset maximum threshold, mark the sub-query as "unable to answer". Then input the sub-problem into the large language model to obtain the target evidence set. The present application can also explicitly prompt the missing information in the final answer.

[0035] When the output of the large language model is the termination identifier "That's enough", it is determined that the information chain required by the original problem is complete, and the is input into the large language model to generate a complete answer to the original multi-hop question; In order to verify the effectiveness of the RAG multi-hop question answering method based on problem decomposition and mixed retrieval proposed in the present application, the present embodiment performs a comparative experiment on the authoritative data set HotpotQA in the multi-hop question answering field.

[0036] HotpotQA dataset is selected, which requires the model to find relevant evidence in a large number of irrelevant documents through multiple inferences and answer the question, which is very suitable for evaluating multi-hop inference ability. Exact match (EM) and F1 score are used as the main evaluation indicators. Among them, EM measures the proportion of predicted answers that are completely consistent with the standard answers, and F1 measures the degree of literal overlap between predicted answers and standard answers. Compared with four kinds of baseline methods, Direct: directly input the question into the large model to answer; ReAct: a question and answer method based on "reasoning + action" chain thinking. MetaRAG: a retrieval augmented generation method combined with meta-cognition. HiRAG (online): an advanced RAG method based on hierarchical retrieval.

[0037] Table 1 Experimental results

[0038] From the experimental results, compared with the existing advanced models (such as HiRAG and MetaRAG), the present application has achieved the best results in the comprehensive evaluation indicators F1 score and exact match rate EM. This shows that the multi-hop question and answer answers generated by the present application not only match the standard answers in terms of literal matching, but also achieve a higher level in terms of logical integrity and factual accuracy. Compared with Direct (direct answer) and ReAct methods, the performance of the present application has been significantly improved. This proves that when dealing with complex multi-hop problems, simply relying on internal model knowledge or simple chain reasoning is not enough, and external knowledge retrieval must be introduced.

[0039] The above description is only the preferred embodiments of the present disclosure and the explanation of the applied technical principles. Those skilled in the art should understand that the scope of the application involved in the embodiments of the present disclosure is not limited to the technical solutions formed by the specific combinations of the above technical features, and should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above inventive concept. For example, the above features are replaced with the technical features disclosed in the embodiments of the present disclosure (but not limited to) having similar functions to form technical solutions.< / text>

Claims

1. A RAG multi-hop question answering method based on question decomposition and hybrid retrieval, characterized in that, include: Obtain multi-source heterogeneous raw document data, generate multiple text blocks, and construct a sparse inverted index and a dense vector index for the text blocks; The original multi-hop problem of obtaining user input is defined as follows: ; in, This represents the reasoning state in the t-th iteration. This represents the original multi-hop problem. This represents multiple key-value pairs that have been determined at the (t-1)th iteration, where each key-value pair includes a subproblem and a sub-answer to the subproblem; Construct a structured prompt template, which includes role settings, constraints, few-shot augmentation, and contextual input; Set the initial iteration count t=1, and initialize... If empty, the initial iteration count will be used as the current iteration count; The reasoning state at the current iteration number t Fill in the context input of the structured prompt template to get the assembled structured prompt. Input the assembled structured prompt into the large language model and output sub-problems or termination indicators. When the output of the large language model is a subquestion, generate sub-answers for the subquestions and add the subquestions and sub-answers to the model. Let t+1, then return to execute: change the inference state of the current iteration number t. Enter the context input for the structured prompt template; When the output of the large language model is a termination marker, Input a large language model and generate a complete answer to the original multi-hop problem.

2. The RAG multi-hop question answering method based on question decomposition and hybrid retrieval according to claim 1, characterized in that, Obtain heterogeneous raw document data from multiple sources, generate multiple text blocks, and construct sparse inverted indexes and dense vector indexes for the text blocks, including: Obtain multi-source heterogeneous raw document data, extract document content from the raw document data using document parsing technology, perform data cleaning and data transformation on the document content, and obtain text data; According to the preset segmentation strategy, the text data is segmented to obtain multiple text blocks. The text blocks have contextual semantic relationships, and each text block is assigned an ID. The segmentation strategies include sliding window segmentation based on fixed character length, or semantic segmentation based on paragraphs and periods; For each text block, the text block is segmented into multiple terms. The frequency of each term in its text block is calculated to obtain the term frequency. The frequency of each term in all text blocks is calculated to obtain the inverse document frequency statistic. Based on the term frequency, inverse document frequency statistic, total number of text blocks, and average length of text blocks, the BM25 score is calculated and used as the keyword of the text block. A sparse inverted index is constructed based on the text block ID and the keyword. Input the text block into the pre-trained embedding model to obtain the dense vector index of the text block.

3. The RAG multi-hop question answering method based on question decomposition and hybrid retrieval according to claim 1, characterized in that, The role setting is used to prompt that the original multi-hop problem needs to be broken down step by step; the constraints include determining the next operation based on the reasoning state of the current input, prompting that only one sub-question can be asked at a time, prompting that only the problem can be broken down and the final answer cannot be generated, and outputting a termination flag when the original multi-hop problem is broken down. Few-shot augmentation includes multiple pre-defined standard decomposition examples; the context input is the inference state.

4. The RAG multi-hop question answering method based on question decomposition and hybrid retrieval according to claim 1, characterized in that, Generate sub-answers to subproblems, including: By utilizing sparse inverted indexes and dense vector indexes, high-confidence evidence for subproblems can be obtained. For high-confidence evidence The verification process yields the target evidence set. This target evidence set is then concatenated with the sub-question to obtain a concatenated vector. This concatenated vector is then input into the large language model to obtain the sub-answer.

5. The RAG multi-hop question answering method based on question decomposition and hybrid retrieval according to claim 1, characterized in that, By utilizing sparse inverted indexes and dense vector indexes, high-confidence evidence for subproblems can be obtained. ,include: Based on a sparse inverted index, a first candidate set is generated. Based on a dense vector index, a second candidate set is generated. The first and second candidate sets are merged and deduplicated to obtain a mixed set. The inverted index fusion algorithm is then used to recalculate the fusion score of each text block, specifically through the following formula: ; in, Represents a text block d The fusion score, Represents a text block d In the ranking position of the mixed set, k is a smoothing constant; Sort all fusion scores from highest to lowest, and select the top L text blocks to form a reordering candidate set. Concatenate each text block in the reordering candidate set with the sub-problem to obtain L input pairs. Input each input pair into the reordering model to obtain the relevance Logits score. Sort the L relevance Logits scores from highest to lowest, and select the top M text blocks to form high-confidence evidence. .

6. The RAG multi-hop question answering method based on question decomposition and hybrid retrieval according to claim 5, characterized in that, Based on the sparse inverted index, a first candidate set is generated, including: The sub-problem is input into the Elasticsearch match query interface, which performs word segmentation on the sub-problem. Based on the BM25 algorithm, the similarity score between the segmented sub-problem and each text block in the sparse inverted index is calculated. All similarity scores are sorted from high to low, and the text blocks with the top L scores are used to form the first candidate set.

7. The RAG multi-hop question answering method based on question decomposition and hybrid retrieval according to claim 5, characterized in that, Based on dense vector indices, a second candidate set is generated, including: Encode the subproblems to obtain dense vectors ,calculate The cosine similarity with the dense vector index of each text block is used to sort all the cosine similarities from high to low, and the text blocks with the top L cosine similarities are selected to form the second candidate set.

8. The RAG multi-hop question answering method based on question decomposition and hybrid retrieval according to claim 4, characterized in that, High confidence evidence The verification process yields the target evidence set, which includes: Constructing sub-problems and high-confidence evidence The verification prompt is input into the large language model, and the output is the judgment result. When the judgment result is yes, high-confidence evidence is added. As a set of target evidence, when the judgment result is negative, the judgment result also includes the reason for failure, which is that the item cannot be found or the entity is ambiguous. When the failure reason is "cannot be found", one or more adjectives in the subproblem are deleted to obtain the corrected subproblem. When the failure reason is "entity ambiguity", the entities in the subproblem are corrected to obtain the corrected subproblem. Based on the corrected subproblem, the sparse inverted index and dense vector index are called to obtain the target evidence set of the subproblem. When the number of sub-problem corrections exceeds the preset maximum threshold, the sub-problem is input into the large language model to obtain the target evidence set.