Knowledge conflict analysis relieving method for retrieval enhancement language model

By conducting knowledge conflict analysis and training on the retrieval-enhanced language model, we solve the accuracy problem of the model when facing information conflicts from different external knowledge sources and internal memory inconsistencies, and improve its accuracy and decision-making quality in the latest information queries.

CN118606444APending Publication Date: 2024-09-06INST OF AUTOMATION CHINESE ACAD OF SCI

Patent Information

Application Number
CN202410656522.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-24
Publication Date
2024-09-06

AI Technical Summary

Technical Problem

Retrieval-enhanced language models are unable to give accurate answers when faced with information conflicts in different external knowledge sources or inconsistencies with internal memory, leading to knowledge conflicts and affecting their accuracy in the latest, real-time information queries.

Method used

By obtaining question samples and their internal memory answers and external source answers, conduct knowledge conflict analysis to determine the type of conflict, and use the question samples and their corresponding answer samples to train the model to alleviate conflicts and improve the accuracy of the model and decision-making quality.

Benefits of technology

It effectively alleviates the knowledge conflict in the retrieval-enhanced language model, improves its accuracy and decision-making quality when facing complex information, and ensures that the model can provide more accurate judgments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118606444A
    Figure CN118606444A
Patent Text Reader

Abstract

The invention relates to the technical field of natural language processing, and provides a knowledge conflict analysis relieving method for a retrieval enhancement language model, which utilizes model internal memory answers, external source answers and reply results to analyze and relieve knowledge conflicts from at least one of correctness and loyalty of the reply results and model memorability. And performing knowledge conflict analysis on the retrieval enhanced language model to obtain an analysis result, so that the problems existing in the retrieval enhanced language model can be determined more clearly. And under the condition that the analysis result is that the retrieval enhanced language model has the knowledge conflict, training the retrieval enhanced language model by utilizing the question sample and the answer sample corresponding to the type of the knowledge conflict so as to relieve the knowledge conflict problem of the retrieval enhanced language model and improve the average recall rate of the retrieval enhanced language model. The confidence level of the retrieval enhanced language model is better calibrated, the decision quality of the retrieval enhanced language model in the face of knowledge conflicts is improved, and it is ensured that the retrieval enhanced language model can make accurate judgment in the face of complex information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of natural language processing, and in particular to a knowledge conflict analysis and mitigation method for a retrieval enhanced language model. Background Art

[0002] With the rapid evolution of information technology, large language models (LLMs) have extracted rich factual knowledge from massive pre-training corpora through a deep pre-training process, and then built a complex internal memory system to form internal memory. This internal memory is encoded in the structural parameters of the large language model, enabling the large language model to generate and reason text based on previously seen knowledge. However, this internal memory may not always be accurate or up-to-date. Its update and real-time performance are limited by the constraints of the pre-training cycle and cannot reflect the dynamic changes in the real world. Therefore, when faced with queries that require the latest, real-time information, such as asking "Who is the latest Nobel Prize winner in physics?", large language models often rely on outdated internal memory, resulting in inaccurate output.

[0003] In the face of such challenges, the concept of retrieval-enhanced language models came into being. The retrieval-enhanced language model adds the function of information retrieval to the traditional large-scale language model architecture. It can dynamically extract information from external data sources through the retriever and combine it with internal memory to produce more accurate and timely answers. The retrieval-enhanced language model not only retains the powerful ability of large-scale language models in text generation, but also greatly expands its application boundaries and accuracy through real-time retrieval of external information.

[0004] However, this new capability of the retrieval-augmented language model has the problem of knowledge conflict. This knowledge conflict occurs when the information retrieved by the retrieval-augmented language model from different external knowledge sources contradicts each other or does not match the internal memory. For example, if some data sources indicate that a scientist won the Nobel Prize in Physics in year X, and another data source states that another scientist won the award in year X+1, and the internal memory of the retrieval-augmented language model stays on the information in year X-2, the retrieval-augmented language model cannot give an accurate answer in the face of knowledge conflict. Summary of the invention

[0005] The present invention provides a knowledge conflict analysis and mitigation method for a retrieval enhanced language model, which is used to solve the defect of knowledge conflict generated when the retrieval enhanced language model is applied.

[0006] The present invention provides a knowledge conflict analysis and mitigation method for a retrieval enhanced language model, comprising:

[0007] Obtaining a question sample, an answer stored in the model's internal memory, and an answer from an external source;

[0008] Retrieving relevant documents of the question sample from an external knowledge source, and inputting the question sample and the relevant documents into a retrieval enhanced language model to obtain a reply result of the retrieval enhanced language model;

[0009] Based on the answer memorized internally by the model, the answer from the external source and the reply result, performing a knowledge conflict analysis on the retrieval enhanced language model from at least one perspective of the correctness, fidelity and model memorability of the reply result to obtain an analysis result;

