User dialogue generation method and system based on memory fusion

By constructing a user memory knowledge base and integrating short-term, long-term, and contextual memory data, the problem of insufficient memory depth and breadth in existing technologies is solved, achieving high reliability and personalized response in the dialogue generation system.

CN120952153APending Publication Date: 2025-11-14E FUND MANAGEMENT CO LTD
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202511003193.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-21
Publication Date
2025-11-14

AI Technical Summary

Technical Problem

Existing technologies are insufficient to meet the needs in terms of the depth, breadth, and dimensions of user dialogue memory, resulting in poor reliability of user responses, easy loss of early content in long short-term memory networks, slow adjustment of knowledge graphs, and failure to effectively integrate short-term and long-term memories in historical dialogue records.

Method used

A user memory knowledge base is constructed using a pre-set knowledge graph tool. Combined with large language models and prompt word engineering technology, short-term, long-term, and contextual memory data are generated and integrated. The memory base is dynamically updated through Euclidean distance and retrieval enhancement algorithms to ensure comprehensive coverage of users' information from recent interactions to distant past.

Benefits of technology

The system achieves high reliability in dialogue generation. By integrating multi-dimensional memory data, it ensures the coherence of dialogue and personalized responses, thereby improving the reliability and real-time nature of user responses.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120952153A_ABST
    Figure CN120952153A_ABST
Patent Text Reader

Abstract

The invention provides a user dialogue generation method and system based on memory fusion, and relates to the technical field of artificial intelligence, and the method comprises the steps: building a user memory knowledge base based on a preset knowledge graph tool; based on the user memory knowledge base, reading current text data input by the current dialogue user and historical text data of the current dialogue user; obtaining short-term memory data, long-term memory data and scene memory data based on the user memory knowledge base, a preset large language model, a preset cue word engineering algorithm, the current text data and the historical text data; and generating a user dialogue based on the preset large language model, the preset cue word engineering algorithm, the short-term memory data, the long-term memory data and the scene memory data. According to the invention, the memory range of the user from recent interaction to long-term important information is fully covered, and the reliability of responding to the user is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence technology, and in particular to a method and system for generating user dialogue based on memory fusion. Background Technology

[0002] The core objective of a dialogue system memory scheme is to enable the system to effectively remember key information from user interactions. By remembering users' historical dialogues, preferences, and knowledge, the system can achieve a deeper understanding of user input and more accurate responses. This memory capability is a key foundation for enhancing the personalization, coherence, and intelligence of the dialogue experience, providing users with more natural and appropriate interactive services.

[0003] Currently, existing technologies mainly employ methods such as Long Short-Term Memory (LSTM) networks, knowledge graphs, and historical dialogue records. LSTM networks utilize bidirectional LSTM neural networks to model dialogue sequences and capture contextual dependencies to improve dialogue coherence. However, they struggle to effectively remember and utilize important early information in complex multi-turn dialogues; LSTM and similar methods are prone to losing early content in extremely long sequences. Knowledge graphs construct knowledge graphs containing entities and relationships, enhancing the system's semantic understanding and knowledge reasoning capabilities to provide more accurate and richer answers. However, they are slow to adapt to new users or new needs and struggle to incorporate new knowledge in rapidly evolving domains. Historical dialogue records collect and utilize users' historical question-and-answer data to optimize dialogue generation models, improving the personalization of dialogues and making them more user-friendly. However, they often process short-term or long-term memory independently, failing to organically integrate short-term, long-term, and contextual memories, resulting in insufficient attention to real-time context or rigid knowledge utilization. Therefore, existing technologies fail to meet users' needs in terms of the depth, breadth, and dimensionality of dialogue memory, leading to poor reliability in responding to users. Summary of the Invention

[0004] To address the aforementioned issues, this invention proposes a user dialogue generation method and system based on memory fusion, which comprehensively covers the user's memory range from recent interactions to important information from a long time ago, thereby improving the reliability of responding to users.

[0005] To achieve the above objectives, embodiments of the present invention provide a user dialogue generation method based on memory fusion, comprising: constructing a user memory knowledge base based on a preset knowledge graph tool; reading current text data input by the current dialogue user and historical text data of the current dialogue user based on the user memory knowledge base; obtaining short-term memory data, long-term memory data, and contextual memory data based on the user memory knowledge base, a preset large language model, a preset prompt word engineering algorithm, current text data, and historical text data; and generating a user dialogue based on the preset large language model, the preset prompt word engineering algorithm, short-term memory data, long-term memory data, and contextual memory data.

[0006] This invention proposes a user dialogue generation method based on memory fusion. It employs a pre-defined knowledge graph tool to construct a user memory knowledge base. By reading real-time text data of the current dialogue and historical dialogue text, and combining a large language model with prompt word engineering technology, it simultaneously generates and integrates three types of structured data: short-term memory, long-term memory, and contextual memory. Finally, the large language model integrates multi-dimensional memory data to generate user dialogue. This solution overcomes the limitations of traditional methods in terms of memory depth, breadth, and dimensionality, enabling the system to comprehensively access the user's complete memory from recent interactions to long-term preferences, significantly improving the reliability of user responses.

[0007] Furthermore, based on the user memory knowledge base, the current text data input by the current dialogue user and the historical text data of the current dialogue user are read, including: obtaining the current dialogue user information; based on a preset user information matching library and the user memory knowledge base, if the preset user information matching library contains the current dialogue user information, then matching the current dialogue user's user memory knowledge base; if the preset user information matching library does not contain the current dialogue user information, then creating the current dialogue user's user memory knowledge base; reading the content input by the current dialogue user and converting the content input by the current dialogue user into current text data according to a text conversion algorithm; and obtaining the current dialogue user's historical text data based on the current dialogue user's user memory knowledge base.

[0008] In the above solution, user information is dynamically matched or a dedicated user memory knowledge base is created. By converting the current input text in real time and calling related historical text data, the depth and breadth of each user's dialogue memory are accurately maintained. In addition, a memory knowledge base is created immediately when a user interacts for the first time, and existing users are directly located in their dedicated memory knowledge base. This solves the response reliability problem caused by the isolation or incomplete coverage of user memory in traditional methods, so that the system always generates dialogue based on continuous and complete user memory, which significantly improves the reliability of user response.

[0009] Furthermore, based on the user memory knowledge base, the preset large language model, the preset prompt word engineering algorithm, the current text data, and the historical text data, short-term memory data, long-term memory data, and contextual memory data are obtained, including: constructing a first prompt word template based on the user memory knowledge base and the preset prompt word engineering algorithm; embedding the first prompt word template into the preset large language model to obtain the first prompt word large language model; and extracting structured key information from the current text data through the prompt word large language model to obtain short-term memory data.

[0010] In the above scheme, a first prompt word template is constructed using a preset prompt word engineering algorithm, and then embedded into a large language model to obtain a first prompt word large language model. This accurately captures the structured key information in the current dialogue to generate short-term memory data, and analyzes the core elements of the user's latest input in real time. This solves the problem of shallow and fragmented memory of recent dialogues in traditional methods, enabling the system to always maintain high-purity real-time memory response and focus on key details, significantly improving the reliability of user responses.

