Knowledge fusion-based retrieval enhanced large language model system and generation method

By enhancing the large language model system based on knowledge fusion retrieval, the problem of insufficient knowledge fusion in traditional methods is solved, and more accurate and robust answer generation is achieved, improving the model's cross-domain adaptability and robustness.

CN120950676APending Publication Date: 2025-11-14UNIV OF SCI & TECH OF CHINA
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202511453254.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-13
Publication Date
2025-11-14

AI Technical Summary

Technical Problem

Traditional retrieval enhancement generation methods are prone to introducing irrelevant or erroneous information and struggle to achieve optimal knowledge fusion in complex contexts.

Method used

A knowledge fusion-based retrieval enhancement big language model system is introduced, including a retrieval module, a generation module, a knowledge fusion decision module, and a model optimization module. Through a two-stage generation and decision mechanism and a direct preference optimization method, it autonomously compares and analyzes internal and external knowledge to optimize the model generation capability.

Benefits of technology

It significantly improves the accuracy and factuality of the generated answers, enhances the model's generalization ability and robustness in cross-domain and complex contexts, and simplifies the system architecture.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120950676A_ABST
    Figure CN120950676A_ABST
Patent Text Reader

Abstract

The invention provides a retrieval enhanced large language model system and generation method based on knowledge fusion, and the system comprises a retrieval module which is used for receiving user query and retrieving related corpora from an external knowledge base; the generation module is realized by a pre-trained large language model and is used for generating candidate answers and fact bases thereof; and the knowledge fusion decision-making module is realized by the large language model and is used for receiving the user query and the multiple groups of candidate answers and fact bases generated by the generation module, performing analysis and decision-making and outputting final answers and final fact bases. By introducing a double-stage generation and decision-making mechanism based on an inverse normal form and an adjustment and optimization method based on direct preference optimization, the problems of insufficient knowledge fusion and rough decision in the existing retrieval enhancement generation technology are effectively solved, the accuracy and factuality of generated answers are improved, and the user experience is improved. And the generalization ability and robustness of the method in cross-domain and complex contexts are enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, specifically a knowledge fusion-based retrieval enhancement large language model system and its generation method. Background Technology

[0002] In recent years, Large Language Models (LLMs) have demonstrated significant capabilities in natural language processing tasks such as text generation and question answering. However, LLMs primarily rely on knowledge from parameters that cannot be updated in real time for reasoning and generation. This makes them prone to factual errors or completely fabricated content when handling open-ended or time-sensitive tasks. Retrieval-enhanced generation (RAG), which retrieves real-time information from external knowledge bases to assist LLMs in generating answers, has been widely applied in question answering systems and intelligent search to mitigate the illusion problem and improve the credibility of generated content.

[0003] However, existing RAG methods still face key challenges in knowledge fusion: on the one hand, traditional RAG does not distinguish between external and internal model knowledge, easily introducing irrelevant or erroneous information; on the other hand, multi-source knowledge may conflict or be redundant, making it difficult for existing models to achieve optimal knowledge fusion in complex contexts. Recent RAG methods conditionally integrate external knowledge into LLMs based on specific strategies. Typical works include classifying based on the input query, generating the probability of terms, or assessing the relevance of retrieved content. Query- and term-based strategies typically rely on predefined question sets or thresholds for decision-making, limiting their effectiveness due to incomplete information; relevance-based strategies employ additional validation filtering modules to evaluate retrieved information, with the final response quality depending on the accuracy of the validation module.

[0004] To address these limitations, this invention proposes a knowledge fusion-based retrieval enhancement large language model system and generation method to solve the aforementioned problems. Summary of the Invention

[0005] The problem addressed by this invention is that traditional RAG is prone to introducing irrelevant or erroneous information, and existing models struggle to achieve optimal knowledge fusion in complex contexts.

[0006] To address the aforementioned problems, this invention provides a knowledge fusion-based enhanced retrieval large language model system, a generation method, a storage medium, and an electronic device.