[0010] If the analysis result is that there is a knowledge conflict in the retrieval enhanced language model, the retrieval enhanced language model is trained based on the question samples and answer samples corresponding to the type of the knowledge conflict to alleviate the knowledge conflict.

[0011] According to a knowledge conflict analysis and mitigation method for a retrieval enhanced language model provided by the present invention, the retrieval enhanced language model is trained based on the question sample and the answer sample corresponding to the type of the knowledge conflict to mitigate the knowledge conflict, specifically comprising:

[0012] Determining that the type of the knowledge conflict is a first conflict between the model's internal memory and an external knowledge source, inputting the question sample into a retrieval-enhanced language model to obtain an internal memory prediction result of the retrieval-enhanced language model, and taking the reply result and the internal memory prediction result as the answer sample, training the retrieval-enhanced language model with the goal of maximizing the difference between the reply result and the internal memory prediction result to alleviate the first conflict;

[0013] Determine that the type of the knowledge conflict is a second conflict between real knowledge and non-real knowledge in an external knowledge source, then determine the non-real answers to the question sample in the external knowledge source, and use the non-real answers and the external source answers as the answer samples, with the goal of maximizing the difference between the non-real answers and the external source answers, and train the retrieval enhanced language model to alleviate the second conflict.

[0014] According to a knowledge conflict analysis and mitigation method for a retrieval enhanced language model provided by the present invention, the determining of the non-authentic answers to the question samples in the external knowledge source specifically includes:

[0015] Based on the amateur language model, using fact-aware instructions, generating a non-authentic answer to the question sample in the external knowledge source;

[0016] The amateur language model is trained based on non-authentic question and answer sample pairs.

[0017] According to a knowledge conflict analysis and mitigation method for a retrieval-enhanced language model provided by the present invention, based on the internal memory answer of the model, the external source answer and the reply result, the knowledge conflict analysis of the retrieval-enhanced language model is performed from at least one perspective of the correctness, fidelity and model memory of the reply result to obtain the analysis result, which specifically includes:

[0018] The first difference between the answer stored in the model and the response result, and the second difference between the answer stored in the external source and the response result are calculated respectively, and based on the first difference and the second difference, a knowledge conflict analysis is performed on the retrieval enhanced language model from the perspective of correctness.

[0019] According to a knowledge conflict analysis and mitigation method for a retrieval-enhanced language model provided by the present invention, based on the internal memory answer of the model, the external source answer and the reply result, the knowledge conflict analysis of the retrieval-enhanced language model is performed from at least one perspective of the correctness, fidelity and model memory of the reply result to obtain the analysis result, and specifically includes:

[0020] Based on the external knowledge source, determining whether the reply result refers to the external knowledge source and the preferred knowledge type, and obtaining a first determination result;

[0021] Based on the first judgment result, a knowledge conflict analysis is performed on the retrieval enhanced language model from the perspective of fidelity.

[0022] According to a knowledge conflict analysis and mitigation method for a retrieval-enhanced language model provided by the present invention, based on the internal memory answer of the model, the external source answer and the reply result, the knowledge conflict analysis of the retrieval-enhanced language model is performed from at least one perspective of the correctness, fidelity and model memory of the reply result to obtain the analysis result, and specifically includes:

[0023] Based on the external knowledge source, determining whether the response result adheres to the internal memory of the model to obtain a second determination result;

[0024] Based on the second judgment result, a knowledge conflict analysis is performed on the retrieval enhanced language model from the perspective of the model's memorability.

[0025] The present invention also provides a knowledge conflict analysis and mitigation device for a retrieval enhanced language model, comprising:

[0026] An acquisition module, used to acquire a question sample, an answer stored in the model internally and an answer from an external source;

[0027] A model application module, used to retrieve relevant documents of the question sample from an external knowledge source, and input the question sample and the relevant documents into a retrieval enhanced language model to obtain a reply result of the retrieval enhanced language model;

[0028] a conflict analysis module, configured to perform knowledge conflict analysis on the retrieval enhanced language model based on the internal memory answer of the model, the external source answer and the reply result, from at least one perspective of the correctness, fidelity and model memory of the reply result, to obtain an analysis result;

[0029] The conflict mitigation module is used to train the retrieval enhanced language model based on the question samples and answer samples corresponding to the type of the knowledge conflict to mitigate the knowledge conflict if the analysis result shows that the retrieval enhanced language model has knowledge conflict.

[0030] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for alleviating knowledge conflict analysis for a retrieval-enhanced language model as described above is implemented.

[0031] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the above-described knowledge conflict analysis mitigation methods for retrieval-enhanced language models.

[0032] The present invention also provides a computer program product, comprising a computer program, which, when executed by a processor, implements any of the above-described knowledge conflict analysis and mitigation methods for retrieval-enhanced language models.

