A memory management method, a memory management device, and a computer storage medium.

CN121029932BActive Publication Date: 2026-08-14HARBIN INSTITUTE OF TECHNOLOGY (SHENZHEN) (INSTITUTE OF SCIENCE AND TECHNOLOGY INNOVATION HARBIN INSTITUTE OF TECHNOLOGY SHENZHEN)
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-01
Publication Date
2026-08-14

AI Technical Summary

Technical Problem

[0003]然而,现有技术大多将不同会话的记忆作为孤立的文本片段进行存储和检索,未能有效追踪特定信息(如一个计划、一个观点)在长时间跨度内的演变和发展过程,导致人工智能对于用户的个性化学习效果不佳

Benefits of technology

[0042]与现有技术相比,本申请的有益效果是:记忆管理装置提取当前对话内容中当前记忆类别以及当前记忆线索;根据所述当前记忆类别匹配目标记忆类别;将所述当前记忆类别对应的当前记忆线索链接到所述目标记忆类别所在记忆链的末端。通过上述记忆管理方法,记忆管理装置一方面通过提取对话的记忆类别,并匹配已存在的记忆类别,实现相同记忆类别的记忆线索整合,从而将不同对话之间的文本片段进行关联处理;另一方面通过将新对话内容的记忆线索链接到匹配到的记忆链的末端,从时间维度上追踪该记忆链的线索变化,实现对特定信息在长时间跨度内的演变和发展过程的追踪。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121029932B_ABST
    Figure CN121029932B_ABST
Patent Text Reader

Abstract

This application proposes a memory management method, a memory management device, and a computer storage medium. The memory management method includes: extracting the current memory category and current memory cues from the current conversation content; matching a target memory category based on the current memory category; and linking the current memory cues corresponding to the current memory category to the end of the memory chain containing the target memory category. Through this memory management method, a memory chain with dual indexes of category and time is constructed for memories of different conversations, enabling the tracking of the evolution and development of specific information from different conversations over a long period.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence natural language processing technology, and in particular to a memory management method, a memory management device, and a computer storage medium. Background Technology

[0002] As artificial intelligence (AI) becomes increasingly integrated into people's lives, the user experience it provides is attracting more and more attention. The ability of AI to provide thoughtful and personalized services depends on continuous interaction between users and AI. Through these repeated conversations, AI learns from user needs, thereby deepening its connection with users.

[0003] However, most existing technologies store and retrieve memories of different conversations as isolated text fragments, failing to effectively track the evolution and development of specific information (such as a plan or an opinion) over a long period of time, resulting in poor personalized learning effects of artificial intelligence for users. Summary of the Invention

[0004] To address the aforementioned technical problems, this application proposes a memory management method, a memory management device, and a computer storage medium.

[0005] To address the aforementioned technical problems, this application proposes a memory management method, which includes:

[0006] Extract the current memory category and current memory cues from the current dialogue content;

[0007] Match the target memory category based on the current memory category;

[0008] Link the current memory cue corresponding to the current memory category to the end of the memory chain containing the target memory category.

[0009] The memory management method further includes, after extracting the current memory category and current memory cues from the current dialogue content:

[0010] Calculate the first similarity of each pair of memory categories in the current memory category;

[0011] Merge memory category pairs whose first similarity is greater than the first preset threshold into one memory category;

[0012] The memory categories that are merged into one memory category will be merged with the corresponding current memory cues.

[0013] Wherein, the step of matching the target memory category according to the current memory category includes:

[0014] The maximum similarity between the current memory category and existing memory categories is calculated as the second similarity.

[0015] Determine whether the second similarity is greater than a second preset threshold;

[0016] If so, the existing memory category corresponding to the maximum similarity is identified as the target memory category;

[0017] If not, create the target memory category based on the current memory category.

[0018] Wherein, after linking the memory cues corresponding to the current memory category to the end of the memory chain containing the target memory category, the memory management method further includes:

[0019] Obtain historical memory cues belonging to the same memory category as the current memory cues that link to the end of the memory chain containing the target memory category;