[0011] Furthermore, based on the user memory knowledge base, a preset large language model, a preset prompt word engineering algorithm, current text data, and historical text data, short-term memory data, long-term memory data, and contextual memory data are obtained, including: constructing a second prompt word template based on historical text data and the preset prompt word engineering algorithm; embedding the second prompt word template into the preset large language model to obtain a second prompt word large language model; obtaining historical memory content based on the second prompt word large language model and historical text data, and converting the historical memory content into a first high-dimensional vector; obtaining current memory content based on the second prompt word large language model and current text data, and converting the current memory content into a second high-dimensional vector; storing the first high-dimensional vector in the user memory knowledge base; calculating the Euclidean distance between the first high-dimensional vector and the second high-dimensional vector to obtain the relevance analysis results; performing vector addition or vector replacement operations on the user memory knowledge base based on the relevance analysis results and the second prompt word large language model to update the user memory knowledge base; and retrieving a matching first high-dimensional vector that meets the similarity requirements for the second high-dimensional vector in the user memory knowledge base based on a preset retrieval enhancement algorithm to obtain long-term memory data.

[0012] In the above scheme, a second prompt word template is constructed using historical and current text data. This template drives a large language model for the second prompt word to generate high-dimensional vectors of historical and current memory content. The correlation between old and new memories is quantified using Euclidean distance. Based on the analysis results, vector addition or replacement operations are dynamically performed. Combined with a retrieval enhancement algorithm, highly similar historical vectors are accurately matched in the memory knowledge base to construct long-term memory data covering everything from real-time interactions to distant knowledge. This scheme breaks through the limitations of traditional methods in terms of memory depth and breadth, ensuring that the memory knowledge base always reflects the user's complete memory trajectory and improving the reliability of user responses.

[0013] Furthermore, based on the relevance analysis results and the second prompt word large language model, vector addition or replacement operations are performed on the user's memory knowledge base to update it. This includes: selecting several first high-dimensional vectors and candidate high-dimensional vectors from the vector database based on the relevance analysis results; inputting the candidate high-dimensional vectors and the second high-dimensional vectors into the second prompt word large language model; if there is no second high-dimensional vector identical to the candidate high-dimensional vectors, then the second high-dimensional vector is added to the user's memory knowledge base to update it; if there is a second high-dimensional vector identical to the candidate high-dimensional vectors, then the candidate high-dimensional vectors are replaced with the second high-dimensional vectors to update the user's memory knowledge base.

[0014] In the above scheme, candidate high-dimensional vectors are selected based on the correlation analysis results, and the candidate high-dimensional vectors are input into the second prompt word large language model for conflict detection. When the new vector has no overlap with the candidate vector, the vector is added. If there is a duplicate vector, the vector is replaced. The user's memory knowledge base is dynamically optimized. This method solves the defects of traditional methods in terms of memory depth and breadth by accurately identifying the mutual exclusivity and complementarity of new and old memories, ensuring that the knowledge base continuously covers the key information of the user's full-cycle interaction, and significantly improving the reliability of the user's response.

[0015] Furthermore, based on the user memory knowledge base, the preset large language model, the preset prompt word engineering algorithm, the current text data, and the historical text data, short-term memory data, long-term memory data, and contextual memory data are obtained, including: constructing a third prompt word template based on the current text data and the preset prompt word engineering algorithm; and matching historical text data that meets the semantic similarity requirements from the user memory knowledge base based on the third prompt word template and the preset semantic similarity matching algorithm to obtain contextual memory data.

[0016] In the above scheme, the third prompt word template is constructed using the current text data. The semantic similarity matching algorithm accurately filters related historical texts in the user's memory knowledge base and dynamically generates contextual memory data that is highly adapted to the current dialogue topic. This method breaks through the limitation of the traditional method in the single memory dimension, enabling the system to deeply activate long-standing but relevant historical information, achieve a semantic closed loop with real-time dialogue, significantly improve the contextual coherence of the response and the consistency with the user's intent, and ensure the reliability of the user's response.

[0017] Furthermore, based on a pre-set large language model, a pre-set prompt word engineering algorithm, short-term memory data, long-term memory data, and contextual memory data, user dialogue is generated, including: based on a pre-trained neural network model, decomposing the short-term memory data, long-term memory data, and contextual memory data corresponding to the current text data into a first short-term memory fine-grained segment, a second long-term memory fine-grained segment, and a third contextual memory fine-grained segment; based on a pre-set large language model and a pre-set prompt word engineering algorithm, decomposing the short-term memory data, long-term memory data, and contextual memory data corresponding to the current text data into a second short-term memory fine-grained segment, a second long-term memory fine-grained segment, a second long-term memory fine-grained segment, and a third contextual memory fine-grained segment; The system firstly extracts fine-grained fragments of short-term memory and secondly extracts fine-grained fragments of long-term memory. It then integrates these fragments to obtain fine-grained fragments of short-term memory, long-term memory, and contextual memory. Based on a pre-defined large language model and a pre-defined prompt word engineering algorithm, the system reorganizes these fragments to obtain a dialogue knowledge framework. Finally, it generates a user dialogue based on this knowledge framework.

[0018] In the above scheme, a dual-path approach of pre-trained model and large language model is used to decompose three types of memory data into fine-grained memory fragments. These fragments are then reorganized into a unified dialogue knowledge framework through prompt word engineering. This scheme breaks through the limitations of traditional fragmented use of memory. By deeply integrating fragmented information from short-term, long-term and contextual memories, it constructs a coherent semantic network throughout the entire lifecycle. This enables the generated dialogue to accurately cover the complete memory spectrum of users, from immediate needs to long-term preferences, eliminating response bias caused by missing memory dimensions and improving the reliability of user responses.

[0019] Furthermore, based on short-term memory fine-grained fragments, a pre-set large language model and a pre-set prompt word engineering algorithm are used to query the user's memory knowledge base for long-term memory fine-grained fragments and contextual memory fine-grained fragments that meet pre-set relevance requirements. These short-term memory fine-grained fragments, long-term memory fine-grained fragments, and contextual memory fine-grained fragments are then combined to obtain a dialogue knowledge framework. This includes: constructing a fourth prompt word template based on short-term memory fine-grained fragments and the pre-set prompt word engineering algorithm; based on the fourth prompt word template, using a pre-set large language model, querying the user's memory knowledge base for long-term memory fine-grained fragments and contextual memory fine-grained fragments that meet pre-set relevance requirements to obtain a third long-term memory fine-grained fragment and a third contextual memory fine-grained fragment; and recombining the third long-term memory fine-grained fragment and the third contextual memory fine-grained fragment to obtain the dialogue knowledge framework.