[0033] The knowledge conflict analysis and mitigation method for the retrieval enhanced language model provided by the present invention utilizes the model's internal memory answers, external source answers, and reply results to perform knowledge conflict analysis on the retrieval enhanced language model from at least one of the correctness, fidelity, and model memory of the reply results to obtain analysis results, so that the problems existing in the retrieval enhanced language model can be more clearly determined. Furthermore, in the case where the analysis result is that there is a knowledge conflict in the retrieval enhanced language model, the retrieval enhanced language model is trained using question samples and answer samples corresponding to the type of knowledge conflict to alleviate the knowledge conflict problem of the retrieval enhanced language model, improve its average recall rate, better calibrate the confidence level of the retrieval enhanced language model, so as to improve its decision-making quality when facing knowledge conflicts, and ensure that the retrieval enhanced language model can make more accurate judgments when facing complex information. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] In order to more clearly illustrate the technical solutions in the present invention or related technologies, the following briefly introduces the drawings required for use in the embodiments or related technical descriptions. Obviously, for ordinary technicians in this field, other drawings can be obtained based on the drawings in the following description without creative work.

[0035] Figure 1 This is one of the flow charts of the knowledge conflict analysis and mitigation method for the retrieval enhanced language model provided by the present invention;

[0036] Figure 2 This is the second flow chart of the knowledge conflict analysis and mitigation method for the retrieval enhanced language model provided by the present invention;

[0037] Figure 3 It is a structural schematic diagram of a knowledge conflict analysis and mitigation device for a retrieval-enhanced language model provided by the present invention;

[0038] Figure 4 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0039] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0040] The term "first" or "second" in the specification and claims of the present invention may include one or more of the features explicitly or implicitly. In the description of the invention, unless otherwise specified, "plurality" means two or more. In addition, "and / or" in the specification and claims means at least one of the connected objects, and the character " / " generally means that the objects connected before and after are in an "or" relationship.

[0041] Figure 1 FIG. 1 is a flow chart of a method for alleviating knowledge conflict analysis in a retrieval-enhanced language model provided in an embodiment of the present invention. Figure 1 As shown, the method includes:

[0042] S1, obtaining a question sample, an answer stored in the model's internal memory and an answer from an external source;

[0043] S2, retrieving relevant documents of the question sample from an external knowledge source, and inputting the question sample and the relevant documents into a retrieval enhanced language model to obtain a reply result of the retrieval enhanced language model;

[0044] S3, based on the internal memory answer of the model, the external source answer and the reply result, from at least one perspective of the correctness, fidelity and model memory of the reply result, performing knowledge conflict analysis on the retrieval enhanced language model to obtain an analysis result;

[0045] S4. If the analysis result shows that the retrieval enhanced language model has knowledge conflicts, the retrieval enhanced language model is trained based on the question samples and answer samples corresponding to the types of the knowledge conflicts to alleviate the knowledge conflicts.

[0046] Specifically, the knowledge conflict analysis mitigation method for retrieval-enhanced language model provided in the embodiment of the present invention is executed by a processor, which can be configured in a computer, which can be a local computer or a cloud computer. The local computer can be a computer, a tablet, etc., which is not specifically limited here.

[0047] First, execute step S1 to obtain question samples, answers in the model's internal memory, and answers from external sources. Here, the question samples can be questions from four different types of question-answering datasets: Natural Questions (NQ) dataset, Document-level Question Answering (TriviaQA, TQA) dataset, WebQuestions (WQ) dataset, and CuratedTrec (CT). Knowledge conflicts can be evaluated from the perspectives of open domain (single evidence), entity-centric (questions involve the popularity of specific entities), and multi-hop reasoning (multiple evidence). Among them, the NQ dataset is a large-scale question-answering dataset that contains Google search queries from real users, and each query is associated with a Wikipedia page from which the answer is extracted. The TQA dataset is a question-answering dataset that contains questions from various topics, such as history, literature, and science, and the questions are usually more open-ended.

[0048] The answer to the model's internal memory carried by the question sample may be the answer output by the expert language model after the question sample and the prompt information are input into the expert language model. The expert language model may be obtained by training the first language model through a pair of authentic question-answer samples. The pair of authentic question-answer samples includes a first question and a correct answer to the first question. The prompt information may include relevant information for prompting the first language model to output the correct answer to the first question.

[0049] The external source answer carried by the question sample may be the answer corresponding to the question sample in the external knowledge source.

[0050] Then, step S2 is performed, and the relevant documents of the question sample can be retrieved from the external knowledge source by using the retriever, and then the relevant documents are used as prompt information, and the question sample and the relevant documents are input into the retrieval enhanced language model, and the reply result is determined by the retrieval enhanced language model. The retrieval enhanced language model can be one of the models such as FLAN-T5-XL, FLAN-T5-XXL, FLAN-UL2, Baichuan2 7B, Baichuan2 13B, LLaMA2 7B, LLaMA2 13B and a large language model accessed through an application programming interface (API).