[0020] Based on the current memory cues and the historical memory cues, a first prompt message is generated to determine whether a memory conflict is present;

[0021] Input the first prompt information into the large language model to perform a consistency check;

[0022] When the large language model confirms the existence of a memory conflict, the historical memory cues are updated using the current memory cues.

[0023] The step of updating the historical memory cues using the current memory cues includes:

[0024] The current memory clue and the historical memory clue are merged to generate a new memory clue;

[0025] Remove the historical memory clue and the current memory clue from the memory chain containing the historical memory clue, and connect the new memory clue to the end of the memory chain containing the target memory category.

[0026] The memory management method further includes:

[0027] Traverse each memory chain and obtain the unmatched unfuzzed memory clues within a preset time for each memory chain;

[0028] The memory cues to be blurred are compressed using a text compressor to generate new memory cues.

[0029] The step of compressing the memory cues to be blurred using a text compressor to generate new memory cues includes:

[0030] The memory cues to be blurred are compressed for the first time using a text compressor to generate the first memory cues.

[0031] Based on the memory clues to be blurred and the first memory clues, a determination is made as to whether to implement the second prompt information based on recovery;

[0032] Input the second prompt message into the large language model to perform a memory recovery check;

[0033] The compression process stops when the large language model confirms that the memory cues to be blurred have been recovered based on the first memory cues.

[0034] The memory management method further includes:

[0035] Get the query text entered by the user;

[0036] The most relevant memory category to match the query text;

[0037] The most similar memory clue is retrieved from the memory chain corresponding to the most relevant memory category, and the most similar memory clue is added to the initialized candidate memory set.

[0038] Using the most similar memory clue as the search center, search for neighboring memory clues in the memory chain corresponding to the most relevant memory category, and add the searched neighboring memory clues to the candidate memory set;

[0039] A dialogue response is generated from the query text and the candidate memory set using a large language model.

[0040] To address the aforementioned technical problems, this application also proposes a memory management device, which includes a memory and a processor coupled to the memory; wherein the memory is used to store program data, and the processor is used to execute the program data to implement the memory management method described above.

[0041] To address the aforementioned technical problems, this application also proposes a computer storage medium for storing program data, which, when executed by a computer, is used to implement the aforementioned memory management method.

[0042] Compared with existing technologies, the beneficial effects of this application are: the memory management device extracts the current memory category and current memory cues from the current dialogue content; matches the target memory category according to the current memory category; and links the current memory cues corresponding to the current memory category to the end of the memory chain where the target memory category is located. Through the above memory management method, the memory management device, on the one hand, integrates memory cues of the same memory category by extracting the memory category of the dialogue and matching existing memory categories, thereby associating text fragments between different dialogues; on the other hand, by linking the memory cues of new dialogue content to the end of the matched memory chain, it tracks the changes of cues in the memory chain from a time dimension, thereby tracking the evolution and development of specific information over a long period of time. Attached Figure Description

[0043] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0044] in:

[0045] Figure 1 This is a flowchart illustrating the first embodiment of the memory management method provided in this application;

[0046] Figure 2 This is a schematic diagram of an embodiment of the long-term dialogic memory framework based on ordered memory integration provided in this application;

[0047] Figure 3 This is a flowchart illustrating the second embodiment of the memory management method provided in this application;

[0048] Figure 4 This is a flowchart illustrating the third embodiment of the memory management method provided in this application;

[0049] Figure 5 This is a flowchart illustrating the fourth embodiment of the memory management method provided in this application;

[0050] Figure 6 This is a flowchart illustrating the fifth embodiment of the memory management method provided in this application;

[0051] Figure 7 This is a flowchart illustrating an embodiment of the heuristic memory retrieval algorithm provided in this application;

[0052] Figure 8 This is a schematic diagram of the structure of an embodiment of the memory management device provided in this application;

[0053] Figure 9 This is a schematic diagram of the structure of an embodiment of the computer storage medium provided in this application. Detailed Implementation