[0007] In a first aspect, the present invention provides a knowledge fusion-based enhanced retrieval large language model system, comprising: The retrieval module is used to receive user queries and retrieve relevant corpora from external knowledge bases; The generation module, implemented by a pre-trained large language model, is used to generate candidate answers and their factual basis. The knowledge fusion decision module, implemented by the large language model, is used to receive the user query and multiple sets of candidate answers and factual evidence generated by the generation module, perform analysis and decision-making, and output the final answer and final factual evidence.

[0008] Optionally, the generation process of the generation module includes a candidate generation stage, used for: Based on the user query, without introducing retrieval information, a first candidate answer and a first factual basis are generated. Based on the user query and the relevant corpus retrieved by the retrieval module, and under the second condition of introducing retrieval information, a second candidate answer and a second factual basis are generated.

[0009] Optionally, the decision-making process of the knowledge fusion decision module is a reflective decision-making stage, used for: The first candidate answer, the first factual basis, the second candidate answer, the second factual basis, and the user query are used together as the input context; The large language model is guided to analyze, evaluate, and select the input context, and generate and output the final answer and the final factual basis.

[0010] Optionally, it also includes a model optimization module, the model optimization module comprising: The consistency discrimination unit is used to compare the generated candidate answers with the real answers to construct a preference dataset; The preference optimization unit is used to fine-tune the large language model in the generation module and / or knowledge fusion decision module based on the preference dataset using the direct preference optimization algorithm.

[0011] Optionally, the consistency discrimination unit is specifically used for: For each user query, determine the consistency between the first and second candidate answers and the actual answer; The initial preference dataset is formed by filtering out samples containing only one correct answer and one incorrect answer. These samples include: user queries, real answers, positive sample answers and factual basis, and negative sample answers and factual basis.

[0012] Optionally, the model optimization module further includes a data augmentation unit, used for: For each user query in the initial preference dataset, find the Top-K other queries in the dataset that are most similar to it; The positive and negative samples corresponding to similar queries found are used as additional negative examples for the current query to build an enhanced preference dataset.

[0013] Optionally, the data augmentation unit finds the top-K most similar other queries by calculating the similarity between the sentence vectors of the queries.

[0014] Optionally, the preference optimization unit uses the direct preference optimization algorithm for fine-tuning, and its objective function is: ; in, For the current training model, As a reference model, Deviation between parameter control strategy and reference For the sigmoid function, Represents the mathematical expectation. Represents sample triples Sampling is performed according to the distribution of the training dataset D. For input content, As a positive sample, This is a negative sample.

[0015] Secondly, the present invention provides a knowledge fusion-based enhanced retrieval generation method, based on the system described in the first aspect, the method comprising: The retrieval module receives user queries and retrieves relevant corpora from external knowledge bases; The generation module generates at least two sets of candidate answers and their corresponding factual basis. The knowledge fusion decision module receives the user query and at least two sets of candidate answers and factual evidence, performs analysis and decision-making, and outputs the final answer and final factual evidence.

[0016] Optionally, a first candidate answer and a first factual basis are generated based on the user query as input; Using the relevant corpus retrieved by the user as input, a second candidate answer and a second factual basis are generated.

[0017] Optionally, the method further includes a step of optimizing the large language model in the generation module and / or knowledge fusion decision module, the optimization step including: By using consistency discrimination, a preference dataset containing positive sample answers and factual basis and negative sample answers and factual basis is constructed; The large language model is fine-tuned based on the preference dataset using the direct preference optimization algorithm.

[0018] Optionally, the steps of constructing the preference dataset may also include data augmentation steps: For each query in the dataset, find its Top-K similar queries; The positive and negative samples corresponding to the similar queries are used as additional negative examples for the current query to expand the preference data pairs.

[0019] Thirdly, the present invention provides an electronic device including a processor, a communication interface, a memory, and a bus, wherein the processor, the communication interface, and the memory communicate with each other through the bus, and the processor can call logical instructions in the memory to execute the method provided in the second aspect.