[0051] Since the input of the retrieval-enhanced language model includes relevant documents of the question samples retrieved from external knowledge sources, the response results given by the retrieval-enhanced language model may be obtained through the model's internal memory or through searching in external knowledge sources, which may lead to knowledge conflicts and cause errors in the response results.

[0052] Thereafter, step S3 is executed to perform a knowledge conflict analysis on the retrieval enhanced language model from at least one of the following perspectives: the correctness, fidelity and model memory of the response result, using the model's internal memory answers, external source answers and response results to obtain an analysis result.

[0053] Among them, correctness is used to indicate whether the retrieval-enhanced language model can correctly answer the question sample based on internal memory or external knowledge sources, fidelity is used to indicate whether the retrieval-enhanced language model refers to external knowledge sources in the answer and the preferred type of knowledge, and memorability is used to indicate how the retrieval-enhanced language model adheres to its internal memory.

[0054] From at least one of the angles of correctness, fidelity and model memorability of the response results, the behavior and preference of the retrieval enhanced language model may be studied in depth, and the obtained analysis results may include: there is no knowledge conflict in the retrieval enhanced language model and there is knowledge conflict in the retrieval enhanced language model.

[0055] In the case of knowledge conflicts in the retrieval enhanced language model, the types of knowledge conflicts may include a first conflict between the model's internal memory and the external knowledge source and a second conflict between real knowledge and non-real knowledge in the external knowledge source. The real knowledge in the external knowledge source refers to the correct answer to the question sample, and the non-real knowledge refers to the non-correct answer to the question sample, which may include wrong answers (i.e., misleading answers) and irrelevant answers.

[0056] For the first conflict, the recall data of each retrieval enhanced language model on the NQ dataset and the TriviaQA dataset are shown in Table 1.

[0057] Table 1

[0058]

[0059] Among them, Intenal Memory refers to the internal memory of the model, and the EM (Exact Match) indicator refers to the ratio of the model's answers to questions that completely match the questions. The F1 indicator is a comprehensive evaluation indicator based on precision and recall. Precision refers to the ratio of the number of correct answers to the total number of answers, while recall refers to the ratio of the number of correct answers to the total number of questions. The F1 indicator takes precision and recall into consideration, combining the accuracy and completeness of the model.

[0060] Correct Memory w / C is the situation where the model’s internal memory is correct, Mem R is the model’s internal memory recall rate, Con R is the incorrect knowledge recall rate of the external knowledge source, and MR (Miss rate) is the missed detection rate.

[0061] Incorrect Memory w / C is the case where the model’s internal memory is incorrect, IMR is the MR when the model’s internal memory is incorrect, and CMR is the MR when the model’s internal memory is correct.

[0062] From Table 1 we can see that:

[0063] Retrieval-enhanced language model’s preference for knowledge type: The retrieval-enhanced language model exhibits an availability bias towards common knowledge, that is, it prefers knowledge that is easily accessible in internal memory. For long-tail knowledge, the retrieval-enhanced language model relies on external knowledge sources in most cases. As knowledge becomes more common, the retrieval-enhanced language gradually shifts to give more trust to its internal memory.

[0064] Retrieval-augmented language models suffer from the Dunning-Kruger phenomenon: even when the retrieval-augmented language model is provided with correct external knowledge, a more capable retrieval-augmented language model may lack confidence in its correct internal memory, but will stubbornly stick to its incorrect internal memory.

[0065] For the second conflict, the recall data of each retrieval enhanced language model on the NQ dataset and the TriviaQA dataset are shown in Table 2.

[0066] Table 2

[0067]

[0068] From Table 2 we can see that:

[0069] Confirmation bias of retrieval-augmented language models towards external knowledge: Retrieval-augmented language models cannot accurately determine correct and incorrect knowledge in external knowledge sources.

[0070] The retrieval-enhanced language model follows the principle of majority rule and tends to trust evidence that appears more frequently. In addition, experiments also show that more external knowledge does not necessarily lead to better results. Too long prompt information may cause the model to be easily misled, making it difficult to provide accurate answers.

[0071] Finally, step S4 is executed. When the analysis result shows that there is a knowledge conflict in the retrieval enhancement language model, the retrieval enhancement language model can be trained using question samples and answer samples corresponding to the type of knowledge conflict to alleviate the knowledge conflict.

[0072] For the first conflict, the retrieval enhanced language model can be trained using the question sample and the answer sample corresponding to the first conflict to alleviate the first conflict. The answer sample corresponding to the first conflict can be selected according to the content of the first conflict and the mitigation goal of the first conflict. For example, the reply result and the internal memory prediction result of the retrieval enhanced language model for the question sample can be used as the answer sample corresponding to the first conflict.

[0073] For the second conflict, the question sample and the answer sample corresponding to the second conflict can be used to train the retrieval enhanced language model to alleviate the second conflict. The answer sample corresponding to the second conflict can be selected according to the content of the second conflict and the mitigation goal of the second conflict. For example, the non-authentic answer to the question sample and the answer from an external source can be used as the answer sample.