[0054] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.

[0055] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the application described herein can be implemented, for example, in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0056] To address the problems of existing technologies, this application provides a memory management method, proposing a novel memory organization paradigm that moves from disordered memory to ordered integration. It is the first to propose categorizing massive, discrete dialogue history information by type and then constructing it into an ordered "memory chain" in chronological order. This structured approach can clearly track the evolution of each topic, solving the problem of existing technologies neglecting the memory evolution process.

[0057] First, let's introduce the technical terms and their explanations involved in the memory management method provided in this application:

[0058] Large Language Models (LLMs) refer to pre-trained language models trained on massive amounts of text data, typically with billions or even more parameters. LLMs possess powerful text understanding, generation, and reasoning capabilities, and are the core components for realizing the functions of each module in this invention (such as content understanding, conflict detection, and response generation).

[0059] A session consists of multiple rounds of dialogue, with a clear time interval between each session.

[0060] Trace of Memory (ToM): This invention proposes a framework aimed at effectively utilizing contributing memories from massive dialogue histories. Its core is to transform disordered memory cues into ordered memory integration, thereby improving the performance of LLMs in long-term dialogues.

[0061] Memory Clues: Key information units extracted and summarized from dialogue content for a specific "memory category".

[0062] Memory Chain: For each "memory category," a memory chain is an ordered sequence of memories formed by linking related "memory cues" generated in different conversations in chronological order. Memory chains record the evolutionary trajectory of information on a specific topic.

[0063] Linking: Connecting new memory cues to the end of an existing memory chain based on their category, or creating a new memory chain for a newly emerging category.

[0064] Updating: When a newly added memory cue conflicts with existing information in the memory chain or when the content evolves, the two are merged to generate a new, unambiguous memory cue that is up-to-date, and the old conflicting information is replaced.

[0065] Blurring: Text compression of "stale" memory cues that have not been mentioned for a long time in the memory chain to reduce storage space and computational overhead while preserving their core semantics.

[0066] Heuristic-based memory retrieval: an efficient memory retrieval strategy. When responding to a user query, it does not traverse all historical records, but instead starts with the most relevant memory chain and dynamically and iteratively retrieves memories along the chain until sufficient information is obtained.

[0067] Please refer to details. Figure 1 and Figure 2 , Figure 1 This is a flowchart illustrating the first embodiment of the memory management method provided in this application. Figure 2 This is a schematic diagram of an embodiment of the long-term dialogic memory framework based on ordered memory integration provided in this application.

[0068] like Figure 2The dialogic memory framework shown aims to enhance the responsiveness of LLMs in long-term dialogues by transforming disordered memory cues into ordered memory integration through a process consisting of three core modules: categorized memory construction, chained memory management, heuristic memory retrieval, and dialogue response generation. The working principles and processes of these four modules are described below through different implementation examples.

[0069] The memory management method of this application is applied to a memory management device, which can be a server, a terminal device, or a system in which the server and the terminal device cooperate with each other. Accordingly, the various parts of the memory management device, such as each unit, subunit, module, and submodule, can all be set in the server, all in the terminal device, or separately in the server and the terminal device.

[0070] Furthermore, the aforementioned server can be either hardware or software. When the server is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or as a single server. When the server is software, it can be implemented as multiple software programs or software modules, such as software or software modules used to provide distributed server functionality, or as a single software program or software module; no specific limitations are made here.

[0071] like Figure 1 As shown, the specific steps are as follows:

[0072] Step S11: Extract the current memory category and current memory cues from the current dialogue content.

[0073] In the embodiments of this application, regarding Figure 2 The categorized memory building module aims to extract structured memory units from the original dialogue content as the basis for subsequent management and retrieval.