[0020] Fourthly, the present invention provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the knowledge fusion-based retrieval enhancement generation method as described in the second aspect.

[0021] The beneficial effects of the knowledge fusion-based retrieval enhancement large language model system of the present invention are as follows: This invention effectively addresses the problems of insufficient knowledge fusion and coarse decision-making in existing retrieval enhancement generation technologies by introducing a two-stage generation and decision-making mechanism based on a reflective paradigm and an optimization method based on direct preference. The system can autonomously compare, analyze, and optimally fuse internal parameter knowledge with external retrieval knowledge, fundamentally reducing factual errors caused by blindly introducing external information and significantly improving the accuracy and factuality of the generated answers. Secondly, through a preference-aligned optimization framework, the model can achieve powerful knowledge fusion and decision-making capabilities without relying on preset rules or additional validation modules, simplifying the system architecture and enhancing its generalization ability and robustness across domains and complex contexts. Attached Figure Description

[0022] Figure 1 This is a structural block diagram of the knowledge fusion-based retrieval enhancement large language model system in an embodiment of the present invention; Figure 2 This is a schematic diagram of the knowledge fusion-based retrieval enhancement large language model system in an embodiment of the present invention; Figure 3 This is an example diagram of decision input containing factual basis in an embodiment of the present invention; Figure 4 This is a comparison diagram of the proposed solution and the existing baseline method in this embodiment of the invention; Figure 5 This is a flowchart of the knowledge fusion-based retrieval enhancement generation method in an embodiment of the present invention; Figure 6 This is a structural block diagram of the electronic device in an embodiment of the present invention. Detailed Implementation

[0023] To better understand the purpose, technical solution, and advantages of this application, the application is described and explained below in conjunction with the accompanying drawings and embodiments.

[0024] Unless otherwise defined, the technical or scientific terms used in this application shall have the general meaning understood by one of ordinary skill in the art to which this application pertains. Words such as “a,” “an,” “an,” “the,” “the,” and “these” used in this application do not indicate quantitative limitation and may be singular or plural. The terms “comprising,” “including,” “having,” and any variations thereof used in this application are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or device that comprises a series of steps or modules (units) is not limited to the listed steps or modules (units) but may include steps or modules (units) not listed, or may include other steps or modules (units) inherent to these processes, methods, products, or devices. Words such as “connected,” “linked,” and “coupled” used in this application are not limited to physical or mechanical connections but may include electrical connections, whether direct or indirect. “Multiple” used in this application refers to two or more. “And / or” describes the relationship between related objects, indicating that three relationships may exist; for example, “A and / or B” can represent: A alone, A and B simultaneously, and B alone. Normally, the character " / " indicates that the objects before and after it are in an "or" relationship. The terms "first," "second," "third," etc., used in this application are merely to distinguish similar objects and do not represent a specific order of objects.

[0025] First, to better understand this solution, let's briefly explain it: This invention constructs an tunable knowledge fusion framework based on a large language model. It introduces a knowledge fusion mechanism to achieve knowledge fusion decisions from different sources and introduces a preference-aligned training module to optimize the model's reasoning and generation capabilities, thereby simultaneously realizing knowledge fusion decisions and model optimization in retrieval-enhanced generation scenarios.

[0026] This invention proposes a knowledge fusion-based retrieval enhancement large language model system, comprising the following core modules: Retrieval Generation-Knowledge Fusion Framework: This component employs a two-stage generation mechanism inspired by the "reflection" paradigm, comprising candidate generation and reflective decision-making. First, it infers factual basis and generates candidate answers under conditions of no retrieval and combined with external retrieval. Then, the model evaluates the candidates and rewrites them through reflection, thereby achieving effective knowledge fusion and robust generation.

[0027] Optimization method for the knowledge fusion model: This component introduces a consistency discrimination module, which constructs feedback signals by evaluating candidate answers and true labels to optimize the model's decision reflection process. Based on data with feedback signals, this invention uses Direct Preference Optimization (DPO) to fine-tune the pre-trained large language model, optimizing the model's knowledge fusion generation capability. The invention is described in detail below.