[0074] The knowledge conflict analysis and mitigation method for the retrieval enhanced language model provided in the embodiment of the present invention utilizes the model's internal memory answers, external source answers, and reply results to perform knowledge conflict analysis on the retrieval enhanced language model from at least one of the correctness, fidelity, and model memory of the reply results to obtain analysis results, so that the problems existing in the retrieval enhanced language model can be more clearly determined. Furthermore, when the analysis result is that there is a knowledge conflict in the retrieval enhanced language model, the retrieval enhanced language model is trained using question samples and answer samples corresponding to the type of knowledge conflict to alleviate the knowledge conflict problem of the retrieval enhanced language model, improve its average recall rate, and better calibrate the confidence level of the retrieval enhanced language model to improve its decision-making quality when facing knowledge conflicts, and ensure that the retrieval enhanced language model can make more accurate judgments when facing complex information.

[0075] On the basis of the above embodiment, the training of the retrieval enhanced language model based on the question sample and the answer sample corresponding to the type of the knowledge conflict to alleviate the knowledge conflict specifically includes:

[0076] Determining that the type of the knowledge conflict is a first conflict between the model's internal memory and an external knowledge source, inputting the question sample into a retrieval-enhanced language model to obtain an internal memory prediction result of the retrieval-enhanced language model, and taking the reply result and the internal memory prediction result as the answer sample, training the retrieval-enhanced language model with the goal of maximizing the difference between the reply result and the internal memory prediction result to alleviate the first conflict;

[0077] Determine that the type of the knowledge conflict is a second conflict between real knowledge and non-real knowledge in an external knowledge source, then determine the non-real answers to the question sample in the external knowledge source, and use the non-real answers and the external source answers as the answer samples, with the goal of maximizing the difference between the non-real answers and the external source answers, and train the retrieval enhanced language model to alleviate the second conflict.

[0078] Specifically, when it is determined that the type of knowledge conflict is the first conflict between the model's internal memory and the external knowledge source, the question sample can be input into the retrieval-enhanced language model, and the retrieval-enhanced language model can determine the internal memory prediction result of the question sample based on the internal memory without the relevant documents of the question sample retrieved from the external knowledge source as prompt information. Thereafter, the reply result and the internal memory prediction result can be used as answer samples, and the retrieval-enhanced language model can be trained with the goal of maximizing the difference between the reply result and the internal memory prediction result to alleviate the first conflict, thereby reducing the impact of the erroneous internal memory of the retrieval-enhanced language model.

[0079] In the case where it is determined that the type of knowledge conflict is the second conflict between real knowledge and non-real knowledge in the external knowledge source, the non-real answer to the question sample in the external knowledge source can be determined first, and the non-real answer can be a wrong answer or a misleading answer randomly generated according to the question sample. Thereafter, the non-real answer and the external source answer can be used as answer samples, and the retrieval enhanced language model can be trained with the goal of maximizing the difference between the non-real answer and the external source answer to alleviate the second conflict, so that the retrieval enhanced language model can correctly distinguish the correctness of the knowledge in the external knowledge source relative to the question sample.

[0080] Based on the above embodiment, determining the non-authentic answer of the question sample in the external knowledge source specifically includes:

[0081] Based on the amateur language model, using fact-aware instructions, generating a non-authentic answer to the question sample in the external knowledge source;

[0082] The amateur language model is trained based on non-authentic question and answer sample pairs.

[0083] Specifically, when determining the non-authentic answers to the question samples in the external knowledge source, the amateur language model can be used to generate the non-authentic answers to the question samples in the external knowledge source using fact-aware instructions. The fact-aware instructions are prompt information provided by the user to guide the amateur language model to generate non-authentic answers.

[0084] It is understandable that the amateur language model can be obtained by training the second language model through non-authentic question and answer sample pairs. The non-authentic question and answer sample pairs may include questions and non-authentic answers to the questions. When training the second language model, prompt samples may be introduced to guide the generation action of the second language model.

[0085] In the embodiment of the present invention, the amateur language model can be used to quickly obtain non-authentic answers to question samples, thereby improving the efficiency of knowledge conflict analysis and mitigation of the retrieval enhanced language model.

[0086] On the basis of the above embodiment, based on the internal memory answer of the model, the external source answer and the reply result, the retrieval enhanced language model is subjected to knowledge conflict analysis from at least one perspective of the correctness, fidelity and model memory of the reply result to obtain the analysis result, which specifically includes:

[0087] The first difference between the answer stored in the model and the response result, and the second difference between the answer stored in the external source and the response result are calculated respectively, and based on the first difference and the second difference, a knowledge conflict analysis is performed on the retrieval enhanced language model from the perspective of correctness.