[0074] For each dialogue session, the memory management device first prompts the LLMs to "summarize all possible topics based on the current dialogue, ensuring that each topic is independent and unique as much as possible. For each identified topic, generate a summary containing key events and return it in JSON format" to process the dialogue content, thereby identifying a set of memory categories T = {t1, t2, ..., t...}. n} and their corresponding memory cues C={c1,c2,...,c n}. Where, t i ∈R dt It is the embedding vector of the memory category, c i ∈R dc It is the embedding vector corresponding to the memory cue, d t and dc These refer to the dimension size of the word embedding model. In this invention, the embedding model used is OpenAI's text-embedding-3-large.

[0075] In one specific embodiment, the current dialogue content is as follows:

[0076] User: "I want to book a flight from Beijing to Shanghai next Friday, preferably in the morning, in economy class."

[0077] Artificial intelligence: "Flight found: China Eastern Airlines MU5107, departing at 8:00 AM, price 1200 yuan."

[0078] In response, the memory management device can identify a set of memory categories, such as {departure city, arrival city, date, flight number}, and the memory clues corresponding to the memory categories, such as {Beijing, Shanghai, next Friday, MU5107}.

[0079] It should be noted that the input data in this application is not limited to open domain dialogues, but can be extended to any field that needs to track the evolution of information, such as electronic medical record tracking in the healthcare field, case file analysis in the legal field, and customer relationship management in the financial field.

[0080] Furthermore, for the memory types generated by the above process, in order to eliminate ambiguity between related categories and maintain the independence of categories within the same session, this application can also perform category deduplication and independence maintenance. For details, please refer to [link to relevant documentation]. Figure 3 , Figure 3 This is a flowchart illustrating the second embodiment of the memory management method provided in this application.

[0081] like Figure 3 As shown, the specific steps are as follows:

[0082] Step S21: Calculate the first similarity of each pair of memory categories in the current memory category.

[0083] In this embodiment of the application, the memory management device traverses the memory category pairs (t) formed by the two memory categories extracted in step S11 of the current memory category. i ,t j For each pair of memory categories, cosine similarity is calculated:

[0084]

[0085] Step S22: Merge memory category pairs with a first similarity greater than a first preset threshold into one memory category.

[0086] In this embodiment of the application, if the memory category is (t) i ,t jIf the similarity between categories t and t is greater than a preset threshold, then category t... i and t j They will be merged into the same category. Otherwise, they will be treated as two separate categories.

[0087] Step S23: Merge the memory categories that have been merged into one memory category with the corresponding current memory cues.

[0088] In this embodiment of the application, for the memory category pairs that are merged into one memory category in step S22, their corresponding memory cues also need to be merged.

[0089] By following the steps above, it can be ensured that in a single session, although multiple different categories may be extracted, each category will ultimately be summarized into only one corresponding memory cue, which provides a basic source of disordered memory for subsequent memory utilization.

[0090] Step S12: Match the target memory category based on the current memory category.

[0091] In the embodiments of this application, regarding Figure 2 The chain memory management module aims to organize the disordered memory cues extracted in the previous stage into an ordered "memory chain" and dynamically maintain it to ensure the comprehensiveness, unambiguity and simplicity of the memory. Figure 2 The chain memory management mechanism in the system includes, but is not limited to, the following three key actions: linking, updating, and blurring.

[0092] The following section will introduce the working process of the linking action in the chain memory management mechanism:

[0093] The linking action is responsible for integrating new memory cues into the memory structure, which is divided into two processing methods: linking new cues to existing memory chains, or creating new memory chains for newly emerging categories.

[0094] Specifically, the memory management device for new sessions S k A set of memory categories T k and memory cues C k This application will use the cosine similarity formula in step S21 to calculate the similarity between each new category and all existing memory categories.

[0095] Then, based on the set of similarities calculated for each new category, the memory management device finds the maximum similarity and its corresponding memory cue using the following formula:

[0096]

[0097] Furthermore, before linking, the memory management device also needs to perform a threshold judgment on the maximum similarity of each new category. Specifically, if This indicates that the category already exists, and the corresponding memory cues... It will be linked to the category The end of the memory chain it belongs to. If This indicates that it is a newly mentioned category, and the memory management device will create a new memory chain for the category and... As its initial memory clues.