[0020] In the above scheme, a fourth prompt word template is constructed using fine-grained fragments of short-term memory. This drives a pre-set large language model to accurately query long-term and contextual memory fragments with sufficient relevance in the user's memory knowledge base. By dynamically recombining these two types of cross-time period memory elements, a dialogue knowledge framework is formed. This scheme overcomes the shortcomings of traditional methods, such as slow retrieval of long-term information and weak contextual relevance. It activates deep historical knowledge by using real-time memory as an index, constructs a complete semantic chain covering everything from immediate needs to long-term context, solves the response bias caused by fragmented memory dimensions, and significantly improves the reliability of user responses.

[0021] Furthermore, the user dialogue generation method based on memory fusion proposed in this embodiment of the invention further includes, after each user dialogue generation, the following steps: storing short-term memory data, long-term memory data, and contextual memory data into a user memory knowledge base; dividing each memory data in the user memory knowledge base into important memory data and unimportant memory data based on preset importance requirements; adding connections between important memory data and deleting connections between unimportant memory data to obtain optimized memory data; receiving user feedback data in real time and converting the user feedback data into a third high-dimensional vector and updating the third high-dimensional vector in the user memory knowledge base.

[0022] In the above scheme, after each dialogue is generated, three types of memory data are dynamically stored in the memory knowledge base. Then, key memory levels are divided according to preset importance requirements. Connections are added between important memories to strengthen semantic associations, and redundant connections of unimportant memories are deleted to purify the knowledge network. At the same time, user feedback is converted into high-dimensional vectors in real time and updated into the database. This scheme solves the shortcomings of traditional methods in terms of memory depth and breadth by continuously optimizing the memory topology and feedback-driven dynamic learning, ensuring that the knowledge base always covers high-value full-cycle user memories and significantly improving the reliability of user responses.

[0023] This invention also provides a user dialogue generation system based on memory fusion, comprising: a user memory knowledge base construction module, a text data acquisition module, a memory data acquisition module, and a user dialogue generation module; the user memory knowledge base construction module is used to construct a user memory knowledge base based on a preset knowledge graph tool; the text data acquisition module is used to read the current text data input by the current dialogue user and the historical text data of the current dialogue user based on the user memory knowledge base; the memory data acquisition module is used to obtain short-term memory data, long-term memory data, and contextual memory data based on the user memory knowledge base, a preset large language model, a preset prompt word engineering algorithm, the current text data, and the historical text data; the user dialogue generation module is used to generate user dialogue based on the preset large language model, the preset prompt word engineering algorithm, the short-term memory data, the long-term memory data, and the contextual memory data.

[0024] This invention proposes a user dialogue generation system based on memory fusion. The user memory knowledge base construction module uses a pre-defined knowledge graph tool to build the user memory knowledge base. The text data acquisition module reads real-time text data of the current dialogue and historical dialogue text. The memory data acquisition module combines a large language model and prompt word engineering technology to simultaneously generate and fuse three types of structured data: short-term memory, long-term memory, and contextual memory. Finally, the user dialogue generation module uses a large language model to integrate multi-dimensional memory data to generate user dialogue. This solution overcomes the limitations of traditional methods in terms of memory depth, breadth, and dimension, enabling the system to comprehensively access the user's complete memory from recent interactions to long-term preferences, significantly improving the reliability of user responses. Attached Figure Description

[0025] Figure 1 A flowchart illustrating the steps of a user dialogue generation method based on memory fusion, provided in a certain embodiment of the present invention;

[0026] Figure 2 This is a schematic diagram of the module structure of a user dialogue generation system based on memory fusion, provided in a certain embodiment of the present invention. Detailed Implementation

[0027] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0028] Example 1

[0029] See Figure 1 , Figure 1 This is a flowchart illustrating the steps of a user dialogue generation method based on memory fusion, provided in a certain embodiment of the present invention. Figure 1 As shown, this embodiment of the invention proposes a user dialogue generation method based on memory fusion, including steps 101 to 104, each step of which is as follows:

[0030] Step 101: Construct a user memory knowledge base based on a pre-set knowledge graph tool;

[0031] Step 102: Based on the user's memory knowledge base, read the current text data input by the current user in the current conversation and the historical text data of the current user in the current conversation;

[0032] Step 103: Based on the user's memory knowledge base, the preset large language model, the preset prompt word engineering algorithm, the current text data and historical text data, obtain short-term memory data, long-term memory data and episodic memory data;

[0033] Step 104: Generate user dialogue based on the preset large language model, preset prompt word engineering algorithm, short-term memory data, long-term memory data, and contextual memory data.

[0034] One preferred implementation involves using a knowledge graph tool to parse and structure the raw data, constructing a user memory knowledge base. The knowledge graph tool can be open-source, such as GraphRAG. When data is stored in the user memory knowledge base, based on key information such as people, places, events, and their relationships, the knowledge graph tool constructs a semantic relationship graph and vector index for the unstructured text. This stores the unstructured text in the user memory knowledge base for easy retrieval and summarization. Then, the current text data input by the user in the current dialogue and the corresponding user's historical text data are retrieved from the user memory knowledge base. Next, cue word engineering technology is used to design specialized cue word templates to guide a pre-defined large language model to extract key information from the user's current dialogue turn. This ensures that the pre-defined large language model can accurately identify key information such as user intent, core questions, and mentioned entities. The cue word templates can be customized according to the dialogue scenario and objectives, and the pre-defined large language model can be implemented using existing mature technologies. For short-term memory, the corresponding cue word template guides the pre-defined large language model to extract key information from the current text data. Typically, the cue word template for short-term memory can be: the user's core... The system retrieves questions and key entities mentioned, and outputs structured data in key-value pairs or JSON format, both of which facilitate rapid retrieval and use of short-term memory data during subsequent searches and matching. For long-term memory, a cue word template is first constructed from historical text data. Key information is extracted from the historical text based on the cue word template; typically, the cue word template for long-term memory includes user knowledge, experiences, and preferences. Then, vectorized processing is applied to the current and historical text data to generate long-term memory data. For contextual memory, a cue word template is constructed from the current text data. This template allows for the extraction of key information from the current text data, such as keywords and themes of the current dialogue. Based on this extracted key information, a series of memory entries most relevant to the current context are quickly retrieved from the user's knowledge base, thus obtaining contextual memory data. Finally, a pre-defined large model is used to fuse short-term, long-term, and contextual memory data to generate user dialogue. This typically involves splitting, reorganizing, and digesting memories from different sources and in different forms to fuse them, thereby enabling a rapid and reliable user dialogue response based on the user's input text data.

[0035] This invention proposes a user dialogue generation method based on memory fusion. It employs a pre-defined knowledge graph tool to construct a user memory knowledge base. By reading real-time text data of the current dialogue and historical dialogue text, and combining a large language model with prompt word engineering technology, it simultaneously generates and integrates three types of structured data: short-term memory, long-term memory, and contextual memory. Finally, the large language model integrates multi-dimensional memory data to generate user dialogue. This solution overcomes the limitations of traditional methods in terms of memory depth, breadth, and dimensionality, enabling the system to comprehensively access the user's complete memory from recent interactions to long-term preferences, significantly improving the reliability of user responses.