[0088] Specifically, when performing knowledge conflict analysis on the retrieval enhanced language model, the first difference between the answer in the model's internal memory and the reply result, and the second difference between the answer from the external source and the reply result can be calculated respectively. The correctness of the internal memory of the retrieval enhanced language model is judged by the first difference. If the first difference is less than or equal to the first threshold, the internal memory of the retrieval enhanced language model is determined to be correct, otherwise the internal memory of the retrieval enhanced language model is determined to be wrong. The correctness of the external knowledge of the external knowledge source is judged by the second difference. If the second difference is less than or equal to the second threshold, the external knowledge of the external knowledge source is determined to be correct, otherwise the external knowledge of the external knowledge source is determined to be wrong.

[0089] On the basis of the above embodiment, the knowledge conflict analysis of the retrieval enhanced language model is performed based on the internal memory answer of the model, the external source answer and the reply result from at least one of the correctness, fidelity and model memory of the reply result to obtain the analysis result, which specifically includes:

[0090] Based on the external knowledge source, determining whether the reply result refers to the external knowledge source and the preferred knowledge type, and obtaining a first determination result;

[0091] Based on the first judgment result, a knowledge conflict analysis is performed on the retrieval enhanced language model from the perspective of fidelity.

[0092] Specifically, when performing knowledge conflict analysis on the retrieval enhanced language model, an external knowledge source can also be used to determine whether the reply result refers to the external knowledge source and the preferred knowledge type to obtain a first judgment result. Here, if the second difference is less than or equal to the second threshold, it is determined that the reply result refers to the external knowledge source. Further, the knowledge type preferred by the retrieval enhanced language model can be determined, that is, whether the reply result belongs to common knowledge or long-tail knowledge.

[0093] Afterwards, the first judgment result is used to perform knowledge conflict analysis on the retrieval enhanced language model from the perspective of fidelity. If the reply result refers to the external knowledge source, the retrieval enhanced language model is determined to be faithful to the external knowledge source, otherwise the retrieval enhanced language model is determined to be not faithful to the external knowledge source.

[0094] On the basis of the above embodiment, the knowledge conflict analysis of the retrieval enhanced language model is performed based on the internal memory answer of the model, the external source answer and the reply result from at least one of the correctness, fidelity and model memory of the reply result to obtain the analysis result, which specifically includes:

[0095] Based on the external knowledge source, determining whether the response result adheres to the internal memory of the model to obtain a second determination result;

[0096] Based on the second judgment result, a knowledge conflict analysis is performed on the retrieval enhanced language model from the perspective of the model's memorability.

[0097] Specifically, when performing knowledge conflict analysis on the retrieval enhanced language model, the external knowledge source can be used to first determine whether the reply result adheres to the model internal memory to obtain a second judgment result. Here, if the reply result refers to the external knowledge source, it is determined that the retrieval enhanced language model does not adhere to the model internal memory, otherwise it is determined that the retrieval enhanced language model adheres to the model internal memory.

[0098] Afterwards, the second judgment result is used to perform knowledge conflict analysis on the retrieval enhanced language model from the perspective of model memory. If it is determined that the retrieval enhanced language model does not adhere to the model internal memory, the model memory is poor, otherwise it is determined that the retrieval enhanced language model adheres to the model internal memory, and the model memory is strong.

[0099] In summary, if Figure 2 As shown, the knowledge conflict analysis and mitigation method for the retrieval enhanced language model provided in the embodiment of the present invention can perform knowledge conflict analysis on the retrieval enhanced language model from the perspectives of the correctness, fidelity and model memorability of the response results, and it can be obtained that the knowledge conflict of the retrieval enhanced language model may include a first conflict and a second conflict.

[0100] Among them, the first conflict will lead to the Dunning-Kruger phenomenon and availability bias in the retrieval-enhanced language model, and the second conflict will lead to confirmation bias and the principle of minority obeying the majority in the retrieval-enhanced language model.

[0101] Finally, the retrieval enhanced language model is trained by maximizing the difference between question samples and their answer samples corresponding to the types of knowledge conflicts, so as to alleviate the knowledge conflicts existing in the retrieval enhanced language model.

[0102] like Figure 3 As shown, based on the above embodiment, an embodiment of the present invention provides a knowledge conflict analysis and mitigation device for a retrieval enhanced language model, comprising:

[0103] An acquisition module 31 is used to acquire a question sample, an answer stored in the model internally and an answer from an external source carried by the question sample;

[0104] A model application module 32 is used to retrieve relevant documents of the question sample from an external knowledge source, and input the question sample and the relevant documents into a search-enhanced language model to obtain a reply result of the search-enhanced language model;

[0105] A conflict analysis module 33 is used to perform knowledge conflict analysis on the retrieval enhanced language model based on the internal memory answer of the model, the external source answer and the reply result from at least one of the correctness, fidelity and model memory of the reply result to obtain an analysis result;