[0098] Step S13: Link the current memory cue corresponding to the current memory category to the end of the memory chain containing the target memory category.

[0099] In this embodiment of the application, the memory management device obtains the memory chain of the target memory category that is successfully matched with the current memory category, and then links the memory clues of the current memory category to the end of the memory chain, thereby realizing the management of clues of the same memory category. By linking to the end of the memory chain, the generation time sequence information of the memory clues can also be introduced.

[0100] This application designs a dynamic and automated memory chain management mechanism: it introduces three operations—"linking," "updating," and "fuzzing"—to dynamically maintain the memory chain. This memory chain management mechanism can automatically integrate new information, resolve content conflicts, and compress old memories, thereby ensuring the comprehensiveness, unambiguity, and conciseness of the memory, and avoiding the risk of error accumulation and information loss that exists in existing iterative summarization methods.

[0101] The following section continues with the update operation in the memory chain management mechanism. Please refer to [link to relevant documentation] for details. Figure 4 , Figure 4 This is a flowchart illustrating the third embodiment of the memory management method provided in this application.

[0102] like Figure 4 As shown, the specific steps are as follows:

[0103] Step S31: Obtain historical memory cues belonging to the same memory category as the current memory cues that are linked to the end of the memory chain containing the target memory category.

[0104] In this embodiment of the application, the update operation is intended to resolve conflicts between memories and ensure the timeliness and consistency of information, such as when a user changes a previously agreed meeting time.

[0105] Step S32: Generate a first prompt message based on the current memory cues and historical memory cues to determine whether there is a memory conflict.

[0106] Step S33: Input the first prompt information into the large language model to perform a consistency check.

[0107] In this embodiment of the application, for each newly added memory cue, the memory management device will prompt the LLMs "The following are past memories and current new memories. Please carefully understand their differences and fairly judge whether there are memory conflicts between them, such as changes in meeting time, changes in relationships between people, etc." to perform a consistency check to identify any factual conflicts, information updates, or significant event evolutions.

[0108] Step S34: When a memory conflict is confirmed in the large language model, the historical memory cues are updated using the current memory cues.

[0109] In this embodiment of the application, the update operation provided by this application is defined as follows:

[0110]

[0111] Among them, f m (·) is a conflict identification and merging function that utilizes LLMs to "carefully understand the differences between these memories and merge them into a new memory c" to identify the new c. i The old clue that conflicted with the con Merge to generate a new, unambiguous clue.

[0112] f u (·) is an update function that removes conflicting threads c from the memory chain. con and the merged new clues Add it to the end of the memory chain. This operation ensures that each memory chain reflects the latest state of its category.

[0113] In one specific implementation, the new clue c i Possible explanations: The meeting is this Friday at 3 PM; old clue c con We can hold a meeting at 10 a.m. this Friday to compare and discover new clues. i With old clues c con A conflict occurs. At this point, the memory management device generates a new clue through an update operation. The meeting time this Friday has been changed from 10:00 AM to 3:00 PM.

[0114] The following section continues with fuzzy operations in the memory chain management mechanism. Please refer to [link to relevant documentation] for details. Figure 5 , Figure 5 This is a flowchart illustrating the fourth embodiment of the memory management method provided in this application.

[0115] like Figure 5 As shown, the specific steps are as follows:

[0116] Step S41: Traverse each memory chain and obtain the unmatched fuzzy memory clues within a preset time for each memory chain.

[0117] In the embodiments of this application, the fuzzy operation draws on the principle of the Ebbinghaus forgetting curve, in which memories do not disappear in the brain but become blurred, aiming to make room for new memories and reduce the interference of irrelevant information during retrieval.

[0118] The memory management device records the time when each memory cue is linked to the memory chain, which is called the link time of the memory cue. Then, it determines whether the memory cue needs to be blurred by the difference between the link time and the current time. For example, if the difference between the link time and the current time exceeds a preset duration, such as one month, the memory cue can be identified as a memory cue to be blurred.

