A Multi-Level Memory Management Method and System for Intelligent Agents Based on Dynamic Metadata Generation
By refining the agent's short-term memory cache and generating dynamic metadata, the problems of memory quality degradation and retrieval confusion in existing technologies are solved, achieving efficient multi-level memory management and improving the agent's decision-making accuracy and response consistency.
Patent Information
- Application Number
- CN202611212616.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-11
- Publication Date
- 2026-11-17
AI Technical Summary
Existing intelligent agent memory management solutions lack structured purification and value identification of short-term memory content, resulting in low-value information being mixed in the long-term memory bank, leading to a decline in memory quality. Furthermore, during retrieval, it is easy to recall memories with similar semantics but different applicable conditions, affecting the accuracy of decision-making.
A dynamic metadata generation method is used to refine the short-term memory cache, generate structured memory units, and distribute them to a multi-level long-term memory storage structure. The dynamic metadata is used for pre-screening and semantic matching evaluation to select target recall memories for inference.
It improves the quality of the memory bank, reduces pollution from low-value information, enhances the accuracy and efficiency of memory retrieval, and strengthens the agent's response consistency and decision reliability in long-term operation and cross-session scenarios.
Smart Images

Figure CN123117326A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of multi-level memory management of intelligent agents, and specifically to a method and system for multi-level memory management of intelligent agents based on dynamic metadata generation. Background Technology
[0002] With the improvement of large language model capabilities, agents are gradually evolving from single-question-answering tools into intelligent systems that can continuously and autonomously operate in long-term conversations, cross-conversation tasks, and multi-project scenarios. In such systems, agents need to have memory capabilities to record information such as user preferences, task constraints, historical decisions, tool call results, and environmental states, so as to provide coherent, personalized, and context-sensitive services in subsequent interactions.
[0003] Currently, long-term memory schemes for intelligent agents mainly follow a technical path of dialogue recording, text segmentation, vectorization, storage in a vector database, and semantic similarity retrieval. Under this path, the system usually segments the original conversation content into fixed lengths or time windows, directly converts the segmented text fragments into vector representations, and stores these vectors along with the original text in a vector database. When the intelligent agent needs to access historical information, the system converts the current query into a vector, performs semantic similarity matching based on vector distance in the global memory, and returns the most similar historical fragments as auxiliary context, which are then input into a large language model for inference.
[0004] However, in practical applications, the aforementioned existing technical solutions have some shortcomings as the running time of the agent increases and the memory scale expands: In the memory writing stage, existing solutions generally lack effective identification and processing judgment of short-term memory content. For example, patent application CN121981145A discloses an agent construction system and method based on long and short-term memory. Although a weight adjustment mechanism is introduced, its memory writing stage still lacks a step for structured purification and value identification of short-term memory content. This results in low-value information and key information entering the memory bank indiscriminately, and the memory quality decreases as the scale expands. The short-term context includes not only the user's stable preferences, key error correction and task constraints, but also a large amount of small talk, trial and error processes, temporary intermediate states and old content that has been replaced by subsequent information. Existing solutions vectorize and store the above-mentioned types of content in an almost indiscriminate manner, resulting in a large amount of repetitive, low-value and expired information mixed in the long-term memory bank, and the memory quality decreases significantly as the scale expands. In existing solutions, the stored memory content is separated from its applicable conditions. Memory entries usually only contain the original text or its summary, lacking clear structured annotations on the subject to which the memory belongs, the applicable task, the time range, the validity status, and the reliability. This means that the system cannot directly determine the scope of application of the memory itself. For example, it cannot directly distinguish between user A's project preferences and user B's project preferences, nor can it directly determine whether a certain preference has been replaced by the user's subsequent error correction.
[0005] In the memory retrieval stage, existing solutions mainly rely on full-database vector similarity matching. This single retrieval mechanism makes it easy for semantically similar memories with completely different applicable conditions to be recalled simultaneously. For example, the system may use semantically similar content generated in other tasks, by other users, or in expired time periods as a reference for the current task, thereby causing memory confusion and interfering with the agent's decision-making accuracy. For example, patent application CN122364283A discloses a method for deep optimization of AI agent memory. Although this scheme optimizes retrieval ranking in multiple dimensions, its retrieval is still a vector matching within the global memory bank, lacking a pre-screening mechanism based on structured metadata. Memory with similar semantics but different applicable conditions is easily recalled simultaneously, causing memory confusion. Another example is patent application CN121960553A, which uses a multi-level memory system to hierarchically store, manage, and provide feedback on the agent's experience and knowledge. Although this scheme involves a multi-level storage structure, its memory entries are still stored in the form of raw context or simple summaries, lacking clear structured annotations on the subject, applicable task, time range, validity status, and reliability of the memory. This makes it impossible for the system to directly determine the scope of application from the memory itself, making it difficult to achieve accurate retrieval based on applicable conditions. Existing schemes use the same storage, retrieval priority, and lifecycle strategy for different types of memory. Core user preferences, key task constraints, and general historical events are not differentiated in terms of storage level and retrieval priority, causing truly important memories to be diluted in massive amounts of general information, reducing the efficiency and accuracy of core memory retrieval.
[0006] In summary, existing technologies have significant shortcomings in quality control of short-term memory transfer to long-term memory, structured expression of memory applicability conditions, and multi-level storage and retrieval mechanisms based on applicability conditions. There is an urgent need for an intelligent agent memory management solution that can solve the above problems.
[0007] Therefore, existing technologies still need further development. Summary of the Invention
[0008] The purpose of this invention is to overcome the above-mentioned technical deficiencies and provide a method and system for multi-level memory management of intelligent agents based on dynamic metadata generation, so as to solve the problems existing in the prior art.
[0009] To achieve the above-mentioned technical objectives, according to a first aspect of the present invention, the present invention provides a method for multi-level memory management of intelligent agents based on dynamic metadata generation, comprising: Acquire the short-term memory cache generated during the operation of the intelligent agent; When the memory transfer triggering condition is met, the content in the short-term memory cache is purified to generate purified memory content, and dynamic metadata is generated based on the purified memory content. The purified memory content and its corresponding dynamic metadata are combined into structured memory units, and the structured memory units are distributed to the corresponding levels in a multi-level long-term memory storage structure with different retrieval priorities. In response to a query request, the search criteria are extracted from the current query, and a candidate memory set is obtained by pre-screening the multi-level long-term memory storage structure based on dynamic metadata. The candidate memory set is semantically matched and evaluated. The target recall memory is selected based on the evaluation results, and the target recall memory and the current short-term memory are input into the large language model for reasoning.
[0010] Specifically, the dynamic metadata includes the confidence and importance of the purified memory content. The method of performing purification processing on the content in the short-term memory cache to generate purified memory content, and generating dynamic metadata based on the purified memory content, includes: Retrieve existing long-term memories that are already stored and associated with the current short-term memory cache; The contents of the short-term memory cache are divided into several candidate segments; The candidate fragments and existing long-term memories are input into the reflection and purification processing model to obtain the purified memory content and determine the relationship type between the candidate fragments and the existing long-term memories. The confidence level is calculated based at least on the relationship type, the reliability of the source of the purified memory content, the degree of user confirmation, and the consistency with existing long-term memory; and the importance level is calculated based on whether the purified memory content belongs to user error correction or long-term constraint information, whether it is a stable preference, its future reuse value, and its historical usage.
[0011] Specifically, the relationship types include new, merge, supplement, replace, conflict, and discard; The dynamic metadata also includes at least one of the following: subject identifier, task identifier, memory type, entity set, time information, validity status, and source pointer.
[0012] Specifically, the method for distributing structured memory units to corresponding levels in a multi-level long-term memory storage structure with different retrieval priorities includes: The multi-level long-term memory storage structure includes at least a core long-term memory layer, a task long-term memory layer, and a general contextual memory layer, with different memory layers having different retrieval priorities; Based on the importance and the confidence level, the target level of the structured memory unit in the multi-level long-term memory storage structure is determined, and the structured memory unit is written into the target level.
[0013] Specifically, the method of extracting search conditions from the current query and performing preliminary screening of the multi-level long-term memory storage structure based on dynamic metadata to obtain a candidate memory set includes: Extract the retrieval conditions corresponding to the dynamic metadata from the current query; Based on the search criteria, the memories in the multi-level long-term memory storage structure are pre-screened. In the multi-level long-term memory storage structure, memories whose dynamic metadata does not match the search criteria are excluded, and then the remaining memories are included in the candidate memory set.
[0014] Specifically, the method for semantic matching evaluation of the candidate memory set includes: Calculate the semantic similarity between the vector representation of the current query request and the vector representation of each memory in the candidate memory set; Obtain the dynamic metadata of each memory in the candidate memory set, as well as the historical usage records of each memory; A comprehensive score for each memory is calculated based at least on the semantic similarity, the information in the dynamic metadata, and the historical usage records.
[0015] Specifically, the method for selecting target recall memories based on evaluation results includes: From the candidate memory set, memories whose comprehensive score reaches a preset score threshold and whose number does not exceed a preset number are selected as the target recall memories.
[0016] Specifically, after inputting the target recall memory and the current short-term memory into the large language model for reasoning, the method further includes: Obtain task execution results and user feedback information; Based on the task execution results and user feedback, update the confidence and importance in the dynamic metadata of the recalled memories.
[0017] Specifically, the method for updating the confidence and importance in the dynamic metadata of the recalled memories based on the task execution results and user feedback information includes: If the task execution result indicates that the task was successful or the user feedback information is a positive confirmation, then the confidence level and / or importance level are increased. If the user feedback is negative or the task execution result indicates that the error was caused by the memory, then the confidence and / or importance are reduced.
[0018] According to a second aspect of the present invention, an intelligent agent multi-level memory management system based on dynamic metadata generation is provided, comprising: Short-term memory acquisition module: used to acquire the short-term memory cache generated during the operation of the agent; Purification and Metadata Generation Module: When the memory transfer triggering condition is met, it performs purification processing on the content in the short-term memory cache, generates purified memory content, and generates dynamic metadata based on the purified memory content; Multi-level memory distribution module: used to combine the purified memory content and its corresponding dynamic metadata into structured memory units, and distribute the structured memory units to the corresponding levels in a multi-level long-term memory storage structure with different retrieval priorities; Joint addressing and reasoning module: In response to a query request, it extracts retrieval conditions from the current query, performs pre-screening on the multi-level long-term memory storage structure based on dynamic metadata to obtain a candidate memory set; performs semantic matching evaluation on the candidate memory set, selects the target recall memory based on the evaluation results, and inputs the target recall memory and the current short-term memory together into the large language model for reasoning.
[0019] Beneficial effects: This invention provides a multi-level memory management method and system for intelligent agents based on dynamic metadata generation. By introducing purification processing and dynamic metadata generation mechanisms during the conversion from short-term memory to long-term memory, each piece of content entering long-term memory is processed, and structured metadata representing the applicable conditions of the memory is generated simultaneously. This reduces the pollution of long-term memory by low-value, repetitive, and conflicting information from the source of writing, improving the overall quality of the memory bank. At the same time, by distributing memories according to importance to a multi-level long-term memory storage structure with different retrieval priorities, differentiated storage of high-value memories and ordinary historical information is achieved, allowing important memories to be prioritized during retrieval. During the memory retrieval stage, pre-screening based on dynamic metadata narrows the candidate range of semantic matching, reducing the risk of erroneous recall of semantically similar but applicable memories, and improving the accuracy and efficiency of memory retrieval. Finally, by inputting the screened recalled memories and the current short-term memory into a large language model for reasoning, the model can simultaneously utilize the continuous context of the current session and effective historical experience across sessions, improving the response consistency and decision reliability of the intelligent agent in long-term operation, cross-session, and multi-task scenarios. Attached Figure Description
[0020] Figure 1 This is a flowchart of the intelligent agent multi-level memory management method based on dynamic metadata generation provided in a specific embodiment of the present invention; Figure 2 This is a schematic diagram of the composition of the intelligent agent multi-level memory management system based on dynamic metadata generation provided in a specific embodiment of the present invention. Detailed Implementation
[0021] To enable those skilled in the art to better understand the technical solutions of the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Based on the embodiments in this application, other similar embodiments obtained by those skilled in the art without creative effort should all fall within the scope of protection of this application. Furthermore, directional terms mentioned in the following embodiments, such as "up," "down," "left," and "right," are only for reference to the directions in the accompanying drawings; therefore, the directional terms used are for illustrative purposes and not for limiting the invention.
[0022] The present invention will be further described below with reference to the accompanying drawings and preferred embodiments.
[0023] Example 1 Please see Figure 1 This embodiment provides a multi-level memory management method for intelligent agents based on dynamic metadata generation. This method achieves efficient management and accurate retrieval of intelligent agent memory through structured purification on the write side and joint addressing on the read side. Specifically, the method includes the following steps: Step S100: Obtain the short-term memory cache generated during the operation of the intelligent agent.
[0024] As can be understood, short-term memory (SSM) caching refers to a temporary data storage area used by an agent to maintain context continuity within the current session or task execution cycle. It involves real-time collection of multimodal interaction data, including user input, model responses, tool call results, environmental feedback, and task status, and writing this data into the SSM caching in chronological order. It should be understood that the form of the SSM caching is not limited to a specific data structure; it can be a sliding window in memory, a circular queue, key-value pair storage, or a vector list, as long as it can temporarily store recent interaction information and support subsequent retrieval. This step, by aggregating scattered interaction events into a unified cache object, provides a standardized data source for subsequent memory transfer, avoiding the computational and logical complexity of directly processing raw streaming data.
[0025] Step S200: When the memory transfer triggering condition is met, perform purification processing on the content in the short-term memory cache to generate purified memory content, and generate dynamic metadata based on the purified memory content.
[0026] Specifically, the memory transfer trigger condition is the starting point for initiating the long-term memory writing process. It can be triggered individually or in combination by various factors such as context window occupancy, task completion events, time intervals, semantic topic changes, or explicit user corrections. When the trigger condition is met, the reflection and purification process and dynamic metadata generation are activated. The purification process involves noise removal, redundancy merging, key information extraction, and conflict detection on the original content in the short-term memory cache, transforming the unstructured dialogue flow into purified memory content with clear semantic boundaries. Based on the purified content, structured tags describing the applicable boundaries and value attributes of the memory are generated synchronously. It is important to emphasize that the purification process and the generation of dynamic metadata are closely related and even executed synchronously. Together, they constitute the link in the transformation of memory from a temporary state to a persistent state. This design ensures that every memory entering long-term storage has undergone value assessment and contextual annotation, solving the problem of low signal-to-noise ratio caused by the indiscriminate accumulation of raw logs in traditional solutions.
[0027] Understandably, memory transfer triggering can employ rule-based methods, or methods based on classification models, large language models, or a combination of rules and models. Rule-based methods can trigger memory transfer based on the proportion of the context window occupied, the cumulative number of lexical units, the session duration, task completion indicators, or explicit user commands. Model-based methods can use classification models or large language models to determine whether new topics, stable preferences, key facts, user corrections, or task states that need to be retained across sessions have appeared in the current context. Memory transfer triggering can also employ periodic batch processing, such as performing reflection processing on short-term memory at preset intervals; or it can be event-driven, executing immediately upon task completion, tool invocation completion, user confirmation, or model switching.
[0028] Step S300: Combine the purified memory content and its corresponding dynamic metadata into structured memory units, and distribute the structured memory units to the corresponding levels in a multi-level long-term memory storage structure with different retrieval priorities.
[0029] Specifically, a structured memory unit is the basic atomic object for long-term memory storage and retrieval. It includes at least three parts: purified memory content, semantic vector representation, and dynamic metadata. It can also include a source pointer to trace the original context. A multi-level long-term memory storage structure refers to a hierarchical storage architecture that is divided according to the memory's retrieval priority, lifecycle, or business importance. The distribution process routes the structured memory units to the matching level based on the value indicators (such as importance and confidence) in the dynamic metadata. Through the hierarchical storage mechanism, high-value core memories can obtain faster access speeds and longer retention times, while low-value memories are automatically relegated to lower levels, thereby maximizing the utilization of memory value with limited storage resources.
[0030] Step S400: In response to the query request, extract the retrieval conditions from the current query, and perform pre-screening of the multi-level long-term memory storage structure based on dynamic metadata to obtain a candidate memory set.
[0031] Understandably, pre-filtering refers to a rapid filtering operation using structured metadata before computationally intensive semantic vector matching. First, the current query request is parsed, extracting search conditions corresponding to dynamic metadata fields such as subject identifier, task identifier, time range, and validity status. Then, memories whose metadata does not match the search conditions are excluded from a multi-level long-term memory storage structure. For example, if the current query belongs to task A, the system will directly filter out all memories marked as task B before vector calculation, regardless of their semantic similarity. This reduces the search space from the entire database to a subset that conforms to business logic constraints, significantly reducing the computational load of subsequent semantic matching, effectively preventing false recalls across tasks, subjects, or expired memories, and improving the logical accuracy of the search results.
[0032] Step S500: Perform semantic matching evaluation on the candidate memory set, select the target recall memory based on the evaluation results, and input the target recall memory and the current short-term memory into the large language model for reasoning.
[0033] Specifically, semantic matching evaluation is a process of further calculating the semantic relevance between queries and memories within the candidate memory set obtained from pre-screening. Candidate memories are comprehensively scored, and target recall memories that meet threshold or quantity requirements are selected based on the scoring results. Subsequently, these high-quality memories, which have undergone dual screening (metadata pre-screening + semantic matching evaluation), are injected into the large language model's inference unit, forming the model's input context together with the current short-term memory cache. This fusion reasoning mode, where short-term memory provides immediate state and long-term memory provides historical experience, enables the agent to maintain dialogue coherence while possessing cross-conversation knowledge accumulation and personalized service capabilities. Simultaneously, because the long-term memory input to the model has undergone rigorous applicability verification, the risk of the model experiencing illusions due to receiving irrelevant or erroneous historical information is reduced, improving the reliability of inference output and the success rate of task execution.
[0034] In this embodiment, dynamic metadata includes the confidence and importance of purified memory content. A method for performing purification processing on content in the short-term memory cache to generate purified memory content, and generating dynamic metadata based on the purified memory content, includes: acquiring existing long-term memories already stored and related to the current short-term memory cache; dividing the content in the short-term memory cache into several candidate fragments; inputting the candidate fragments and existing long-term memories into a reflective purification processing model to obtain purified memory content, and determining the relationship type between the candidate fragments and existing long-term memories; calculating the confidence level based at least on the relationship type, the reliability of the purified memory content's source, the degree of user confirmation, and its consistency with existing long-term memories; and calculating the importance level based on whether the purified memory content belongs to user error correction or long-term constraint information, whether it represents stable preferences, future reuse value, and historical usage.
[0035] It should be noted that when retrieving existing long-term memories, the system does not load all historical records. Instead, it retrieves semantically or logically related subsets of local memories based on entities, task identifiers, or topic keywords in the current short-term memory cache as a reference. This on-demand association mechanism ensures the targeted comparison between new and old memories while avoiding the computational overhead of a full database scan. Subsequently, the system divides the short-term memory cache into several candidate segments according to semantic integrity, time interval, or dialogue turn. Each segment represents a potential atomic unit of memory. The reflection and purification processing model (such as a finely tuned large language model or a specialized classification model) receives candidate segments and existing long-term memories as joint input. It not only outputs purified memory content after denoising, summarizing, or reorganizing, but also determines the relationship type between the two. This design upgrades the traditional text summarization task to a knowledge evolution judgment task, making memory updates no longer a simple overwriting or addition, but possessing assimilation and accommodation capabilities similar to those in human cognition.
[0036] It is understandable that the reflection and purification process can be implemented by a large language model, or by a rule engine, a small classification model, a text summarization model, an information extraction model, a knowledge graph extraction model, or a combination of multiple models. For resource-constrained terminal devices, a rule engine can be used first to remove fixed-format content and repetitive fragments, and then a small classification model can be used to determine the memory type. For servers with sufficient computing resources, a large language model can be used to output the purified content, memory type, relationship between new and old memories, and dynamic metadata all at once. The relationship between new and old memories can be determined by text similarity, natural language inference models, knowledge graph relationship comparison, or one-click database matching. As long as the relationship of addition, repetition, supplementation, substitution, and conflict between candidate memories and existing memories can be determined, it is an alternative implementation of reflection and purification in this embodiment.
[0037] Furthermore, in this embodiment, the aforementioned relationship types include creation, merging, supplementation, replacement, conflict, and discarding; dynamic metadata also includes at least one of subject identifier, task identifier, memory type, entity set, time information, valid status, and source pointer.
[0038] It should be noted that these six relationship types constitute the complete state of memory evolution. Among them, "new creation" indicates that the candidate fragment contains entirely new knowledge, and the system will initialize a higher initial confidence level; "merging" indicates that the candidate fragment has semantic repetition with the existing memory but different expression, and the system will merge the two and increase the confidence level of the merged memory, while marking the source pointer to preserve multiple chains of evidence; "supplementation" indicates that the candidate fragment adds new details or constraints to the existing memory, and the importance may increase due to the improved information completeness; "substitution" indicates that the candidate fragment corrects errors or outdated information in the existing memory, and the system will set the valid state of the old memory to invalid and set the confidence level of the new memory to a high value; "conflict" indicates that there is a contradiction between the new and old information that cannot be automatically resolved temporarily, and the system will reduce the confidence level of both parties and mark it for manual confirmation or subsequent verification; "discard" indicates that the candidate fragment is a greeting, temporary debugging information, or other content without long-term value, and the writing process will be terminated directly. Fields such as subject identifier and task identifier in dynamic metadata further define the applicable boundaries of each memory, ensuring that the context environment can be accurately matched during subsequent retrieval. For example, the source pointer can point to the message ID of the original conversation or an external document link, providing underlying support for the traceability and credibility verification of the memory.
[0039] It is understandable that the aforementioned dynamic metadata is not limited to the fields listed above, such as subject, task, entity, time, confidence level, importance, version, and lifecycle. Depending on the application scenario, fields such as device identifier, geographic location, organization identifier, language type, data modality, risk level, compliance label, sentiment state, tool type, environmental state, and data sensitivity level can also be added. Different application systems can select only some metadata fields or add new fields. Metadata can be stored as relational database fields, document database attributes, key-value pairs, graph database node attributes, or vector database filter fields, as long as it can be used for memory distribution, status judgment, and conditional filtering.
[0040] Furthermore, in terms of quantitative assessment, the calculation of confidence and importance is a crucial step in transforming abstract cognition into engineering parameters. Confidence reflects the reliability of the remembered content. Among its calculation factors, source reliability can be determined based on the information generation channel; for example, results returned from system APIs are usually higher than predictions generated by the model itself, and information from explicit user confirmation is higher than implicit inference. User confirmation can be captured through interactive behavior; for example, a user's "like" or explicit confirmation of a reply is given high weight. Consistency with existing long-term memory is obtained through semantic comparison or logical verification. If new information corroborates multiple verified high-confidence memories, the confidence significantly increases. Importance, on the other hand... The system measures the value density of memories for future tasks, with information related to user error correction or long-term constraints typically having the highest priority because this type of information directly determines the compliance and security of the agent's behavior. Stable preferences refer to user habits that remain unchanged across sessions, and their importance decays slowly over time. Future reusability value can be predicted by the model based on task generality or scored according to the domain universality of the knowledge to which the memory belongs. Historical usage is a dynamic feedback factor; memories that are frequently and successfully retrieved automatically accumulate higher importance. Through this multi-dimensional weighted calculation, the system can transform subjective memory value into objective numerical indicators, providing a basis for decision-making in subsequent automated hierarchical storage.
[0041] It should be further explained that the importance and confidence of memories can be calculated using preset rules and linear weighted formulas, or using fuzzy comprehensive evaluation, hierarchical analysis, Bayesian update, machine learning regression models, neural network scoring models, reinforcement learning models, or large language models. For example, the system can set user error correction, explicit user confirmation, and successful task use as positive weights, and repetition, conflict, misuse, and user negativity as negative weights. It can also use historical task data to train the scoring model, allowing it to automatically learn the impact of different factors on subsequent task performance. The specific calculation methods, number of parameters, and weights for importance and confidence can all be adjusted according to the application environment without affecting the overall technical approach of structured memory generation and hierarchical storage.
[0042] In this embodiment, the method for distributing structured memory units to corresponding levels in a multi-level long-term memory storage structure with different retrieval priorities includes: the multi-level long-term memory storage structure includes at least a core long-term memory layer, a task long-term memory layer, and a general context memory layer, with different memory layers having different retrieval priorities; determining the target level of the structured memory unit in the multi-level long-term memory storage structure based on importance and confidence, and writing the structured memory unit into the target level.
[0043] It should be noted that the multi-level long-term memory storage structure is internally divided into a core long-term memory layer (L1), a task long-term memory layer (L2), a general contextual memory layer (L3), and an optional low-frequency archiving layer (L4). The hierarchical writing is not randomly allocated, but follows a preset value-hierarchy mapping rule. For example, in a preferred embodiment, when the importance is greater than 0.8 and the confidence is greater than 0.7, the structured memory unit is written to the core long-term memory layer. This layer typically stores key information such as user identity, security red lines, and global preferences, and enjoys the highest retrieval priority and the longest lifespan. When the importance is between 0.5 and 0.8 and the confidence is greater than 0.6, it is written to the task long-term memory layer to support the continuous execution of the current project or phased task. When the importance is less than 0.5 but the confidence is qualified, it is written to the general contextual memory layer for general historical reference. Memory with low confidence or that has not been used for a long time is relegated to the low-frequency archiving layer or directly discarded. It should be understood that in actual deployment, operations and maintenance personnel can dynamically adjust the access thresholds of each level according to the sensitivity of the business scenario and storage costs. For example, in high-risk fields such as medical or legal fields, the confidence threshold for entering the L1 layer can be increased; while in creative writing assistance scenarios, the access standards of the L3 layer can be appropriately relaxed to retain more fragments of inspiration. This hierarchical mechanism based on dual-dimensional indicators essentially ensures the immediate availability of high-value memories and the orderly exit of low-value memories through differentiated service level agreements under the premise of limited storage resources, thereby realizing the continuous evolution of the entire memory system.
[0044] Furthermore, while the above description uses a core long-term memory layer, a task long-term memory layer, a general contextual memory layer, and a low-frequency archive layer, in practical applications, two, three, five, or more layers can be used. For example, core long-term memory and task long-term memory can be merged into a high-priority memory layer, and general contextual memory and low-frequency archive memory can be merged into a low-priority memory layer. Alternatively, a fixed rule layer that cannot be automatically deleted can be added above the core long-term memory layer, and an offline cold storage layer can be added below the low-frequency archive layer. Different memory layers can be stored in different databases or in the same database, and can be logically distinguished by a layer field. As long as differentiated storage, retrieval, and lifecycle strategies can be adopted based on memory value and usage frequency, the purpose of multi-level memory distribution can be achieved.
[0045] In this embodiment, the method for extracting search conditions from the current query and performing preliminary screening of the multi-level long-term memory storage structure based on dynamic metadata to obtain a candidate memory set includes: extracting search conditions corresponding to dynamic metadata from the current query; performing preliminary screening of memories in the multi-level long-term memory storage structure based on the search conditions; excluding memories in the multi-level long-term memory storage structure that do not match the dynamic metadata with the search conditions; and then including the remaining memories into the candidate memory set.
[0046] It should be noted that, unlike the existing technology that performs full vector retrieval first and then filters the results, this embodiment adopts a pre-screening strategy. That is, before computationally intensive semantic vector matching, the retrieval space is quickly pruned using structured metadata. The specific steps are as follows: Step S401: First, parse the current query request and convert it into structured search conditions that are mapped to dynamic metadata fields. For example, if the current query is "help me modify the login interface code of project A", the system will not only extract semantic keywords, but also automatically identify and fill in the search conditions: subject identifier = current user, task identifier = project A, memory type = code specification or API definition, valid status = true, minimum confidence = 0.6, etc. Step S402: The system uses these search conditions to directly perform filtering operations at the database index level, directly excluding memory entries whose subjects do not belong to the current user, whose task identifiers do not match, whose entries have been marked as invalid, or whose confidence level is lower than the threshold, and only including the remaining memories that meet the conditions into the candidate memory set.
[0047] Understandably, replacing some vector calculations with database index filtering significantly reduces retrieval latency and computational power consumption. On the other hand, it blocks the possibility of cross-task, cross-subject, or expired information entering the semantic ranking process from the logical source, effectively avoiding memory confusion caused by semantic similarity but different applicable contexts, and improving the logical accuracy of the recall results.
[0048] In this embodiment, the method for semantic matching evaluation of the candidate memory set includes: calculating the semantic similarity between the vector representation of the current query request and the vector representation of each memory in the candidate memory set; obtaining the dynamic metadata of each memory in the candidate memory set and the historical usage records of each memory; and calculating the comprehensive score of each memory based at least on the semantic similarity, the information in the dynamic metadata, and the historical usage records.
[0049] It should be further explained that after obtaining the pre-screened candidate memory set, a multi-dimensional comprehensive score is applied to the candidate memory set to overcome the limitations of single semantic matching in complex business scenarios. The comprehensive score calculation integrates the following four key dimensions: First, semantic similarity, i.e., the cosine similarity between the query vector and the memory vector, is used to measure the relevance at the content level; Second, entity overlap, which quantifies the matching degree of business objects by calculating the Jaccard similarity coefficient between the entity set involved in the query and the entity set in the memory metadata, which can effectively distinguish memories that are semantically similar but target different entities; Third, time relevance, which calculates the score based on the difference between the memory's occurrence time or update time and the current time, combined with a preset time decay coefficient. A smaller decay coefficient can be set for long-term stable preference-type memories, while a larger decay coefficient is set for task status-type memories to reflect the difference in the timeliness of information; Fourth, historical usage records, which is a dynamic feedback factor that reflects whether the memory has truly helped complete the task or been confirmed by the user after being recalled in the past. Memory with high-frequency successful use will receive higher weighting. Through this multi-dimensional integrated scoring mechanism, the system can organically combine static semantic relevance with dynamic business applicability and historical validity, ensuring that the memories ranked at the top in the final ranking are not only relevant on the surface, but also reliable and applicable in practical applications.
[0050] Furthermore, it should be noted that the vector representation of purified memory can be generated from intermediate features of general text embedding models, domain embedding models, multilingual embedding models, or large language models. Vector matching in joint addressing can be replaced by keyword retrieval, inverted index, sparse vector retrieval, dense vector retrieval, hybrid retrieval, knowledge graph search, cross-encoder reordering, or a combination of the above methods. Metadata condition filtering can be performed during the database query stage or after the retrieval results are returned. The preferred approach is to perform it before vector similarity calculation to reduce the number of candidates participating in vector calculation. However, when database capabilities are limited, coarse-grained vector retrieval can be performed first, followed by secondary filtering based on metadata.
[0051] Furthermore, the method for selecting target recall memories based on the evaluation results includes: selecting memories from the candidate memory set whose comprehensive score reaches a preset score threshold and whose number does not exceed a preset number as target recall memories.
[0052] Specifically, the comprehensive scoring results of candidate memories are subject to two constraints: first, a quality constraint, which retains only memories with a comprehensive score higher than a preset score threshold to prevent low-quality or marginally relevant memories from polluting the model context; and second, a quantity constraint, which limits the number of memories recalled in the end to no more than a preset number to avoid exceeding the context window limit of the large language model or introducing too much noise, thus ensuring the stability of the inference process.
[0053] Furthermore, in order to ensure both retrieval accuracy and recall, this embodiment also introduces a hierarchical rollback mechanism as a preferred implementation method. When the aforementioned pre-screening and comprehensive scoring are performed in high-priority levels (such as the core long-term memory layer and the task long-term memory layer), if the number of candidate memories that meet the threshold conditions is less than the preset number, or the highest comprehensive score does not reach the expected standard, the system will automatically trigger hierarchical rollback, gradually expanding the retrieval scope to the ordinary context memory layer and even the low-frequency archive layer. Each time the system expands to the next level, it does not simply add all the low-level memories, but re-executes the aforementioned metadata pre-screening and comprehensive scoring process to ensure that the newly added candidate memories have also undergone rigorous quality verification. For example, when a query involves relatively obscure historical events or early project experience, the core layer and task layer may not have matching results. In this case, the system automatically descends to the general context memory layer for retrieval. This maximizes the value of long-tail knowledge while ensuring priority retrieval of core memory. This hierarchical fallback strategy avoids the waste of resources caused by traversing the entire database for every query, and also prevents retrieval failures due to the sparsity of high-priority data, achieving a dynamic balance between retrieval efficiency and coverage.
[0054] Hierarchical rollback can be executed in a fixed order or dynamically determined based on the query type. For example, when querying user identity and long-term preferences, the core long-term memory layer can be accessed first; when querying the current project progress, the task long-term memory layer can be accessed first; and when querying earlier historical events, the ordinary contextual memory layer and low-frequency archive layer can be accessed directly. The system can also decide whether to expand the search scope based on the number of candidates, the highest score, the average score, the score difference, or the model's judgment result. As long as the system can expand to other memory layers when high-priority candidates are insufficient, cross-level addressing can be achieved.
[0055] In one specific embodiment, after inputting the target recalled memory and the current short-term memory into a large language model for inference, the method further includes: obtaining task execution results and user feedback information; and updating the confidence and importance in the dynamic metadata of the recalled memory based on the task execution results and user feedback information.
[0056] Understandably, the above process constitutes an adaptive evolutionary closed loop for the agent's memory system, making the memory bank no longer a static accumulation of data, but a dynamic knowledge body that can continuously self-optimize based on usage effects. The collection of feedback signals is divided into two dimensions: explicit and implicit. Explicit feedback includes users' likes and dislikes of the agent's replies in the interactive interface, or evaluative statements explicitly entered in the dialogue. These signals are usually characterized by high confidence but low frequency. Implicit feedback comes from the objective state monitoring during task execution. For example, in code assistance scenarios, if the code snippet generated by the agent based on a certain memory passes the compilation check or unit test, the system determines it as a positive signal of task success; conversely, if a syntax error or runtime exception is triggered, and the error can be traced back to the specific memory referenced, it is determined as a negative signal. In document question-and-answer scenarios, if the user adopts an answer generated based on a certain memory and ends the current task flow, it can also be regarded as implicit positive feedback. By integrating subjective and objective, explicit and implicit multi-source feedback signals, the system can comprehensively capture the real utility of memory in practical applications, avoiding the sparsity and bias problems caused by relying solely on subjective user evaluations.
[0057] Specifically, the method for updating the confidence and importance in the dynamic metadata of the recalled memory based on the task execution result and user feedback information includes: increasing the confidence and / or importance if the task execution result indicates that the task was successful or the user feedback information is positive; and decreasing the confidence and / or importance if the user feedback information is negative or the task execution result indicates that the memory caused the error.
[0058] It's important to note that the update strategy is not a simple linear addition or subtraction, but rather a weighted update algorithm with a decay factor. This ensures a balance between the stability and sensitivity of memory evaluation. For positive feedback, exponential smoothing or cumulative rewards can be used to increase the value. For example, when a memory is successfully used to complete a task, its importance increases by a preset step size, while the confidence level is fine-tuned based on the certainty of task success. If explicit user confirmation is obtained, the confidence level can be increased even more significantly, as user confirmation represents the highest level of factual verification. For negative feedback, when a task failure is detected as being attributed to a memory, the system significantly reduces the confidence level of that memory, as this directly indicates that the memory content may contain factual errors or be outdated. At the same time, the importance level will also decay accordingly, reflecting a decrease in its business value. If explicit user denial is received, the system will not only reduce the value but may also trigger a re-reflection process, marking the memory as pending verification or in a conflict state to prevent it from continuing to mislead subsequent reasoning before correction. It should be understood that confidence primarily represents the objective truthfulness of the memory content, while importance primarily represents its subjective value to current and future tasks. Although related, the two are updated independently. For example, an outdated company rule may still have high historical reference value (importance is still acceptable), but it will cause the task to fail because it is no longer applicable (confidence drops sharply). This allows the system to more finely characterize the complex attributes of memory.
[0059] Furthermore, memory lifecycle can be implemented using exponential decay, linear decay, segmented decay, Ebbinghaus forgetting curve, least-used strategy, least-used strategy, or learning-based lifecycle prediction model. Feedback updates can be executed in real time or in batches when a task is completed, a session ends, or a preset period is reached. Feedback sources can include explicit user confirmation, user modification, user denial, task success rate, tool call results, whether the model references the memory, and whether subsequent error correction occurs. When the importance or retention strength of a memory drops below a threshold, it can be downgraded, compressed, moved to the archive layer, or deleted. When a low-level memory is frequently called and proven effective, it can also be promoted to a higher level.
[0060] Furthermore, the large language model inference unit can use a cloud-based general-purpose large language model, or a locally deployed domain model, small language model, or multi-model collaborative system. The recall memory can be directly concatenated into the model prompt in text form, or it can be first converted into a vector aggregation representation and then provided to the model through a memory adaptation layer, prefix vectors, cross-attention layer, or external tool call interface. For multi-agent systems, an independent memory management agent can be responsible for memory purification and retrieval, and then send the recall results to the task execution agent. Alternatively, each agent can be configured with independent short-term memory and shared long-term memory. All of the above implementation methods can realize model inference enhanced by long short-term memory.
[0061] To form a complete closed loop for memory lifecycle management, this embodiment also introduces a feedback-based memory degradation and elimination mechanism. When the confidence level of a memory drops below a preset minimum threshold (e.g., 0.3) due to continuous negative feedback or long-term lack of verification, the system will not immediately physically delete it. Instead, it will perform a degradation operation, migrating the memory from the core long-term memory layer or task long-term memory layer to the low-frequency archive layer, and marking its validity status as suspected invalid. In the archive layer, the memory can only be recalled at the very end of the hierarchical rollback retrieval, and a clear risk warning will be attached to the recall. Only when the memory is verified to be valid again during the archive period (e.g., user-initiated recovery or new evidence support) can it be upgraded back to the next level. Otherwise, after the preset cold data retention period is exceeded, the system will soft delete or permanently archive it. This avoids the continuous interference of erroneous memories with normal business operations, preserves the possibility of data error correction and backtracking, and significantly improves the robustness and security of the system in long-term operation.
[0062] The following specific example illustrates the working principle of the agent multi-level memory management method based on dynamically generated metadata in this embodiment: Step 1: Short-term memory acquisition Collect user input, model responses, tool call results, environmental feedback, and task execution status in the current session of the intelligent agent, write the data into the short-term memory cache in chronological order, and generate a representation of the current short-term memory state; Step 2: Memory Transfer Triggering and Reflection Refinement The system determines whether to trigger the transfer from short-term memory to long-term memory based on the short-term memory cache occupancy ratio, task completion events, time intervals, semantic topic changes, and user error correction events. When the triggering conditions are met, the independent reflection module performs content segmentation, noise removal, duplication merging, conflict detection, and key information extraction on the short-term memory to form purified memory content. Step 3: Dynamic Metadata Generation For the purified memory content, generate subject identifier, task identifier, memory type, entity set, time information, confidence level, importance, validity status, source pointer and life cycle parameters to form dynamic metadata; only generate vector representation for the purified memory content, and do not perform indiscriminate vectorization on the complete original session; Step 4: Multi-level memory distribution Based on memory importance, confidence level, memory type, and life cycle parameters, structured memory units are written into the core long-term memory layer, task long-term memory layer, general contextual memory layer, or low-frequency archiving layer.
[0063] Step 5: Joint Addressing When an agent performs a new task, it extracts search conditions such as subject, task, entity, time range, memory type, valid state, and minimum confidence from the current query. First, it performs metadata pre-screening based on the search conditions, and then performs vector similarity calculation and comprehensive scoring in the filtered candidate memory set. When the number of candidates or the comprehensive score does not reach the threshold, the search scope is expanded step by step according to the memory level.
[0064] Step 6: Memory Enhancement Model Inference and Feedback Update The memory weights of the final recalled memories are calculated based on a comprehensive score. The recalled memories, along with the current query, short-term memory, and system instructions, are input into a large language model for inference to generate model output. The confidence, importance, and lifecycle parameters of the used memories are updated based on the task completion results and user feedback.
[0065] The specific calculation process for the above steps is as follows: 1. The method for generating and hierarchically writing dynamic metadata is as follows: (1) Short-term memory time collection At any moment A single short-term memory event generated by an agent is represented as: ; In the formula, Indicates time Received user input or task instructions, Indicates the agent at time... The generated response, plan, or tool call action, This indicates the observations returned by the tool, environment, or external system. This indicates the current task status, including task identifier, task stage, completion status, and exception status. This indicates the timestamp of the event.
[0066] Recently Short-term memory events constitute a short-term memory cache: ; In the formula, Indicates time The collection of short-term memories, Indicates the number of events that the short-term memory cache can hold; In order to obtain a unified representation of the current context The system uses a large language model or an embedding model to encode short-term memory: ; In the formula, The parameter is Language model encoding function, This indicates text concatenation or feature concatenation performed in the order in which events occur. The context representation of the current short-term memory is used for subsequent semantic boundary detection and memory purification; Short-term memory encoding function Used to encode multiple event sequences in a short-term memory cache into a unified context representation. In this embodiment, Using a large language model The encoder shares the underlying architecture, meaning it's also based on the Transformer architecture. Specifically, Composed of six stacked Transformer encoder blocks, each layer includes a multi-head self-attention mechanism (8 attention heads) and a feedforward neural network. The hidden layer has a 512-dimensional dimension. This encoder concatenates the input event sequence in chronological order, then processes it sequentially through a word embedding layer, a positional encoding layer (using sine-cosine positional encoding), and the six Transformer encoder blocks, finally outputting a 512-dimensional vector as the context representation of the entire short-term memory cache. The encoder's training method is similar to that of large language models. The process is carried out in conjunction with the optimization of encoder parameters during the instruction fine-tuning stage, enabling it to effectively extract key semantic information from the short-term memory cache and provide high-quality contextual representations for subsequent semantic boundary detection and memory purification. The maximum input length of the encoder can be set to 4096 lexical units, which is sufficient to cover the concatenation of the most recent N (N=50) short-term memory events.
[0067] (2) Short-term memory transfer trigger judgment The decision to activate the reflection module is made using a combination of multiple conditions, with the trigger variable represented as follows: ; In the formula, Indicates time Does it trigger memory transfer? Indicates triggering, This indicates that it will not be triggered. This indicates a conditional indicator function. Indicates the current proportion of the context window occupied. This indicates the preset window occupancy threshold. This indicates an event that signifies the completion of a task or the end of a task phase. Indicates the time elapsed since the last memory transfer. Indicates the maximum allowed transfer interval. This indicates the semantic difference between the current context and the previous context. Indicates the semantic boundary threshold. This indicates whether a user has corrected their error, changed their preferences, or confirmed a key fact.
[0068] If any of the above conditions are met, the system will start the reflection and purification process. For user-explicit error correction and core preference change events, it can be set to be forcibly triggered, without being limited by the window occupancy ratio. (3) Reflection and purification process when At this time, the reflection module first divides short-term memory into several candidate segments: ; In the formula, This represents a context-splitting function executed based on task, topic, time, and entity relationships. A number of candidate memory fragments Indicates the number of candidate segments; The reflection module will select candidate fragments Related long-term memory sets Input the reflection model together: ; In the formula, The parameter is The reflection and purification processing model Indicates with candidate fragments Existing long-term memories related to the subject, task, or entity. This represents the purified memory content obtained after noise removal, duplicate merging, and summary compression. This indicates the relationship between candidate fragments and existing memories; Reflective purification processing model A pre-trained language model based on the Transformer architecture can be used as the base model. Specifically, the model adopts an encoder-decoder structure, in which the encoder is composed of 12 stacked Transformer blocks, each containing a multi-head self-attention mechanism and a feedforward neural network (with a hidden layer dimension of 768). The decoder is also composed of 12 stacked Transformer blocks, each containing a mask multi-head self-attention mechanism, an encoder-decoder attention mechanism, and a feedforward neural network.
[0069] The model's input is the concatenated candidate fragments. With related existing long-term memory sets The maximum length of the input sequence is 2048 tokens. The model output includes two parts: (1) purified memory content. (2) Relation type The model's training method involves using a Softmax classifier following a fully connected layer to output the probability distributions of six types of relationships (new, merge, supplement, replacement, conflict, and discard). The training dataset is as follows: First, a training dataset is constructed by collecting paired samples of candidate fragments and existing long-term memories from historical agent interaction logs. Human annotators then label each pair of samples with purified memory content and relationship types, collecting no fewer than 100,000 labeled samples. Supervised fine-tuning is used during training, with the cross-entropy loss function as the optimization objective and the AdamW optimizer employed. The initial learning rate is set to 2 × 10⁻⁻⁻⁶. 5 The batch size is 32, and the training epochs are 5. During training, 80% of the labeled samples are used as the training set, 10% as the validation set, and 10% as the test set. The model parameters with the minimum loss on the validation set are selected as the final model parameters. During actual inference, the model accepts concatenated input of candidate fragments and existing long-term memories. After processing by the encoder-decoder, it outputs the purified memory content text and relation type labels.
[0070] The relation type can be represented as: ; in, Indicates the creation of a new memory. This indicates the merging of repeated memories. This indicates supplementing existing memories. It means replacing old memories with new ones. This indicates that there is an unresolved conflict between old and new memories. This indicates that the candidate fragment does not have long-term preservation value.
[0071] (4) Dynamic metadata generation For the preserved purified memory The system generates dynamic metadata vectors: ; In the formula, This indicates the user, agent, or tenant identifier to which the memory belongs. This indicates the task, project, or conversation topic to which the memory belongs. Representing memory types, including facts, preferences, error correction, task constraints, task states, and performance experiences. Represents the set of entities involved in memory. Indicates the event occurrence time, write time, and most recent update time. Indicates the confidence level of memory. Indicates the importance of memory. Indicates the version and valid status of the memory. Indicates access permissions and sensitivity levels. This represents the memory lifecycle parameter.
[0072] The confidence score for memory is calculated as follows: ; In the formula, This indicates that the calculation results will be mapped to... The normalization function of the interval, Indicates the reliability of the memory source. Indicates the degree of user confirmation. This indicates the degree of consistency between the memory and existing valid memories. This indicates the degree of conflict between the memory and existing memories. to Indicates the weight of each factor. This indicates the bias term used in confidence level calculation.
[0073] The importance of memory is calculated as follows: ; In the formula, This indicates whether the memory belongs to user error correction, critical constraints, or security rules. This indicates whether the memory belongs to stable user preferences or core identity information. This indicates the predictive value of the memory's future reuse in other tasks. This indicates the successful use of the memory history. This indicates the degree of repetition between the memory and existing memories. This indicates the risk of conflict or error in the memory. to This indicates the weight of the corresponding factor. This indicates the bias term used in importance calculation.
[0074] The system only processes purified memory content. Vectorization: ; In the formula, This represents the text embedding encoding function. The semantic vector representing purified memory.
[0075] Text embedding encoding function A semantic embedding model based on the Sentence-BERT architecture is adopted. This model is based on the pre-trained BERT-base model (12 Transformer layers, 768-dimensional hidden layers, 12 attention heads), and a pooling layer is added to the output of BERT. Mean pooling is used, which means that the hidden states of all tokens output by BERT are averaged to form a fixed-dimensional vector representation of the entire input text. The output vector has a dimension of 768. The training method of this embedding model is as follows: joint fine-tuning is performed using a publicly available general semantic similarity dataset and a self-built dataset collected from intelligent agent application scenarios. During training, a contrastive learning objective function is used, with cosine similarity as the similarity measure. The Adam optimizer is used, and the initial learning rate is 2×10⁻. 5 With a batch size of 64 and 3 training rounds, the model can map any input text (including the current query, purified memory content, etc.) into a 768-dimensional dense vector representation after training, resulting in high cosine similarity between semantically similar texts in the vector space. During the inference phase, vectorization is performed only once for each purified memory content, and the generated vector is stored along with the memory content. Subsequent retrievals directly read the stored vector, eliminating the need for repeated computation.
[0076] The final structured memory unit is represented as follows: In the formula, This indicates the purification of memory text. This represents the purified memory vector. Represents dynamic metadata; This indicates the source pointer of the original session, file, or tool output. The original context is not used as the primary vector retrieval object; it is only used through... Preserving traceability reduces the amount of vector indexing occupied by duplicate text; The memory storage hierarchy is determined based on importance and confidence: In the formula, Indicates the first The storage hierarchy of a memory. Indicates the core long-term memory layer. This represents the long-term memory layer of the task. This represents the general episodic memory layer. Indicates a low-frequency archiving layer. , and Indicates the importance thresholds for different levels. This represents the minimum confidence level required to enter the core long-term memory layer.
[0077] User error correction, stable preferences, identity information, and long-term constraints are given priority. Current project status and unfinished tasks depend on entering General historical facts and periodic experiences enter Low-value information that will not be deleted for the time being is entered. ; Memory retention strength is represented as: ; In the formula, Indicates time The strength of memory retention Indicates the initial importance. This represents the attenuation coefficient corresponding to the current storage level. This indicates the time since the last valid use or confirmation of that memory. Indicates the number of times a memory is recalled. This indicates the number of times memory was used to help complete a task. This indicates the number of times the user needs to confirm. This indicates the number of times the memory led to an error or was denied by the user. to This represents the feedback adjustment coefficient; When the retention strength drops below a set threshold, the memory can be downgraded from a high level to a low level; when the memory is used frequently and successfully, its level can be increased and its lifespan extended.
[0078] 2. Reasoning Methods for Joint Addressing and Memory Enhancement Models The agent receives the current query Then, input the current query and recent short-term memory into the encoding model: ; In the formula, This indicates a query from the current user or a command from the current task. Indicates the current short-term memory cache. Indicates the embedding encoding function. This represents a query vector that includes the current query and recent context semantics.
[0079] The system also extracts structured search criteria from the current query: ; In the formula, Indicates the current user or agent identifier. Indicates the current task or project identifier; Indicates the type of memory to be retrieved. This represents the set of entities involved in the current query. Indicates the allowed time range for retrieval. This indicates the minimum confidence level for recalling memories. This indicates the required effective state of memory. This indicates the access permissions corresponding to the current query.
[0080] First, in the core long-term memory layer Long-term memory layer corresponding to the current task Perform a search in the middle: ; In the formula, This indicates the set of memory levels used in the first retrieval. This method ensures that core user preferences, user error correction, current project constraints, and recent task status are given priority in agent reasoning, avoiding ordinary historical information from occupying a large number of candidate positions in the initial stage. Within the selected memory level, the system constructs a candidate set based on structured retrieval criteria: ; In the formula, This represents the set of candidate memories after being filtered by metadata. Indicates the first Structured memory, This indicates that the memory subject is the same as the current query subject. This indicates that only the currently valid version is allowed to enter the normal candidate set. This indicates that the candidate memory confidence level has met the minimum requirement. This indicates that the current query has permission to access this memory. Functions that define task, memory type, entity, and time condition judgments; Metadata filtering can exclude other user memories, other item memories, expired memories, memories that do not meet the time requirements, and low-confidence memories before vector computation; For candidate memories filtered by metadata, calculate the semantic similarity between the query vector and the memory vector: ; In the formula, Indicates the current query and the first The vector cosine similarity between memories. Indicates the current query vector. Indicates the first The semantic vector of memory, The second norm of a vector; The degree of entity overlap is represented by set similarity: ; In the formula, This indicates the degree of overlap between the queried entity and the remembered entity. Indicates the query to a set of entities. This represents the set of candidate memory entities.
[0081] Time correlation is expressed as: ; In the formula, Indicates time correlation. This indicates the time corresponding to the current query. Indicates the time when the memory event occurred or the time of most recent update. This represents the time decay coefficient, which, for long-term stable preferences and core identity information, can be... Setting it to a smaller value allows for better handling of task status and temporary information. Set to a larger value.
[0082] The overall score for the candidate memory is: ; In the formula, Indicates the first The overall score of each candidate memory. Represents the semantic similarity of vectors. Indicates the degree of overlap between entities. Indicates time correlation. Indicates the importance of memory. Indicates the confidence level of memory. This indicates the validity of the use of this memory history. This indicates a risk of memory conflict, invalidation, or inapplicability. , , , , , and This indicates the weight of each scoring factor.
[0083] The comprehensive score does not only rank texts based on semantic similarity, but also considers whether the memory belongs to the current task, whether it involves the current entity, whether it is still valid, and whether it has a reliable history of use.
[0084] The system judges the number and score of the candidate set: ; In the formula, Indicates the first Has the round-robin search reached the stopping condition? Indicates the first The candidate set obtained in the round, Indicates the number of candidates. Indicates the expected number of items to be recalled. This indicates the minimum overall score threshold; when At this point, the system stops expanding the search scope and outputs the top results with the highest overall scores. A memory, when At this time, the system performs a hierarchical rollback: In the formula, Indicates the current search level range. This represents the general episodic memory layer. This indicates a low-frequency archiving layer, which the system will prioritize expanding to. Only when enough candidates are still not obtained will the scope be expanded to Instead of adding the entire low-level memory to the model context, the metadata pre-screening and candidate scoring are re-executed after each expansion.
[0085] The system selects the top scorers based on their overall scores. Memory: ; The weight of each memory in the model's reasoning is calculated based on the overall score: ; In the formula, Indicates the first The reasoning weight of memory recall, Indicates temperature control parameters. The temperature parameter indicates the final number of recalled memories. The smaller the temperature parameter, the more the model focuses on using the few memories with the highest scores. The larger the temperature parameter, the more evenly the weight distribution of different recalled memories. The aggregate representation of recalled memories is as follows: ; In the formula, This represents the aggregation representation of long-term memory. Represents the memory vector mapping matrix. Indicates the first A vector for recalling memories.
[0086] The system inputs a model constructed from system commands, short-term memory, current queries, and long-term memory retrievals according to a fixed template: ; In the formula, Indicates instructions for the intelligent agent system. Represents current short-term memory. Indicates the current query. This is a formatted function that converts the recalled memory content, source, time, confidence level, and valid state into model-readable text. The large language model generates output using an autoregressive approach: ; In the formula, The parameter is Large language models This represents the complete output sequence generated by the model. Indicates the first Each output word element This indicates the preorder lexicon that has already been generated. This indicates text input consisting of system commands, short-term memory, current query, and long-term memory. This represents a weighted aggregate representation of long-term memory recall. In this embodiment, the large language model An autoregressive language model based on a Transformer decoder architecture is adopted. Specifically, the model consists of L stacked Transformer decoder blocks, each layer containing a masked multi-head self-attention mechanism (H attention heads) and a feedforward neural network. The hidden layer dimension is D, and the vocabulary size is V. For example, a model architecture with L=32 layers, H=32 attention heads, D=4096-dimensional hidden layers, and V=32000 vocabulary sizes is adopted, with a total parameter count of approximately 7 billion (7B). The model employs Rotation Position Encoding (RoPE) and Root Mean Square Layer Normalization (RMSNorm) to enhance long sequence modeling capabilities. The pre-training method of this model is as follows: self-supervised pre-training is performed using a large-scale corpus covering general domain text (including web page text, books, papers, code, etc.). The training objective is autoregressive next-word prediction. The cross-entropy loss function is adopted, and the AdamW optimizer is used during pre-training. A cosine annealing learning rate scheduling strategy is adopted, with a peak learning rate of 3×10⁻. 4 The batch size is 1024, and the training rounds are 1.
[0087] In the specific application scenario of this example, the above large language model, after instruction fine-tuning, is supervised fine-tuned using a dataset containing agent task instruction-response pairs, with the learning rate set to 1×10⁻ during fine-tuning. 5 The batch size is 64, and the training rounds are 3, enabling it to generate response or action sequences that meet task requirements based on the joint input of system instructions, short-term memory, current query, and long-term memory retrieval. In actual inference, the maximum length of the model input sequence can be set to 8192 words, and a temperature sampling strategy is used to generate the output, with the temperature parameter set to 0.7 and the sampling threshold set to 0.9.
[0088] The model's reasoning approach involves short-term memory providing the continuous context of the current task, while long-term memory provides stable facts, preferences, constraints, and historical experiences across sessions.
[0089] After the model completes the task, the system updates the importance and confidence of the memory based on whether the task was successful, whether the user confirmed it, and whether the memory retrieval led to an error. ; ; In the formula, Indicates the importance after the update. This indicates the updated confidence level. This indicates whether the task was successful after using the memory. This indicates whether the memory has been confirmed by the user. This indicates whether the memory has been denied by the user. This indicates whether the memory resulted in incorrect output or incorrect operation. to , to Indicates the feedback update coefficient. This indicates that the update results will be limited to interval; Through feedback updates, successfully used memories can increase their importance and lifespan, while memories that are rejected by the user or lead to errors will have their confidence reduced and trigger re-reflection.
[0090] Example 2 Please see Figure 2 This embodiment provides an intelligent agent multi-level memory management system based on dynamic metadata generation. The system includes a short-term memory acquisition module 100, a purification and metadata generation module 200, a multi-level memory distribution module 300, and a joint addressing and reasoning module 400.
[0091] The short-term memory acquisition module 100 is used to acquire the short-term memory cache generated during the operation of the intelligent agent. It is usually composed of high-speed random access memory (RAM) or a circular buffer and is driven by a processor or dedicated data acquisition circuit. This module is not only responsible for temporarily storing interactive data such as user input, model response and tool call results, but also establishes a low-latency data path with subsequent processing units through a memory bus or shared memory mechanism.
[0092] The purification and metadata generation module 200 is used to purify the content in the short-term memory cache when the memory transfer trigger condition is met, generating purified memory content and dynamic metadata based on the purified memory content. In specific implementation, the purification and metadata generation module 200 can be carried by a computing unit loaded with a reflexive algorithm and a metadata generation model. It contains a trigger determination subunit, a content segmentation and comparison subunit, and a metadata calculation subunit. The subunits exchange intermediate results through on-chip interconnection or inter-process communication protocols. For example, the trigger determination subunit continuously monitors the cache occupancy rate and event flags, and wakes up the subsequent subunits once the condition is met; the content segmentation and comparison subunit calls the pre-trained reflexive model to perform structured parsing of candidate fragments. By encapsulating triggering, purification, and metadata generation in the same module, the structured transformation process of memory can be completed in a short time, avoiding the risk of context loss due to memory processing delays.
[0093] The multi-level memory distribution module 300 combines the purified memory content and its corresponding dynamic metadata into structured memory units, and distributes these structured memory units to the corresponding levels in a multi-level long-term memory storage structure with different retrieval priorities. The multi-level memory distribution module 300 acts as a routing gateway between the memory production side and the storage side. Internally, it maintains a hierarchical strategy engine and a data serializer. In terms of data transmission format, it encapsulates the purified content, vector representation, and dynamic metadata into standardized structured objects, such as a unified message body defined using Protocol Buffers or JSON format, to ensure cross-platform compatibility and parsing efficiency. Based on the importance and confidence values in the metadata, this module automatically selects the target storage backend and completes data persistence through asynchronous write queues.
[0094] The joint addressing and inference module 400 responds to query requests by extracting retrieval conditions from the current query, performing pre-screening on the multi-level long-term memory storage structure based on dynamic metadata to obtain a candidate memory set, evaluating the candidate memory set through semantic matching, selecting the target recall memory based on the evaluation results, and inputting the target recall memory and the current short-term memory together into the large language model for inference. The joint addressing and inference module 400 typically includes a query parser, an index retrieval engine, a re-ranking calculator, and a model inference accelerator. The query parser transforms natural language requests into structured filtering instructions and directly sends them to the storage layer for pre-screening; the index retrieval engine performs vector similarity calculations on the returned candidate set; the re-ranking calculator integrates multi-dimensional features to output the final score; and the inference accelerator receives the weighted aggregated memory representation and the current context, driving the large language model to generate a response. Furthermore, this module includes a feedback collection interface to capture task execution results and user evaluations, and sends them back to the purification and metadata generation module to trigger parameter updates. The system decomposes the complex joint addressing and reasoning tasks into multiple parallel execution stages, which not only ensures the rapid retrieval of core memory, but also makes full use of heterogeneous computing resources.
[0095] Furthermore, the system provided in this application has flexible deployment adaptability. The above modules can be centrally deployed in a cloud server cluster to serve large-scale intelligent agent applications for multiple tenants; or they can be deployed in edge devices or terminal chips after lightweight trimming to achieve localized privacy protection and offline memory management. In the cloud deployment scenario, each module can be split into microservices and communicate through RPC or message queues; in the edge deployment scenario, each module can be integrated into a single process or firmware library to share limited memory and computing resources.
[0096] The working principle of the system in this embodiment is illustrated below through specific examples: The overall system in this embodiment includes a short-term memory acquisition unit, a memory transfer triggering unit, a reflection and purification unit, a dynamic metadata generation unit, a multi-level long-term memory storage unit, a joint addressing unit, and a large language model reasoning unit.
[0097] The short-term memory acquisition unit receives user input, model history responses, tool call parameters, tool return results, environment status, and task execution status in the current session and saves them in the short-term memory cache in the order of event occurrence. The memory transfer triggering unit continuously monitors the occupancy of the short-term memory cache and the current task running status. When the context window is about to reach its capacity limit, the task phase ends, the user explicitly corrects existing information, the user confirms long-term preferences, or the session topic changes significantly, the reflection and purification unit is triggered. The reflection and purification unit segments and analyzes the original events in short-term memory, removing greetings, repetitive explanations, intermediate trial-and-error processes, and expired temporary states that have no actual memory value. It extracts facts, preferences, error corrections, task constraints, and execution experiences that can influence subsequent tasks as purified memories. The dynamic metadata generation unit generates structured applicable conditions for each purified memory, ensuring that each memory clearly represents its user, task, involved entities, occurrence time, content type, reliability, and current valid state. The multi-level long-term memory storage unit includes at least a core long-term memory layer, a task long-term memory layer, a general context memory layer, and a low-frequency archive layer. Different layers use different retrieval priorities and lifecycle parameters. The joint addressing unit receives the current query, first uses metadata to exclude memories with inconsistent subjects, inconsistent tasks, mismatched times, expired states, or insufficient confidence, and then performs semantic similarity calculation and comprehensive ranking on the remaining candidates. The large language model reasoning unit constructs the model input by combining the current short-term memory and the recalled long-term memory, enabling the model to use the current context and historical effective experience simultaneously when generating responses or task plans. The system forms a closed-loop processing flow of short-term memory generation, reflection and purification, dynamic metadata generation, hierarchical storage, joint addressing, model reasoning, and usage feedback.
[0098] This embodiment uses enterprise-level code intelligence agent-assisted programming as a specific application scenario to illustrate the implementation process of a multi-level memory management method based on dynamic metadata generation: In this scenario, the agent needs to serve multiple independent development projects simultaneously and must strictly adhere to enterprise-level security coding standards, which places extremely high demands on the isolation and priority scheduling capabilities of the memory system.
[0099] Specifically, suppose the developer first defines a specific set of API encapsulation specifications in Project A, such as "all external interface calls must be authenticated through the AuthWrapper class". As development progressed, the developer switched to Project B, which employed a different lightweight authentication scheme based on direct token transmission. In traditional vector retrieval schemes, due to the high semantic similarity between the two specifications, the agent could easily recall incorrect specifications from Project A into the context of Project B, resulting in generated code that did not meet the requirements of the current project. However, in the technical solution of this application, when the developer establishes the specification in Project A, it is generated as a structured memory unit and given a clear task identifier (such as task_id=proj_A) and a high initial confidence. Subsequently, based on the importance of the specification, it is written into the long-term memory layer of the task. When the developer switches to Project B and issues a similar instruction, the task identifier (task_id=proj_B) is first extracted from the current query, and before performing semantic matching, all memory entries with task_id not equal to proj_B are directly excluded through a pre-filtering mechanism. This metadata-based hard isolation mechanism ensures that the agent in Project B can only access the context information belonging to that project, solving the memory crosstalk problem when multiple tasks are running in parallel.
[0100] Furthermore, this scenario demonstrates the system's adaptive evolutionary capabilities in handling memory conflicts. If a developer mistakenly uses the AuthWrapper specification from Project A in Project B due to habitual thinking, and this erroneous code is submitted or triggers a compiler warning, the system will capture this negative feedback signal. The system will not only reduce the confidence of the misused memory but also trigger reflection, purification, and re-examination of the relevant memory. If the system detects mutually exclusive implementations of the same entity under different task identifiers, it will mark the relationship type of the original memory as conflicting or conditionally restricted and supplement the applicable boundary description in the metadata. For example, the originally general "interface authentication specification" can be refined to "interface authentication specification applicable only to Project A," while reducing its retrieval weight in non-Project A environments. After several such feedback iterations, the memory can automatically learn the subtle differences between projects, achieving increasingly accurate personalized adaptation with each use.
[0101] In terms of core knowledge retrieval, this scenario also verifies the synergistic advantages of hierarchical storage and joint addressing. When a developer queries "how to implement a secure encryption function" in any project, it may match the standard encryption library document released by the company-level security team (stored in the core long-term memory layer), or it may match the temporary encryption tool code written by the developer in past projects (stored in the ordinary context memory layer). Since the company-level security specifications are given extremely high importance (e.g., I>0.9) and source reliability when written, they are routed to the core long-term memory layer with the highest retrieval priority. When performing the retrieval, the L1 level is scanned first, and combined with the pre-screening to confirm that the current user has access rights and the memory is in a valid state, as long as there are candidate memories in the L1 level that meet the comprehensive scoring threshold, the system will not continue to extend down to the L3 level to search for personal historical code. This hierarchical backtracking strategy ensures that the enterprise-level security red line is always recalled over personal experience, effectively preventing security risks caused by developers' personal habits overriding company compliance requirements.
[0102] To more intuitively illustrate the changes in technical parameters during the above process, the following is a snapshot of parameters for a set of key steps: During the Project A specification writing phase, the generated structured memory unit contains: content = authentication using AuthWrapper, task identifier = proj_A, importance = 0.85, confidence = 0.90, and level = L2. When this memory is incorrectly recalled in Project B, causing the task to fail, the feedback update mechanism lowers its confidence from 0.90 to 0.45 and its importance from 0.85 to 0.60, and automatically triggers a downgrade operation to move it to the low-frequency archive layer or mark it as pending verification. In the subsequent normal development of Project B, when an authentication-related query is initiated again, the pre-filter condition task_id = proj_B directly filters out the above low-confidence memory and instead recalls the Token authentication specification belonging to Project B (confidence 0.92, level L2). Finally, the large language model inference unit generates code snippets that conform to the Project B specification based on the correct target recalled memory.
[0103] Example 3 In a preferred embodiment, this application also provides an electronic device, the electronic device comprising: The computer device includes a memory and a processor. The memory stores computer-readable instructions, which, when executed by the processor, implement the multi-level memory management method for intelligent agents based on dynamic metadata generation. This computer device can be broadly categorized as a server, terminal, or any other electronic device with the necessary computing and / or processing capabilities. In one embodiment, the computer device may include a processor, memory, network interface, communication interface, etc., connected via a system bus. The processor of the computer device can be used to provide the necessary computing, processing, and / or control capabilities. The memory of the computer device may include a non-volatile storage medium and internal memory. The non-volatile storage medium may store an operating system, computer programs, etc. The internal memory can provide an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The network interface and communication interface of the computer device can be used to connect and communicate with external devices via a network. When the computer program is executed by the processor, it performs the steps of the method of the present invention.
[0104] This invention can be implemented as a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, causes the steps of the methods of embodiments of the invention to be performed. In one embodiment, the computer program is distributed across multiple network-coupled computer devices or processors, such that the computer program is stored, accessed, and executed in a distributed manner by one or more computer devices or processors. A single method step / operation, or two or more method steps / operations, may be executed by a single computer device or processor or by two or more computer devices or processors. One or more method steps / operations may be executed by one or more computer devices or processors, and one or more other method steps / operations may be executed by one or more other computer devices or processors. One or more computer devices or processors may execute a single method step / operation, or execute two or more method steps / operations.
[0105] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover 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.
[0106] The technical features described above can be combined arbitrarily. Although not all possible combinations of these technical features are described, any combination of these technical features should be considered to be covered by this specification, provided that such combination does not contain contradictions.
[0107] The specific embodiments of the present invention described above do not constitute a limitation on the scope of protection of the present invention. Any other corresponding changes and modifications made in accordance with the technical concept of the present invention should be included within the scope of protection of the claims of the present invention.
Claims
1. A method for multi-level memory management of intelligent agents based on dynamic metadata generation, characterized in that, include: Acquire the short-term memory cache generated during the operation of the intelligent agent; When the memory transfer triggering condition is met, the content in the short-term memory cache is purified to generate purified memory content, and dynamic metadata is generated based on the purified memory content. The purified memory content and its corresponding dynamic metadata are combined into structured memory units, and the structured memory units are distributed to the corresponding levels in a multi-level long-term memory storage structure with different retrieval priorities. In response to a query request, the search criteria are extracted from the current query, and a candidate memory set is obtained by pre-screening the multi-level long-term memory storage structure based on dynamic metadata. The candidate memory set is semantically matched and evaluated. The target recall memory is selected based on the evaluation results, and the target recall memory and the current short-term memory are input into the large language model for reasoning.
2. The intelligent agent multi-level memory management method based on dynamic metadata generation according to claim 1, characterized in that, The dynamic metadata includes the confidence and importance of the purified memory content. The method for performing purification processing on the content in the short-term memory cache to generate purified memory content, and generating dynamic metadata based on the purified memory content, includes: Retrieve existing long-term memories that are already stored and associated with the current short-term memory cache; The contents of the short-term memory cache are divided into several candidate segments; The candidate fragments and existing long-term memories are input into the reflection and purification processing model to obtain the purified memory content and determine the relationship type between the candidate fragments and the existing long-term memories. The confidence level is calculated based at least on the relationship type, the reliability of the source of the purified memory content, the degree of user confirmation, and the consistency with existing long-term memory; and the importance level is calculated based on whether the purified memory content belongs to user error correction or long-term constraint information, whether it is a stable preference, its future reuse value, and its historical usage.
3. The intelligent agent multi-level memory management method based on dynamic metadata generation according to claim 2, characterized in that, The relationship types include new, merge, supplement, replace, conflict, and discard; The dynamic metadata also includes at least one of the following: subject identifier, task identifier, memory type, entity set, time information, validity status, and source pointer.
4. The intelligent agent multi-level memory management method based on dynamic metadata generation according to claim 2, characterized in that, The method for distributing structured memory units to corresponding levels in a multi-level long-term memory storage structure with different retrieval priorities includes: The multi-level long-term memory storage structure includes at least a core long-term memory layer, a task long-term memory layer, and a general contextual memory layer, with different memory layers having different retrieval priorities; Based on the importance and the confidence level, the target level of the structured memory unit in the multi-level long-term memory storage structure is determined, and the structured memory unit is written into the target level.
5. The intelligent agent multi-level memory management method based on dynamic metadata generation according to claim 1, characterized in that, The method for extracting search conditions from the current query and performing preliminary screening of the multi-level long-term memory storage structure based on dynamic metadata to obtain a candidate memory set includes: Extract the retrieval conditions corresponding to the dynamic metadata from the current query; Based on the search criteria, the memories in the multi-level long-term memory storage structure are pre-screened. In the multi-level long-term memory storage structure, memories whose dynamic metadata does not match the search criteria are excluded, and then the remaining memories are included in the candidate memory set.
6. The intelligent agent multi-level memory management method based on dynamic metadata generation according to claim 1, characterized in that, The method for semantic matching evaluation of candidate memory sets includes: Calculate the semantic similarity between the vector representation of the current query request and the vector representation of each memory in the candidate memory set; Obtain the dynamic metadata of each memory in the candidate memory set, as well as the historical usage records of each memory; A comprehensive score for each memory is calculated based at least on the semantic similarity, the information in the dynamic metadata, and the historical usage records.
7. The intelligent agent multi-level memory management method based on dynamic metadata generation according to claim 6, characterized in that, The method for selecting target recall memories based on evaluation results includes: From the candidate memory set, memories whose comprehensive score reaches a preset score threshold and whose number does not exceed a preset number are selected as the target recall memories.
8. The intelligent agent multi-level memory management method based on dynamic metadata generation according to claim 2, characterized in that, After inputting the target recall memory and the current short-term memory into the large language model for reasoning, the method further includes: Obtain task execution results and user feedback information; Based on the task execution results and user feedback, update the confidence and importance in the dynamic metadata of the recalled memories.
9. The intelligent agent multi-level memory management method based on dynamic metadata generation according to claim 8, characterized in that, The method for updating the confidence and importance in the dynamic metadata of the recalled memories based on the task execution results and user feedback information includes: If the task execution result indicates that the task was successful or the user feedback information is a positive confirmation, then the confidence level and / or importance level are increased. If the user feedback is negative or the task execution result indicates that the error was caused by the memory, then the confidence and / or importance are reduced.
10. A multi-level memory management system for intelligent agents based on dynamic metadata generation, characterized in that, include: Short-term memory acquisition module: used to acquire the short-term memory cache generated during the operation of the agent; Purification and Metadata Generation Module: When the memory transfer triggering condition is met, it performs purification processing on the content in the short-term memory cache, generates purified memory content, and generates dynamic metadata based on the purified memory content; Multi-level memory distribution module: used to combine the purified memory content and its corresponding dynamic metadata into structured memory units, and distribute the structured memory units to the corresponding levels in a multi-level long-term memory storage structure with different retrieval priorities; Joint addressing and reasoning module: In response to a query request, it extracts retrieval conditions from the current query, performs pre-screening on the multi-level long-term memory storage structure based on dynamic metadata to obtain a candidate memory set; performs semantic matching evaluation on the candidate memory set, selects the target recall memory based on the evaluation results, and inputs the target recall memory and the current short-term memory together into the large language model for reasoning.
Citation Information
Patent Citations
Unified context and multi-level memory cooperation system and method for LLM intelligent agent
CN121960553A
Intelligent agent construction system and method based on long and short memory
CN121981145A
Method for deeply optimizing memory of AI Agent
CN122364283A