[0036] Furthermore, based on the user memory knowledge base, the current text data input by the current dialogue user and the historical text data of the current dialogue user are read, including: obtaining the current dialogue user information; based on a preset user information matching library and the user memory knowledge base, if the preset user information matching library contains the current dialogue user information, then matching the current dialogue user's user memory knowledge base; if the preset user information matching library does not contain the current dialogue user information, then creating the current dialogue user's user memory knowledge base; reading the content input by the current dialogue user and converting the content input by the current dialogue user into current text data according to a text conversion algorithm; and obtaining the current dialogue user's historical text data based on the current dialogue user's user memory knowledge base.

[0037] As a preferred implementation method, a knowledge graph tool is used to parse and structure the raw data, constructing a user memory knowledge base. The knowledge graph tool can be, for example, the open-source GraphRAG. When data is stored in the user memory knowledge base, based on key information such as people, places, events, and their relationships, a semantic relationship graph and vector index are constructed for the unstructured text. This stores the unstructured text in the user memory knowledge base for easy retrieval and summarization. The user information of the current user is identified, and a user information matching database is used to determine if the user is an existing user. If the user information is already stored in the matching database, the user is an existing user, and the user memory knowledge base containing that user information is directly accessed. If the user information is not stored in the matching database, the user is a new user, and a user memory knowledge base containing that user information can be constructed for easy retrieval in the future. Since new users do not have historical text data, in this embodiment of the invention, a comprehensive search query is used to traverse all user memory knowledge bases for new users. Specifically, when… After a new user initiates a dialogue, the system queries and retrieves relevant user memory knowledge bases based on the current text data input by the new user. It then attempts to respond to the new user. Based on the new user's feedback or newly input text data, the system continuously updates the user memory knowledge base, optimizing the generated dialogue. It's important to note that querying and retrieving relevant user memory knowledge bases only provides a direction for dialogue generation; privacy data in other user memory knowledge bases must be protected, and private data should not be directly used for dialogue generation. Once the user memory knowledge base is constructed, existing mature text conversion algorithms are used to convert the user's input into current text data, and historical text data is prepared from the user memory knowledge base. User input can include text, images, and voice. In this embodiment, the user memory knowledge base can include modules such as short-term memory, long-term memory, contextual memory, and user data feedback storage to receive and store corresponding data, facilitating quick retrieval of relevant modules and improving the efficiency of dialogue generation.

[0038] In the above solution, user information is dynamically matched or a dedicated user memory knowledge base is created. By converting the current input text in real time and calling related historical text data, the depth and breadth of each user's dialogue memory are accurately maintained. In addition, a memory knowledge base is created immediately when a user interacts for the first time, and existing users are directly located in their dedicated memory knowledge base. This solves the response reliability problem caused by the isolation or incomplete coverage of user memory in traditional methods, so that the system always generates dialogue based on continuous and complete user memory, which significantly improves the reliability of user response.

[0039] Furthermore, based on the user memory knowledge base, the preset large language model, the preset prompt word engineering algorithm, the current text data, and the historical text data, short-term memory data, long-term memory data, and contextual memory data are obtained, including: constructing a first prompt word template based on the user memory knowledge base and the preset prompt word engineering algorithm; embedding the first prompt word template into the preset large language model to obtain the first prompt word large language model; and extracting structured key information from the current text data through the prompt word large language model to obtain short-term memory data.

[0040] As a preferred implementation method, for short-term memory, a pre-defined large language model is guided by corresponding cue word templates to extract key information from the current text data. Typically, the cue word templates for short-term memory can be the user's core question and the key entities mentioned. The final output is structured data, which can be in key-value pair or JSON format. Both formats facilitate rapid reading and use of short-term memory data during subsequent retrieval and matching. It's worth noting that short-term memory primarily focuses on the user's recent interactions and recently provided information, with timeliness as its core. By capturing key information in the user's current dialogue round in real time, such as the dialogue topic, key points of the user's question, and specific objects mentioned, it quickly stores this information in the short-term memory module. This real-time information capture and storage allows the system to accurately grasp the immediate context of the dialogue, providing strong support for the coherence of subsequent rounds. For example, in a multi-round dialogue, a user might further inquire about the price and performance details of a specific product mentioned in a previous round. Short-term memory ensures that the system accurately recalls product information from the previous round, thus providing an answer that fits the current context. Specifically… A first prompt word template is constructed using prompt word engineering technology. This template includes the user's intent, core question, and mentioned entities. The dialogue text input by the user in the current round (i.e., the current text data) is input into a large language model. The first prompt word template is embedded into the input of the large language model, guiding it to focus on the key information corresponding to the template and generating structured data containing this key information. The data output format can be key-value pairs, etc. For example, in a certain round, the user's current text data, through the process of acquiring short-term memory data, reveals that the user's core question is "the specific question the user is asking," the key entities are "the names of people, places, and products mentioned by the user," and the user's dialogue intent is "the purpose of the user's question, such as consultation, complaint, or suggestion." After extracting the short-term memory data, it is stored in a short-term memory module. This module can be a dedicated database or caching system set up in the user's memory knowledge base to quickly store and retrieve key information from the current dialogue round. The key information is stored as key-value pairs or JSON format for easy retrieval and use in subsequent dialogues.

[0041] In the above scheme, a first prompt word template is constructed using a preset prompt word engineering algorithm, and then embedded into a large language model to obtain a first prompt word large language model. This accurately captures the structured key information in the current dialogue to generate short-term memory data, and analyzes the core elements of the user's latest input in real time. This solves the problem of shallow and fragmented memory of recent dialogues in traditional methods, enabling the system to always maintain high-purity real-time memory response and focus on key details, significantly improving the reliability of user responses.

[0042] Furthermore, based on the user memory knowledge base, a preset large language model, a preset prompt word engineering algorithm, current text data, and historical text data, short-term memory data, long-term memory data, and contextual memory data are obtained, including: constructing a second prompt word template based on historical text data and the preset prompt word engineering algorithm; embedding the second prompt word template into the preset large language model to obtain a second prompt word large language model; obtaining historical memory content based on the second prompt word large language model and historical text data, and converting the historical memory content into a first high-dimensional vector; obtaining current memory content based on the second prompt word large language model and current text data, and converting the current memory content into a second high-dimensional vector; storing the first high-dimensional vector in the user memory knowledge base; calculating the Euclidean distance between the first high-dimensional vector and the second high-dimensional vector to obtain the relevance analysis results; performing vector addition or vector replacement operations on the user memory knowledge base based on the relevance analysis results and the second prompt word large language model to update the user memory knowledge base; and retrieving a matching first high-dimensional vector that meets the similarity requirements for the second high-dimensional vector in the user memory knowledge base based on a preset retrieval enhancement algorithm to obtain long-term memory data.