[0119] Step S42: Compress the fuzzy memory cues using a text compressor to generate new memory cues.

[0120] In this embodiment, the memory management device uses a text compressor (such as LLLMingua[6]) to retain its important tokens, thereby deriving a blurred result (retaining only the important text):

[0121]

[0122] The aforementioned fuzzing operation is performed iteratively, but to prevent the information from being completely lost, this application introduces a protection mechanism.

[0123] Specifically, after each iteration of compression, LLMs (Limited Language Management) are used to "carefully distinguish the differences between the original text and the compressed text, and objectively judge whether most of the key information in the original text can be recovered from the compressed text" to determine whether the key information necessary for understanding and memory can still be recovered based on the currently compressed cue. When LLMs cannot recover its core meaning with high confidence, the compression process will stop, and the compression result of the previous step will be retained as the final representation of the cue.

[0124] In summary, this application innovatively proposes a closed-loop, dynamic memory chain management mechanism that includes linking, updating, and fuzziness. This mechanism can automatically maintain a memory structure that evolves synchronously with the dialogue history, is accurate and unambiguous, and is efficiently stored, thus realizing a dynamic management method that integrates the organization, evolution, and optimization of memory.

[0125] like Figure 2As shown, this application also constructs an efficient heuristic memory retrieval and integration algorithm: Addressing the challenge of high computational costs in retrieving information from massive historical records using traditional methods, this application designs a heuristic retrieval algorithm. This algorithm performs a directional search along an ordered memory chain, dynamically determining the sufficiency of the required information, thereby efficiently integrating the most relevant historical memories for the current dialogue with minimal resource consumption. This transforms an NP-hard (Nondeterministic Polynomial time) global optimization problem into an efficient local search problem.

[0126] Please refer to details. Figure 6 and Figure 7 , Figure 6 This is a flowchart illustrating the fifth embodiment of the memory management method provided in this application. Figure 7 This is a flowchart illustrating an embodiment of the heuristic memory retrieval algorithm provided in this application.

[0127] like Figure 6 As shown, the specific steps are as follows:

[0128] Step S51: Obtain the query text input by the user.

[0129] In the embodiments of this application, such as Figure 2 The heuristic memory retrieval module dynamically retrieves and integrates relevant historical memories to generate a dialogue response when a user enters a new query q.

[0130] Step S52: Match the most relevant memory category of the query text.

[0131] In this embodiment, the memory management device performs category analysis on the query using LLMs ("Please analyze the possible related topics involved in the current query and return JSON format"), and obtains the memory category set T related to each related topic. q And Clue Set C q .

[0132] Specifically, the memory management device selects from all memory chains, for each Find the K most similar candidate memory classes At the same time, initialize an empty candidate memory set.

[0133] Step S53: Query the most similar memory clue from the memory chain corresponding to the most relevant memory category, and add the most similar memory clue to the initialized candidate memory set.

[0134] In this embodiment of the application, the memory management device selects the memory chain C from the most relevant candidate memory category. iIn step S21, the cosine similarity formula is used to find the memory c most similar to the query. k c k Add to memory set middle:

[0135]

[0136] Step S54: Using the most similar memory cue as the search center, search for neighboring memory cues in the memory chain corresponding to the most relevant memory category, and add the searched neighboring memory cues to the candidate memory set.

[0137] In this embodiment of the application, the memory management device uses c k Centered on the memory chain, proceed along its adjacent nodes (the previous c) k-1 and the next C k+1 Perform a heuristic greedy search. Calculate the similarity using the following formula:

[0138] η k+1 =sim(c k+1 ,c k ),η k-1 =sim(c k-1 ,c k )

[0139] If η k+1 ≥η k-1 Then the next neighbor c k+1 Add to memory set In the middle, and move the search center to c k+1 Otherwise, add the previous neighbor c. k-1 During this process, memories retain their original order when being integrated.