[0028] like Figure 1 As shown in the figure, an embodiment of the present invention provides a retrieval enhancement large language model system based on knowledge fusion, comprising: The retrieval module is used to receive user queries and retrieve relevant corpora from external knowledge bases; This invention uses a retrieval module to retrieve relevant corpora from an external knowledge base, and uses a generative model to generate candidate answers and reflect on decision-making. It should be noted that the retrieval module is based on a dense vector retrieval method, uses a semantic vector embedding model to generate a vector database of corpora, and then retrieves the most relevant corpora through the vector database and the query vectors.

[0029] The generation module, implemented by a pre-trained large language model, is used to generate candidate answers and their factual basis. In this embodiment, the generation process of the generation module includes a candidate generation stage, used for: Based on the user query, and without introducing search information, the first candidate answer and the first factual basis are generated. Based on the relevant corpus retrieved by the user query and retrieval module, and under the second condition of introducing retrieval information, a second candidate answer and a second factual basis are generated.

[0030] For example, such as Figure 2 and Figure 3 As shown, this invention uses a pre-trained large language model to implement a generative model for each user query. Two types of response results are generated: 1. Using prompt words and query Input generation model To obtain the first factual basis for the model's autonomous generation and the first candidate answer ; II. For the same query, introduce a retrieval module. Collection and Query Related paragraphs , paragraph Incorporate the context of the input, using prompt words. Generate corresponding second factual evidence Second candidate answer The formalization is as follows: ; ; ; The knowledge fusion decision-making module, implemented by a large language model, is used to receive user queries and multiple sets of candidate answers and factual evidence generated by the generation module, analyze and make decisions, and output the final answer and final factual evidence.

[0031] The decision-making process of the knowledge fusion decision-making module is a reflective decision-making stage, used for: The first candidate answer, the first factual basis, the second candidate answer, the second factual basis, and the user query are used together as the input context; The large language model is guided to analyze, evaluate, and select the input context, and generate and output the final answer and the final factual basis.