[0043] As a preferred implementation method, for long-term memory, the first step is to construct corresponding cue word templates from historical text data. Key information is then extracted from the historical text based on these templates. Typically, long-term memory cue word templates can include user knowledge, experiences, and preferences. Then, vectorized processing is applied to the current and historical text data to generate long-term memory data. Long-term memory encompasses users' long-standing but important knowledge, experiences, and preferences, which is crucial for understanding users and providing personalized services. Long-term memory is represented in text form, such as "the user likes playing basketball." This embodiment of the invention uses a large language model to extract long-term memory from dialogues and employs a parallel approach of retrieval enhancement and knowledge graphs to achieve efficient storage and retrieval of long-term memory. First, based on the capabilities of the large language model, text data such as the user's historical dialogue records and past interaction logs (equivalent to historical text data) are input into the large language model. Through predefined cue word templates (equivalent to second cue word templates), the model is guided to extract user knowledge, experiences, and preferences. Then, through embedding... The model transforms historical memory content into high-dimensional vectors (equivalent to the first high-dimensional vector) and stores it in a dedicated vector database of user memory knowledge base as both text and vectors. When new memory content is added, the current text data is transformed into a second high-dimensional vector. The correlation between the new content vector (equivalent to the second high-dimensional vector) and existing vectors (equivalent to the first high-dimensional vector) is calculated. The k most relevant (usually 5) existing vectors (equivalent to the first high-dimensional vector) are selected. The new content vector (equivalent to the second high-dimensional vector) and the selected k most relevant vectors are input into the larger model. A second prompt word guides the larger model to determine whether a new independent memory (text and corresponding vector) should be added to the vector database of user memory knowledge base. The replacement is based on the existing text and corresponding vectors in the memory. In this embodiment, relevance refers to the Euclidean distance between two vectors in high-dimensional space. The closer the distance, the higher the relevance between the two. During the query, the vector similarity matching algorithm (i.e., the retrieval enhancement algorithm) is used to quickly return the memory content (including text, vectors, and similarity to the current dialogue) that is most relevant to the current dialogue or query needs from the vector database of the user's memory knowledge base. This flexibly responds to the dynamic changes in memory content and achieves efficient retrieval in large-scale data. For example, for the user's past travel experiences, the system can convert the destination, time, experience, and other information of each trip into vectors. When the user mentions travel-related topics again, the system can quickly retrieve the past memory that best matches it.For the management and storage of long-term memory, knowledge graph tools can also be used. Knowledge graph updates occur after each round of dialogue, although longer time intervals can be used in practice. During the update process, firstly, a large model and predefined prompt word templates (i.e., second prompt word templates) are used to perform entity recognition and relation extraction on the user-provided text data, extracting key information such as people, places, events, and their relationships. Then, a semantic relationship graph or vector index is incrementally constructed, transforming this unstructured text into a knowledge base that is easy to retrieve and summarize. The advantage of knowledge graphs lies in their ability to clearly display the connections between knowledge points, providing the system with a deeper level of semantic understanding. For example, for a complex family relationship description input by a user, a knowledge graph can transform it into an intuitive network of interpersonal relationships, facilitating accurate referencing and reasoning in subsequent dialogues.

[0044] In the above scheme, a second prompt word template is constructed using historical and current text data. This template drives a large language model for the second prompt word to generate high-dimensional vectors of historical and current memory content. The correlation between old and new memories is quantified using Euclidean distance. Based on the analysis results, vector addition or replacement operations are dynamically performed. Combined with a retrieval enhancement algorithm, highly similar historical vectors are accurately matched in the memory knowledge base to construct long-term memory data covering everything from real-time interactions to distant knowledge. This scheme breaks through the limitations of traditional methods in terms of memory depth and breadth, ensuring that the memory knowledge base always reflects the user's complete memory trajectory and improving the reliability of user responses.

[0045] Furthermore, based on the relevance analysis results and the second prompt word large language model, vector addition or replacement operations are performed on the user's memory knowledge base to update it. This includes: selecting several first high-dimensional vectors and candidate high-dimensional vectors from the vector database based on the relevance analysis results; inputting the candidate high-dimensional vectors and the second high-dimensional vectors into the second prompt word large language model; if there is no second high-dimensional vector identical to the candidate high-dimensional vectors, then the second high-dimensional vector is added to the user's memory knowledge base to update it; if there is a second high-dimensional vector identical to the candidate high-dimensional vectors, then the candidate high-dimensional vectors are replaced with the second high-dimensional vectors to update the user's memory knowledge base.

[0046] As a preferred implementation method, firstly, based on the capabilities of a large language model, text data such as the user's historical dialogue records and past interaction logs (equivalent to historical text data) are input into the large language model. Using predefined prompt word templates (equivalent to second prompt word templates), the model is guided to extract information such as the user's knowledge, experience, and preferences. Then, through an embedding model, the historical memory content is transformed into a high-dimensional vector form (equivalent to the first high-dimensional vector), and stored in a dedicated user memory knowledge base vector database in both text and vector form. When new memory content is added, the current text data memory content is transformed into a second high-dimensional vector. The correlation between the new content vector (equivalent to the second high-dimensional vector) and existing vectors (equivalent to the first high-dimensional vector) is calculated. The k most relevant existing vectors (equivalent to candidate high-dimensional vectors, usually 5) are selected. The new content vector (equivalent to the second high-dimensional vector) and the selected k most relevant vectors are input into the large language model. The second prompt word guides the large language model to determine whether a new independent memory (text and vector) should be added to the user memory knowledge base vector database. The process involves either replacing the existing text and its corresponding vector, or replacing it based on the existing memory text and its corresponding vector. Specifically, the second cue word language model performs two operations: "addition" and "replacement." The second cue word language model compares the new content with the retrieved memory to determine which operation to perform. The conditions for performing "addition" and "replacement" are then explained: "If the new content contains new information that does not exist in the existing memory, the addition operation should be performed." "If the new content contains information that exists in the existing memory but there is a conflict, the replacement operation should be performed." It's worth noting that if the information in the existing memory and the elements in the new content convey the same message, the content with the most information is merged and retained.

[0047] In the above scheme, candidate high-dimensional vectors are selected based on the correlation analysis results, and the candidate high-dimensional vectors are input into the second prompt word large language model for conflict detection. When the new vector has no overlap with the candidate vector, the vector is added. If there is a duplicate vector, the vector is replaced. The user's memory knowledge base is dynamically optimized. This method solves the defects of traditional methods in terms of memory depth and breadth by accurately identifying the mutual exclusivity and complementarity of new and old memories, ensuring that the knowledge base continuously covers the key information of the user's full-cycle interaction, and significantly improving the reliability of the user's response.

[0048] Furthermore, based on the user memory knowledge base, the preset large language model, the preset prompt word engineering algorithm, the current text data, and the historical text data, short-term memory data, long-term memory data, and contextual memory data are obtained, including: constructing a third prompt word template based on the current text data and the preset prompt word engineering algorithm; and matching historical text data that meets the semantic similarity requirements from the user memory knowledge base based on the third prompt word template and the preset semantic similarity matching algorithm to obtain contextual memory data.

