A general memory management method and system based on a language model
By generating and managing persistent memories in the language model, the problem of cross-model sharing and application is solved, achieving efficient and secure storage and retrieval of user memories, improving the personalization and continuity of human-computer dialogue, and enhancing the system's adaptability and user trust.
Patent Information
- Application Number
- CN202510043414.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-10
- Publication Date
- 2026-01-27
- Estimated Expiration
- 2045-01-10
AI Technical Summary
Existing language models are inadequate in terms of memory and context retention, and cannot be shared and applied across models, resulting in a poor humanized, continuous, and personalized experience during human-computer natural language dialogue.
By extracting memory information during dialogue, generating temporary memories and integrating them into persistent memories, and performing type classification management and importance updates, it achieves flexible and efficient storage and retrieval of short-term, long-term and permanent memories, and supports cross-model compatibility and dynamic updates.
It enhances the personalization and continuity of human-computer natural language dialogue, ensures the security and real-time nature of memory, adapts to changes in user behavior, strengthens the system's flexibility and customization capabilities, and provides a more natural and intelligent interactive experience.
Smart Images

Figure CN119962574B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of artificial intelligence, human-computer natural language dialogue, and other technical fields, and in particular to a general memory management method and system based on a language model. Background Technology
[0002] With the rapid development of artificial intelligence (AI) technology, especially the continuous optimization and application of language models, the interaction between AI and humans has gradually become more natural and personalized. However, existing language models still have some shortcomings in dialogue with users, particularly in terms of memory and context retention. Most language models only process contextual information within a single dialogue; once the dialogue ends, the model cannot remember the user's personal information or dialogue history, making the interaction with the user somewhat monotonous and repetitive. Furthermore, with technological updates and the iteration of different models, existing model memories often cannot be shared and applied across models, posing a challenge to improving the flexibility and usability of language models. In this context, how to efficiently store, update, and apply user memories has become an urgent problem for language models. An ideal solution must not only ensure user privacy and security but also possess the ability to be applied across models and dynamically updated, enabling different versions and types of language models to share and update their memories, thereby achieving a more humanized, continuous, and personalized dialogue experience.
[0003] In summary, existing language model-based dialogue technologies suffer from technical problems such as the inability to flexibly, efficiently, and securely store and retrieve user memories, and poor humanized, continuous, and personalized dialogue experience during human-computer natural language dialogue. Summary of the Invention
[0004] To address the shortcomings of the existing technologies, this invention provides a general memory management method and system based on language models, enabling flexible, efficient, and secure storage and retrieval of user memories regardless of model type, thereby enhancing the humanized, continuous, and personalized dialogue experience during human-computer natural language dialogue.
[0005] In a first aspect, the present invention provides a general memory management method based on a language model, comprising:
[0006] During the natural language dialogue between the user and the language model, the memory information that needs to be memorized is extracted from the dialogue content.
[0007] Temporary memories are generated based on the memory information to be memorized, and these temporary memories are integrated to generate persistent memories about the dialogue user. These persistent memories are used to be integrated into the dialogue process between the dialogue user and the language model when accessed, forming a memory of the dialogue user to control the dialogue of the dialogue system.
[0008] The memory types are classified and managed according to the importance of the memory information in the persistent memory, so that the persistent memory includes short-term memory and long-term memory. The importance of the memory information in the persistent memory is updated and managed to allow for forgetting and promotion of the short-term memory and the long-term memory.
[0009] Secondly, the present invention provides a language model-based universal memory management system, wherein the language model-based universal memory management system uses the above-mentioned language model-based universal memory management method.
[0010] Compared with the prior art, the beneficial effects of this invention are as follows:
[0011] This invention provides a general memory management method and system based on a language model. During natural language dialogue between a user and a language model, memory information that needs to be remembered is extracted from the dialogue content. Temporary memories are generated based on this information, and these temporary memories are integrated to generate persistent memories about the user. These persistent memories are then integrated into the dialogue between the user and the language model when accessed, forming a memory of the user to control the dialogue system. Memory types are categorized and managed according to the importance of the memory information in the persistent memories, resulting in both short-term and long-term memories. The importance of the memory information in the persistent memories is updated and managed to manage the forgetting and promotion of short-term and long-term memories. This achieves flexible and efficient storage and retrieval of user memories, independent of model type, enhancing the humanized, continuous, and personalized dialogue experience during human-computer natural language dialogue. Attached Figure Description
[0012] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this invention, illustrate exemplary embodiments of the invention and are used to explain the invention, but do not constitute an undue limitation of the invention. Some specific embodiments of the invention will be described in detail below with reference to the accompanying drawings in an exemplary and non-limiting manner. The same reference numerals in the drawings designate the same or similar parts or components. It should be understood by those skilled in the art that these drawings are not necessarily drawn to scale. In the drawings:
[0013] Figure 1 This is a flowchart illustrating a general memory management method based on a language model according to an embodiment of the present invention;
[0014] Figure 2 This is a schematic diagram of a memory data organization method in an embodiment of the present invention;
[0015] Figure 3This is a schematic diagram of a process for generating temporary memory in an embodiment of the present invention;
[0016] Figure 4 This is a schematic diagram of a process for generating persistent memory in an embodiment of the present invention;
[0017] Figure 5 This is a schematic diagram of a memory forgetting process in an embodiment of the present invention;
[0018] Figure 6 This is a schematic diagram of a memory rise process in an embodiment of the present invention;
[0019] Figure 7 This is a schematic diagram of a process for integrating and remembering dialogue content in an embodiment of the present invention;
[0020] Figure 8 This is a schematic diagram of a memory access and model splitting process in an embodiment of the present invention. Detailed Implementation
[0021] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments. Obviously, the described embodiments are merely 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 should fall within the scope of protection of the present invention.
[0022] Example 1
[0023] See Figures 1-8 This embodiment provides a general memory management method based on a language model, including steps S101, S102 and S103.
[0024] S101. During the natural language dialogue between the user and the language model, extract the memory information that needs to be memorized from the dialogue content.
[0025] S102. Generate temporary memory based on the memory information to be memorized, and integrate the temporary memory to generate persistent memory about the dialogue user. The persistent memory is used to be integrated into the dialogue process between the dialogue user and the language model when accessed, forming a memory of the dialogue user to control the dialogue of the dialogue system.
[0026] S103. Memory types are classified and managed according to the importance of memory information in the persistent memory, so that the persistent memory includes short-term memory and long-term memory. The importance of memory information in the persistent memory is updated and managed to allow for forgetting and promotion of short-term and long-term memories. Furthermore, the persistent memory also includes permanent memory. When updating and managing the importance of memory information in the persistent memory, permanent memory is also subject to forgetting and promotion.
[0027] Furthermore, the general memory management method based on language models also includes: performing degradation management on the persistent memory, by setting the short-term memory and the long-term memory to empty according to memory complexity requirements. The memory complexity requirements can be proposed by the user or actively configured by the system.
[0028] It should be noted that in this embodiment, during the natural language dialogue between the user and the language model, the memory information that needs to be remembered is extracted from the dialogue content. Temporary memories are generated based on the memory information that needs to be remembered, and these temporary memories are integrated to generate persistent memories about the user. These persistent memories are used to be integrated into the dialogue between the user and the language model when accessed, forming a memory of the user to control the dialogue system. The memory types are classified and managed according to the importance of the memory information in the persistent memories, dividing the persistent memories into short-term memories, long-term memories, and permanent memories. The importance of the memory information in the persistent memories is updated and managed to allow for forgetting and upgrading of the short-term memories, long-term memories, and permanent memories. This achieves flexible and efficient storage and retrieval of user memories, improving the humanized, continuous, and personalized dialogue experience during human-computer natural language dialogue.
[0029] It should be noted that in this embodiment, by generating and recalling the user's personalized memories during the dialogue process, the dialogue system can adjust its response based on historical dialogue content and user preferences, thereby greatly improving the naturalness and intelligence of human-computer interaction. The memory mechanism enables the system to remember the user's past information, interests, habits, etc., just like a human, and to make more accurate responses that meet the user's needs, resulting in a more natural dialogue-like interactive experience. Furthermore, the memory management mechanism is model-independent and can be used across different versions or architectures of dialogue models. This means that as technology iterates and upgrades, existing memory data can still be effectively stored, recalled, and updated, and will not be lost or unusable due to model changes. This cross-model compatibility enhances the system's flexibility and long-term adaptability, providing a more stable and durable memory foundation for future technological development. In addition, the memory management mechanism in this embodiment supports dynamic updates, that is, timely adjustments and corrections to memory entries based on time and dialogue priority. This not only ensures the real-time nature and accuracy of memory but also effectively removes irrelevant or outdated information, ensuring that the memory data obtained by the user always has high relevance and value. The system intelligently handles issues of repetition, contradiction, and priority conflicts, ensuring the accuracy of memory content. Furthermore, users can control memory saving and updating through custom rules, even specifying which memory entries should be permanently saved or prioritized, allowing for personalized management of memory content according to individual needs and enhancing the system's customization capabilities. Users can autonomously choose the update priority and importance rules for memories, making the system more tailored to individual user needs and further improving personalization and flexibility. In addition, this embodiment employs a biomimetic memory management model to simulate the human brain's memory processing mechanism, managing user memories hierarchically, dividing memory information into temporary and persistent memories (such as short-term and long-term memory), and dynamically updating them based on the importance and timeliness of the information. The system ensures the consistency and accuracy of memory content through deduplication and contradiction removal mechanisms, while employing a forgetting mechanism to automatically reduce the priority of unused memories as conversations progress, maintaining the timeliness of memories. Moreover, the system can adaptively update memories based on changes in user behavior and allows users to customize priorities or set certain memories for permanent storage. This biomimetic memory management model enables the system to manage memories more naturally and intelligently, improving the personalization of dialogues and the fluency of long-term interactions, while enhancing user trust and satisfaction.
[0030] It's important to note that temporary memory stores temporary content that occurs during a conversation, such as temporary information, temporary tasks, or temporary states within the conversation. This memory is typically used to resolve conflicts, repetitions, or contradictions between persistent memory files and new conversation content. Temporary memory is not stored long-term but helps ensure the immediacy and stability of the conversation system. Short-term memory includes transactional content, incidental events, and memos. These memories are usually associated with a specific conversation scenario and have a high time sensitivity. Short-term memory can be delayed based on the completion and priority of the conversation. After a conversation or task is completed, the priority of short-term memory can be evaluated, and it can be decided whether to clear it or convert it into long-term memory. Long-term memory contains the user's core information, such as personal interests, historical experiences, and habits / preferences. Long-term memory entries can be generated from short-term memory through multiple human-computer interaction sessions or directly extracted from the conversation content. Information stored in long-term memory has a high priority, but long-term memory that has not been accessed for a certain period will gradually decrease in importance as the number of conversations or words increases. Furthermore, permanent memories can only be generated through user-defined rules and multiple accesses to long-term memories. Permanent memories cannot be downgraded or forgotten unless manually intervened or deleted by the user.
[0031] Preferably, during the natural language dialogue between the user and the language model, the user interacts with the language model by inputting natural language. The language model performs semantic understanding, generates responses, and provides feedback based on the user's input. The dialogue content between the user and the language model includes various topics, such as daily communication, transaction processing, and emotional support. During the process of semantic understanding, response generation, and feedback based on the user's input, the language model establishes contextual connections with the user through continuous dialogue, extracting and accumulating relevant information from the dialogue content. It should be noted that during the dialogue, the language model identifies and understands the user's needs, intentions, and emotions, providing relevant information or providing appropriate responses. Simultaneously, the language model establishes contextual connections with the user through continuous dialogue, gradually accumulating information about the user's short-term and long-term memories. This accumulation of information provides the foundation for personalized services, recommendations, and other functions in subsequent dialogues.
[0032] Preferably, the memory information extracted from the dialogue content is stored in the form of entries, divided into memory structure data and memory content data. Each entry in the memory structure data has a unique entry category, subject category, time information including timestamps of each memory access, hit count, and memory importance. The memory content data for each entry corresponds to the memory structure data, including memory content, associated entries, dialogue snapshots, and modification records. It should be noted that in each dialogue, the user's input is analyzed to determine if it contains content that needs to be remembered. For example, if a user's dialogue includes a discussion about what they ate for lunch yesterday, mentioning they don't like cilantro and that the cafeteria food is delicious, the model will analyze the dialogue content and extract entries categorized as "preferences," "user," and containing the memory content "dislikes cilantro"; or categorized as "experiences," "user-related," and containing the memory content "the cafeteria food is delicious." Furthermore, the model will determine the importance of memory entries based on the dialogue context and the specific content of the memory. This importance affects functions such as memory retrieval, promotion, and forgetting.
[0033] Preferably, after the persistent memory is generated, it is locally encrypted and stored. When the encrypted persistent memory needs to be transmitted over the network, an encoder converts the memory content into unreadable computer language for encrypted transmission. The language model can be a deep neural network model. When using a deep neural network model, it can be decomposed, separating the first few layers and the last few layers (with computational complexity below a preset range) from the dialogue system, and processing the middle layers (with computational complexity exceeding a preset range) separately.
[0034] It should be noted that when the persistent memory needs to be accessed or updated, it can be locally decoded using a decoder. In the deep neural network model, the computationally less computationally intensive text segmentation, word vectorization, embedding layers, and positional encoding components can serve as the encoder, and the final feedforward neural network in the deep neural network model can serve as the decoder.
[0035] It should also be noted that in this general memory management method based on a language model, when the language model adopts a deep neural network model, the deep neural network model is decomposed. The first few layers and the last few layers of the network with lower computational cost are isolated from the dialogue system, while the middle part with higher computational cost is processed separately. This ensures that even if the encoded memory content needs to be transmitted over the network, the transmitted content is a feature encoding that is not readable by humans, thus protecting user privacy. In addition, the deep neural network model is a large language model, belonging to the category of large models. From text input to text output, the large language model first segments and tokenizes the input text and converts it into word vectors. After processing by the embedding layer and positional encoding, the vectors are input. In the encoder, taking the Transformer architecture as an example, attention weights are calculated and weighted summed through a multi-head attention mechanism. Then, a feedforward neural network is used for feature extraction. The decoder predicts the next tag based on the input and encoder output, and strategies such as greedy search, sampling, or bundle search can be used, with repetition penalties and bundle width adjustments. Finally, the generated tag sequence is converted back into text and post-processed to obtain the final output text. In this method, the text pre-processing and post-processing parts can be run on the local processor. User input and memorized content are encoded separately by an encoder, fused into vectors, and then inferred by the backbone of a large model. The resulting feature vectors are transmitted to a decoder for decoding, ultimately outputting text. Throughout this process, all text that can be understood by humans can only be presented on the local machine. In this method, the large language model refers to a deep neural network with a large number of parameters trained on a large amount of natural language, typically an attention-based model. The large language model possesses strong linguistic logic, information integration and extraction capabilities, and a near-human thinking style. It can integrate and process large amounts of information in a conversational manner using natural language and execute pre-defined instructions without requiring detailed logical operations.
[0036] Preferably, when generating temporary memory based on the required memory information, the method includes: storing the required memory information in a buffer to generate the temporary memory. When integrating the temporary memory to generate persistent memory about the user, the method includes: searching for memory entries that are close to the content of the current temporary memory, and generating persistent memory about the user based on the search results. Further, when generating persistent memory about the user based on the search results, the method includes: when a memory entry close to the content of the current temporary memory is found, analyzing the relationship between the content of the found memory entry and the temporary memory; when there is no correlation between the content of the found memory entry and the temporary memory, adding a new memory entry for the temporary memory in the persistent memory file, and filling the new memory entry with the content of the temporary memory to generate persistent memory about the user. Furthermore, when generating persistent memories about the dialogue user based on the search results of the memory entries, the process includes: if no memory entry closely related to the content of the temporary memory is found, adding a new memory entry for the temporary memory in the persistent memory file, and filling the newly added memory entry with the content of the temporary memory to generate persistent memories about the dialogue user. Further, when generating persistent memories about the dialogue user based on the search results of the memory entries, the process includes: if the memory content of the found memory entry is a duplicate of the temporary memory, incrementing the hit count of the found memory entry to indicate a successful access; if the memory content of the found memory entry is contradictory to the temporary memory, handling the contradictory information. The strategy for handling contradictions is based on the user's settings; the user can choose to be prompted to handle memory conflicts, or choose time priority or allow the large model to handle contradictory information autonomously.
[0037] It's worth noting that users can control the saving and updating of memories through custom rules, and even specify which memory entries should be permanently saved or prioritized. This feature allows users to personalize memory management according to their needs, enhancing the system's customization capabilities. Users can independently choose the update priority and importance rules for memories, making the system more tailored to individual user needs and further improving personalization and flexibility. This method employs a biomimetic memory management model, simulating the human brain's memory processing mechanism. It manages user memories hierarchically, dividing them into temporary, short-term, and long-term memories, and dynamically updates them based on the importance and timeliness of the information. The system ensures the consistency and accuracy of memory content through deduplication and contradiction removal mechanisms, while employing a forgetting mechanism that automatically reduces the priority of unused memories as the conversation progresses, maintaining the timeliness of memories. Furthermore, the system can adaptively update memories based on changes in user behavior and allows users to customize priorities or set certain memories for permanent saving. This biomimetic memory management model makes the system manage memories more naturally and intelligently, improving the personalization of conversations and the fluency of long-term interactions, while enhancing user trust and satisfaction.
[0038] It's important to note that during the dialogue, this method can adaptively select the memory content to retrieve based on the dialogue content. The model refines the dialogue content, retrieves relevant information from memory entries and content, and extracts the required memory entries and content from the memory bank based on the retrieval results. This memory entry information is then input into the language model as a premise for dialogue, thus achieving the function of embedding memory within the dialogue. Taking a recommendation scenario as an example, a user asks: "What are some good restaurants nearby?" First, the model analyzes the dialogue content and determines that it needs to retrieve content related to the user's preferences. Searching for relevant memory entries reveals that content related to the user's taste preferences includes: the user likes spicy food, the user likes fish, etc. By integrating this information as a premise into the dialogue, the dialogue system possesses a memory of the current user, thus recommending a nearby Sichuan-style boiled fish restaurant to the user.
[0039] Furthermore, when classifying and managing memory types based on the importance of the memory information in the persistent memory, the process includes: using the language model to comprehensively judge the importance of the memory information in the persistent memory based on the contextual information during the dialogue, the degree of relevance to the dialogue topic, and user-defined rules; sorting the importance levels of the memory information from low to high according to levels 1-9, with the persistent memory having an importance level of 1-4 being short-term memory, the persistent memory having an importance level of 5-8 being long-term memory, and the persistent memory having an importance level of 9 being permanent memory.
[0040] Furthermore, the importance of the memory information in the persistent memory is updated and managed. When forgetting and promoting the short-term memory, long-term memory, and permanent memory, this includes: when the persistent memory is a short-term memory with an importance level of 1-4 and the entry category is a transaction, after the transaction ends, based on the feedback from the user, directly forgetting the short-term memory, retaining the short-term memory, or converting the short-term memory into long-term memory; when the persistent memory is a long-term memory with an importance level of 8 and is accessed and hit multiple times, the long-term memory with an importance level of 8 is promoted to... Permanent memories are accessed during conversations by mentioning relevant information. Permanent memories with importance levels 1-8 are accessed and their importance increases with repeated access, decreasing in importance as the number of unmentioned words or instances decrease, until they are forgotten. Permanent memories with an importance level of 9 are not directly forgotten. A queue of permanent memories with an importance level of 9 is maintained. When the number of permanent memories reaches the maximum length of the queue, the memory at the tail of the queue is downgraded to a long-term memory with an importance level of 8. Whenever a permanent memory is accessed, it is immediately placed at the head of the queue. It should be noted that in this embodiment, the memory mechanism supports dynamic updates, meaning that memory entries are adjusted and corrected in a timely manner based on time and conversation priority. This not only ensures the real-time nature and accuracy of the memory but also effectively removes irrelevant or outdated information, ensuring that the memory data obtained by the user always has high relevance and value. The system can intelligently handle issues of repetition, contradiction, and priority conflicts, ensuring that the memory content is always accurate. Furthermore, users can control the saving and updating of memories through custom rules, and can even specify which memory entries need to be permanently saved or prioritized. This feature allows users to personalize memory management according to their needs, enhancing the system's customization capabilities. Users can independently choose the update priority and importance rules for memories, making the system more tailored to individual user needs and further improving personalization and flexibility. Furthermore, the importance of the memory information in the persistent memories can be dynamically updated. Through a forgetting mechanism, the system automatically reduces the priority of unused memories as the conversation progresses, maintaining the timeliness of memories. In addition, the system can adaptively update memories based on changes in user behavior and allows users to customize priorities or set certain memories for permanent storage. This biomimetic memory management model makes the system manage memories more naturally and intelligently, improving the personalization of conversations and the fluency of long-term interactions, while enhancing user trust and satisfaction. For example, Table 1 is a detailed illustration of memory classification management.
[0041]
[0042] As shown in Table 1, if a memory has not been accessed for a long period, its importance gradually decreases as the number of words in the dialogue increases. The table only shows one rule for importance decay; the number of dialogues can also be used as a rule for memory importance decay. The advantage of using the number of dialogues and words to decay memory importance is that the decay coefficient is only accumulated when the user accesses the dialogue system, avoiding the problem of all memories being forgotten due to a long period of inactivity. For example, if a long-term memory with an importance of 5 has not been accessed in the last 100,000 words of dialogue, its importance decreases to 4. In this case, the decay rule applied is the same as for an importance of 4, meaning that the importance decreases by 0.2 for every 10,000 words not accessed. Memory entries that are transactions have a special forgetting rule: the importance of a memory does not decrease before the transaction is executed, but after the transaction is completed, a determination of whether it has been forgotten is made. If the determination result is forgetting, the memory entry is directly deleted. The decay rules shown in Table 1 are only initial rules. In reality, the frequency and length of each user's dialogue with the system vary. Therefore, this coefficient will be automatically calculated and adjusted based on the parameters of the user's dialogue to keep the system's forgetting curve within a reasonable range. In the actual system, there is also an upper limit to the importance decay of memories of different importance levels per unit time to prevent a large number of memory entries from being forgotten due to short-term, high-intensity dialogues. When a memory is hit, its importance will also be increased accordingly according to Table 1, and the level of increase will also be dynamically adjusted based on the parameters of the user's dialogue. In addition to being directly specified by user rules, a memory must be hit to become a long-term memory; that is, an 8-level long-term memory becomes a permanent memory through multiple hits. The importance increase from a memory hit and the importance decrease from a dialogue miss work together to determine the storage time of a memory in the persistent memory system.
[0043] In general, the language model-based general memory management method can generate memories about the user during human-computer dialogue. These memories are stored in a file in an unreadable form, but can be read and retrieved from the file during user dialogue, allowing the model to access memories about the dialogue object and achieve a more natural human-computer interaction effect. Memories can be generated, saved, retrieved, and updated across models. Although the parameters in the model may change at any time with technological iterations, the memory effect achieved by this invention is model-independent, so the parameters generated in different models are universal. Memories are dynamically updated according to time and priority. As the user continues to dialogue with the model, short-term memories generated in new dialogues are compared with previously saved long-term memories, deduplicated, contradictory, and their importance is compared before being updated to the long-term memory file. The memory entries in the saved long-term memory file change over time, and users can also define rules to determine the importance of memories or make certain memory entries permanent. Memories are divided into temporary memory, short-term memory, and long-term memory. Temporary memory is used to integrate persistent memory files with new dialogue content to address issues such as duplication and conflict. Short-term memory typically contains transactional content, incidental events, memos, or experiences and events not involving the user. It is usually cleared after access or completion of a transaction, based on priority. Long-term memory is the highest priority memory, typically storing user preferences, experiences, and personal information. Long-term memory can be generated through multiple accesses to short-term memory or directly from conversation content. Long-term memory often exhibits varying levels of importance and decreases in importance over time until it is forgotten. Unless actively managed by the user, permanent memory does not decrease in importance or become forgotten. Memory files are encoded using an encoder and then decoded using a decoder before being read; the encoder and decoder exist only on the user's local hardware. The information stored in the file system is in computer language unreadable to humans, reducing the risk and concern of user privacy breaches.
[0044] Example 2
[0045] See Figures 1-8This embodiment provides a language model-based universal memory management system. The system uses the language model-based universal memory management method described in any of the above embodiments. During natural language dialogue between a user and a language model, it extracts the memory information to be remembered from the dialogue content, generates temporary memories based on the required information, and integrates these temporary memories to generate persistent memories about the user. These persistent memories are then integrated into the dialogue between the user and the language model when accessed, forming a memory of the user to control the dialogue system. The system categorizes and manages memory types based on the importance of the information in the persistent memories, ensuring that the persistent memories include short-term and long-term memories. It also updates and manages the importance of the information in the persistent memories, allowing for forgetting and promotion of short-term and long-term memories. This achieves flexible and efficient storage and retrieval of user memories regardless of model type, enhancing the humanized, continuous, and personalized dialogue experience during human-computer natural language dialogue.
[0046] It should be noted that the above embodiments are merely preferred embodiments of the present invention, and the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention, and the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A general memory management method based on a language model, characterized in that, include: During the natural language dialogue between the user and the language model, the memory information that needs to be memorized is extracted from the dialogue content. Temporary memories are generated based on the memory information to be memorized, and these temporary memories are integrated to generate persistent memories about the dialogue user. These persistent memories are used to be integrated into the dialogue process between the dialogue user and the language model when accessed, forming a memory of the dialogue user to control the dialogue of the dialogue system. When generating temporary memory based on the memory information to be memorized, the process includes: storing the memory information to be memorized in a buffer to generate the temporary memory; when integrating the temporary memory to generate persistent memory about the dialogue user, the process includes: searching for memory entries that are close to the content of the current temporary memory, and generating persistent memory about the dialogue user based on the search results of the memory entries. Memory types are categorized and managed according to the importance of the memory information in the persistent memory, so that the persistent memory includes short-term memory and long-term memory. The importance of the memory information in the persistent memory is updated and managed to allow for forgetting and promotion of short-term and long-term memories. When updating and managing the importance of the memory information in the persistent memory to allow for forgetting and promotion of short-term and long-term memories, the following steps are taken: when the persistent memory is a short-term memory with an importance level of 1-4 and the memory entry category is a transaction, after the transaction ends, based on the feedback from the user, the short-term memory is either directly forgotten, retained, or converted into long-term memory; when the persistent memory is a long-term memory with an importance level of 8 and is accessed and hit multiple times, the long-term memory with an importance level of 8 is promoted to permanent memory; all persistent memories are hit during the conversation by mentioning relevant information, and persistent memories with an importance level of 1-8 are promoted after being accessed and hit multiple times, and their importance level decreases with the number of words or times not mentioned in the conversation until they are forgotten; The general memory management method based on language models further includes: performing degradation management on the persistent memory, so as to set the short-term memory and the long-term memory to empty according to the memory complexity requirements.
2. The general memory management method based on a language model as described in claim 1, characterized in that, After the persistent memory is generated, it is encrypted and stored locally. When the encrypted persistent memory needs to be transmitted over the network, the memory content of the persistent memory is converted into an unreadable computer language by an encoder for encrypted transmission.
3. The general memory management method based on a language model as described in claim 1, characterized in that, During a natural language dialogue between a user and a language model, the user interacts with the language model by inputting natural language, and the language model performs semantic understanding, generates responses, and provides feedback based on the user's input. The dialogue content between the user and the language model includes various topics.
4. The general memory management method based on a language model as described in claim 3, characterized in that, The language model performs semantic understanding, generates responses, and provides feedback based on the input of the dialogue user. Through continuous dialogue, it establishes contextual connections with the dialogue user and extracts and accumulates memory information that needs to be memorized from the dialogue content.
5. The general memory management method based on a language model as described in claim 4, characterized in that, The memory information extracted from the dialogue content is stored in the form of entries, divided into memory structure data and memory content data. Each entry in the memory structure data has a separate entry category, subject category, time information including timestamps of each memory access, hit or modification, the number of hits of the memory access, and the importance of the memory. The memory content data of each entry corresponds to the memory structure data and includes memory content, associated entries, dialogue snapshots, and modification record information.
6. The general memory management method based on a language model as described in claim 5, characterized in that, When generating a temporary memory based on the memory information to be memorized, the process includes: storing the memory information to be memorized in a buffer to generate the temporary memory.
7. The general memory management method based on a language model as described in claim 6, characterized in that, When integrating the temporary memories to generate persistent memories about the conversation user, the process includes: finding memory entries that are close to the content of the current temporary memories, and generating persistent memories about the conversation user based on the search results of the memory entries.
8. A general memory management system based on a language model, characterized in that, The language model-based general memory management system uses the language model-based general memory management method as described in any one of claims 1-7.
Citation Information
Patent Citations
Long text processing method and related device
CN119204234A
Cited By
Single-point writing gate and candidate memory adoption method for AI long-term memory
CN122596115A