Method and apparatus for retrieving augmented generation, electronic device, storage medium
By conducting parallel searches in the content knowledge base and the question knowledge base, the search scores of knowledge blocks are obtained and aggregated to generate enhanced context, thus solving the problems of information redundancy and fragmentation caused by searching a single knowledge base and achieving more accurate and complete knowledge queries.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHENGDU PLANING & DESIGNING INST
- Filing Date
- 2026-01-12
- Publication Date
- 2026-04-17
AI Technical Summary
Existing retrieval enhancement generation methods, which only retrieve from a single content knowledge base, result in information redundancy or fragmentation in the returned knowledge blocks, leading to incomplete and low-accuracy answers output by LLM.
By retrieving in parallel from the content knowledge base and the question knowledge base, the first and second knowledge blocks corresponding to the question to be queried and their retrieval scores are obtained, and the two are aggregated to generate an enhanced context. The potential query question is generated using a large language model, thus achieving multi-evidence fusion.
It improves the accuracy and completeness of knowledge retrieval, and the enhanced context coverage generated by multi-perspective evidence fusion is more comprehensive, with high evidence strength and significantly improved information density.
Smart Images

Figure CN121479030B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of knowledge retrieval, and more specifically to a method and apparatus, electronic device, and storage medium for enhanced retrieval generation. Background Technology
[0002] With the development of large language models (LLMs), more and more people need to use them for knowledge retrieval in their lives and work. However, due to the limitations of the knowledge within large language models, they are prone to problems such as knowledge lag and "illusions." To reduce these problems, Retrieval-Augmented Generation (RAG) has gradually emerged. The core idea of RAG is to enhance its answering ability by introducing external, real-time, domain-specific information sources. Specifically, before the LLM generates an answer, it first uses the user's question to retrieve information from a pre-built external knowledge base. This knowledge base is usually a massive collection of unstructured or semi-structured documents. The retrieval process aims to find several text fragments or "knowledge blocks" most relevant to the user's question. Subsequently, this retrieved contextual information is concatenated with the original user question to form a richer hint, which is then input into the LLM. In this way, the LLM is guided or "anchored" to reason and generate based on the specific facts provided, thereby producing a more accurate, factually grounded answer that reflects the latest information.
[0003] However, traditional retrieval-enhanced generation methods only retrieve from a single content knowledge base, and the returned knowledge blocks may have serious information redundancy or fragmentation, resulting in incomplete answers and low accuracy in the LLM output.
[0004] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this application, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0005] The technical problem to be solved by the present invention is how to improve the accuracy of knowledge retrieval. The purpose is to provide a method and apparatus, electronic device and storage medium for enhanced retrieval generation to improve the accuracy of knowledge retrieval.
[0006] This invention is achieved through the following technical solution:
[0007] In a first aspect, a method for retrieval enhancement generation includes: obtaining a query question; obtaining a first knowledge block corresponding to the query question and a first retrieval score corresponding to the first knowledge block according to a preset content knowledge base; obtaining a second knowledge block corresponding to the query question and a second retrieval score corresponding to the second knowledge block according to a preset question knowledge base; the content knowledge base stores the first knowledge block; the question knowledge base stores a target question knowledge matching pair corresponding to the query question; the target question knowledge matching pair includes a reference question corresponding to the query question and a second knowledge block corresponding to the reference question; aggregating the first knowledge block and the second knowledge block according to the first retrieval score and the second retrieval score to obtain an enhancement context corresponding to the query question.
[0008] In some embodiments, the content knowledge base is obtained by: obtaining an original knowledge document; dividing the original knowledge document into blocks to obtain several original knowledge blocks; and combining the original knowledge blocks to obtain the content knowledge base.
[0009] In some embodiments, the question knowledge base is obtained by: acquiring an original knowledge document; dividing the original knowledge document into blocks to obtain several original knowledge blocks; inputting the original knowledge blocks into a preset large language model to generate potential query questions corresponding to the original knowledge blocks based on a preset semantic perspective using the large language model; pairing the original knowledge blocks with the potential query questions corresponding to the original knowledge blocks to obtain multiple initial question knowledge matching pairs; and combining the initial question knowledge matching pairs to obtain the question knowledge base.
[0010] In some embodiments, obtaining the first knowledge block corresponding to the query question and the first retrieval score corresponding to the first knowledge block according to a preset content knowledge base includes: obtaining a first relevance score between each original knowledge block in the content knowledge base and the query question; and obtaining the most relevant knowledge block to the query question in the content knowledge base according to the first relevance score. A set of original knowledge blocks; the most relevant to the query question. The first knowledge block is determined from the original knowledge blocks; the one most relevant to the query question is selected. The first relevance score between each original knowledge block and the query question is determined as the first retrieval score corresponding to the first knowledge block.
[0011] In some embodiments, obtaining the second knowledge block corresponding to the query question and the second retrieval score corresponding to the second knowledge block according to a preset question knowledge base includes: obtaining a second relevance score between each initial question knowledge matching pair in the question knowledge base and the query question; and obtaining the most relevant query question in the question knowledge base according to the second relevance score. Initial question knowledge matching pairs; then select the most relevant ones to the question to be queried. An initial question knowledge matching pair is determined as the target question knowledge matching pair; the original knowledge block in the target question knowledge matching pair is determined as the second knowledge block; the second relevance score between the target question knowledge matching pair and the question to be queried is determined as the second retrieval score corresponding to the second knowledge block.
[0012] In some embodiments, the step of aggregating the first knowledge block and the second knowledge block based on the first retrieval score and the second retrieval score to obtain the enhanced context corresponding to the query question includes: obtaining a first ranking corresponding to the first knowledge block based on the first retrieval score; obtaining a second ranking corresponding to the second knowledge block based on the second retrieval score; obtaining a first normalized score corresponding to each of the first knowledge blocks based on the first ranking; obtaining a second normalized score corresponding to each of the second knowledge blocks based on the second ranking; determining a third knowledge block that is doubly hit by the content knowledge base and the question knowledge base, a fourth knowledge block that is only hit by the content knowledge base, and a fifth knowledge block that is only hit by the question knowledge base among the first knowledge block and the second knowledge block; and obtaining the enhanced context corresponding to the query question based on the first normalized score, the second normalized score, the third knowledge block, the fourth knowledge block, and the fifth knowledge block.
[0013] In some embodiments, obtaining the enhanced context corresponding to the query question based on the first normalized score, the second normalized score, the third knowledge block, the fourth knowledge block, and the fifth knowledge block includes: obtaining the enhanced score of each third knowledge block and the supplementary value score of each fifth knowledge block based on the first normalized score and the second normalized score; determining a sixth knowledge block from each fifth knowledge block based on the supplementary value score of each fifth knowledge block; sorting the third knowledge block, the fourth knowledge block, and the sixth knowledge block based on the enhanced score, the first normalized score of the fourth knowledge block, and the supplementary value score; obtaining M knowledge blocks from the sorted knowledge blocks to obtain candidate knowledge blocks; inputting the candidate knowledge blocks into a preset re-sorting model for re-sorting; and combining the top P re-sorted candidate knowledge blocks with the query question to obtain the enhanced context.
[0014] Secondly, an apparatus for retrieval enhancement generation includes: a question acquisition module configured to acquire a question to be queried; a knowledge acquisition module configured to acquire a first knowledge block corresponding to the question to be queried and a first retrieval score corresponding to the first knowledge block according to a preset content knowledge base; acquire a second knowledge block corresponding to the question to be queried and a second retrieval score corresponding to the second knowledge block according to a preset question knowledge base; the content knowledge base stores the first knowledge block; the question knowledge base stores a target question knowledge matching pair corresponding to the question to be queried; the target question knowledge matching pair includes a reference question corresponding to the question to be queried and a second knowledge block corresponding to the reference question; the second retrieval score is acquired through the reference question and the question to be queried; and an aggregation module configured to aggregate the first knowledge block and the second knowledge block according to the first retrieval score and the second retrieval score to acquire an enhancement context corresponding to the question to be queried.
[0015] Thirdly, an electronic device includes a processor and a memory storing program instructions, the processor being configured to execute the above-described method for retrieving enhanced generation when the program instructions are executed.
[0016] Fourthly, a storage medium storing program instructions, characterized in that, when the program instructions are executed, they perform the aforementioned method for retrieval enhancement generation.
[0017] Compared with existing technologies, this invention obtains the query question, then retrieves the first knowledge block and its corresponding first search score based on a preset content knowledge base, and obtains the target question knowledge matching pair based on a preset question knowledge base. This leads to the acquisition of a second knowledge block and its corresponding second search score. Finally, the first and second knowledge blocks are aggregated based on the first and second search scores to obtain the enhanced context corresponding to the query question. This approach, compared to existing technologies that only retrieve from a single content knowledge base, potentially resulting in redundant or fragmented knowledge blocks, integrates data blocks from different databases through parallel retrieval of both content and question knowledge bases. This achieves multi-evidence fusion for enhanced retrieval, retrieving evidence from both the answer itself and various potential question formats. This results in a more comprehensive, stronger, and more information-dense enhanced context, leading to more accurate and complete query results. Attached Figure Description
[0018] To more clearly illustrate the technical solutions of the exemplary embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly described below. It should be understood that the following drawings only show some embodiments of the present invention and should not be considered as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort. In the drawings:
[0019] Figure 1 This is a flowchart of a method for retrieval enhancement generation provided in an embodiment of this disclosure;
[0020] Figure 2 This is a flowchart of a method for obtaining a content knowledge base provided in an embodiment of this disclosure;
[0021] Figure 3 This is a flowchart of a method for obtaining a problem knowledge base provided in an embodiment of this disclosure;
[0022] Figure 4 This is a schematic diagram of an apparatus for retrieval enhancement generation provided in an embodiment of this disclosure;
[0023] Figure 5 This is a schematic diagram of an electronic device provided in an embodiment of this disclosure. Detailed Implementation
[0024] 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 embodiments and accompanying drawings. The illustrative embodiments and descriptions of the present invention are only used to explain the present invention and are not intended to limit the present invention.
[0025] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0026] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.
[0027] The flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily have to be performed in the described order. For example, some operations / steps can be broken down, while others can be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.
[0028] In this application, "multiple" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.
[0029] Please see Figure 1 , Figure 1 This is a flowchart illustrating a method for retrieving enhanced generation, as shown in an exemplary embodiment of this application.
[0030] Combination Figure 1 As shown, this disclosure provides a method for retrieving enhanced generation, the method comprising:
[0031] Step S101: Obtain the question to be queried.
[0032] Step S102: Obtain the first knowledge block and the first retrieval score corresponding to the query question according to the preset content knowledge base; obtain the second knowledge block and the second retrieval score corresponding to the query question according to the preset question knowledge base; the content knowledge base stores the first knowledge block; the question knowledge base stores the target question knowledge matching pair corresponding to the query question; the target question knowledge matching pair includes the reference question corresponding to the query question and the second knowledge block corresponding to the reference question.
[0033] Step S103: Aggregate the first knowledge block and the second knowledge block based on the first search score and the second search score to obtain the enhanced context corresponding to the query question.
[0034] The method for enhanced retrieval generation provided in this disclosure involves obtaining a query question, then acquiring a first knowledge block and a first retrieval score corresponding to the query question based on a preset content knowledge base, and then acquiring a target question knowledge matching pair corresponding to the query question based on a preset question knowledge base. This leads to the acquisition of a second knowledge block and a second retrieval score, and finally, the aggregation of the first and second knowledge blocks based on the first and second retrieval scores to obtain the enhanced context corresponding to the query question. Compared to existing technologies that rely solely on a single content knowledge base, resulting in potentially redundant or fragmented knowledge blocks, this application integrates data blocks from different databases through parallel retrieval of both the content and question knowledge bases, achieving multi-evidence fusion for enhanced retrieval generation. Evidence is retrieved from both the answer itself and various potential question formats, resulting in a more comprehensive, stronger, and more information-dense enhanced context. This leads to more accurate and complete query results when using this enhanced context.
[0035] Please see Figure 2 , Figure 2 This is a flowchart illustrating a method for obtaining a content knowledge base, as shown in an exemplary embodiment of this application.
[0036] Combination Figure 2 As shown in the embodiments of this disclosure, a method for obtaining a content knowledge base is provided, the method comprising:
[0037] Step S201: Obtain the original knowledge document.
[0038] Step S202: Divide the original knowledge document into blocks to obtain several original knowledge blocks.
[0039] Step S203: Assemble the original knowledge blocks to obtain the content knowledge base.
[0040] The method for enhanced retrieval provided in this embodiment of the present disclosure obtains the original knowledge document, divides the original knowledge document into blocks to obtain several original knowledge blocks, and then combines the original knowledge blocks to obtain a content knowledge base, thereby realizing the storage of the original knowledge blocks.
[0041] It should be noted that segmenting the original knowledge document into blocks can be achieved using large language models or natural language processing. This allows each segmented block of the original knowledge document to represent a single piece of knowledge.
[0042] However, simply dividing the original document into blocks results in the knowledge blocks containing answers but lacking a clear query intent, leading to high retrieval difficulty and low query hit rate. To solve this problem, this solution introduces a question knowledge base.
[0043] For details, please refer to Figure 3 , Figure 3 This is a flowchart illustrating a method for obtaining a problem knowledge base, as shown in an exemplary embodiment of this application.
[0044] Combination Figure 3 As shown in the embodiments of this disclosure, a method for obtaining a problem knowledge base is provided, the method comprising:
[0045] Step S301: Obtain the original knowledge document.
[0046] Step S302: Divide the original knowledge document into blocks to obtain several original knowledge blocks.
[0047] Step S303: Input the original knowledge block into the preset large language model, so as to use the large language model to generate the potential query question corresponding to the original knowledge block based on the preset semantic perspective.
[0048] Step S304: Pair the original knowledge block with the potential query question corresponding to the original knowledge block to obtain multiple initial question knowledge matching pairs.
[0049] Step S305: Collect initial problem knowledge matching pairs to obtain a problem knowledge base.
[0050] The method for enhanced retrieval generation provided in this disclosure involves acquiring an original knowledge document, dividing it into blocks to obtain several original knowledge blocks, and inputting these blocks into a preset large language model. The large language model then generates potential query questions corresponding to the original knowledge blocks based on a preset semantic perspective. Next, the original knowledge blocks are paired with their corresponding potential query questions to obtain multiple initial question-knowledge matching pairs. These initial question-knowledge matching pairs are then combined to obtain a question knowledge base. This ensures that each knowledge block in the question knowledge base corresponds to one or more potential query questions, achieving a direct mapping from question to answer, thereby significantly improving retrieval accuracy.
[0051] Meanwhile, by introducing a preset semantic perspective to generate potential query questions corresponding to the original knowledge block, a series of high-quality and diverse exploratory questions can be generated, thereby simulating the questioning methods that real users might raise related to the content of the knowledge block. This achieves a data augmentation strategy for multi-perspective question generation to help semantic alignment.
[0052] It should be noted that the preset semantic perspectives include: exploring causes and motivations, analyzing effects and results, defining core concepts, describing processes and steps, and comparisons and contrasts, which are perspectives used to describe the semantics of knowledge blocks.
[0053] The perspective of each original knowledge block can be determined by the large language model, and then the potential query question corresponding to the original knowledge block can be generated according to the preset question format.
[0054] In some embodiments, for exploring causes and motivations from a semantic perspective, the preset question format is "What are the causes and motivations of the object?". For analyzing effects and results from a semantic perspective, the preset question format is "What are the analysis effects and results of the object?". For defining core concepts from a semantic perspective, the preset question format is "What are the core concepts of the object?". For describing processes and steps from a semantic perspective, the preset question format is "What are the processes and steps of the object?". For comparison and contrast from a semantic perspective, the preset question format is "How do object A compare and contrast with object B?". Specifically, for an original knowledge block that describes the causes and effects of phenomenon A, inputting this original knowledge block into a large language model allows the large language model to confirm that the semantic perspective of this original knowledge block is: exploring causes and motivations, and analyzing effects and results. Then, the potential query questions corresponding to this original knowledge block can be generated as follows:
[0055] 1. What are the reasons and motivations for the occurrence of phenomenon A?
[0056] 2. What are the effects and results of phenomenon A?
[0057] It should be noted that the content knowledge blocks and the question knowledge base are parallel and interconnected.
[0058] When searching in the question knowledge base, the target is no longer to directly match knowledge blocks with vague content. Instead, the question knowledge base is first matched with questions with clear intent, and then the corresponding precise answer, i.e. knowledge block, is located. This greatly improves the accuracy and generalization ability of the search, thereby significantly reducing the difficulty of the search and improving the accuracy.
[0059] Furthermore, based on a pre-defined content knowledge base, the first knowledge block corresponding to the query question and the first retrieval score corresponding to the first knowledge block are obtained, including: obtaining the first relevance score between each original knowledge block in the content knowledge base and the query question; and obtaining the most relevant knowledge block to the query question from the content knowledge base based on the first relevance score. A set of original knowledge blocks; those most relevant to the query question. The first knowledge block is determined from the original knowledge blocks; the knowledge blocks most relevant to the query question are selected. The first relevance score between each original knowledge block and the query question is determined as the first retrieval score corresponding to the first knowledge block. Thus, by obtaining the first relevance score between each original knowledge block in the content knowledge base and the query question, and based on this first relevance score, the most relevant knowledge block to the query question is retrieved from the content knowledge base. Given a set of original knowledge blocks, the system retrieves the first knowledge block and its first search score. This enables the retrieval of answers to queries from a content knowledge base.
[0060] It should be noted that, It is a positive integer greater than 0.
[0061] Furthermore, the first relevance score between each original knowledge block in the content knowledge base and the query question is obtained, including: using a preset vector retrieval algorithm, a preset BM25 (Best Match 25) algorithm, or a preset hybrid retrieval algorithm to obtain the first relevance score between each original knowledge block in the content knowledge base and the query question. The preset hybrid retrieval algorithm is an algorithm that integrates the scores from the vector retrieval algorithm and the BM25 algorithm using a Reciprocal Rank Fusion (RRF) mechanism.
[0062] Optionally, a preset vector retrieval algorithm is used to obtain the first relevance score between each original knowledge block in the content knowledge base and the query question, including: inputting each original knowledge block in the content knowledge base and the query question into a preset vector retrieval model to obtain the vector similarity between each original knowledge block and the query question; and determining the vector similarity between each original knowledge block and the query question as the first relevance score between each original knowledge block and the query question.
[0063] Optionally, the first relevance score between each original knowledge block in the content knowledge base and the query question is obtained using a preset BM25 algorithm, including: obtaining the probability relevance score between each original knowledge block in the content knowledge base and the query question using the preset BM25 algorithm; and determining the probability relevance score between each original knowledge block and the query question as the first relevance score between each original knowledge block and the query question.
[0064] Optionally, a preset hybrid retrieval algorithm is used to obtain the first relevance score between each original knowledge block in the content knowledge base and the query question, including: obtaining the vector similarity between each original knowledge block and the query question; sorting each original knowledge block according to the vector similarity from largest to smallest to obtain the third ranking corresponding to each original knowledge block; obtaining the probability relevance score between each original knowledge block in the content knowledge base and the query question; sorting each original knowledge block according to the probability relevance score from largest to smallest to obtain the fourth ranking corresponding to each original knowledge block; using a preset reciprocal rank fusion (RRF) mechanism, obtaining the RRF score corresponding to each original knowledge block based on the third ranking and the fourth ranking corresponding to each original knowledge block; and determining the RRF score corresponding to each original knowledge block as the first relevance score between each original knowledge block and the query question.
[0065] Furthermore, using a pre-defined inverse sorting fusion mechanism, the RRF score corresponding to each original knowledge block is obtained based on the third sorting and the fourth sorting corresponding to each original knowledge block, including: calculating... , obtained the The RRF scores corresponding to each original knowledge block. For the first RRF scores corresponding to each original knowledge block; This is a preset adjustment constant used to adjust the weight of higher rankings; For the first The third sorting corresponding to each original knowledge block; For the first The fourth sorting corresponds to each original knowledge block.
[0066] Furthermore, based on the first relevance score, the N original knowledge blocks most relevant to the query question are obtained from the content knowledge base, including: sorting each original knowledge block in the content knowledge base in descending order according to the first relevance score; and determining the top N original knowledge blocks as the N original knowledge blocks most relevant to the query question.
[0067] Furthermore, based on a pre-defined question knowledge base, the second knowledge block corresponding to the query question and the second retrieval score corresponding to the second knowledge block are obtained, including: obtaining the second relevance score between each initial question knowledge matching pair in the question knowledge base and the query question; and obtaining the most relevant information to the query question from the question knowledge base based on the second relevance score. Initial question knowledge matching pairs; those most relevant to the question to be queried. The initial question knowledge matching pair is determined as the target question knowledge matching pair; the original knowledge block in the target question knowledge matching pair is determined as the second knowledge block; the potential query question in the target question knowledge matching pair is the reference question; the second relevance score between the target question knowledge matching pair and the query question is determined as the second retrieval score corresponding to the second knowledge block.
[0068] In this way, by obtaining the second relevance score between each initial question knowledge matching pair in the question knowledge base and the question to be queried, and then based on the second relevance score, the most relevant pair to the question to be queried is obtained from the question knowledge base. The system generates an initial question knowledge matching pair, obtains a target question knowledge matching pair, and then obtains a second knowledge block and its corresponding second retrieval score. This achieves query retrieval of the target question by matching the initial question knowledge matching pair within the question knowledge base with the target question, ensuring that the retrieved potential query questions match the target question, and that the corresponding second knowledge block is also more closely matched to the answer to the target question.
[0069] It should be noted that, It is a positive integer greater than 0.
[0070] Optionally, a second relevance score can be obtained between each initial question knowledge matching pair in the question knowledge base and the query question. This includes obtaining the second relevance score using a preset vector retrieval algorithm, a preset BM25 (Best Match 25) algorithm, or a preset hybrid retrieval algorithm. The preset hybrid retrieval algorithm integrates the scores from the vector retrieval algorithm and the BM25 algorithm using a Reciprocal Rank Fusion (RRF) mechanism. The specific method for obtaining the second relevance score can refer to the method for obtaining the first relevance score, and will not be elaborated here.
[0071] Optionally, a second relevance score is obtained between each initial question knowledge matching pair in the question knowledge base and the query question. This includes: using a preset vector retrieval algorithm, a preset BM25 (Best Match 25) algorithm, or a preset hybrid retrieval algorithm to obtain the relevance between the potential query question and the query question for each initial question knowledge matching pair in the question knowledge base. The relevance between each potential query question and the query question is then determined as the second relevance score between each initial question knowledge matching pair and the query question.
[0072] Furthermore, based on the second relevance score, the N initial question knowledge matching pairs most relevant to the query question are obtained from the question knowledge base, including: sorting each initial question knowledge matching pair in the question knowledge base in descending order according to the second relevance score; and determining the top N initial question knowledge matching pairs as the N initial question knowledge matching pairs most relevant to the query question.
[0073] Furthermore, the first and second knowledge blocks are aggregated based on the first and second search scores to obtain the enhanced context corresponding to the query question. This includes: obtaining a first ranking corresponding to the first knowledge block based on the first search score; obtaining a second ranking corresponding to the second knowledge block based on the second search score; obtaining a first normalized score corresponding to each first knowledge block based on the first ranking; obtaining a second normalized score corresponding to each second knowledge block based on the second ranking; identifying a third knowledge block that is hit by both the content knowledge base and the question knowledge base, a fourth knowledge block that is hit only by the content knowledge base, and a fifth knowledge block that is hit only by the question knowledge base from the first and second knowledge blocks; and obtaining the enhanced context corresponding to the query question based on the first, second, and third knowledge blocks. Thus, by obtaining the first ranking corresponding to the first knowledge block based on the first search score, and obtaining the second ranking corresponding to the second knowledge block based on the second search score, then obtaining the first normalized score corresponding to each first knowledge block based on the first ranking, and obtaining the second normalized score corresponding to each second knowledge block based on the second ranking. Then, in the first and second knowledge blocks, the third knowledge block that is hit by both the content knowledge base and the question knowledge base, the fourth knowledge block that is hit by the content knowledge base alone, and the fifth knowledge block that is hit by the question knowledge base alone are determined. Then, based on the first normalized score, the second normalized score, the third knowledge block, the fourth knowledge block, and the fifth knowledge block, the enhanced context corresponding to the query question is obtained. This achieves efficient aggregation of retrieval results from the two heterogeneous information sources, the content knowledge base and the question knowledge base, and enhances the robustness of the finally obtained enhanced context.
[0074] It should be noted that due to inherent differences in scale and distribution between the retrieval scores of the content knowledge base and the question knowledge base, direct comparison or fusion may lead to bias. To reduce the bias caused by fusion, the first and second retrieval scores need to be converted into normalized scores based on their ranking information in their respective retrieval lists, so as to achieve comparability of cross-source scores.
[0075] Furthermore, based on the first ranking, the first normalized score corresponding to each first knowledge block is obtained, including: by calculating... , obtained the The first normalized score corresponding to the first knowledge block. Among them, For the first The first normalized score corresponding to the first knowledge block; For the first The first knowledge block is ranked first in the first knowledge set; This is a smoothing parameter. It should be noted that... It can be a preset value, such as 60.
[0076] Furthermore, the first knowledge set can be a set of first knowledge blocks sorted according to the first retrieval score. It can be sorted in descending order.
[0077] First Knowledge Collection .in, This represents the query question; The first set of knowledge obtained by retrieving the content knowledge base based on the query question; This represents the first knowledge block, that is, the first knowledge block ranked first. The first search score corresponding to the first knowledge block ranked first; This represents the second first knowledge block, that is, the first knowledge block ranked second. The first search score corresponding to the first knowledge block ranked second; Characterizing the first The first knowledge block, i.e., the sorting of the first knowledge block. The first knowledge block; For sorting number The first search score corresponding to the first knowledge block; Characterizing the first The first knowledge block, i.e., the sorting of the first knowledge block. The first knowledge block; For sorting number The first search score corresponding to the first knowledge block.
[0078] Furthermore, based on the second ranking, the second normalized score corresponding to each second knowledge block is obtained, including: by calculating... , obtained the The second normalized score corresponds to each second knowledge block. Among them, For the first The second normalized score corresponding to each second knowledge block; For the first The second knowledge block is ordered in the second knowledge set; For smoothing parameters.
[0079] Furthermore, the second knowledge set can be a collection of second knowledge blocks sorted according to the second retrieval score. It can be sorted in descending order.
[0080] Second Knowledge Set .in, This represents the query question; The representation is a second set of knowledge obtained by retrieving the question from the question knowledge base; This represents the first knowledge block, which is the first knowledge block in the order of priority. The second search score corresponding to the second knowledge block ranked first; This represents the second knowledge block, that is, the second knowledge block ranked second. The second retrieval score corresponds to the second knowledge block ranked second. Characterizing the first The second knowledge block, namely the sorting block. The second knowledge block; For sorting number The second retrieval score corresponding to the second knowledge block; Characterizing the first The second knowledge block, namely the sorting block. The second knowledge block; For sorting number The second knowledge block corresponds to the second search score.
[0081] It should be noted that in the step "determining the third knowledge block that is doubly hit by both the content knowledge base and the question knowledge base, the fourth knowledge block that is only hit by the content knowledge base, and the fifth knowledge block that is only hit by the question knowledge base in the first and second knowledge blocks," being doubly hit by both the content knowledge base and the question knowledge base indicates that the third knowledge block appears in both the first and second knowledge sets simultaneously; being only hit by the content knowledge base indicates that the fourth knowledge block appears only in the first knowledge set and not in the second knowledge set; and being only hit by the question knowledge base indicates that the fifth knowledge block appears only in the second knowledge set and not in the first knowledge set.
[0082] It should be noted that this solution retrieves information by recording it in both the content knowledge base and the question knowledge base in parallel, searching for evidence from two different perspectives: the answer itself and various potential question formats. This not only improves the retrieval hit rate, but also provides multi-faceted and in-depth supporting evidence, especially for complex and multi-hop questions. It significantly improves the system's ability to understand the user's true query intent and the depth of its responses, thereby enhancing retrieval diversity and improving its ability to respond to complex and multi-hop questions.
[0083] Furthermore, based on the first normalized score, the second normalized score, the third knowledge block, the fourth knowledge block, and the fifth knowledge block, the enhanced context corresponding to the query question is obtained, including: obtaining the enhanced score of each third knowledge block and the supplementary value score of each fifth knowledge block based on the first and second normalized scores; determining the sixth knowledge block from each fifth knowledge block based on the supplementary value score of each fifth knowledge block; sorting the third, fourth, and sixth knowledge blocks based on the enhanced score, the first normalized score of the fourth knowledge block, and the supplementary value score; obtaining M knowledge blocks from the sorted knowledge blocks to obtain candidate knowledge blocks; inputting the candidate knowledge blocks into a preset re-sorting model for re-sorting; and combining the top P re-sorted candidate knowledge blocks with the query question to obtain the enhanced context. In this way, by obtaining the corresponding enhancement score or supplementary value score of different knowledge blocks based on their hits in the content knowledge base and question knowledge base, the third, fourth, and sixth knowledge blocks are then sorted according to the enhancement score, the first normalized score of the fourth knowledge block, and the supplementary value score. Then, M knowledge blocks are obtained from the sorted knowledge blocks to obtain candidate knowledge blocks. The candidate knowledge blocks are input into a preset re-sorting model for re-sorting. The top P candidate knowledge blocks after re-sorting are combined with the question to be queried to obtain the enhanced context. This achieves hierarchical evidence aggregation of data blocks, improves the comprehensiveness of the final obtained enhanced context, and reduces its redundancy.
[0084] Furthermore, the enhanced scores for each third knowledge block are obtained as follows: the target score for each third knowledge block is obtained based on the second normalized score; for each third knowledge block, the sum of the first normalized score and the target score is determined as the enhanced score for that third knowledge block. Thus, since the double-hit knowledge blocks have been jointly verified by two independent sources—the content knowledge base and the question knowledge base—their overall relevance should be higher than that of any single source. Calculating their enhanced scores by summing their normalized scores objectively reflects the convergence effect of the double-hit knowledge blocks.
[0085] It should be noted that since a single knowledge block may correspond to multiple potential query questions, searching the question knowledge base yields multiple target question knowledge matching pairs. Among these, several target question knowledge matching pairs may have the same second knowledge block. Therefore, in the resulting third knowledge block, there may be one third knowledge block corresponding to multiple second normalized scores.
[0086] Furthermore, obtaining the target score corresponding to the third knowledge block based on the second normalized score includes: when the third knowledge block corresponds to only one second normalized score, determining the second normalized score as the target score corresponding to the third knowledge block; and / or, when the third knowledge block corresponds to multiple second normalized scores, determining the maximum value among the various second normalized scores as the target score corresponding to the third knowledge block.
[0087] Furthermore, the supplementary value score for each fifth knowledge block is obtained as follows: the second normalized score corresponding to each fifth knowledge block is determined as the relevance score for each fifth knowledge block; the novelty score for each fifth knowledge block is obtained; and the score is calculated... , obtained the The supplementary value score for the fifth knowledge block. Among them, For the first The supplementary value score for the fifth knowledge block; The preset adjustment weights are used to adjust the relative weights of relevance and novelty; For the first Novelty score corresponding to each fifth knowledge block; For the first The second normalized score corresponding to the fifth knowledge block, here representing the... The relevance score corresponding to the fifth knowledge block.
[0088] Further, the novelty score corresponding to each fifth knowledge block is obtained, including: obtaining the first embedding representation corresponding to each fifth knowledge block; and obtaining the second embedding representation corresponding to each first knowledge block in the first knowledge set. This is achieved through calculation... , obtained the The novelty score corresponds to each of the fifth knowledge blocks. Among them, For the first knowledge set The first knowledge block; For the first The first embedded representation corresponding to the fifth knowledge block; For the first knowledge set The second embedded representation corresponding to each first knowledge block; Representation to obtain the first The first embedded representation corresponding to the fifth knowledge block and the first knowledge set in the first knowledge set Vector cosine similarity between the second embedded representations corresponding to the first knowledge blocks.
[0089] Furthermore, based on the supplementary value scores of each fifth knowledge block, a sixth knowledge block is determined from each fifth knowledge block, including selecting the one with the highest supplementary value score from each fifth knowledge block. This knowledge block is designated as the sixth knowledge block. It can be a fixed value or it can be dynamically adjusted according to the actual situation; there are no further restrictions here.
[0090] Furthermore, the third, fourth, and sixth knowledge blocks are sorted according to the enhancement score, the first normalized score of the fourth knowledge block, and the supplementary value score, including: arranging each third knowledge block in descending order according to its corresponding enhancement score to obtain the first knowledge block sequence; arranging the sixth knowledge block in descending order according to its corresponding supplementary value score to obtain the second knowledge block sequence; arranging the fourth knowledge block in descending order according to its corresponding first normalized score to obtain the third knowledge block sequence; and concatenating the first knowledge block sequence, the second knowledge block sequence, and the second knowledge block sequence in the order of the third, sixth, and fourth knowledge blocks.
[0091] It should be noted that the third knowledge block has the highest priority due to its double hit, while the sixth knowledge block has the second highest priority because its reference question matches the query question well. The fourth knowledge block has the third highest priority.
[0092] In this way, based on whether a knowledge block has undergone dual-source cross-validation, it is scored with enhancement, supplementary value, or original content, and then cascaded and sorted according to a preset priority order, achieving a more robust and accurate retrieval result fusion and ranking. This hierarchical, multi-indicator fusion ranking mechanism is more robust than traditional methods that rely solely on single relevance ranking, and can more accurately rank high-value, high-confidence knowledge blocks first, providing a better contextual foundation for subsequent re-ranking machines and large language models.
[0093] Simultaneously, the relevance of knowledge blocks across both content and question retrieval paths was comprehensively examined, along with the novelty and complementarity among different knowledge blocks. Results from different sources were also standardized and prioritized. This mechanism effectively filters out comprehensive, low-redundancy, and high-evidence combinations of knowledge blocks, forming contexts with significantly optimized information density, thereby directly assisting large models in generating more accurate and complete answers.
[0094] From the sorted knowledge blocks, select M knowledge blocks to obtain candidate knowledge blocks. It should be noted that M is slightly larger than P. For example, This results in the total size of the candidate knowledge blocks being larger than the enhanced context.
[0095] It should be noted that the reordering model can be a BAAI (Beijing Academy of Artificial Intelligence) model, a BGE (BAAI General Embedding) model, or other models that can be reordered.
[0096] The re-ranking model can use a deep semantic interaction algorithm to perform a fine-grained relevance evaluation between the query question and each candidate knowledge block, output a relevance score for each knowledge block, and then re-rank them based on the relevance score.
[0097] Specifically, the re-ranking model can concatenate or interactively encode the query question and each candidate knowledge block. Then, through a multi-layer Transformer structure, it captures the fine-grained semantic relationships between them and uses contrastive learning or ranking loss optimization to obtain a relevance score for each knowledge block to determine its semantic matching degree. Finally, all candidate knowledge blocks are ranked in descending order based on their relevance scores, achieving re-ranking. This effectively identifies and enhances fragments closely related to the query and with high information contribution, significantly optimizing the logical order and information purity of knowledge blocks, and improving the quality and accuracy of context integration. Simultaneously, it significantly suppresses redundant, noisy, or low-quality content.
[0098] It should be noted that after obtaining the enhanced context corresponding to the query question, the process also includes: inputting the enhanced context into a preset large language model to obtain the answer corresponding to the query question.
[0099] In this way, a complete and optimized technical loop is formed, from offline data augmentation to online heterogeneous retrieval and multi-evidence fusion, and finally to re-ranking and answer generation. This not only solves several inherent defects of traditional methods, but also significantly improves the accuracy, factuality, and interpretability of the final generated answer through systematic design.
[0100] Combination Figure 4 As shown, this embodiment of the disclosure provides an apparatus 400 for retrieval enhancement generation, the apparatus including: a question acquisition module 401, a knowledge acquisition module 402, and an aggregation module 403.
[0101] Among them, the question acquisition module 401 is configured to acquire questions to be queried;
[0102] The knowledge acquisition module 402 is configured to acquire a first knowledge block and a first search score corresponding to the query question based on a preset content knowledge base; acquire a second knowledge block and a second search score corresponding to the query question based on a preset question knowledge base; the content knowledge base stores the first knowledge block; the question knowledge base stores the target question knowledge matching pair corresponding to the query question; the target question knowledge matching pair includes a reference question corresponding to the query question and a second knowledge block corresponding to the reference question.
[0103] The aggregation module 403 is configured to aggregate the first knowledge block and the second knowledge block based on the first search score and the second search score to obtain the enhanced context corresponding to the query question.
[0104] The apparatus for enhanced retrieval generation provided in this disclosure obtains a query question, then acquires a first knowledge block and a first retrieval score corresponding to the query question based on a preset content knowledge base, and acquires a target question knowledge matching pair corresponding to the query question based on a preset question knowledge base. This leads to the acquisition of a second knowledge block and a second retrieval score corresponding to the second knowledge block. Finally, the first and second knowledge blocks are aggregated based on the first and second retrieval scores to obtain the enhanced context corresponding to the query question. Compared to existing technologies that only retrieve from a single content knowledge base, resulting in potentially redundant or fragmented knowledge blocks, this application integrates data blocks from different databases through parallel retrieval of both the content knowledge base and the question knowledge base, achieving multi-evidence fusion for enhanced retrieval generation. Evidence is retrieved from both the answer itself and various potential question formats, resulting in a more comprehensive, stronger, and more information-dense enhanced context. This leads to more accurate and complete query results when knowledge is retrieved using this enhanced context.
[0105] Furthermore, the apparatus for retrieval enhancement generation also includes a content knowledge base acquisition module. The content knowledge base acquisition module is configured to acquire the content knowledge base by: acquiring the original knowledge document; dividing the original knowledge document into blocks to obtain several original knowledge blocks; and combining the original knowledge blocks to obtain the content knowledge base.
[0106] Furthermore, the apparatus for enhanced retrieval generation also includes a question knowledge base acquisition module. The question knowledge base acquisition module is configured to acquire the question knowledge base by: acquiring the original knowledge document; dividing the original knowledge document into blocks to obtain several original knowledge blocks; inputting the original knowledge blocks into a preset large language model to generate potential query questions corresponding to the original knowledge blocks based on a preset semantic perspective using the large language model; pairing the original knowledge blocks with the potential query questions corresponding to the original knowledge blocks to obtain multiple initial question knowledge matching pairs; and combining the initial question knowledge matching pairs to obtain the question knowledge base.
[0107] Furthermore, the knowledge acquisition module is configured to obtain the first knowledge block corresponding to the query question and the first retrieval score corresponding to the first knowledge block based on a preset content knowledge base in the following manner: obtaining the first relevance score between each original knowledge block in the content knowledge base and the query question; and obtaining the most relevant knowledge block to the query question from the content knowledge base based on the first relevance score. A set of original knowledge blocks; those most relevant to the query question. The first knowledge block is determined from the original knowledge blocks; the knowledge blocks most relevant to the query question are selected. The first relevance score between each original knowledge block and the query question is determined as the first retrieval score corresponding to the first knowledge block.
[0108] Furthermore, the knowledge acquisition module is configured to obtain the second knowledge block corresponding to the query question and the second retrieval score corresponding to the second knowledge block based on a preset question knowledge base in the following manner: obtaining the second relevance score between each initial question knowledge matching pair in the question knowledge base and the query question; and obtaining the most relevant knowledge block to the query question from the question knowledge base based on the second relevance score. Initial question knowledge matching pairs; those most relevant to the question to be queried. The initial question knowledge matching pair is determined as the target question knowledge matching pair; the original knowledge block in the target question knowledge matching pair is determined as the second knowledge block; the potential query question in the target question knowledge matching pair is the reference question; the second relevance score between the target question knowledge matching pair and the query question is determined as the second retrieval score corresponding to the second knowledge block.
[0109] Furthermore, the aggregation module is configured to aggregate the first knowledge block and the second knowledge block based on the first retrieval score and the second retrieval score in the following manner to obtain the enhanced context corresponding to the query question: obtain the first ranking corresponding to the first knowledge block based on the first retrieval score; obtain the second ranking corresponding to the second knowledge block based on the second retrieval score; obtain the first normalized score corresponding to each first knowledge block based on the first ranking; obtain the second normalized score corresponding to each second knowledge block based on the second ranking; determine the third knowledge block that is doubly hit by both the content knowledge base and the question knowledge base, the fourth knowledge block that is only hit by the content knowledge base, and the fifth knowledge block that is only hit by the question knowledge base from the first and second knowledge blocks; obtain the enhanced context corresponding to the query question based on the first normalized score, the second normalized score, the third knowledge block, the fourth knowledge block, and the fifth knowledge block.
[0110] Furthermore, the aggregation module is configured to obtain the enhanced context corresponding to the query question based on the first normalized score, the second normalized score, the third knowledge block, the fourth knowledge block, and the fifth knowledge block in the following manner: obtaining the enhanced score of each third knowledge block and the supplementary value score of each fifth knowledge block based on the first and second normalized scores; determining the sixth knowledge block from each fifth knowledge block based on the supplementary value score of each fifth knowledge block; sorting the third, fourth, and sixth knowledge blocks based on the enhanced score, the first normalized score of the fourth knowledge block, and the supplementary value score; obtaining M knowledge blocks from the sorted knowledge blocks to obtain candidate knowledge blocks; inputting the candidate knowledge blocks into a preset re-sorting model for re-sorting; and combining the top P re-sorted candidate knowledge blocks with the query question to obtain the enhanced context.
[0111] Combination Figure 5 As shown, this disclosure provides an electronic device including a processor 501 and a memory 502. Optionally, the device may further include a communication interface 503 and a bus 504. The processor 501, communication interface 503, and memory 502 can communicate with each other via the bus 504. The communication interface 503 can be used for information transmission. The processor 501 can invoke logical instructions in the memory 502 to execute the retrieval enhancement generation method described in the above embodiments.
[0112] Furthermore, the logic instructions in the aforementioned memory 502 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium.
[0113] The memory 502, as a storage medium, can be used to store software programs and computer-executable programs, such as program instructions / modules corresponding to the methods in the embodiments of this disclosure. The processor 501 executes functional applications and data processing by running the program instructions / modules stored in the memory 502, that is, it implements the method for retrieval enhancement generation in the above embodiments.
[0114] The memory 502 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the terminal device. Furthermore, the memory 502 may include high-speed random access memory and may also include non-volatile memory.
[0115] Using the electronic device provided in this embodiment, the system obtains a query question, then retrieves a first knowledge block and a first retrieval score corresponding to the query question based on a preset content knowledge base, and obtains a target question knowledge matching pair corresponding to the query question based on a preset question knowledge base. This leads to the acquisition of a second knowledge block and a second retrieval score, and finally, the first and second knowledge blocks are aggregated based on the first and second retrieval scores to obtain the enhanced context corresponding to the query question. Compared to existing technologies that only retrieve from a single content knowledge base, resulting in potentially redundant or fragmented knowledge blocks, this application integrates data blocks from different databases through parallel retrieval of both the content knowledge base and the question knowledge base, achieving multi-evidence fusion for enhanced retrieval. Evidence is retrieved from both the answer itself and various potential question formats, resulting in a more comprehensive, stronger, and more information-dense enhanced context. This makes the query results more accurate and complete when using this enhanced context.
[0116] This disclosure provides a storage medium storing computer-executable instructions configured to perform the above-described method for retrieval enhancement generation.
[0117] The aforementioned storage media can be either transient computer-readable storage media or non-transitory computer-readable storage media. Non-transitory storage media include various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks, and can also be transient storage media.
[0118] The foregoing description and accompanying drawings fully illustrate embodiments of this disclosure to enable those skilled in the art to practice them. Other embodiments may include structural, logical, electrical, procedural, and other changes. The embodiments represent only possible variations. Individual components and functions are optional unless explicitly required, and the order of operation may vary. Parts and features of some embodiments may be included in or replace parts and features of other embodiments. Moreover, the terminology used in this application is for describing embodiments only and is not intended to limit the claims. As used in the description of embodiments and claims, the singular forms “a,” “an,” and “the” are intended to equally include the plural forms unless the context clearly indicates otherwise. Similarly, the term “and / or” as used in this application means including one or more of the associated listed items and all possible combinations thereof. Additionally, when used in this application, the term "comprise" and its variations "comprises" and / or "comprising" refer to the presence of stated features, integrals, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or groups thereof. Without further limitations, an element defined by the phrase "comprises a..." does not exclude the presence of other identical elements in the process, method, or apparatus that includes said element. In this document, each embodiment may focus on the differences from other embodiments, and similar or identical parts between embodiments can be referred to mutually. For methods, products, etc., disclosed in the embodiments, if they correspond to the method section disclosed in the embodiments, the relevant parts can be referred to the description of the method section.
[0119] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the embodiments of this disclosure. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0120] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than that shown in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. In the descriptions corresponding to the flowcharts and block diagrams in the accompanying drawings, the operations or steps corresponding to different blocks may also occur in a different order than disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. Each block in a block diagram and / or flowchart, and combinations of blocks in a block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
Claims
1. A method for retrieval enhancement generation, characterized in that, include: Retrieve the question to be queried; The first knowledge block corresponding to the question to be queried and the first search score corresponding to the first knowledge block are obtained according to the preset content knowledge base. The second knowledge block corresponding to the query question and the second retrieval score corresponding to the second knowledge block are obtained according to the preset question knowledge base; the content knowledge base stores the first knowledge block; the question knowledge base stores the target question knowledge matching pair corresponding to the query question; The target question knowledge matching pair includes a reference question corresponding to the question to be queried and a second knowledge block corresponding to the reference question; Based on the first retrieval score and the second retrieval score, the first knowledge block and the second knowledge block are aggregated to obtain the enhanced context corresponding to the query question; The step of aggregating the first knowledge block and the second knowledge block based on the first retrieval score and the second retrieval score to obtain the enhanced context corresponding to the query question includes: obtaining a first ranking corresponding to the first knowledge block based on the first retrieval score; obtaining a second ranking corresponding to the second knowledge block based on the second retrieval score; obtaining a first normalized score corresponding to each of the first knowledge blocks based on the first ranking; obtaining a second normalized score corresponding to each of the second knowledge blocks based on the second ranking; determining a third knowledge block that is double-hit by the content knowledge base and the question knowledge base, a fourth knowledge block that is single-hit by the content knowledge base, and a fifth knowledge block that is single-hit by the question knowledge base among the first knowledge block and the second knowledge block; and obtaining the enhanced context corresponding to the query question based on the first normalized score, the second normalized score, the third knowledge block, the fourth knowledge block, and the fifth knowledge block. The step of obtaining the enhanced context corresponding to the query question based on the first normalized score, the second normalized score, the third knowledge block, the fourth knowledge block, and the fifth knowledge block includes: obtaining the enhanced score of each third knowledge block and the supplementary value score of each fifth knowledge block based on the first normalized score and the second normalized score; determining a sixth knowledge block from each fifth knowledge block based on the supplementary value score of each fifth knowledge block; sorting the third knowledge block, the fourth knowledge block, and the sixth knowledge block based on the enhanced score, the first normalized score of the fourth knowledge block, and the supplementary value score; obtaining M knowledge blocks from the sorted knowledge blocks to obtain candidate knowledge blocks; inputting the candidate knowledge blocks into a preset re-sorting model for re-sorting; and combining the top P re-sorted candidate knowledge blocks with the query question to obtain the enhanced context.
2. The method according to claim 1, characterized in that, The content knowledge base is obtained through the following methods: Obtain the original knowledge document; The original knowledge document is divided into blocks to obtain several original knowledge blocks; The original knowledge blocks are combined to obtain the content knowledge base.
3. The method according to claim 1, characterized in that, The knowledge base for the problem was obtained through the following methods: Obtain the original knowledge document; The original knowledge document is divided into blocks to obtain several original knowledge blocks; The original knowledge block is input into a preset large language model, so that the large language model can generate the potential query question corresponding to the original knowledge block based on a preset semantic perspective. The original knowledge block is paired with the potential query question corresponding to the original knowledge block to obtain multiple initial question knowledge matching pairs; The initial problem knowledge matching pairs are combined to obtain the problem knowledge base.
4. The method according to claim 2, characterized in that, The step of obtaining the first knowledge block corresponding to the query question and the first search score corresponding to the first knowledge block according to the preset content knowledge base includes: Obtain the first relevance score between each original knowledge block in the content knowledge base and the query question; Based on the first relevance score, the most relevant query question is obtained from the content knowledge base. A primitive knowledge block; The most relevant to the query question The original knowledge block is identified as the first knowledge block; The most relevant to the query question The first relevance score between each original knowledge block and the query question is determined as the first retrieval score corresponding to the first knowledge block.
5. The method according to claim 3, characterized in that, The step of obtaining the second knowledge block corresponding to the query question and the second retrieval score corresponding to the second knowledge block according to the preset question knowledge base includes: Obtain the second relevance score between each initial question knowledge matching pair in the question knowledge base and the question to be queried; Based on the second relevance score, the most relevant query question is obtained from the question knowledge base. An initial knowledge matching pair for the question; The most relevant to the query question An initial question knowledge matching pair is determined as the target question knowledge matching pair; The original knowledge block in the target question knowledge matching pair is determined as the second knowledge block; the potential query question in the target question knowledge matching pair is the reference question. The second relevance score between the target question knowledge matching pair and the question to be queried is determined as the second retrieval score corresponding to the second knowledge block.
6. An apparatus for retrieval enhancement generation, characterized in that, include: The question retrieval module is configured to retrieve questions to be queried. The knowledge acquisition module is configured to acquire the first knowledge block corresponding to the query question and the first search score corresponding to the first knowledge block based on a preset content knowledge base; The second knowledge block corresponding to the query question and the second retrieval score corresponding to the second knowledge block are obtained according to the preset question knowledge base; the content knowledge base stores the first knowledge block; the question knowledge base stores the target question knowledge matching pair corresponding to the query question; The target question knowledge matching pair includes a reference question corresponding to the question to be queried and a second knowledge block corresponding to the reference question; The aggregation module is configured to aggregate the first knowledge block and the second knowledge block based on the first retrieval score and the second retrieval score to obtain the enhanced context corresponding to the query question; The aggregation module is configured to aggregate the first knowledge block and the second knowledge block based on the first retrieval score and the second retrieval score in the following manner to obtain the enhanced context corresponding to the query question: obtain the first sorting corresponding to the first knowledge block based on the first retrieval score; The second ranking corresponding to the second knowledge block is obtained based on the second retrieval score; the first normalized score corresponding to each of the first knowledge blocks is obtained based on the first ranking; and the second normalized score corresponding to each of the second knowledge blocks is obtained based on the second ranking. In the first knowledge block and the second knowledge block, a third knowledge block that is doubly hit by the content knowledge base and the question knowledge base, a fourth knowledge block that is only hit by the content knowledge base, and a fifth knowledge block that is only hit by the question knowledge base are determined; based on the first normalized score, the second normalized score, the third knowledge block, the fourth knowledge block, and the fifth knowledge block, the enhanced context corresponding to the query question is obtained; The aggregation module is configured to obtain the enhanced context corresponding to the query question based on the first normalized score, the second normalized score, the third knowledge block, the fourth knowledge block, and the fifth knowledge block in the following manner: obtaining the enhanced score of each third knowledge block and the supplementary value score of each fifth knowledge block based on the first normalized score and the second normalized score. A sixth knowledge block is determined from each of the fifth knowledge blocks based on the supplementary value score of each of the fifth knowledge blocks; the third knowledge block, the fourth knowledge block, and the sixth knowledge block are sorted according to the enhancement score, the first normalized score of the fourth knowledge block, and the supplementary value score; Extract M knowledge blocks from the sorted knowledge blocks to obtain candidate knowledge blocks; input the candidate knowledge blocks into the preset reordering model for reordering. The first P candidate knowledge blocks after reordering are combined with the query question to obtain the enhanced context.
7. An electronic device comprising a processor and a memory storing program instructions, characterized in that, The processor is configured to, when executing the program instructions, perform the method for retrieving enhanced generation as described in any one of claims 1 to 5.
8. A storage medium storing program instructions, characterized in that, When the program instructions are executed, they perform the method for retrieving enhanced generation as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Question and answer processing method and device fusing intention recognition and retrieval enhancement generation technology, equipment, readable storage medium and program product
CN120873142A
Trusted questions for question-answering system
WO2025042737A1