[0140] Whenever memory collection When updated, the information, along with the query q, is input into the LLMs, which ask for a fair and honest assessment of whether the current ordered memory contains sufficient information to fully answer the current query. Once the LLMs deem the information sufficient, the traversal process terminates immediately.

[0141] It should be noted that the memory management device needs to execute steps S53 and S54 for each candidate memory class, and the most similar memory clue obtained from the execution and the memory clue obtained from the exploration are both placed in this... Corresponding memory set middle.

[0142] This application enables memory management methods to extract useful memories without having to painstakingly explore the entire memory space through the aforementioned dynamic mechanism.

[0143] Step S55: Generate a dialogue response from the query text and candidate memory set using a large language model.

[0144] In the embodiments of this application, such as Figure 2 The response generation module shown above, after the above retrieval process terminates, the memory management device will combine the user's query q and the final integrated ordered memory set. The input to LLMs is "Generate the most reasonable dialogue response based on the currently given memory cues. Each line in the memory cues represents a timeline chain of a topic; please pay attention to the development sequence and evolution of these memories," to generate the final response r:

[0145]

[0146] This application constructs an ordered "memory chain" from an unordered dialogue history and designs a heuristic, iterative, and dynamically terminated ordered retrieval algorithm on top of this structure. This complete processing flow cleverly transforms a computationally difficult problem of optimal history selection into an efficient and targeted search task performed on structured memory, realizing a complete technical architecture of "ordered structured memory + heuristic ordered retrieval".

[0147] The memory management method of this application can be widely applied to conversational artificial intelligence that requires long-term memory capabilities, including but not limited to:

[0148] 1. Personalized intelligent assistant: It can remember users' preferences, past agreements, and daily events to provide more thoughtful and personalized services.

[0149] 2. Enterprise-level intelligent customer service: It can fully track all historical consultation records and problem evolution of a customer at different points in time, and provide coherent and efficient solutions.

[0150] 3. Psychological companionship and counseling robot: It can remember the user's state changes and the content of their conversations for a long time, and establish a deep trust relationship.

[0151] By introducing the memory management scheme of this application, the above application can overcome the limitations of short-term memory such as "goldfish memory" and exhibit higher memory capacity, coherence, consistency and anthropomorphism in long-term interaction, significantly improving user experience and task success rate.

[0152] The memory management method proposed in this application utilizes long-term memory efficiently and accurately. This solution significantly improves the performance of chatbots in multiple dimensions such as coherence, consistency, memory, and human-likeness, and can generate more accurate and personalized responses.

[0153] The memory management method proposed in this application helps the model understand the temporal sequence and causal relationships of events through an ordered memory chain structure, thereby performing better on complex question-answering tasks such as multi-conversation reasoning, knowledge updating, and temporal reasoning.

[0154] In the memory management method of this application, the "fuzzy" operation can reduce the number of tokens required for memory storage by more than half by compressing old memories, which greatly reduces the high computation and API call costs in the LLM era and makes long-term memory applications more economically feasible.

[0155] The memory management framework provided in this application is decoupled from specific LLM models. Experiments have shown that it can achieve consistent and significant performance improvements on various mainstream large models such as Qwen, Llama, and ChatGPT, demonstrating good versatility and portability.

[0156] Those skilled in the art will understand that, in the above-described method of the specific implementation, the order in which each step is written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.

[0157] To implement the above-mentioned memory management method, this application also proposes a memory management device, for details please refer to [link / reference needed]. Figure 8 , Figure 8 This is a schematic diagram of an embodiment of the memory management device provided in this application.

[0158] The memory management device 400 of this embodiment includes a processor 41, a memory 42, an input / output device 43, and a bus 44.

[0159] The processor 41, memory 42, and input / output device 43 are respectively connected to the bus 44. The memory 42 stores program data, and the processor 41 is used to execute the program data to implement the memory management method described in the above embodiments.

[0160] In this embodiment, processor 41 can also be referred to as a CPU (Central Processing Unit). Processor 41 may be an integrated circuit chip with signal processing capabilities. Processor 41 can also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The general-purpose processor can be a microprocessor, or processor 41 can be any conventional processor.