[0049] As a preferred implementation method, for contextual memory, a corresponding prompt word template is constructed from the current text data. This prompt word template allows for the extraction of key information from the current text data, such as keywords and themes of the current dialogue. Then, based on the extracted key information, a series of memory entries most relevant to the current context are quickly retrieved from the user's memory knowledge base, thus obtaining contextual memory data. Contextual memory focuses on accurately retrieving relevant content from the user's personal knowledge base based on the current dialogue or task. When a user initiates a new dialogue topic or task, the prompt word template (third prompt word template) extracts keywords and themes from the current dialogue and sends a query request to the contextual memory module. The user's memory knowledge base vector database quickly returns a series of memory entries most relevant to the current context (equivalent to meeting the semantic similarity requirement) based on semantic similarity matching. For example, when a user asks about the background of a historical event, contextual memory can retrieve past learning materials and discussion records related to that historical event from the user's personal knowledge base, providing comprehensive answer materials.

[0050] In the above scheme, the third prompt word template is constructed using the current text data. The semantic similarity matching algorithm accurately filters related historical texts in the user's memory knowledge base and dynamically generates contextual memory data that is highly adapted to the current dialogue topic. This method breaks through the limitation of the traditional method in the single memory dimension, enabling the system to deeply activate long-standing but relevant historical information, achieve a semantic closed loop with real-time dialogue, significantly improve the contextual coherence of the response and the consistency with the user's intent, and ensure the reliability of the user's response.

[0051] Furthermore, based on a pre-set large language model, a pre-set prompt word engineering algorithm, short-term memory data, long-term memory data, and contextual memory data, user dialogue is generated, including: based on a pre-trained neural network model, decomposing the short-term memory data, long-term memory data, and contextual memory data corresponding to the current text data into a first short-term memory fine-grained segment, a second long-term memory fine-grained segment, and a third contextual memory fine-grained segment; based on a pre-set large language model and a pre-set prompt word engineering algorithm, decomposing the short-term memory data, long-term memory data, and contextual memory data corresponding to the current text data into a second short-term memory fine-grained segment, a second long-term memory fine-grained segment, a second long-term memory fine-grained segment, and a third contextual memory fine-grained segment; The system firstly extracts fine-grained fragments of short-term memory and secondly extracts fine-grained fragments of long-term memory. It then integrates these fragments to obtain fine-grained fragments of short-term memory, long-term memory, and contextual memory. Based on a pre-defined large language model and a pre-defined prompt word engineering algorithm, the system reorganizes these fragments to obtain a dialogue knowledge framework. Finally, it generates a user dialogue based on this knowledge framework.

[0052] As a preferred implementation method, when a user initiates a new dialogue turn, relevant memory content is first retrieved from various memory levels (short-term memory, long-term memory, and episodic memory). Then, these memories are further decomposed into smaller and finer-grained memory fragments using a pre-trained BERT model (equivalent to a pre-trained neural network model) and a pre-set prompt word + large model (equivalent to a pre-set large language model and a pre-set prompt word engineering algorithm). The BERT model is mainly used to identify emotions in the memory and extract information such as the entities involved, while the prompt word + large model is mainly used for dialogue decomposition. For example, a complete dialogue memory is broken down into multiple fine-grained fragments such as questions, answers, entities involved, and expressed emotions. The purpose of this decomposition operation is to break the original structural limitations of memory, allowing memories from different sources and in different forms to participate in the subsequent fusion process in a more flexible way. Based on the decomposition, the system reorganizes these fine-grained memory fragments according to the current dialogue topic, the user's intention, and contextual needs to obtain a dialogue knowledge framework and generate the user dialogue.

[0053] In the above scheme, a dual-path approach of pre-trained model and large language model is used to decompose three types of memory data into fine-grained memory fragments. These fragments are then reorganized into a unified dialogue knowledge framework through prompt word engineering. This scheme breaks through the limitations of traditional fragmented use of memory. By deeply integrating fragmented information from short-term, long-term and contextual memories, it constructs a coherent semantic network throughout the entire lifecycle. This enables the generated dialogue to accurately cover the complete memory spectrum of users, from immediate needs to long-term preferences, eliminating response bias caused by missing memory dimensions and improving the reliability of user responses.

[0054] Furthermore, based on short-term memory fine-grained fragments, a pre-set large language model and a pre-set prompt word engineering algorithm are used to query the user's memory knowledge base for long-term memory fine-grained fragments and contextual memory fine-grained fragments that meet pre-set relevance requirements. These short-term memory fine-grained fragments, long-term memory fine-grained fragments, and contextual memory fine-grained fragments are then combined to obtain a dialogue knowledge framework. This includes: constructing a fourth prompt word template based on short-term memory fine-grained fragments and the pre-set prompt word engineering algorithm; based on the fourth prompt word template, using a pre-set large language model, querying the user's memory knowledge base for long-term memory fine-grained fragments and contextual memory fine-grained fragments that meet pre-set relevance requirements to obtain a third long-term memory fine-grained fragment and a third contextual memory fine-grained fragment; and recombining the third long-term memory fine-grained fragment and the third contextual memory fine-grained fragment to obtain the dialogue knowledge framework.

[0055] As a preferred implementation method, based on the decomposition, the system reorganizes these fine-grained memory fragments according to the current dialogue topic, user intent, and contextual needs. This is achieved through a combination of prompt words and a large model (equivalent to a fourth prompt word template and a preset large language model). During the reorganization process, the prompt word template (equivalent to a fourth prompt word template) guides the large language model to consider the logical relationships between the various fine-grained memory fragments, such as causal relationships, temporal order, and semantic associations. The large language model is also required to perform a certain degree of reasonable reasoning, and finally outputs the reorganized content in text form. For example, when a user is discussing a technical issue, the system can combine the technical difficulty fragments just mentioned by the user in short-term memory (equivalent to short-term memory fine-grained fragments), the related (equivalent to meeting preset relevance requirements) technical principle fragments stored in long-term memory (equivalent to third long-term memory fine-grained fragments), and the solution case fragments of similar problems (equivalent to meeting preset relevance requirements) in contextual memory (equivalent to third contextual memory fine-grained fragments) to form a complete knowledge framework around the current technical issue. This makes the memory information more logical and targeted, laying the foundation for generating high-quality answers.

[0056] In the above scheme, a fourth prompt word template is constructed using fine-grained fragments of short-term memory. This drives a pre-set large language model to accurately query long-term and contextual memory fragments with sufficient relevance in the user's memory knowledge base. By dynamically recombining these two types of cross-time period memory elements, a dialogue knowledge framework is formed. This scheme overcomes the shortcomings of traditional methods, such as slow retrieval of long-term information and weak contextual relevance. It activates deep historical knowledge by using real-time memory as an index, constructs a complete semantic chain covering everything from immediate needs to long-term context, solves the response bias caused by fragmented memory dimensions, and significantly improves the reliability of user responses.

[0057] Furthermore, the user dialogue generation method based on memory fusion proposed in this embodiment of the invention further includes, after each user dialogue generation, the following steps: storing short-term memory data, long-term memory data, and contextual memory data into a user memory knowledge base; dividing each memory data in the user memory knowledge base into important memory data and unimportant memory data based on preset importance requirements; adding connections between important memory data and deleting connections between unimportant memory data to obtain optimized memory data; receiving user feedback data in real time and converting the user feedback data into a third high-dimensional vector and updating the third high-dimensional vector in the user memory knowledge base.

