Interaction method, device, system, equipment, storage medium and program product
By assigning a unique identifier to each memory in the memory bank and displaying it in the reply, the problem of unexplainable replies in dialogue systems is solved, achieving high transparency and improved user trust.
Patent Information
- Application Number
- CN202511619622.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-06
- Publication Date
- 2026-02-06
AI Technical Summary
Existing dialogue systems lack interpretability when generating responses, making it impossible for users to verify the evidence, resulting in insufficient trust.
Assign a unique memory identifier to each memory in the memory bank, and include the identifier in the reply to guide the user to trace the source, thus building a mechanism for linking memory references and tracing.
It improves the transparency of the dialogue system and the interpretability of the generated content, allowing users to verify the source of information in the model-generated content, thus enhancing their sense of trust and control.
Smart Images

Figure CN121478826A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of artificial intelligence, and in particular to an interaction method, device, system, equipment, storage medium and program product. BACKGROUND
[0002] With the wide application of large language models in intelligent dialogue, decision support, education consultation and many other fields, its personalization capability is increasingly critical, and has become a core element for maintaining continuous understanding and ensuring context continuity in the interaction process with users. A good interaction experience requires the model not only to understand the current dialogue content, but also to have long-term memory and application ability for past interaction information, so as to provide responses that are more in line with user needs and more coherent.
[0003] To endow the dialogue system with long-term memory function, there are currently various schemes, such as external memory bank type, parameter embedded type, and hybrid memory type. However, the above schemes all have a significant problem when implementing long-term memory, that is, the opacity of the model's reply, and the user cannot know the basis for the model's reply when generating the reply, nor can the user verify the correctness of the reply, which makes it difficult for the user to detect and correct the model's error in time, and because the basis for the reply cannot be verified, the user lacks a sense of security and trust in authorizing the model to use personal information. SUMMARY
[0004] The present application provides an interaction method, device, system, equipment, storage medium and program product to solve the problem of lack of explainability of the reply generated by the dialogue system in the prior art, difficulty for the user to verify the basis, and insufficient trust of the user in the system.
[0005] The present application provides an interaction method, comprising: obtaining a current input of a user in a conversation process; determining long-term memory and short-term memory corresponding to the user, and event memory corresponding to the current input from a memory bank; the plurality of long-term memories, the plurality of short-term memories and the plurality of event memories stored in the memory bank each have a memory identifier; determining a current reply corresponding to the current input based on the current input and the event memory corresponding thereto, and the long-term memory and the short-term memory corresponding to the user; wherein, in the case that the current reply has a reference to the memory in the memory bank, the memory reference place in the current reply contains the memory identifier of the referenced memory; the memory identifier is used to guide the user to trace the memory.
[0006] According to the interaction method provided by the present application, the determination of the long-term memory and the short-term memory corresponding to the user, and the event memory corresponding to the current input from the memory bank comprises: perform memory change intention recognition based on the current input, to obtain a user intention; in a case where the user intention indicates that the user intends to update long-term memory of the user in the memory base, update the long-term memory of the user in the memory base based on the current input; determine the long-term memory and the short-term memory of the user from the updated memory base; perform memory retrieval based on the current input from the updated memory base, to obtain an event memory corresponding to the current input.
[0007] According to the interactive method provided by the application, the current reply corresponding to the current input is determined based on the current input, the event memory corresponding to the current input, the long-term memory and the short-term memory of the user, and the method further comprises: in a case where the conversation process ends or a current conversation round corresponding to the current input ends, perform event summarization based on interaction data of each conversation round in the conversation process or interaction data of the current conversation round, to obtain a new event memory and a memory identifier; store the new event memory and the memory identifier of the user in the memory base; the short-term memory is updated through a sliding window mechanism after each conversation round ends.
[0008] According to the interactive method provided by the application, the current reply corresponding to the current input is determined based on the current input, the event memory corresponding to the current input, the long-term memory and the short-term memory of the user, and the method further comprises: input the current input, the event memory corresponding to the current input, the long-term memory and the short-term memory of the user into a dialogue model, to obtain a current reply output by the dialogue model; the dialogue model is obtained by training a weighted loss function based on a large language model and sample data; the sample data comprises sample memories, sample conversation inputs and sample conversation outputs carrying memory identifiers of the sample memories; in the weighted loss function, a loss weight of the generated memory identifier is higher than a loss weight of other generated content.
[0009] According to the interactive method provided by the application, the sample data is determined based on the following steps: determine multi-dimensional user portraits and behavior change curves of a plurality of virtual users, and a plurality of conversation scenarios; construct a dynamic narrative network corresponding to each virtual user based on the multi-dimensional user portraits and the behavior change curves; the dynamic narrative network is a graph structure describing long-term behaviors and goals of the corresponding virtual user; Based on the multi-dimensional user profile, the multiple conversation scenarios, and the dynamic narrative network, dialogue is generated to obtain the sample data.
[0010] According to an interaction method provided by the present invention, the step of generating dialogue based on the multi-dimensional user profile, the multiple conversation scenarios, and the dynamic narrative network to obtain the sample data includes: Based on a dynamic narrative network of any virtual user, determine cross-session tasks; Based on the cross-session task, the target session scenario is determined from the multiple session scenarios; Based on the cross-session task, a dialogue outline is generated to obtain a multi-dimensional user profile that matches any virtual user and a dialogue outline for the target session scenario. The sample data is obtained by generating dialogues based on the dialogue outlines corresponding to each virtual user.
[0011] According to an interaction method provided by the present invention, the step of generating the sample data based on the dialogue outline corresponding to each virtual user includes: Based on the dialogue outlines corresponding to each virtual user, dialogues are generated to obtain multiple sets of candidate data. A multi-dimensional quality assessment is performed on each group of candidate data to obtain the quality score corresponding to each group of candidate data. Based on the quality score, target data is obtained by filtering from each group of candidate data; The sample data is determined based on the candidate data provided by the data experts after quality review of the target data.
[0012] The present invention also provides an interactive device, comprising: The acquisition unit is used to acquire the user's current input during the session; The retrieval unit is used to determine the long-term memory and short-term memory corresponding to the user, as well as the event memory corresponding to the current input, from the memory bank; the multiple long-term memories, multiple short-term memories, and multiple event memories stored in the memory bank each have their own memory identifier; An interaction unit is used to determine the current response corresponding to the current input based on the current input and its corresponding event memory, as well as the user's long-term memory and short-term memory. Wherein, if the current reply references a memory in the memory bank, the memory reference in the current reply contains a memory identifier of the referenced memory; the memory identifier is used to guide the user to trace the memory source.
[0013] The present invention also provides a dialogue system, including a retrieval system, a memory, and a dialogue model; the dialogue model is built on the basis of a large language model; The retrieval system is used to determine from the memory bank the event memory corresponding to the user's current input during the session, as well as the user's long-term memory and short-term memory; The memory bank stores multiple long-term memories, multiple short-term memories, and multiple event memories, each with its own memory identifier; The dialogue model is used to determine the current response corresponding to the current input based on the current input and its corresponding event memory, as well as the user's long-term memory and short-term memory. Wherein, if the current reply references a memory in the memory bank, the memory reference in the current reply contains a memory identifier of the referenced memory; the memory identifier is used to guide the user to trace the memory source.
[0014] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor executes the computer program to implement the interaction method as described above.
[0015] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the interaction method as described above.
[0016] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the interaction method as described above.
[0017] The interactive method, apparatus, system, device, storage medium, and program product provided by this invention generate highly personalized and context-coherent responses by integrating three types of memory: long-term, short-term, and event-based memory. More importantly, by introducing memory references with unique identifiers into the responses and providing interactive tracing paths, the model's memory and reasoning processes are no longer a black box. This significantly improves the transparency of the dialogue system and the interpretability of the generated content, allowing users to verify the information source of the model-generated content and correct errors in cases of incorrect references or obviously flawed generated content. This significantly enhances users' trust and sense of control over the dialogue system, solving the current problems of unclear memory sources, difficulty in user understanding and trust in model responses. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0019] Figure 1 This is a flowchart illustrating the interaction method provided by the present invention; Figure 2 This is an overall architecture diagram of the dialogue system provided by the present invention; Figure 3 This is an overall flowchart of the interaction process provided by the present invention; Figure 4 This is a schematic diagram of the structure of the interactive device provided by the present invention; Figure 5 This is a schematic diagram of the structure of the dialogue system provided by the present invention; Figure 6 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0020] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0021] With the widespread application of large language models in fields such as intelligent dialogue, decision support, and educational consulting, their personalization capabilities have become crucial for maintaining continuous understanding and contextual continuity during interactions with users. However, traditional large language models typically only perform reasoning based on short-term context windows and generally lack the ability to manage long-term interaction information across conversations.
[0022] To address this issue, several approaches have emerged to introduce long-term memory functionality into dialogue systems. These approaches can be broadly categorized into three memory mechanisms: external memory banks, which store user information and dialogue history in databases or knowledge graphs outside the model; parameter embedding, which encodes long-term user preferences into model parameters through incremental training or low-rank adaptation fine-tuning; and hybrid memory structures, which combine short-term context caching with long-term knowledge storage to achieve multi-layered memory management.
[0023] However, all the above solutions still have a clear drawback in achieving long-term memory: insufficient traceability of the memory content. Specifically, when the model references the user's historical information in its response, this referencing process is opaque to the user; that is, the memory is unexplainable. The user cannot know exactly which historical interaction or original information the model used to generate the current response. This black-box memory referencing mechanism makes it difficult for users to trace the root cause when the model makes incorrect references or generates misleading content, thus preventing correction. Furthermore, because the memory basis of the model's response cannot be verified, users lack a sense of security and trust when authorizing the model to use their personal long-term memory.
[0024] Therefore, how to build a dialogue system that can continuously and efficiently perform long-term memory, and allows users to clearly perceive memory references and support memory tracing, has become an urgent technical problem to be solved.
[0025] To address this, the present invention provides an interactive method that assigns a unique memory identifier to each memory in the memory bank and includes the memory identifier in the response when referencing that memory to guide the user to trace the source. This constructs a memory reference and tracing association mechanism, solving the problems of unexplainable memory references and difficulty for users to verify the model's basis in traditional solutions. It enables accurate tracing of the memories referenced by the model, significantly improves the interpretability of the model-generated content, and greatly enhances user trust.
[0026] Figure 1 This is a flowchart illustrating the interaction method provided by the present invention, as shown below. Figure 1 As shown, this method can be applied to dialogue systems in various scenarios capable of natural language interaction with users, such as intelligent customer service, intelligent assistants, in-vehicle voice assistants, and smart homes. The system can continuously and efficiently memorize personalized user information and supports memory tracing. The method includes: Step 110: Obtain the user's current input during the session; Step 120: Determine the user's long-term memory and short-term memory, as well as the event memory corresponding to the current input, from the memory bank; each of the multiple long-term memories, multiple short-term memories, and multiple event memories stored in the memory bank has its own memory identifier; Step 130: Based on the current input and its corresponding event memory, as well as the user's long-term memory and short-term memory, determine the current response corresponding to the current input; In cases where the current reply references a memory in the memory bank, the memory reference in the current reply contains a memory identifier of the referenced memory; the memory identifier is used to guide the user to trace the memory source.
[0027] Specifically, at the start of the interaction, the dialogue system first acquires the user's input, that is, the user's current input during the conversation. Here, the conversation process can be understood as a series of continuous interactions between the user and the dialogue system from beginning to end. During this interaction, the user's current input acquired by the dialogue system is the latest information provided by the user to the dialogue system. The form of the current input is diverse. For example, it can be text entered by the user through the keyboard, or it can be the user's voice picked up by the dialogue system through the voice pickup component. After acquiring the user's voice, the dialogue system can convert it into text form through speech recognition technology. It can also be multimedia information such as images and videos sent by the user. This embodiment of the invention does not specifically limit this.
[0028] Upon receiving the user's current input, this embodiment of the invention can perform memory retrieval based on the current input to determine the user's long-term and short-term memories, as well as the event memory corresponding to the current input, from the memory bank. Here, the memory bank can be understood as a database in a dialogue system used to centrally store and manage all user-related information. It can be a relational database, a non-relational database, a vector database specifically designed for efficient similarity search, or a knowledge graph, a simple file system, etc. This embodiment of the invention does not specifically limit these types of databases.
[0029] Here, the memory bank stores multiple long-term memories, multiple short-term memories, and multiple event memories. These three types of memories carry information of different time scales and natures. Specifically, long-term memories mainly contain relatively static or slowly changing information about the user. This type of information has a long validity period; for example, it could be basic user information (such as name, gender, age group, place of residence, etc.), long-term preferences (such as liking jazz music, being a vegetarian, etc.), identity / role (such as being a software engineer), and relationship with the user (such as the pet dog's name being Xiaobai), etc. This information can be obtained through explicit user settings or summarized and extracted from multiple interactions.
[0030] Short-term memory, also known as recent conversational memory, primarily consists of the interaction history of the current session or the most recent few sessions. Short-term memory provides direct context for the interaction process, ensuring its fluency and coherence. Short-term memory typically has limitations on length or number of rounds; for example, it may only retain the most recent 10 or 15 rounds of dialogue and update it using a sliding window approach, meaning that when new interaction history is stored, the oldest interaction record is discarded.
[0031] Event memory is dynamic information summarized and extracted from complete historical conversations (such as the interaction data of a complete conversation process or the interaction data of a single conversation round). Event memory is usually organized by events, which record what the user has experienced, the opinions expressed, the plans made, etc. For example, it could be "the user planned to travel to City A last week," "the user expressed a negative opinion about a certain movie in the last conversation," or "the user mentioned in the last conversation that they will spend three months learning Python." Compared to long-term memory, event memory is more dynamic and specific; and compared to short-term memory, event memory has undergone summarization processing, resulting in higher information density, less redundant information, and longer storage time.
[0032] To enable precise referencing and tracing of each memory, each long-term memory, short-term memory, and event memory stored in the memory bank has its own memory identifier (memid). The memory identifier serves as the identity document for each memory, allowing for precise location of the corresponding memory. Specifically, the memory identifier can be a universally unique identifier (UUID), a hash value generated based on the memory content and timestamp, or an auto-incrementing digital identity; this embodiment of the invention does not impose specific limitations on these. When a new memory is created, for example, when a short-term memory is obtained by summarizing a historical conversation, the dialogue system automatically generates a unique memory identifier for it and stores it in the memory bank along with the memory content.
[0033] In detail, when determining long-term memory, short-term memory, and event memory from the memory bank, the corresponding long-term and short-term memories can be retrieved directly from the memory bank based on the user's identity identifier. That is, at the beginning of the session, the dialogue system first identifies the user and obtains the user's identity identifier; during the subsequent session, this identity identifier can be used as a query condition to read all or part of the long-term and short-term memories associated with that identity identifier from the memory bank, and the retrieved memories are the user's corresponding long-term and short-term memories.
[0034] Accordingly, when determining the event memory corresponding to the current input from the memory bank, the number of event memories can be enormous. Therefore, the dialogue system cannot directly read the vast event memory. Instead, it needs to search through the vast event memory based on the specific content of the current input to accurately recall the most relevant event memories. For example, the user's current input can be used as the query, and the internal retrieval system can perform semantic retrieval on all event memories related to the user. This could involve encoding the current input and all event memories into high-dimensional vectors, and then finding the top K event memories with the highest similarity by calculating the cosine similarity between the query vector and the event memory vectors. These K values can be set according to the actual situation.
[0035] Furthermore, after identifying the relevant long-term memory, short-term memory, and event memory from the memory bank, in this embodiment of the invention, interaction can be performed based on this to generate the response content corresponding to the user's current input, i.e., the current response.
[0036] Specifically, Figure 2 This is an overall architecture diagram of the dialogue system provided by the present invention, such as... Figure 2 As shown, after identifying the three types of memories, they can be used as input to the dialogue model to obtain the current response output by the model. The dialogue model here is a pre-trained large language model with powerful natural language understanding and generation capabilities. It can generate highly personalized responses that fit the current context based on the input information. Specifically, the dialogue system integrates all the information obtained in the previous step, including the user's current input, long-term memories reflecting the user's personality, short-term memories ensuring dialogue coherence, and event memories providing deep context, to construct a highly informative prompt text, such as a Prompt. This prompt text is then input into the dialogue model. After fully understanding this prompt containing comprehensive context, the dialogue model performs reasoning and generates the most appropriate natural language response text, which is the current response corresponding to the current input.
[0037] However, it is worth noting that if the dialogue model references one or more memories in the memory bank during the generation of the current response, in order to ensure the traceability of the memories and the interpretability of the generated content, the memory references in the current response are specially marked in this embodiment of the invention. That is, a memory identifier of the referenced memory is generated at the memory reference, which can guide the user to trace the memory source of the referenced memory.
[0038] Specifically, if the current reply references one or more memories (whether long-term, short-term, or event-based) in the memory bank, this reference relationship needs to be explicitly displayed in the final reply text presented to the user. For example, a current reply could be, "I remember you mentioned last time that you like **jazz music** [memid:7a3b8c]". Here, "jazz music", represented in the form of "**XXXX (referenced content)**", is the referenced text, and its location is the memory reference point. This marking method allows the user to immediately recognize that this information comes from the model's memory upon seeing the reply text. The "[memid: 7a3b8c]" that follows is the memory identifier of the referenced memory. The purpose of this memory identifier is to guide the user in tracing the memory source.
[0039] Figure 3 This is an overall flowchart of the interaction process provided by the present invention, such as... Figure 3 As shown, after the dialogue model generates the current response, when a user sees this response and becomes curious or has questions about "how the model knows I like jazz music," they can click on the identifier (which can be designed as a hyperlink or clickable icon on the interactive interface). After capturing the user's click behavior, the dialogue system uses the memory identifier to retrieve the corresponding memory from the memory bank, using "7a3b8c" as the index. Then, it presents the user with the detailed information of that memory, such as the original dialogue content, context, and time information, such as "In the dialogue on October 20, 2025, you said, 'I've been listening to Miles Davis lately, jazz music is great!'"
[0040] The interactive method provided by this invention generates highly personalized and context-coherent responses by integrating long-term, short-term, and event-based memories. More importantly, by introducing memory references with unique identifiers into the responses and providing interactive tracing paths, the model's memory and reasoning processes are no longer a black box. This significantly improves the transparency of the dialogue system and the interpretability of the generated content, allowing users to verify the source of information in the model's generated content and correct errors in cases of incorrect references or obviously flawed generated content. This significantly enhances users' trust and sense of control over the dialogue system, solving the current problems of unclear memory sources, difficulty in user understanding and trust in model responses.
[0041] Based on the above embodiments, step 120 includes: Based on the current input, the user's intent is obtained by recognizing the intent to change the memory. When the user intent indicates that the user intent is to update the user's corresponding long-term memory in the memory bank, the user's corresponding long-term memory in the memory bank is updated based on the current input; From the updated memory bank, determine the user's corresponding long-term and short-term memories; From the updated memory bank, a memory retrieval is performed based on the current input to obtain the event memory corresponding to the current input.
[0042] Specifically, the process of determining the user's long-term and short-term memories, as well as the event memory corresponding to the current input, from the memory bank can include: When a dialogue system retrieves information from its memory bank, it doesn't always passively read from the memory. Instead, it first performs a deep understanding of the user's current input. That is, the dialogue system identifies the user's intent to change their memory based on the current input.
[0043] Here, user intent refers to the operational instructions contained in the user's current input that are related to long-term memory stored in the memory bank. The intent recognition process is the process of actively determining whether the user is altering their long-term memory.
[0044] In detail, this could involve calling a dedicated intent recognition model or related intent recognition algorithm to identify the intent of the current input, classifying the user's natural language input into a preset intent category, such as querying memory, adding to memory, updating memory, or deleting memory. For example, when the current input is "I will live in City B from now on," intent recognition can determine that the user's intent is "update residence." Alternatively, the current input can be fed into the memory operation model within the dialogue system for intent recognition. Another approach is to construct intent recognition prompt text based on the user's current input and feed it to the dialogue model, leveraging the dialogue model's powerful language understanding capabilities to determine the user's intent. Other methods, such as keyword matching and semantic analysis, can also be used to determine the user's intent.
[0045] After recognizing the user's intent, the dialogue system determines whether to operate on the memory bank based on the specific intent. That is, if the user's intent indicates a desire to update the corresponding long-term memory in the memory bank, the memory operation model in the dialogue system can update the corresponding long-term memory in the memory bank based on the current input. This means that once the dialogue system determines that the user wants to update their long-term memory, such as information like name, occupation, preferences, or place of residence, the memory operation model will perform the memory update. Specifically, the memory operation model will first extract key information from the current input and use this key information to update the corresponding memory items or entries in the memory bank.
[0046] For example, if a user's long-term memory includes "place of residence: City A", and the user inputs "I will live in City B from now on", the dialogue system can understand that the user's intention is to "update place of residence". Then, it can parse the new location "City B" based on the current input and immediately update the "place of residence" field in the user's long-term memory from "City A" to "City B" in the memory bank. In this way, the user's long-term memory is updated, ensuring that the long-term memory stored in the memory bank always remains consistent with the user's current situation and is always valid.
[0047] After the above memory update operation is completed, the content stored in the memory bank changes. In order to ensure the accuracy of information utilization and the timeliness of memory citation in subsequent interactions, in this embodiment of the invention, relevant memories can be obtained according to the updated memory bank.
[0048] Specifically, this involves determining the user's long-term and short-term memories from the updated memory bank. Simultaneously, a memory retrieval based on the current input can be performed from the updated memory bank to obtain the event memory corresponding to the current input. In other words, memory reading and retrieval are performed within the updated memory bank to obtain the user's long-term and short-term memories, as well as the event memory corresponding to the current input.
[0049] In this embodiment of the invention, an instant memory update mechanism based on intent recognition enables the dialogue system to dynamically and in real-time respond to users' requests for changes to long-term memory during a conversation. It eliminates the need for offline processing after the conversation ends, allowing for immediate response and application of the updated memory to the current interaction round. For example, after a user informs them of a new address, the dialogue system can use this new address in the next reply, such as, "Okay, your address has been updated to City B. Would you like me to find some local information for City B?" This significantly enhances the immediacy and intelligence of the interaction, avoiding situations where the user provides new information but the dialogue system continues to use outdated information in subsequent conversations. This provides users with a smoother, more coherent, and truly personalized dialogue experience.
[0050] Based on the above embodiments, the memory retrieval process specifically includes: See Figure 3 As can be seen, the memory retrieval process is specifically divided into two stages. That is, in order to improve the sorting accuracy while ensuring recall efficiency, in this embodiment of the invention, when retrieving the event memory from the updated memory bank based on the current input, a two-stage retrieval strategy combining "coarse sorting" and "fine sorting" is adopted.
[0051] Specifically, the first stage is the coarse-sorting stage, where the goal is to quickly and massively retrieve a set of candidate event memories related to the user's current input from the vast event memory repository. In this stage, the dialogue system can employ a dual-encoder vector encoding model. This model consists of two independent encoding towers: one responsible for encoding the current input into a high-dimensional query vector, and the other responsible for encoding each event memory associated with the user stored in the memory repository into an event vector of the same dimension as the query vector.
[0052] Furthermore, to improve retrieval efficiency, the event vectors of all event memories can be pre-constructed into a vector index, such as using the FAISS (Facebook AI Similarity Search) library. In practical implementation, an inverted file index combined with product quantization can be used to achieve millisecond-level approximate nearest neighbor search in a large-scale memory.
[0053] Specifically, during the retrieval process, the dialogue system first vectorizes the user's current input, and then uses this query vector to perform a high-speed similarity search in the pre-built FAISS index to quickly find, for example, the top 100 event memories that are semantically closest to the query vector. These 100 event memories constitute the candidate event memory set recalled in the coarse-sorting stage.
[0054] Additionally, it should be noted that, in order for the vector encoding model to accurately distinguish between relevant and irrelevant memories, its training process can adopt a contrastive learning approach. This involves training with positive sample pairs (approximately 100,000 pairs) containing the query and relevant events, hard negative sample pairs (approximately 200,000 events retrieved by algorithms such as BM25 that are highly relevant but actually irrelevant to the query) and randomly sampled negative samples (approximately 300,000 randomly sampled events that are irrelevant to the query). This optimizes the encoded vector space, making relevant items closer to each other in the space and irrelevant items more distant from each other.
[0055] The second stage is the fine-ranking stage. The goal of this stage is to perform more refined and accurate relevance calculations and rankings on the 100 candidate event memories recalled in the coarse-ranking stage. Unlike the independent encoding in the coarse-ranking stage, the fine-ranking stage employs a more computationally complex but more effective interactive encoder (Cross-Encoder), such as a model based on the RoBERTa-large architecture. In this stage, the dialogue system no longer processes queries and event memories separately. Instead, it concatenates the user's current input with each candidate event memory to form an input sequence, such as "[CLS]{query}[SEP]{event_content}[SEP]". This concatenated sequence is then completely fed into the Cross-Encoder. The model's internal attention mechanism can fully capture the deep interaction information between the query and the candidate event memories, ultimately outputting a single relevance score (e.g., a score between 0 and 1) for each input "query-candidate event memory" pair.
[0056] Finally, the dialogue system will sort these 100 candidate event memories in descending order based on the relevance score, and select the top-ranked candidate event memories, such as the Top-5, as the final event memories most relevant to the user's current input.
[0057] Additionally, it should be noted that to improve the capabilities of the Cross-Encoder, its training process can employ a hybrid training strategy that combines Pointwise and Pairwise approaches. That is, it learns to determine the absolute relevance of a single event through the binary classification cross-entropy loss function, and also learns to rank relevant events before irrelevant events through the contrastive ranking loss function.
[0058] Based on the above embodiments, in step 130, based on the current input and its corresponding event memory, as well as the user's long-term memory and short-term memory, the current response corresponding to the current input is determined, and then the process further includes: When the session ends or the current session round corresponding to the current input ends, an event summary is generated based on the interaction data of each session round during the session or the interaction data of the current session round to obtain a new event memory and memory identifier. The user's new event memory and its memory identifier are stored in the memory bank; short-term memory is updated through a sliding window mechanism after each session round.
[0059] Specifically, the interaction process does not completely end after receiving the current response to the current input. That is, in order to capture new information generated during the current interaction, the dialogue system will further perform a series of memory consolidation and update operations.
[0060] In detail, at the end of the entire conversation or at the end of the current conversation round corresponding to the current input, an event summary can be generated based on the interaction data of each conversation round during the entire conversation or the interaction data of the current conversation round. This allows the fragmented, conversational dialogue content to be summarized and refined into structured, more information-dense memory content, thereby obtaining new event memories and their memory identifiers.
[0061] That is, it can be an incremental, round-by-round summary after the dialogue system generates and sends the current response; or it can be a one-time, more comprehensive summary of the entire conversation at the end of the entire conversation, such as when the user actively exits or the conversation times out.
[0062] Specifically, this could involve taking the interaction data of the current conversation round (containing only the user's input and the system's response in this round) as input during round-by-round summarization and feeding it into the event summarization model within the dialogue system. This would allow the model to refine and summarize the data and output one or more new event memories, along with memory identifiers for each new event memory.
[0063] When the conversation ends, a summary is generated. At this time, the interaction data of each round of the conversation (i.e. the complete dialogue content of this conversation) is taken as input and fed into the event summary model inside the dialogue system so that the model can extract and summarize it and output multiple new event memories, as well as memory identifiers for each new event memory.
[0064] As a preferred embodiment of the present invention, event updates are performed on a session-by-session basis. That is, after a session ends, an event summary is performed based on the interaction data of each session round during that session to obtain a new event memory and its memory identifier.
[0065] For example, given the input "I'm planning a business trip to City C next week, can you check the weather for me?" and the current response from the dialogue system "Okay, the weather in City C will be sunny next week...", the event summary model might generate a new event memory: "User plans to travel to City C next week." Simultaneously, the dialogue system will generate / assign a completely new, unique memory identifier for this new event memory to facilitate subsequent memory referencing and tracing.
[0066] After obtaining new event memories through event summaries, in order to ensure continuous understanding and contextual coherence during the interaction process, in this embodiment of the invention, the dialogue system also needs to store the newly generated event memories and their memory identifiers into a memory bank. Thus, the newly generated event memories are formally archived in the user's "personal memory profile" in the memory bank, becoming part of their personalized information. This allows the user's personalized information to continuously accumulate and solidify as the interaction progresses, thereby enabling the dialogue system to possess continuous learning and memory capabilities.
[0067] Meanwhile, to efficiently manage the direct context of the dialogue, this embodiment of the invention can also update short-term memory. Unlike long-term memory and event memory, short-term memory is updated after each session round using a sliding window mechanism. This sliding window mechanism is a context management technique that allows the short-term memory in the dialogue system to maintain a relatively fixed length, for example, always retaining only the most recent 10 or 15 rounds of dialogue. When a new round of dialogue ends, the interaction data of that round is added to the short-term memory window, while the interaction data of the oldest round in the window is slid out and discarded. This ensures that the length of the short-term memory remains constant while the remembered information is consistently within the most recent time frame.
[0068] In this embodiment of the invention, high-value information from instantaneous dialogues is condensed and stored long-term as event memory through event summarization, preventing the loss of important information due to exceeding the range of short-term memory. This allows the dialogue system's understanding of the user to deepen continuously across conversations. Simultaneously, managing short-term memory through a sliding window mechanism ensures the efficiency and performance of the dialogue system when processing immediate context, avoiding computational burden caused by excessively long dialogue histories. This collaborative management of short and long memories allows the dialogue system to remember current interaction information while retaining important information from historical interactions, thereby greatly enhancing the system's learning ability and optimizing the user's interactive experience.
[0069] Based on the above embodiments, step 130 includes: The current input and its corresponding event memory, as well as the user's long-term memory and short-term memory, are input into the dialogue model to obtain the current response output by the dialogue model; The dialogue model is trained using a weighted loss function based on a large language model and sample data. The sample data includes sample memories, sample session inputs, and their corresponding sample session outputs that carry memory identifiers of the referenced sample memories; in the weighted loss function, the loss weight for the generated memory identifiers is higher than the loss weight for the generated other content.
[0070] Specifically, the process of determining the current response based on the current input and its corresponding event memory, as well as the user's long-term and short-term memories, includes: Considering the current shortcomings in dialogue systems, besides the lack of memory recall capabilities, a critical problem exists: in the initial stage of system deployment (i.e., the cold start phase), the lack of real, high-quality user interaction data makes it difficult for models to effectively learn how to combine memory to generate high-quality personalized responses, resulting in poor model performance. This invention proposes a high-quality cold start data construction mechanism to provide crucial data support for training dialogue models in dialogue systems. This mechanism synthesizes diverse dialogue data by constructing diverse user profiles and event nodes. Using this constructed high-quality dialogue data for model training can significantly improve the model's ability to utilize memory for personalized responses in practical applications.
[0071] In detail, this could involve integrating the current input and its corresponding event memory, as well as the user's long-term and short-term memories, into a structured prompt text. This prompt text contains the complete context for the dialogue model to respond. This prompt text can then be input into the dialogue model within the dialogue system, allowing the model to generate a corresponding response based on the prompt text. This yields the current response to the current input during the conversation.
[0072] However, it is worth noting that, in order to ensure the quality of the generated response content before applying the dialogue model to generate responses, in this embodiment of the invention, the dialogue model can also be trained by a weighted loss function based on the large language model and sample data.
[0073] The large language model, serving as the initial model in the training process, is a model with powerful natural language understanding and generation capabilities, providing a solid foundation for subsequent task-specific learning. Sample data consists of high-quality, formatted training samples designed to teach the initial model how to reference memories and generate personalized responses based on those memories. Sample data includes sample memories, sample session inputs, and corresponding sample session outputs carrying memory identifiers of the referenced sample memories.
[0074] The following will use a specific example to illustrate the data structure of the sample data: The sample memory can include event memory, such as {memid: evt-88c3, content: the user inquired about Disney ticket prices last week}, or long-term memory, such as {memid: usr-01a2, content: user's name: Zhang San}. Sample session input refers to user input during the dialogue, such as a user saying, "Hello, is there still a discount this week for that park I asked about last time?". Sample session output refers to the model's response during the dialogue. An ideal response with a correct reference could be, "Are you referring to the Disney tickets [memid: evt-88c3] you mentioned earlier? I'm checking for the latest offers for you." By training the initial model with a large amount of sample data, the model can fully learn during the training process that when understanding the referent of the user input (such as which amusement park), it needs to associate it with relevant historical memories (such as Disneyland), and when generating a response, it should not only use the memory content, but also attach the corresponding memory identifier at the reference point.
[0075] Additionally, it's worth noting that during model training, to ensure the model learns how to reference memories first and correctly generate memory identifiers, this embodiment employs a special optimization strategy: a weighted loss function. This loss function assigns the highest loss weight to memory identifiers within the model-generated content, while other parts, such as other content and referenced content, receive relatively lower loss weights. However, the loss weight for referenced content is still higher than that for other content. For example, a weight of 2.0 can be assigned to memory identifiers, a weight of 1.5 to referenced content, and a weight of 1.0 to other content.
[0076] Here, it's important to clarify that the loss function measures the difference between the model's predicted output and the sample session output, and the training objective is to minimize this difference. Weighting means assigning different penalties to different parts of the difference. Specifically, if the model generates the correct natural language part during training but misinterprets the memory identifier (e.g., writing [memid:evt-88c3] as [memid:evt-99d4]), the weighted loss function will impose a larger penalty on this error. In contrast, if the model generates the correct memory identifier but the natural language part is slightly off (e.g., saying "recent promotional information" instead of "latest promotional activities"), the penalty will be much smaller.
[0077] This training method enables the trained dialogue model to stably generate memory identifiers for memory tracing. In particular, by employing a weighted loss function for loss measurement and subsequent model fine-tuning, the model's ability to reference memories and correctly generate memory identifiers can be significantly improved. This ensures the accuracy and reliability of the generated memory identifiers, guaranteeing the validity of links when users trace memories, and thus providing a guarantee for the stable operation of the entire memory tracing mechanism.
[0078] Based on the above embodiments, the sample data is determined according to the following steps: Determine multidimensional user profiles and behavior change curves for multiple virtual users, as well as multiple conversation scenarios; Based on multi-dimensional user profiles and behavior change curves, a dynamic narrative network is constructed for each virtual user; the dynamic narrative network is a graph structure that describes the long-term behavior and goals of the corresponding virtual user. Based on multi-dimensional user profiles, multiple conversation scenarios, and a dynamic narrative network, dialogues are generated to obtain sample data.
[0079] Specifically, considering the current lack of high-quality cold start data in dialogue systems, which leads to the inability of models to generate high-quality personalized responses in the early stages of application, this embodiment of the invention proposes to construct data based on multi-dimensional user profiles, multiple conversation scenarios, and dynamic narrative networks to construct high-quality cold start data, thereby improving the understanding ability and response quality of dialogue models in the early stages of application.
[0080] In detail, this could mean that in the initial stage of data construction, it's necessary to first determine multi-dimensional user profiles and behavioral change curves for multiple virtual users. These virtual users are not real people, but rather roles with rich personality traits programmatically defined by the dialogue system. The multi-dimensional user profile is a detailed depiction of these roles; it's not a simple label, but a complex set encompassing multiple dimensions such as demographic information (e.g., age, occupation, geographic location), personality traits (e.g., extroversion, caution, curiosity), and interests (e.g., liking science fiction movies, enjoying hiking).
[0081] To better define the relationship between virtual user behavior and its changes over time, this embodiment of the invention also introduces a time dimension, namely a behavior change curve, into the static user profile. This curve defines how the personality and behavior of a virtual user evolve over time. For example, a virtual user can start as a "student" and, along the behavior change curve, experience a series of state transitions such as "graduation," "job hunting," and "becoming a software engineer," with their interests and needs also changing logically accordingly.
[0082] At the same time, the dialogue system will also preset multiple conversation scenarios, which constitute the specific context in which the dialogue takes place, such as "planning a family trip", "consulting on after-sales issues of electronic products", "chatting about movies recently watched", etc.
[0083] Furthermore, in this embodiment of the invention, a dynamic narrative network corresponding to each virtual user can be constructed based on the multi-dimensional user profile and behavior change curve determined in the previous step. Here, the dynamic narrative network can be understood as a graph structure describing the long-term behavior and goals of the corresponding virtual user.
[0084] In this network, nodes represent a virtual user's state, a life event, a long-term goal, etc. Examples include "learning a new language," "planning to travel to City D next summer," and "buying a new laptop." Edges in the network represent the logical or temporal relationships between these nodes. By using these nodes in the graph structure and the edges connecting them, the complete life trajectory of the corresponding virtual user can be outlined.
[0085] It's important to note here that because the construction and evolution of the graph structure follow the behavioral change curve set in the previous step, the graph structure needs to be dynamic to ensure the long-term consistency and logical rationality of the virtual user's life trajectory and state. For example, the virtual user's narrative network would ensure that the event of "learning to drive" occurs before the event of "driving or riding a bicycle." Similarly, the virtual user's narrative network needs to ensure that the event of "attending university" occurs after the event of "graduating from high school," but before the event of "graduating and starting a job."
[0086] Following this, dialogue can be generated based on multi-dimensional user profiles, multiple conversation scenarios, and a dynamic narrative network to obtain sample data. That is, the dialogue system can utilize one or more powerful generative models as simulators, which simultaneously act as both virtual users and trained dialogue models. Specifically, during dialogue generation, the simulator receives explicit instructions, such as, "You are now the virtual user 'Zhang San' (based on the multi-dimensional user profile), and your story is currently at the stage of 'planning a trip to City D next summer' (based on the dynamic narrative network). Please initiate a dialogue with the trained dialogue model in the 'planning a family trip' conversation scenario." During the simulated dialogue, whenever the dialogue content touches on information in the user profile or past events in the narrative network, the simulator not only produces dialogue text but also simultaneously generates corresponding memory entries, such as the event memory "the user plans to travel to City D next summer," and generates / assigns a memory identifier for it. Then, in the generated response, this memory identifier is inserted at the reference point in a specific format (e.g., [memid: xxx]). In this way, a complete simulated dialogue produces a high-quality sample data that includes sample memory, sample session input, and sample session output with memory identifiers.
[0087] In this embodiment of the invention, dialogue generation is achieved through multi-dimensional user profiles, multiple conversation scenarios, and dynamic narrative networks. This enables the large-scale generation of sample data with high consistency, diversity, and long-term logic, effectively solving the problem of poor model training results due to the lack of high-quality cold-start data in current dialogue systems. It does not rely on long-term dialogues with real users that are difficult to obtain. The programmatically constructed virtual users and narrative networks ensure that the generated sample data covers various complex interaction scenarios and guarantees the accuracy of memory references, providing a reliable data foundation for model training and greatly improving the final performance of the model.
[0088] Based on the above embodiments, dialogue is generated using multi-dimensional user profiles, multiple conversation scenarios, and a dynamic narrative network to obtain sample data, including: Based on a dynamic narrative network of any virtual user, determine cross-session tasks; Based on cross-session tasks, the target session scenario is determined from multiple session scenarios; Dialogue outlines are generated based on cross-session tasks to obtain a multi-dimensional user profile and a dialogue outline for the target conversation scenario that match the virtual user. Dialogues were generated based on the dialogue outlines corresponding to each virtual user, and sample data was obtained.
[0089] Specifically, the process of generating dialogues and obtaining sample data based on multi-dimensional user profiles, multiple conversation scenarios, and dynamic narrative networks includes: First, cross-session tasks can be determined based on the dynamic narrative network of any virtual user. These cross-session tasks are more complex than single-turn dialogues or individual sessions, reflecting a long-term goal or complex intent that requires multiple, time-spanning interactions to achieve. This session task can be directly sampled from the virtual user's dynamic narrative network.
[0090] For example, if a virtual user's dynamic narrative network depicts their journey "from deciding to learn programming to eventually finding a development job," then "learning programming" or "job hunting" can be identified as a cross-conversation task. By first defining such a top-level task, it can be ensured that a series of subsequent dialogues revolve around this unified and coherent theme.
[0091] Then, based on the cross-conversation task, the target conversation scenario can be determined from multiple conversation scenarios. That is, the dialogue system also needs to break down this complex cross-conversation task into multiple specific sub-tasks that can be executed in a single conversation. For example, if the cross-conversation task is "planning a five-day independent trip to City D", the dialogue system will select a specific conversation scenario related to this task from multiple preset conversation scenarios as the target conversation scenario.
[0092] In the first simulated session, the target scenario might be "discussing travel destinations and budgets." In subsequent simulated sessions, the scenarios might shift to "checking flight and hotel information" or "planning daily itineraries." This process breaks down a large and complex task into a series of logically clear and progressively simple tasks.
[0093] Subsequently, to make the dialogue generation process more controllable and logical, the dialogue system does not immediately begin generating dialogue freely, but first performs planning. That is, it generates a dialogue outline based on cross-session tasks, obtaining a multi-dimensional user profile and a dialogue outline for the target conversation scenario that fits any virtual user. This dialogue outline can be understood as a structured dialogue script or flowchart. It does not contain specific wording, but it defines the core flow, key information points, and points for memorization and use in this dialogue. For example, for the target conversation scenario of "searching for flight and hotel information," and considering the "value for money" characteristic in the virtual user's multi-dimensional user profile, the generated dialogue outline might be: 1. The user explicitly requested to inquire about flight tickets from City B to City D.
[0094] 2. The standard options provided by the emulator.
[0095] 3. Based on their profile of "valuing cost-effectiveness", users ask follow-up questions such as "Are there any low-cost airline options?"
[0096] 4. The simulator needs to reference an event memory in its reply. For example, in a previous simulated dialogue, the virtual user mentioned that "I had a bad experience flying with CC Airlines once", and based on this memory, options that do not meet the user's preferences are filtered out.
[0097] 5. The dialogue ends, forming a new event memory, such as "The virtual user searched for air tickets from City B to City D on X month X day, and preferred low-cost flights from non-CC airlines."
[0098] This outline ensures that the generated dialogue is not only topic-specific and reflects the user's personality, but also includes the necessary memory referencing logic.
[0099] Then, dialogues can be generated based on the dialogue outlines corresponding to each virtual user to obtain sample data. That is, the simulator will follow the guidance of the dialogue outlines to transform structured scripts or processes into natural and fluent dialogues. Since the dialogue outlines have already defined the direction of the dialogue and the memory reference points, the simulator only needs to fill in the language details to generate high-quality sample data that fully meets the set requirements. This sample data includes the input of the virtual users (sample session input), the model responses with memory reference identifiers (sample session output), and the sample memories and their memory identifiers.
[0100] In this embodiment of the invention, by following the entire process from task to scene to outline and finally to dialogue generation, the originally divergent dialogue generation process can be transformed into a highly structured, goal-driven process, which greatly enhances the logical consistency of sample data and effectively avoids aimless chatter. This not only makes the generated sample data closer to the complex interaction process in the real world, but also makes the large-scale production of high-quality training data more controllable and efficient.
[0101] Based on the above embodiments, dialogue is generated based on the dialogue outline corresponding to each virtual user to obtain sample data, including: Dialogues are generated based on the dialogue outlines corresponding to each virtual user, resulting in multiple sets of candidate data. A multi-dimensional quality assessment was performed on each group of candidate data to obtain the quality score corresponding to each group of candidate data. Based on the quality score, the target data is selected from the candidate data of each group; Obtain candidate data from data experts after quality review of the target data, and determine the sample data based on the candidate data.
[0102] Specifically, the above-mentioned dialogue generation based on the dialogue outline corresponding to each virtual user yields sample data, which may include: To increase data diversity and select the best data, the dialogue system does not generate dialogues based on a single dialogue outline, but rather on dialogue outlines corresponding to each virtual user, resulting in multiple sets of candidate data. In other words, for the same virtual user, their dynamic narrative network can be used multiple times to obtain multiple cross-session complex tasks, and a dialogue outline corresponding to each cross-session complex task can be determined. Simultaneously, the dynamic narrative networks of multiple virtual users are sampled to ultimately determine dialogue outlines for multiple virtual users. In this case, the simulator needs to generate corresponding dialogue content, i.e., candidate data, for each dialogue outline.
[0103] After obtaining multiple sets of candidate data, in order to select high-quality training samples from the massive amount of data, this embodiment of the invention can perform automatic evaluation, that is, perform multi-dimensional quality evaluation on each set of candidate data to obtain the quality score corresponding to each set of candidate data. Here, the evaluation indicators for multi-dimensional quality evaluation may include naturalness (evaluating whether the dialogue content is fluent and conforms to human language habits), adherence (judging whether the dialogue content strictly follows the corresponding outline, whether key nodes are omitted or deviate from the topic), memory accuracy (verifying whether the memory identifiers cited in the dialogue content are correct and whether the cited content is consistent with the memory in the memory bank), and role consistency (judging whether the personality, profession, behavior, etc. of the virtual user reflected in the dialogue content are consistent with their user profile, such as a virtual user of a "rigorous scholar" whose speech should not be too colloquial or casual), etc. By scoring these dimensions and fusing the scores of multiple dimensions, the quality score corresponding to each set of candidate data can be obtained.
[0104] After this, the dialogue system can automatically filter the candidate data based on the quality score to obtain the target data. Specifically, a score threshold can be set, and all candidate data with a quality score higher than the threshold are retained as the target data. Here, the automatic filtering process can filter out a large number of obviously erroneous or poor-quality candidate data with extremely high efficiency, greatly reducing the pressure of subsequent manual review.
[0105] However, automated evaluation may fail to capture all subtle logical, common-sense, or pragmatic errors. Therefore, to ensure the absolute reliability of the final sample data, a crucial manual verification step is introduced in this embodiment of the invention. Specifically, the dialogue system obtains candidate data from data experts who have conducted quality reviews of the target data, and determines the sample data based on these candidate data. Here, data experts refer to professionally trained annotation personnel with enhanced language comprehension and logical reasoning abilities. After initially screening and determining the target data, they conduct a quality review to check for any potentially deep-seated errors.
[0106] It's important to note here that data experts' work goes beyond simply approving or rejecting data; they can also edit and correct the target data. For example, they can modify an unnatural word or phrase, correct an illogical statement, adjust an inappropriate punctuation mark or paragraph break, or add a missing memory reference. Data that has undergone quality review by data experts becomes the candidate data.
[0107] Ultimately, the dialogue system determines the final sample data based on the candidate data provided by data experts. That is, it can directly use the candidate data as the sample data, or it can select a portion of it. This embodiment of the invention does not impose specific limitations on this.
[0108] The interactive device provided by the present invention will be described below. The interactive device described below can be referred to in correspondence with the interactive method described above.
[0109] Figure 4 This is a schematic diagram of the structure of the interactive device provided by the present invention, as shown below. Figure 4 As shown, the device includes: Acquisition unit 410 is used to acquire the user's current input during the session; The retrieval unit 420 is used to determine the long-term memory and short-term memory corresponding to the user, as well as the event memory corresponding to the current input, from the memory bank; the multiple long-term memories, multiple short-term memories, and multiple event memories stored in the memory bank each have their own memory identifier; The interaction unit 430 is used to determine the current response corresponding to the current input based on the current input and its corresponding event memory, as well as the user's long-term memory and short-term memory. Wherein, if the current reply references a memory in the memory bank, the memory reference in the current reply contains a memory identifier of the referenced memory; the memory identifier is used to guide the user to trace the memory source.
[0110] The interactive device provided by this invention generates highly personalized and context-coherent responses by integrating long-term, short-term, and event-based memories. More importantly, by introducing memory references with unique identifiers into the responses and providing interactive tracing paths, the model's memory and reasoning processes are no longer a black box. This significantly improves the transparency of the dialogue system and the interpretability of the generated content, allowing users to verify the source of information in the model's generated content and correct errors in cases of incorrect references or obviously flawed generated content. This significantly enhances users' trust and sense of control over the dialogue system, solving the current problems of unclear memory sources, difficulty in user understanding and trust in model responses.
[0111] Based on the above embodiments, the retrieval unit 420 is used for: Based on the current input, the user's intent is obtained by recognizing the intent to change the memory. When the user intent indicates that the user intent is to update the long-term memory corresponding to the user in the memory bank, the long-term memory corresponding to the user in the memory bank is updated based on the current input; Determine the user's long-term and short-term memories from the updated memory bank; From the updated memory bank, a memory retrieval is performed based on the current input to obtain the event memory corresponding to the current input.
[0112] Based on the above embodiments, the device further includes a memory update unit, used for: When the session ends or the current session round corresponding to the current input ends, an event summary is performed based on the interaction data of each session round during the session or the interaction data of the current session round to obtain a new event memory and memory identifier. The new event memory corresponding to the user and its memory identifier are stored in the memory bank; the short-term memory is updated through a sliding window mechanism after each session round.
[0113] Based on the above embodiments, the interaction unit 430 is used for: The current input and its corresponding event memory, as well as the user's long-term memory and short-term memory, are input into the dialogue model to obtain the current response output by the dialogue model; The dialogue model is trained using a weighted loss function based on a large language model and sample data. The sample data includes sample memories, sample session inputs, and corresponding sample session outputs carrying memory identifiers of the referenced sample memories; in the weighted loss function, the loss weight for the generated memory identifiers is higher than the loss weight for the generated other content.
[0114] Based on the above embodiments, the device further includes a data construction unit, used for: Determine multidimensional user profiles and behavior change curves for multiple virtual users, as well as multiple conversation scenarios; Based on the multidimensional user profile and the behavior change curve, a dynamic narrative network corresponding to each virtual user is constructed; the dynamic narrative network is a graph structure that describes the long-term behavior and goals of the corresponding virtual user. Based on the multi-dimensional user profile, the multiple conversation scenarios, and the dynamic narrative network, dialogue is generated to obtain the sample data.
[0115] Based on the above embodiments, the data construction unit is used for: Based on a dynamic narrative network of any virtual user, determine cross-session tasks; Based on the cross-session task, the target session scenario is determined from the multiple session scenarios; Based on the cross-session task, a dialogue outline is generated to obtain a multi-dimensional user profile that matches any virtual user and a dialogue outline for the target session scenario. The sample data is obtained by generating dialogues based on the dialogue outlines corresponding to each virtual user.
[0116] Based on the above embodiments, the data construction unit is used for: Based on the dialogue outlines corresponding to each virtual user, dialogues are generated to obtain multiple sets of candidate data. A multi-dimensional quality assessment is performed on each group of candidate data to obtain the quality score corresponding to each group of candidate data. Based on the quality score, target data is obtained by filtering from each group of candidate data; The sample data is determined based on the candidate data provided by the data experts after quality review of the target data.
[0117] Figure 5 This is a schematic diagram of the dialogue system provided by the present invention, as shown below. Figure 5 As shown, the system includes a memory bank 510, a retrieval system 520, and a dialogue model 530; the dialogue model 530 is built on the basis of a large language model. The retrieval system 520 is used to determine from the memory bank 510 the event memory corresponding to the user's current input during the session, as well as the user's long-term memory and short-term memory; The memory bank 510 stores multiple long-term memories, multiple short-term memories, and multiple event memories, each with its own memory identifier. The dialogue model 530 is used to determine the current response corresponding to the current input based on the current input and its corresponding event memory, as well as the user's long-term memory and short-term memory. Wherein, if the current reply references a memory in the memory bank, the memory reference in the current reply contains a memory identifier of the referenced memory; the memory identifier is used to guide the user to trace the memory source.
[0118] Figure 6 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 6As shown, the electronic device may include a processor 610, a communications interface 620, a memory 630, and a communication bus 640, wherein the processor 610, communications interface 620, and memory 630 communicate with each other via the communication bus 640. The processor 610 can invoke logical instructions in the memory 630 to execute an interaction method, which includes: acquiring the user's current input during a session; determining the user's long-term and short-term memories, as well as the event memory corresponding to the current input, from a memory bank; each of the multiple long-term memories, multiple short-term memories, and multiple event memories stored in the memory bank has its own memory identifier; determining the current response corresponding to the current input based on the current input and its corresponding event memory, as well as the user's long-term and short-term memories; wherein, if the current response references a memory in the memory bank, the memory reference in the current response includes the memory identifier of the referenced memory; the memory identifier is used to guide the user to trace the memory.
[0119] Furthermore, the logical instructions in the aforementioned memory 630 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0120] On the other hand, the present invention also provides a computer program product, the computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions, wherein when the program instructions are executed by a computer, the computer is able to execute the interaction methods provided by the above methods, the method comprising: acquiring the user's current input during a session; determining the user's long-term memory and short-term memory, and the event memory corresponding to the current input, from a memory bank; wherein multiple long-term memories, multiple short-term memories, and multiple event memories stored in the memory bank each have their own memory identifier; determining the current response corresponding to the current input based on the current input and its corresponding event memory, and the user's corresponding long-term memory and short-term memory; wherein, if the current response references a memory in the memory bank, the memory reference in the current response contains the memory identifier of the referenced memory; the memory identifier is used to guide the user to trace the memory source.
[0121] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the interaction methods provided by the methods described above. The method includes: acquiring the user's current input during a session; determining, from a memory bank, the user's corresponding long-term memory and short-term memory, as well as the event memory corresponding to the current input; each of the multiple long-term memories, multiple short-term memories, and multiple event memories stored in the memory bank has its own memory identifier; determining, based on the current input and its corresponding event memory, as well as the user's corresponding long-term and short-term memories, the current response corresponding to the current input; wherein, if the current response references a memory in the memory bank, the memory reference in the current response includes the memory identifier of the referenced memory; the memory identifier is used to guide the user to trace the memory source.
[0122] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0123] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0124] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. An interaction method, characterized in that, include: Get the user's current input during the session; Determine the user's long-term and short-term memories, as well as the event memory corresponding to the current input, from the memory bank; The memory bank stores multiple long-term memories, multiple short-term memories, and multiple event memories, each with its own memory identifier; Based on the current input and its corresponding event memory, as well as the user's long-term memory and short-term memory, determine the current response corresponding to the current input; Wherein, if the current reply references a memory in the memory bank, the memory reference in the current reply contains a memory identifier of the referenced memory; the memory identifier is used to guide the user to trace the memory source.
2. The interaction method according to claim 1, characterized in that, The step of determining the user's long-term and short-term memories, as well as the event memory corresponding to the current input, from the memory bank includes: Based on the current input, the user's intent is obtained by recognizing the intent to change the memory. When the user intent indicates that the user intent is to update the long-term memory corresponding to the user in the memory bank, the long-term memory corresponding to the user in the memory bank is updated based on the current input; Determine the user's long-term and short-term memories from the updated memory bank; From the updated memory bank, a memory retrieval is performed based on the current input to obtain the event memory corresponding to the current input.
3. The interaction method according to claim 1, characterized in that, The process of determining the current response based on the current input and its corresponding event memory, as well as the user's long-term and short-term memories, further includes: When the session ends or the current session round corresponding to the current input ends, an event summary is performed based on the interaction data of each session round during the session or the interaction data of the current session round to obtain a new event memory and memory identifier. The new event memory corresponding to the user and its memory identifier are stored in the memory bank; the short-term memory is updated through a sliding window mechanism after each session round.
4. The interaction method according to any one of claims 1 to 3, characterized in that, Determining the current response based on the current input and its corresponding event memory, as well as the user's long-term and short-term memories, includes: The current input and its corresponding event memory, as well as the user's long-term memory and short-term memory, are input into the dialogue model to obtain the current response output by the dialogue model; The dialogue model is trained using a weighted loss function based on a large language model and sample data. The sample data includes sample memories, sample session inputs, and corresponding sample session outputs carrying memory identifiers of the referenced sample memories; in the weighted loss function, the loss weight for the generated memory identifiers is higher than the loss weight for the generated other content.
5. The interaction method according to claim 4, characterized in that, The sample data was determined based on the following steps: Determine multidimensional user profiles and behavior change curves for multiple virtual users, as well as multiple conversation scenarios; Based on the multi-dimensional user profile and the behavior change curve, a dynamic narrative network corresponding to each virtual user is constructed. The dynamic narrative network is a graph structure that describes the long-term behavior and goals of the corresponding virtual users; Based on the multi-dimensional user profile, the multiple conversation scenarios, and the dynamic narrative network, dialogue is generated to obtain the sample data.
6. The interaction method according to claim 5, characterized in that, The process of generating dialogue based on the multi-dimensional user profile, the multiple conversation scenarios, and the dynamic narrative network to obtain the sample data includes: Based on a dynamic narrative network of any virtual user, determine cross-session tasks; Based on the cross-session task, the target session scenario is determined from the multiple session scenarios; Based on the cross-session task, a dialogue outline is generated to obtain a multi-dimensional user profile that matches any virtual user and a dialogue outline for the target conversation scenario. The sample data is obtained by generating dialogues based on the dialogue outlines corresponding to each virtual user.
7. The interaction method according to claim 5, characterized in that, The process of generating dialogues based on the dialogue outlines corresponding to each virtual user to obtain the sample data includes: Based on the dialogue outlines corresponding to each virtual user, dialogues are generated to obtain multiple sets of candidate data. A multi-dimensional quality assessment is performed on each group of candidate data to obtain the quality score corresponding to each group of candidate data. Based on the quality score, target data is obtained by filtering from each group of candidate data; The sample data is determined based on the candidate data provided by the data experts after quality review of the target data.
8. An interactive device, characterized in that, include: The acquisition unit is used to acquire the user's current input during the session; The retrieval unit is used to determine the user's long-term memory and short-term memory, as well as the event memory corresponding to the current input, from the memory bank; The memory bank stores multiple long-term memories, multiple short-term memories, and multiple event memories, each with its own memory identifier; An interaction unit is used to determine the current response corresponding to the current input based on the current input and its corresponding event memory, as well as the user's long-term memory and short-term memory. Wherein, if the current reply references a memory in the memory bank, the memory reference in the current reply contains a memory identifier of the referenced memory; the memory identifier is used to guide the user to trace the memory source.
9. A dialogue system, characterized in that, It includes a retrieval system, a memory, and a dialogue model; the dialogue model is built on top of a large language model. The retrieval system is used to determine from the memory bank the event memory corresponding to the user's current input during the session, as well as the user's long-term memory and short-term memory; The memory bank stores multiple long-term memories, multiple short-term memories, and multiple event memories, each with its own memory identifier; The dialogue model is used to determine the current response corresponding to the current input based on the current input and its corresponding event memory, as well as the user's long-term memory and short-term memory. Wherein, if the current reply references a memory in the memory bank, the memory reference in the current reply contains a memory identifier of the referenced memory; the memory identifier is used to guide the user to trace the memory source.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the interaction method as described in any one of claims 1 to 7.
11. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the interaction method as described in any one of claims 1 to 7.
12. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the interaction method as described in any one of claims 1 to 7.