[0161] This application also provides a computer storage medium; please refer to the following: Figure 9 , Figure 9 This is a schematic diagram of a computer storage medium according to an embodiment of the present application. The computer storage medium 600 stores a computer program 61, which, when executed by a processor, is used to implement the memory management method of the above embodiment.

[0162] When the embodiments of this application are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or 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.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. 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.

[0163] The above description is merely an embodiment of this application and does not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.

Claims

1. A memory management method, characterized in that, The memory management method includes: Extract the current memory category and current memory cues from the current dialogue content; Match the target memory category based on the current memory category; Link the current memory cue corresponding to the current memory category to the end of the memory chain containing the target memory category; The memory management method further includes: Traverse each memory chain and obtain the unmatched unfuzzed memory clues within a preset time for each memory chain; The memory cues to be blurred are compressed using a text compressor to generate new memory cues; The step of compressing the memory cues to be blurred using a text compressor to generate new memory cues includes: The memory cues to be blurred are compressed for the first time using a text compressor to generate the first memory cues. Based on the memory clues to be blurred and the first memory clues, a determination is made as to whether to implement the second prompt information based on recovery; Input the second prompt message into the large language model to perform a memory recovery check; When the large language model confirms that the memory cues to be blurred cannot be recovered based on the first memory cues, the compression process is stopped.

2. The memory management method according to claim 1, characterized in that, After extracting the current memory category and current memory cues from the current dialogue content, the memory management method further includes: Calculate the first similarity of each pair of memory categories in the current memory category; Merge memory category pairs whose first similarity is greater than the first preset threshold into one memory category; The memory categories that are merged into one memory category will be merged with the corresponding current memory cues.

3. The memory management method according to claim 1, characterized in that, The step of matching the target memory category based on the current memory category includes: The maximum similarity between the current memory category and existing memory categories is calculated as the second similarity. Determine whether the second similarity is greater than a second preset threshold; If so, the existing memory category corresponding to the maximum similarity is identified as the target memory category; If not, create the target memory category based on the current memory category.

4. The memory management method according to claim 1, characterized in that, After linking the memory cues corresponding to the current memory category to the end of the memory chain containing the target memory category, the memory management method further includes: Obtain historical memory cues belonging to the same memory category as the current memory cues that link to the end of the memory chain containing the target memory category; Based on the current memory cues and the historical memory cues, a first prompt message is generated to determine whether a memory conflict is present; Input the first prompt information into the large language model to perform a consistency check; When the large language model confirms the existence of a memory conflict, the historical memory cues are updated using the current memory cues.

5. The memory management method according to claim 4, characterized in that, The step of updating the historical memory cues using the current memory cues includes: The current memory clue and the historical memory clue are merged to generate a new memory clue; Remove the historical memory clue and the current memory clue from the memory chain containing the historical memory clue, and connect the new memory clue to the end of the memory chain containing the target memory category.

6. The memory management method according to claim 1, characterized in that, The memory management method further includes: Get the query text entered by the user; The most relevant memory category to match the query text; The most similar memory clue is retrieved from the memory chain corresponding to the most relevant memory category, and the most similar memory clue is added to the initialized candidate memory set. Using the most similar memory clue as the search center, search for neighboring memory clues in the memory chain corresponding to the most relevant memory category, and add the searched neighboring memory clues to the candidate memory set; A dialogue response is generated from the query text and the candidate memory set using a large language model.

7. A memory management device, characterized in that, The memory management device includes a memory and a processor coupled to the memory; The memory is used to store program data, and the processor is used to execute the program data to implement the memory management method as described in any one of claims 1 to 6.

8. A computer storage medium, characterized in that, The computer storage medium is used to store program data, which, when executed by the computer, is used to implement the memory management method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Individualized document processing system based on keywords

    CN101004737A

  • Dialogue processing method and device based on large model, dialogue method and device and electronic equipment

    CN118708688A