[0058] As a preferred implementation method, the user's thought patterns, expression habits, and knowledge system can be gradually mastered by digesting the memory content and repeatedly learning from the fused memory information. During this digestion process, on the one hand, for data stored in the user's memory knowledge base, the connection methods between memory fragments are continuously optimized. Connections are added between memory fragments deemed important by the larger model during the reorganization process, while connections between unimportant fragments are deleted. On the other hand, data stored in the vector database is also deleted according to its importance. Furthermore, the memory fusion strategy can be further adjusted based on user feedback, such as user satisfaction ratings and corrections. The memory fusion strategy includes decomposition and reorganization, making the fused memory more aligned with the user's actual needs. User feedback is stored in a separate vector database (equivalent to the user data feedback storage module of the user's memory knowledge base) in the form of text + corresponding vectors. During the reorganization process, the most relevant feedback to the current scenario can be recalled from this database based on vector similarity, and a small sample (few) of feedback can be retrieved. The retrieved feedback is added in text form to the cue words used in the reconstruction process in the form of a shot. For example, if a user repeatedly agrees with the answer generated by the system based on a certain memory combination, the system will add this information to the cue words when encountering similar scenarios to increase the probability of this combination being applied in similar situations in the future. The updating of user feedback data can adopt the same processing method used in long-term memory processing with knowledge graph tools, which will not be elaborated here.

[0059] In the above scheme, after each dialogue is generated, three types of memory data are dynamically stored in the memory knowledge base. Then, key memory levels are divided according to preset importance requirements. Connections are added between important memories to strengthen semantic associations, and redundant connections of unimportant memories are deleted to purify the knowledge network. At the same time, user feedback is converted into high-dimensional vectors in real time and updated into the database. This scheme solves the shortcomings of traditional methods in terms of memory depth and breadth by continuously optimizing the memory topology and feedback-driven dynamic learning, ensuring that the knowledge base always covers high-value full-cycle user memories and significantly improving the reliability of user responses.

[0060] To further explain the implementation process of the user dialogue generation method based on memory fusion proposed in this embodiment of the invention, a specific conversation is used as an example for explanation, as follows:

[0061] A user initiates the current conversation. The system checks if the user is an existing user, accesses the user's user memory knowledge base, and retrieves the current user's text data as "What about last Friday's post?". The user's dialogue is then processed as follows:

[0062] (1) Retrieve relevant short-term memory: "Intent": "Document understanding", "Core issue": "Introduce the main points of this report";

[0063] (2) Retrieve relevant long-term memory: "The user is interested in purchasing", "The user bought product xx", "The product manager of product xx is Zhang San";

[0064] (3) The retrieved contextual memory: "Last Friday, a user uploaded a report on xxx, and the author was Zhang San";

[0065] Then, a pre-set large model is used for decomposition and recombination. The specific steps are as follows:

[0066] (1) Decomposition: "Question": "Summary of the main points of the document", "Entity": "xx product", "xxx report", "Zhang San", "Emotion": "Neutral";

[0067] (2) Reorganization: After reorganizing and organizing the above information, the following user dialogue was obtained: "The report from last Friday contained the following: xxxx. Read and summarize the main points of the report."

[0068] Then, the knowledge graph is updated by adding the connection "User—Follow—>Zhang San," indicating that the system discovered that the user is following Zhang San in this round. The vector library is updated by adding "User follows Zhang San" to the vector library, and the memory fusion strategy is adjusted. The next time the user talks about purchasing and products, the prompt word template of the large language model will add the prompt word "User follows xx product and Zhang San." If the user likes the generated user dialogue, the user feedback data is stored in the user memory knowledge base, which will assist in the generation of user dialogue in the next round of dialogue.

[0069] Example 2

[0070] See Figure 2 , Figure 2 This is a schematic diagram of the module structure of a user dialogue generation system based on memory fusion, provided as an embodiment of the present invention. Figure 2 As shown in the figure, this embodiment of the invention proposes a user dialogue generation system based on memory fusion, including: a user memory knowledge base construction module 201, a text data acquisition module 202, a memory data acquisition module 203, and a user dialogue generation module 204; the user memory knowledge base construction module 201 is used to construct a user memory knowledge base based on a preset knowledge graph tool; the text data acquisition module 202 is used to read the current text data input by the current dialogue user and the historical text data of the current dialogue user based on the user memory knowledge base; the memory data acquisition module 203 is used to obtain short-term memory data, long-term memory data, and contextual memory data based on the user memory knowledge base, a preset large language model, a preset prompt word engineering algorithm, current text data, and historical text data; the user dialogue generation module 204 is used to generate user dialogue based on the preset large language model, the preset prompt word engineering algorithm, short-term memory data, long-term memory data, and contextual memory data.

[0071] This invention proposes a user dialogue generation system based on memory fusion. The user memory knowledge base construction module uses a pre-defined knowledge graph tool to build the user memory knowledge base. The text data acquisition module reads real-time text data of the current dialogue and historical dialogue text. The memory data acquisition module combines a large language model and prompt word engineering technology to simultaneously generate and fuse three types of structured data: short-term memory, long-term memory, and contextual memory. Finally, the user dialogue generation module uses a large language model to integrate multi-dimensional memory data to generate user dialogue. This solution overcomes the limitations of traditional methods in terms of memory depth, breadth, and dimension, enabling the system to comprehensively access the user's complete memory from recent interactions to long-term preferences, significantly improving the reliability of user responses.

[0072] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the technical principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

[0073] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. Furthermore, the described specific features, structures, materials, or characteristics may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of those different embodiments or examples.

[0074] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "a plurality of" means two or more, unless otherwise explicitly specified.

Claims

1. A user dialogue generation method based on memory fusion, characterized in that, include: A user memory knowledge base is built based on a pre-set knowledge graph tool; Based on the user memory knowledge base, read the current text data input by the current dialogue user and the historical text data of the current dialogue user; Based on the user memory knowledge base, the preset large language model, the preset prompt word engineering algorithm, the current text data and the historical text data, short-term memory data, long-term memory data and episodic memory data are obtained; User dialogue is generated based on the preset large language model, the preset prompt word engineering algorithm, the short-term memory data, the long-term memory data, and the contextual memory data.

2. The user dialogue generation method based on memory fusion as described in claim 1, characterized in that, The step of reading the current text data input by the current user and the historical text data of the current user based on the user's memory knowledge base includes: Get information about the users currently in the conversation; Based on the preset user information matching library and the user memory knowledge base, if the preset user information matching library is in the current dialogue user information, then the user memory knowledge base of the current dialogue user is matched. If the current conversation user information does not exist in the preset user information matching library, then a user memory knowledge base for the current conversation user is created. Read the content input by the current user in the conversation, and convert the content input by the current user in the conversation into the current text data according to the text conversion algorithm; Based on the user memory knowledge base of the current dialogue user, the historical text data of the current dialogue user is obtained.