[0032] In the reflective decision-making phase, based on the candidate generation phase, the generative model is responsible for deciding the final answer from the generated candidate content. For each query... Compare the answer with the factual basis for the candidates ( , and , This information is fed into the generative model as contextual input, allowing it to autonomously analyze and select the factual basis for its final output. With the final answer : ; It also includes a model optimization module, which includes: The consistency discrimination unit is used to compare the generated candidate answers with the real answers to construct a preference dataset; The preference optimization unit is used to fine-tune the large language model in the generation module and / or knowledge fusion decision module based on the preference dataset using the direct preference optimization algorithm.

[0033] To improve the generative model's ability to generate and make decisions by combining multi-source knowledge, this scheme introduces a consistency discrimination unit to evaluate the accuracy of automatically generated candidate answers, realizes preference data construction, and fine-tunes the model through preference optimization methods.

[0034] The consistency discrimination unit is specifically used for: For each user query, determine the consistency between the first and second candidate answers and the actual answer; The initial preference dataset is formed by filtering out samples containing only one correct answer and one incorrect answer. The samples include: user queries, real answers, positive sample answers and factual basis, and negative sample answers and factual basis.

[0035] The key to constructing an effective preference learning dataset is that each sample must contain a set of answers with clear contrast preferences, namely, one correct answer (positive sample) and one incorrect answer (negative sample).

[0036] For example, first, a set containing candidate answers is constructed using a generative model. : ; In the formula, This indicates that the query is from the i-th user. For query The real answer and These are the first candidate answer and the first factual basis, respectively. and These represent the second candidate answer and the second factual basis, respectively. N is the number of samples in the set, and i represents the i-th question-answer pair.

[0037] Then, for the initially generated set A rigorous screening process was conducted, and the specific steps are as follows: Use the consistency discrimination unit to evaluate the first candidate answer one by one. Second candidate answer Is it consistent with the actual answer? Consistency; retain samples that contain only one correct answer and one incorrect answer: ; in, This provides positive sample answers and factual evidence. For negative sample answers and factual evidence, M is a set. The number of samples after being filtered by the consistency discrimination unit is j=1, 2, 3…M, that is, j takes integers from 1 to M.

[0038] Furthermore, the model optimization module also includes a data augmentation unit, used for: For each user query in the initial preference dataset, find the Top-K other queries in the dataset that are most similar to it; The positive and negative samples corresponding to similar queries found are used as additional negative examples for the current query to build an enhanced preference dataset.

[0039] It should be noted that the data augmentation unit finds the top-K most similar other queries by calculating the similarity between the sentence vectors of the queries.

[0040] For example, for dataset Each query in This invention constructs a dataset by calculating the similarity between sentence embedding vectors and the Top-K most similar queries, and then uses all the response results corresponding to these similar queries as the current query. Additional negative examples are used to construct new preference data pairs. Formally, this is represented as follows: for each query... Let the set of its Top-K similar queries and their preferred answers be: ; in, Indicates query and The similarity between them is calculated using sentence vectors; and Let J represent the positive and negative samples of the j-th sample respectively (i.e., the answer and explanation); , For the current sample The original positive samples and the original negative samples are and argmax is a function that evaluates the set of arguments of a function. This represents the set of values ​​with the highest similarity. `top-K` refers to the K most similar queries retrieved for each query. It is necessary to sample j=1, 2, 3…M respectively and Query Perform the calculation.

[0041] When constructing augmented samples, the set All of them and (i.e., positive / negative sample responses under similar problems) are considered as The additional negative examples ultimately form new preference pairs in the data. The augmented dataset is Its form is expressed as follows: ; In the formula, Indicates the current sample, Indicates the original positive sample. Let K represent the original negative sample, K be the number of most similar queries corresponding to each query (an integer, K is set to 3 in this embodiment), and M be the set. The number of samples after being screened by the consistency discrimination unit (in this embodiment of the invention, the number of samples M after screening is 3756).

[0042] Meanwhile, in order to enhance the robustness and generalization ability of the model, this invention uses random rearrangement of the order of positive and negative samples in the input during the training process.

[0043] Furthermore, this invention introduces a preference alignment method to optimize the generative model, implemented using a direct preference optimization algorithm. In the preference alignment stage, each training sample contains three core elements: input content... Positive samples Includes the correct answer and its explanation; negative samples This includes incorrect answers and their explanations. The training objective can be represented as: In other words, within the context of input content x, the model should be more inclined to select positive samples. Non-negative samples The input content is... Includes the original query Prompt words The model identifies both positive and negative responses and guides it to make a choice between the two candidate responses.

[0044] The preference optimization unit is fine-tuned using the direct preference optimization algorithm, and its objective function is: ; in, For the current training model, As a reference model, Deviation between parameter control strategy and reference For the sigmoid function, Represents the mathematical expectation. Represents sample triples Sampling is performed according to the distribution of the training dataset D. For input content, As a positive sample, This is a negative sample.

[0045] By maximizing the objective function described above, the model learns to favor candidate responses with credible factual basis and correct answers in each set of comparative samples, thereby improving its ability to integrate judgments and generate content.

[0046] This invention is flexibly adaptable to the existing RAG framework and can be deployed to different application systems. It is applicable to intelligent application scenarios such as retrieval and question answering, and has good versatility and scalability. The retrieval-enhanced large language model system proposed in this invention can be integrated with intelligent retrieval and question answering assistant applications. By constructing a retrieval module, the retrieval interface integrates multi-source information in real time. The generation model generates candidate results based on the retrieval information and filters and rewrites the candidate results, which can improve the accuracy of the application's output content and help increase users' trust in intelligent service applications.

[0047] Existing RAG methods may lead to incorrect answers when indiscriminately introducing retrieval information, and their conditional use of external information strategies relies on preset rules or requires additional verification modules. Compared to existing methods, this invention improves the accuracy and factuality of generated content by incorporating factual reasoning and knowledge fusion decisions during the LLMs' own generation process. Furthermore, the effectiveness of this invention has been validated using cross-domain datasets.

[0048] First, to train the model, subsets of questions were extracted from open-source datasets (WebQuestions, SquAD2.0, SciQ) to construct training and validation sets. The training set consisted of 3756 pairs of preference data (including factual evidence and answers), while the test set comprised 426 pairs of preference data. Second, data from different domains were used in the testing phase. The test set included three question-answering datasets (TriviaQA, Natural Questions (NQ), and HotpotQA). Subsequently, the results were compared with baseline methods on these two datasets, as shown below. Figure 4 As shown.

[0049] It should be noted that the metrics compared here include: EM: Used to measure whether the predicted answer is completely consistent with the standard answer, and to calculate the proportion of complete consistency (the higher the better).

[0050] F1 score: Used to measure the degree of vocabulary overlap between the predicted answer and the standard answer (the higher the better).

[0051] Acc: Used to determine whether the predicted answer contains the standard answer (the higher the better).

[0052] according to Figure 4 The results show that, using Mistral-7B-Instruct and Qwen-2.5-7B-Instruct as the base models, our proposed solution significantly outperforms all comparable methods on all three datasets. These results demonstrate the significant effectiveness of our invention in improving the accuracy and factuality of model responses. When using Llama-2-13B-Chat as the base model, our solution maintains stable and strong performance, outperforming comparable methods on the TriviaQA and HotpotQA datasets.

[0053] like Figure 5 As shown, this embodiment of the invention also provides a retrieval enhancement generation method based on knowledge fusion. Based on the above system, the method includes the following steps: S100: Receive user queries through the retrieval module and retrieve relevant corpora from an external knowledge base; S200. Generate at least two sets of candidate answers and corresponding factual basis through the generation module; S300: Receive the user query and at least two sets of candidate answers and factual evidence through the knowledge fusion decision module, perform analysis and decision-making, and output the final answer and final factual evidence.

[0054] Using the user query as input, generate a first candidate answer and a first factual basis; Using the relevant corpus retrieved by the user as input, a second candidate answer and a second factual basis are generated.

[0055] It also includes a step of optimizing the large language model in the generation module and / or knowledge fusion decision module, the optimization step including: By using consistency discrimination, a preference dataset containing positive sample answers and factual basis and negative sample answers and factual basis is constructed; The large language model is fine-tuned based on the preference dataset using the direct preference optimization algorithm.

[0056] The steps involved in building a preference dataset also include data augmentation steps: For each query in the dataset, find its Top-K similar queries; The positive and negative samples corresponding to the similar queries are used as additional negative examples for the current query to expand the preference data pairs.

[0057] like Figure 6 As shown in the figure, an electronic device provided by an embodiment of the present invention includes: a processor 610, a communication interface 620, a memory 630, and a communication bus 640, wherein the processor 610, the communication interface 620, and the memory 630 communicate with each other through the communication bus 640. The processor 610 can call logical instructions in the memory 630 to execute the following method: The retrieval module receives user queries and retrieves relevant corpora from external knowledge bases; The generation module generates at least two sets of candidate answers and their corresponding factual basis. The knowledge fusion decision module receives the user query and at least two sets of candidate answers and factual evidence, performs analysis and decision-making, and outputs the final answer and final factual evidence.

[0058] Furthermore, the logical instructions in the aforementioned memory 630 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes 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.

[0059] This invention also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, is implemented to perform the methods provided in the above embodiments.

[0060] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods of various embodiments or some parts of embodiments.

[0061] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A knowledge fusion-based retrieval enhancement large language model system, characterized in that, include: The retrieval module is used to receive user queries and retrieve relevant corpora from external knowledge bases; The generation module, implemented by a pre-trained large language model, performs a two-stage generation process, including: Based on the user query, without introducing retrieval information, a first candidate answer and a first factual basis are generated. Based on the user query and the relevant corpus retrieved by the retrieval module, under the second condition of introducing retrieval information, a second candidate answer and a second factual basis are generated; The knowledge fusion decision module, implemented by the large language model, is used to receive the user query, as well as the first candidate answer, the first factual basis, the second candidate answer and the second factual basis, analyze and select through the reflection decision mechanism, and output the final answer and the final factual basis.

2. The knowledge fusion-based retrieval enhancement large language model system according to claim 1, characterized in that, The decision-making process of the knowledge fusion decision-making module is a reflective decision-making stage, used for: The first candidate answer, the first factual basis, the second candidate answer, the second factual basis, and the user query are used together as the input context; The large language model is guided to analyze, evaluate, and select the input context, and generate and output the final answer and the final factual basis.

3. The knowledge fusion-based retrieval enhancement large language model system according to claim 1, characterized in that, It also includes a model optimization module, which includes: The consistency discrimination unit is used to compare the generated candidate answers with the real answers to construct a preference dataset; The preference optimization unit is used to fine-tune the large language model in the generation module and / or knowledge fusion decision module based on the preference dataset using the direct preference optimization algorithm.

4. The knowledge fusion-based retrieval enhancement large language model system according to claim 3, characterized in that, The consistency discrimination unit is specifically used for: For each user query, determine the consistency between the first and second candidate answers and the actual answer; The initial preference dataset is formed by filtering out samples containing only one correct answer and one incorrect answer. These samples include: user queries, real answers, positive sample answers and factual basis, and negative sample answers and factual basis.

5. The knowledge fusion-based retrieval enhancement large language model system according to claim 4, characterized in that, The model optimization module also includes a data augmentation unit, used for: For each user query in the initial preference dataset, find the Top-K other queries in the dataset that are most similar to it; The positive and negative samples corresponding to similar queries found are used as additional negative examples for the current query to build an enhanced preference dataset.

6. The knowledge fusion-based retrieval enhancement large language model system according to claim 5, characterized in that, The data augmentation unit finds the top-K most similar other queries by calculating the similarity between the sentence vectors of the queries.

7. The knowledge fusion-based retrieval enhancement large language model system according to claim 3, characterized in that, The preference optimization unit is fine-tuned using the direct preference optimization algorithm, and its objective function is: ; in, For the current training model, As a reference model, Deviation between parameter control strategy and reference For the sigmoid function, Represents the mathematical expectation. Represents sample triples Sampling is performed according to the distribution of the training dataset D. For input content, As a positive sample, This is a negative sample.

8. A retrieval enhancement generation method based on knowledge fusion, characterized in that, Based on the system as described in any one of claims 1-7, the method comprises: The retrieval module receives user queries and retrieves relevant corpora from external knowledge bases; The generation module generates at least two sets of candidate answers and their corresponding factual basis. The knowledge fusion decision module receives the user query and at least two sets of candidate answers and factual evidence, performs analysis and decision-making, and outputs the final answer and final factual evidence.

9. The knowledge fusion-based retrieval enhancement generation method according to claim 8, characterized in that, Using the user query as input, generate a first candidate answer and a first factual basis; Using the relevant corpus retrieved by the user as input, a second candidate answer and a second factual basis are generated.

10. The knowledge fusion-based retrieval enhancement generation method according to claim 8, characterized in that, It also includes a step of optimizing the large language model in the generation module and / or knowledge fusion decision module, the optimization step including: By using consistency discrimination, a preference dataset containing positive sample answers and factual basis and negative sample answers and factual basis is constructed; The large language model is fine-tuned based on the preference dataset using the direct preference optimization algorithm.

11. The knowledge fusion-based retrieval enhancement generation method according to claim 10, characterized in that, The steps involved in building a preference dataset also include data augmentation steps: For each query in the dataset, find its Top-K similar queries; The positive and negative samples corresponding to the similar queries are used as additional negative examples for the current query to expand the preference data pairs.

Citation Information

Cited By

  • RAG and preference alignment collaborative optimization method and system oriented to power field

    CN121980039A

  • Rag and preference alignment collaborative optimization method and system for power field

    CN121980039B

  • Marine solution toolkit system and method based on AI

    CN122114686A