[0106] The conflict mitigation module 34 is used to train the retrieval enhanced language model based on the question samples and answer samples corresponding to the type of the knowledge conflict to mitigate the knowledge conflict if the analysis result shows that the retrieval enhanced language model has knowledge conflict.

[0107] On the basis of the above-mentioned embodiments, in the knowledge conflict analysis and mitigation device for retrieval-enhanced language model provided in the embodiments of the present invention, the conflict mitigation module is specifically used for:

[0108] Determining that the type of the knowledge conflict is a first conflict between the model's internal memory and an external knowledge source, inputting the question sample into a retrieval-enhanced language model to obtain an internal memory prediction result of the retrieval-enhanced language model, and taking the reply result and the internal memory prediction result as the answer sample, training the retrieval-enhanced language model with the goal of maximizing the difference between the reply result and the internal memory prediction result to alleviate the first conflict;

[0109] Determine that the type of the knowledge conflict is a second conflict between real knowledge and non-real knowledge in an external knowledge source, then determine the non-real answers to the question sample in the external knowledge source, and use the non-real answers and the external source answers as the answer samples, with the goal of maximizing the difference between the non-real answers and the external source answers, and train the retrieval enhanced language model to alleviate the second conflict.

[0110] On the basis of the above-mentioned embodiment, in the knowledge conflict analysis and mitigation device for retrieval-enhanced language model provided in the embodiment of the present invention, the conflict mitigation module is further specifically used for:

[0111] Based on the amateur language model, using fact-aware instructions, generating a non-authentic answer to the question sample in the external knowledge source;

[0112] The amateur language model is trained based on non-authentic question and answer sample pairs.

[0113] On the basis of the above-mentioned embodiments, in the knowledge conflict analysis and mitigation device for retrieval-enhanced language model provided in the embodiments of the present invention, the conflict analysis module is specifically used for:

[0114] The first difference between the answer stored in the model and the response result, and the second difference between the answer stored in the external source and the response result are calculated respectively, and based on the first difference and the second difference, a knowledge conflict analysis is performed on the retrieval enhanced language model from the perspective of correctness.

[0115] On the basis of the above-mentioned embodiment, in the knowledge conflict analysis and mitigation device for retrieval enhanced language model provided in the embodiment of the present invention, the conflict analysis module is further specifically used for:

[0116] Based on the external knowledge source, determining whether the reply result refers to the external knowledge source and the preferred knowledge type, and obtaining a first determination result;

[0117] Based on the first judgment result, a knowledge conflict analysis is performed on the retrieval enhanced language model from the perspective of fidelity.

[0118] On the basis of the above-mentioned embodiment, in the knowledge conflict analysis and mitigation device for retrieval enhanced language model provided in the embodiment of the present invention, the conflict analysis module is further specifically used for:

[0119] Based on the external knowledge source, determining whether the response result adheres to the internal memory of the model to obtain a second determination result;

[0120] Based on the second judgment result, a knowledge conflict analysis is performed on the retrieval enhanced language model from the perspective of the model's memorability.

[0121] Specifically, the functions of each module in the knowledge conflict analysis and mitigation device for the retrieval enhanced language model provided in the embodiment of the present invention correspond one-to-one to the operation flow of each step in the above-mentioned method embodiment, and the effects achieved are also consistent. Please refer to the above-mentioned embodiment for details, and no further details will be given in the embodiment of the present invention.

[0122] Figure 4 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 4 As shown, the electronic device may include: a processor (Processor) 410, a communication interface (Communications Interface) 420, a memory (Memory) 430 and a communication bus 440, wherein the processor 410, the communication interface 420, and the memory 430 communicate with each other through the communication bus 440. The processor 410 may call the logic instructions in the memory 430 to execute the knowledge conflict analysis mitigation method for the retrieval enhanced language model provided in the above embodiments.

[0123] In addition, the logic instructions in the above-mentioned memory 430 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the relevant technology or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program codes.

[0124] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the knowledge conflict analysis mitigation method for the retrieval enhanced language model provided in the above embodiments.

[0125] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the knowledge conflict analysis mitigation method for retrieval-enhanced language model provided in the above-mentioned embodiments.

[0126] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0127] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, by hardware. Based on this understanding, the above technical solution can be essentially or in other words, the part that contributes to the relevant technology can be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiment.

[0128] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A knowledge conflict analysis and mitigation method for retrieval-enhanced language model, characterized in that: include: Obtaining a question sample, an answer stored in the model's internal memory, and an answer from an external source; Retrieving relevant documents of the question sample from an external knowledge source, and inputting the question sample and the relevant documents into a retrieval enhanced language model to obtain a reply result of the retrieval enhanced language model; Based on the answer memorized internally by the model, the answer from the external source and the reply result, performing a knowledge conflict analysis on the retrieval enhanced language model from at least one perspective of the correctness, fidelity and model memorability of the reply result to obtain an analysis result; If the analysis result is that there is a knowledge conflict in the retrieval enhanced language model, the retrieval enhanced language model is trained based on the question samples and answer samples corresponding to the type of the knowledge conflict to alleviate the knowledge conflict.