3. The user dialogue generation method based on memory fusion as described in claim 1, characterized in that, Based on the user memory knowledge base, the preset large language model, the preset prompt word engineering algorithm, the current text data, and the historical text data, short-term memory data, long-term memory data, and episodic memory data are obtained, including: Based on the user memory knowledge base and the preset prompt word engineering algorithm, a first prompt word template is constructed; The first prompt word template is embedded into the preset large language model to obtain the first prompt word large language model; The structured key information of the current text data is extracted using the cue word large language model to obtain short-term memory data.

4. The user dialogue generation method based on memory fusion as described in claim 3, characterized in that, Based on the user memory knowledge base, the preset large language model, the preset prompt word engineering algorithm, the current text data, and the historical text data, short-term memory data, long-term memory data, and episodic memory data are obtained, including: Based on the historical text data and the preset prompt word engineering algorithm, a second prompt word template is constructed; The second prompt word template is embedded into the preset large language model to obtain the second prompt word large language model; Based on the second prompt word large language model and the historical text data, the historical memory content is obtained and the historical memory content is transformed into a first high-dimensional vector; Based on the second prompt word large language model and the current text data, the current memory content is obtained and the current memory content is transformed into a second high-dimensional vector; Store the first high-dimensional vector in the user memory knowledge base; Calculate the Euclidean distance between the first high-dimensional vector and the second high-dimensional vector to obtain the correlation analysis results; Based on the correlation analysis results and the second prompt word large language model, vector addition or vector replacement operations are performed on the user memory knowledge base to update the user memory knowledge base; Based on a preset retrieval enhancement algorithm, a first high-dimensional vector that meets the similarity requirement is retrieved from the user's memory knowledge base for the second high-dimensional vector, thereby obtaining long-term memory data.

5. The user dialogue generation method based on memory fusion as described in claim 4, characterized in that, Based on the correlation analysis results and the second prompt word large language model, vector addition or vector replacement operations are performed on the user memory knowledge base to update the user memory knowledge base, including: Based on the correlation analysis results, several first high-dimensional vectors and candidate high-dimensional vectors are selected from the vector database. The candidate high-dimensional vector and the second high-dimensional vector are input into the second prompt word large language model. If there is no second high-dimensional vector that is the same as the candidate high-dimensional vector, the second high-dimensional vector is added to the user memory knowledge base to update the user memory knowledge base. If a second high-dimensional vector exists that is identical to the candidate high-dimensional vector, then the candidate high-dimensional vector is replaced with the second high-dimensional vector to update the user memory knowledge base.

6. The user dialogue generation method based on memory fusion as described in claim 1, characterized in that, Based on the user memory knowledge base, the preset large language model, the preset prompt word engineering algorithm, the current text data, and the historical text data, short-term memory data, long-term memory data, and episodic memory data are obtained, including: Based on the current text data and the preset prompt word engineering algorithm, a third prompt word template is constructed; Based on the third prompt word template and the preset semantic similarity matching algorithm, historical text data that meets the semantic similarity requirements is matched from the user's memory knowledge base to obtain contextual memory data.

7. The user dialogue generation method based on memory fusion as described in claim 1, characterized in that, Based on the preset large language model, the preset prompt word engineering algorithm, the short-term memory data, the long-term memory data, and the contextual memory data, a user dialogue is generated, including: Based on a pre-trained neural network model, the short-term memory data, long-term memory data, and contextual memory data corresponding to the current text data are decomposed into a first short-term memory fine-grained segment, a second long-term memory fine-grained segment, and a third contextual memory fine-grained segment. Based on the preset large language model and the preset prompt word engineering algorithm, the short-term memory data, long-term memory data and contextual memory data corresponding to the current text data are decomposed into a second short-term memory fine-grained fragment, a second long-term memory fine-grained fragment and a third contextual memory fine-grained fragment; By integrating the first short-term memory fine-grained segment, the second long-term memory fine-grained segment, the third episodic memory fine-grained segment, the second short-term memory fine-grained segment, the second long-term memory fine-grained segment, and the third episodic memory fine-grained segment, we obtain short-term memory fine-grained segment, long-term memory fine-grained segment, and episodic memory fine-grained segment. Based on the preset large language model and the preset prompt word engineering algorithm, the fine-grained fragments of short-term memory, long-term memory, and contextual memory are reorganized to obtain a dialogue knowledge framework; Based on the aforementioned dialogue knowledge framework, user dialogue is generated.

8. The user dialogue generation method based on memory fusion as described in claim 7, characterized in that, Based on the aforementioned short-term memory fine-grained fragments, the system queries the user's memory knowledge base using the preset large language model and the preset prompt word engineering algorithm to find long-term memory fine-grained fragments and contextual memory fine-grained fragments that meet preset relevance requirements. The short-term memory fine-grained fragments, long-term memory fine-grained fragments, and contextual memory fine-grained fragments are then combined to obtain a dialogue knowledge framework, including: Based on the aforementioned short-term memory fine-grained fragments and the preset prompt word engineering algorithm, a fourth prompt word template is constructed; Based on the fourth prompt word template, the user's memory knowledge base is queried using the preset large language model to obtain the third long-term memory fine-grained fragment and the third contextual memory fine-grained fragment, which meet the preset relevance requirements. The third long-term memory fine-grained fragment and the third episodic memory fine-grained fragment are recombined to obtain the dialogue knowledge framework.

9. The user dialogue generation method based on memory fusion as described in claim 8, characterized in that, After each user dialogue is generated, it also includes: The short-term memory data, the long-term memory data, and the episodic memory data are stored in the user's memory knowledge base; Based on preset importance requirements, the memory data in the user memory knowledge base is divided into important memory data and unimportant memory data; By adding connections between important memory data and deleting connections between unimportant memory data, optimized memory data is obtained. The system receives user feedback data in real time, transforms the user feedback data into a third high-dimensional vector, and updates the third high-dimensional vector to the user's memory knowledge base.

10. A user dialogue generation system based on memory fusion, characterized in that, include: The module includes a user memory knowledge base construction module, a text data acquisition module, a memory data acquisition module, and a user dialogue generation module. The user memory knowledge base construction module is used to construct a user memory knowledge base based on a preset knowledge graph tool. The text data acquisition module is used to read the current text data input by the current dialogue user and the historical text data of the current dialogue user based on the user memory knowledge base; The memory data acquisition module is used to obtain short-term memory data, long-term memory data, and contextual memory data based on the user memory knowledge base, the preset large language model, the preset prompt word engineering algorithm, the current text data, and the historical text data. The user dialogue generation module is used to generate user dialogue based on the preset large language model, the preset prompt word engineering algorithm, the short-term memory data, the long-term memory data, and the contextual memory data.

Citation Information

Cited By

  • Virtual historical character dialogue method and system with role knowledge and context awareness

    CN121352040A

  • Intelligent investment consultant dialogue method and system based on dynamic memory reconstruction

    CN121765064A

  • An intelligent investment consultant dialogue method and system based on dynamic memory reconstruction

    CN121765064B

  • Method for LLM dialogue interaction and long-term memory data processing method

    CN121920330A