CN-121996750-A - Retrieval enhancement generation method and system based on long-term memory and multisource knowledge iterative fusion
Abstract
The invention discloses a retrieval enhancement generation method and a retrieval enhancement generation system based on long-term memory and multisource knowledge iterative fusion. The method comprises the steps of firstly receiving user inquiry, triggering long-term memory database retrieval, external knowledge base retrieval and large language model internal knowledge generation in parallel to construct a multi-source candidate knowledge base, improving result correlation by adopting a dynamic top-k value-based self-adaptive retrieval method, secondly inputting the user inquiry and the multi-source knowledge into the large language model for iterative fusion, generating a final answer through conflict detection, fusion processing and confidence assessment, and finally updating the long-term memory database. The invention can improve the accuracy and stability of generating answers in multi-round interaction and complex task scenes, reduce the risk of one-sided answer, incomplete reasoning or fact deviation, and enhance the multi-source knowledge utilization capability and long-term learning capability of the system, thereby remarkably expanding the comprehensive performance and reliability of the system in applications such as intelligent question-answering, information retrieval assistance, text generation and the like.
Inventors
- CHENG GUANJIE
- GAO JIANFENG
- TONG YUFEI
- CHEN YISHAN
- HUANG BUTIAN
- DENG SHUIGUANG
Assignees
- 浙江大学软件学院(宁波)创新与管理中心
- 浙江大学
- 江西理工大学
- 杭州云象网络技术有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20251217
Claims (10)
- 1. The search enhancement generation method based on the iterative fusion of long-term memory and multi-source knowledge is characterized by comprising the following steps of: After receiving the inquiry of the user, the system triggers the long-term memory database search, the external knowledge base search and the large language model internal knowledge generation in parallel to construct a multi-source candidate knowledge base comprising candidate memory, candidate external knowledge and candidate internal knowledge; Inputting the user inquiry, the candidate memory, the candidate external knowledge and the candidate internal knowledge into a large language model, performing conflict detection and fusion processing by the large language model to generate candidate answers, performing confidence assessment based on the candidate answers, and performing iteration condition judgment according to confidence scores; selecting the answer with highest confidence from the generated candidate answers, and outputting the answer as a final answer; Combining the user inquiry and the final answer into an interaction record, storing the interaction record into a history interaction record set, generating a memory abstract, then inputting the interaction record, the history interaction record and the memory abstract into a large language model, extracting candidate memory facts, simultaneously retrieving old memories corresponding to the candidate memory facts from a long-term memory base, inputting the candidate memory facts and the corresponding old memories into the large language model together, and determining the updating operation of the long-term memory database by the old memories.
- 2. The method of claim 1, wherein the long-term memory database search and the external knowledge base search each employ an adaptive search method based on a dynamic top-k value to generate candidate memories and candidate external knowledge, respectively, based on user queries.
- 3. The method according to claim 1 or 2, wherein the large language model directly generates responsive content from user queries, resulting in candidate internal knowledge.
- 4. The method according to claim 2, wherein the adaptive search method based on the dynamic top-k value comprises the steps of: Retrieving the first k pieces of content and a similarity score sequence thereof from a database based on the user query; calculating the similarity proportion between every two adjacent terms according to the similarity score sequence based on the search result; comparing each similarity proportion with a preset threshold value to obtain a retrieval result; If all the similarity ratios do not exceed the threshold value, the original search result is maintained.
- 5. The method of claim 1, wherein the conflict detection and fusion process comprises merging consistent information, separating conflicting information, and filtering irrelevant information.
- 6. The method of claim 1, wherein performing an iterative condition determination based on the confidence score comprises: When the variation exceeds a preset threshold, re-inputting the current candidate answers and the confidence scores, and returning to the conflict detection and fusion processing step for continuing iteration; if the variation is lower than a preset threshold or the iteration reaches the maximum round T, the answer is judged to be stable, and the iteration is terminated.
- 7. The method of claim 1 or 6, wherein the update operation comprises a new memory, a modified old memory, a deleted old memory, or no update operation.
- 8. A search enhancement generation system based on long-term memory and multisource knowledge iterative fusion, comprising: the system comprises a multi-source knowledge base module, a multi-source candidate knowledge base module and a multi-source candidate knowledge base module, wherein the multi-source knowledge base module is used for triggering long-term memory database retrieval, external knowledge base retrieval and large language model internal knowledge generation in parallel after receiving user inquiry so as to construct a multi-source candidate knowledge base comprising candidate memory, candidate external knowledge and candidate internal knowledge; The conflict detection and fusion processing module is used for inputting the user inquiry, the candidate memory, the candidate external knowledge and the candidate internal knowledge into a large language model together, performing conflict detection and fusion processing on the large language model to generate candidate answers, then performing confidence evaluation on the basis of the candidate answers, and executing iteration condition judgment according to the confidence score; The final answer output module is used for selecting the answer with the highest confidence from the generated candidate answers and outputting the answer as a final answer; And the long-term memory database updating module is used for combining the user query and the final answer into an interaction record, storing the interaction record into a history interaction record set, generating a memory abstract, inputting the interaction record, the history interaction record and the memory abstract into a large language model, extracting candidate memory facts, simultaneously retrieving old memories corresponding to the candidate memory facts from a long-term memory database, inputting the candidate memory facts and the corresponding old memories into the large language model together, and determining the updating operation of the long-term memory database by the old memories.
- 9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 7 when the computer program is executed.
- 10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method according to any one of claims 1 to 7.
Description
Retrieval enhancement generation method and system based on long-term memory and multisource knowledge iterative fusion Technical Field The invention relates to the technical field of artificial intelligence, in particular to a retrieval enhancement generation method and system based on iteration fusion of long-term memory and multisource knowledge. Background The large language model (Large Language Model, LLM) is used as an important basic technology in the field of artificial intelligence in recent years, and can learn language structures and semantic rules through training of large-scale corpus, so that the large-scale language model has outstanding text understanding, knowledge reasoning and natural language generating capabilities. In the processing tasks of machine translation, intelligent question and answer, text abstract, information retrieval assistance, intelligent customer service and other natural languages, the large language model shows outstanding comprehensive performance and wide application value. To further enhance the reliability and accuracy of large language models in factual question-answering, knowledge-intensive tasks, and complex reasoning scenarios, search enhancement generation (RETRIEVAL-Augmented Generation, RAG) techniques, which typically enhance the system's ability to exploit external knowledge by retrieving knowledge related to user queries from an external database or collection of documents, are one of the mainstream solutions. However, the existing search enhancement generation technology still has a plurality of defects in long-term application support, multi-source knowledge integration and the like. First, existing RAG systems generally lack a long-term memory mechanism that is accumulative and updateable. Most systems only rely on instant retrieval triggered by single query, and cannot effectively manage long-term and multi-round interaction information between users and the systems. When there are reusable facts, user preferences, or context inference chains in the historical interactions, the system is unable to automatically extract stable memory, and lacks the ability to fuse, correct, or clean the old knowledge, making it difficult for the system to achieve continuous learning and personalized knowledge maintenance. This long-term memory loss places the system in limited performance in terms of facing repetitive tasks, user preference maintenance, cross-session semantic consistency, and the like. Second, the search strategies of existing RAG systems generally lack adaptivity. The traditional method adopts a fixed top-k retrieval mode without considering the dynamic change of the similarity distribution. In actual retrieval, the condition that the similarity is 'cliff-type reduced' often occurs in the retrieval result, and a large amount of low-correlation even noise-level contents are erroneously included in the generation stage by a fixed k mode, so that irrelevant information interference is increased, and the reasoning accuracy and the generation quality of a model are reduced. The lack of detection of similarity trend changes and automatic cut-off mechanism is one of the performance bottlenecks of the existing search strategies. Again, existing RAG systems have limited capabilities in terms of multi-source knowledge fusion. The traditional method generally adopts single-round fusion, one-time input of query and search contents into a large language model is carried out for generation, and a systematic mechanism for carrying out deep integration, conflict detection and evidence screening on knowledge from different sources (such as external knowledge base contents, potential internal knowledge and historical interaction information) is lacked. When redundancy, inconsistencies, or conflicts exist between multi-source content, single round fusion has difficulty in ensuring the logical consistency and the fact reliability of the generated results. Meanwhile, due to the lack of an iterative optimization mechanism based on confidence level or generation quality, the model can not correct and enhance the preliminary generation result through multi-round fusion, and the incomplete answer, inference chain or fact deviation are easily caused. In summary, the existing search enhancement generation technology still has defects in key aspects of long-term memory management, search self-adaption, multi-source knowledge fusion and the like, and is difficult to meet novel application requirements of complex task scenes, multi-source knowledge utilization, long-term learning and the like. Therefore, it is necessary to propose a search enhancement generation method capable of simultaneously fusing long-term memory, external knowledge and internal knowledge of a large language model and having dynamic search, adaptive truncation, conflict detection and iterative fusion capabilities, so as to comprehensively improve the multisource knowledge utilization capability, long-term