2. The method for alleviating knowledge conflict analysis based on a retrieval-enhanced language model according to claim 1, characterized in that: The step of training the retrieval enhanced language model based on the question sample and the answer sample corresponding to the type of the knowledge conflict to alleviate the knowledge conflict specifically includes: Determining that the type of the knowledge conflict is a first conflict between the model's internal memory and an external knowledge source, inputting the question sample into a retrieval-enhanced language model to obtain an internal memory prediction result of the retrieval-enhanced language model, and taking the reply result and the internal memory prediction result as the answer sample, training the retrieval-enhanced language model with the goal of maximizing the difference between the reply result and the internal memory prediction result to alleviate the first conflict; Determine that the type of the knowledge conflict is a second conflict between real knowledge and non-real knowledge in an external knowledge source, then determine the non-real answers to the question sample in the external knowledge source, and use the non-real answers and the external source answers as the answer samples, with the goal of maximizing the difference between the non-real answers and the external source answers, and train the retrieval enhanced language model to alleviate the second conflict.

3. The method for alleviating knowledge conflict analysis based on a retrieval-enhanced language model according to claim 2, characterized in that: The determining of the non-authentic answers to the question samples in the external knowledge source specifically includes: Based on the amateur language model, using fact-aware instructions, generating a non-authentic answer to the question sample in the external knowledge source; The amateur language model is trained based on non-authentic question and answer sample pairs.

4. The method for alleviating knowledge conflict analysis for a retrieval-enhanced language model according to any one of claims 1 to 3, characterized in that: The step of performing a knowledge conflict analysis on the retrieval enhanced language model based on the model's internal memory answer, the external source answer and the reply result from at least one of the correctness, fidelity and model memory of the reply result to obtain an analysis result specifically includes: The first difference between the answer stored in the model and the response result, and the second difference between the answer stored in the external source and the response result are calculated respectively, and based on the first difference and the second difference, a knowledge conflict analysis is performed on the retrieval enhanced language model from the perspective of correctness.

5. The method for alleviating knowledge conflict analysis for a retrieval-enhanced language model according to any one of claims 1 to 3, characterized in that: The step of performing a knowledge conflict analysis on the retrieval enhanced language model based on the model's internal memory answer, the external source answer and the reply result from at least one of the correctness, fidelity and model memory of the reply result to obtain the analysis result further specifically includes: Based on the external knowledge source, determining whether the reply result refers to the external knowledge source and the preferred knowledge type, and obtaining a first determination result; Based on the first judgment result, a knowledge conflict analysis is performed on the retrieval enhanced language model from the perspective of fidelity.

6. The method for alleviating knowledge conflict analysis for a retrieval-enhanced language model according to any one of claims 1 to 3, characterized in that: The step of performing a knowledge conflict analysis on the retrieval enhanced language model based on the model's internal memory answer, the external source answer and the reply result from at least one of the correctness, fidelity and model memory of the reply result to obtain the analysis result further specifically includes: Based on the external knowledge source, determining whether the response result adheres to the internal memory of the model to obtain a second determination result; Based on the second judgment result, a knowledge conflict analysis is performed on the retrieval enhanced language model from the perspective of the model's memorability.

7. A knowledge conflict analysis and mitigation device for a retrieval-enhanced language model, characterized in that: include: An acquisition module, used to acquire a question sample, an answer stored in the model internally and an answer from an external source; A model application module, used to retrieve relevant documents of the question sample from an external knowledge source, and input the question sample and the relevant documents into a retrieval enhanced language model to obtain a reply result of the retrieval enhanced language model; a conflict analysis module, configured to perform knowledge conflict analysis on the retrieval enhanced language model based on the internal memory answer of the model, the external source answer and the reply result, from at least one perspective of the correctness, fidelity and model memory of the reply result, to obtain an analysis result; The conflict mitigation module is used to train the retrieval enhanced language model based on the question samples and answer samples corresponding to the type of the knowledge conflict to mitigate the knowledge conflict if the analysis result shows that the retrieval enhanced language model has knowledge conflict.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the knowledge conflict analysis and mitigation method for a retrieval enhanced language model according to any one of claims 1 to 6 is implemented.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the knowledge conflict analysis and mitigation method for a retrieval-enhanced language model according to any one of claims 1 to 6 is implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the knowledge conflict analysis and mitigation method for a retrieval-enhanced language model according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Efficient network retrieval enhanced answering method and system oriented to human preferences

    CN116501843A

  • Financial question and answer text generation method and device based on retrieval enhancement and storage medium

    CN116662502A

Cited By

  • Knowledge conflict-oriented adaptive decoding method and apparatus, and electronic device

    CN119067213A

  • Knowledge base conflict decision-making system and method

    CN121117236A

  • A knowledge base conflict resolution system and method

    CN121117236B