Memory processing method based on intelligent agent, storage medium and electronic device

By separating real-time interaction, structured events, and pattern induction memory into a three-layer memory architecture, the problem of mixed information value in the agent's memory is solved, the retrieval accuracy and response relevance are improved, and the agent's active learning and deep cognition are realized.

CN121168679AActive Publication Date: 2025-12-19ZTE CORP

Patent Information

Application Number
CN202511728535.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-24
Publication Date
2025-12-19
Estimated Expiration
2045-11-24

AI Technical Summary

Technical Problem

Existing intelligent agent memory processing methods suffer from mixed information values, resulting in low retrieval accuracy and poor response relevance, making it impossible to effectively manage long-term information and conduct proactive cognition and summarization.

Method used

It adopts a three-layer memory architecture, including a first memory layer that stores real-time interactive information, a second memory layer that stores structured events, and a third memory layer that stores pattern-based inductive memory, mimicking the human memory layering mechanism to achieve information separation and efficient retrieval.

Benefits of technology

Through a hierarchical memory architecture, the agent can access information on demand, avoid interference from low-value information, improve retrieval accuracy and response relevance, and achieve proactive learning and deep cognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121168679A_ABST
    Figure CN121168679A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a memory processing method based on an intelligent agent, a storage medium and an electronic device, a memory architecture of the intelligent agent comprises a first memory layer, a second memory layer and a third memory layer, the first memory layer is used for storing historical dialogue information of interactive dialogue between at least one interactive object and the intelligent agent, and the second memory layer is used for storing historical dialogue information of interactive dialogue between at least one interactive object and the intelligent agent. The second memory layer is used for storing structured events extracted from historical dialogue information, and the third memory layer is used for storing pattern induction memory obtained by performing pattern induction on the structured dialogue events; the method comprises the steps that in response to current round dialogue input information of a target interaction object, target storage information associated with the current round dialogue input information is retrieved from at least one memory layer in a memory architecture, and the current round dialogue input information and the target storage information are assembled into a current cue word; and submitting the current prompt word to a specified interaction model through the intelligent agent, and outputting a response result of the specified interaction model to the interaction object.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of artificial intelligence and human-computer interaction technology, and more specifically, to a memory processing method, storage medium, and electronic device based on an intelligent agent. Background Technology

[0002] Currently, intelligent agents are widely used to build personalized assistants, intelligent customer service, and creative aids, becoming an important form of human-computer interaction. To achieve long-term, coherent personalized interaction, intelligent agents need stable memory capabilities to retain user information across different scenarios. Memory management for intelligent agents can rely on short-term memory, also known as conversational memory, which is only valid within the current dialogue flow. This can be achieved by directly storing the recent dialogue history using the context window of interaction models such as Large Language Models (LLMs). While simple, this approach cannot retain long-term information.

[0003] To address this, a memory management scheme based on long-term memory can be adopted. Long-term memory is a type of cross-conversation memory that can be retrieved at any time during any conversation. When the conversation history exceeds the context window, the conversation content can be stored in an external database. When a new user inputs, the database is searched to find the most relevant historical information for the interaction model to reference.

[0004] However, all long-term information is stored indiscriminately in a single knowledge base, resulting in a mixture of information values. This leads to the recall of a large amount of low-value or even irrelevant noise information during memory retrieval, interfering with the judgment of the interaction model and reducing the accuracy of retrieval and the relevance of the response.

[0005] It is evident that agent-based memory processing methods in related technologies suffer from low retrieval accuracy and poor response relevance due to the mixing of information values. Summary of the Invention

[0006] This application provides an agent-based memory processing method, storage medium, and electronic device to at least solve the problem of low response accuracy caused by the mixing of information values ​​in related technologies.

[0007] According to one embodiment of this application, a memory processing method based on an intelligent agent is provided. The memory architecture of the intelligent agent includes a first memory layer, a second memory layer, and a third memory layer. The first memory layer is used to store historical dialogue information of interactive dialogues between at least one interactive object and the intelligent agent. The second memory layer is used to store structured events extracted from the historical dialogue information of the interactive dialogues between the at least one interactive object and the intelligent agent. The third memory layer is used to store pattern induction memory obtained by pattern induction of the structured events of the second memory layer. The method includes: responding to current round dialogue input information initiated by a target interactive object in the at least one interactive object to the intelligent agent in the current interactive dialogue; retrieving target stored information associated with the current round dialogue input information from at least one memory layer in the memory architecture; assembling the current round dialogue input information and the target stored information into a current prompt word; submitting the current prompt word to a specified interaction model through the intelligent agent; and outputting the response result of the specified interaction model to the target interactive object.

[0008] According to another embodiment of this application, a memory processing device based on an intelligent agent is provided. The memory architecture of the intelligent agent includes a first memory layer, a second memory layer, and a third memory layer. The first memory layer is used to store historical dialogue information of interactive dialogues between at least one interactive object and the intelligent agent. The second memory layer is used to store structured events extracted from the historical dialogue information of the interactive dialogues between the at least one interactive object and the intelligent agent. The third memory layer is used to store pattern induction memory obtained by pattern induction of the structured events of the second memory layer. The device includes: a first execution unit, used to respond to current round dialogue input information initiated by a target interactive object in the at least one interactive object to the intelligent agent in the current interactive dialogue, retrieve target stored information associated with the current round dialogue input information from at least one memory layer in the memory architecture, and assemble the current round dialogue input information and the target stored information into a current prompt word; and a second execution unit, used to submit the current prompt word to a specified interaction model through the intelligent agent and output the response result of the specified interaction model to the target interactive object.

[0009] According to yet another embodiment of this application, a computer-readable storage medium is also provided, wherein a computer program is stored therein, and the computer program is configured to perform the steps in any of the above method embodiments when it is run.

[0010] According to yet another embodiment of this application, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.

[0011] According to yet another embodiment of this application, a computer program product is also provided, including a computer program that, when executed by a processor, implements the steps in any of the above method embodiments.

[0012] Through the above embodiments of this application, the memory architecture of the intelligent agent is divided into three interrelated but clearly defined layers: a first memory layer for storing historical dialogue information between the interactive object and the intelligent agent; a second memory layer for storing structured events extracted from the historical dialogue information between the interactive object and the intelligent agent; and a third memory layer for storing pattern induction memory obtained by pattern induction (or pattern-based induction) of the structured events in the second memory layer. This three-layer heterogeneous memory architecture mimics the hierarchical mechanism of human memory, effectively separating immediate dialogue, structured facts, and abstract experience. During information retrieval, information can be retrieved from the memory architecture... At least one memory layer retrieves target stored information associated with the current turn dialogue input, and assembles the current turn dialogue input and target stored information into a current prompt word. The agent can submit the current prompt word to a specified interaction model and output the response result of the specified interaction model to the interaction object. In this way, the agent can call information hierarchically as needed when constructing the context, avoiding interference from the original massive amount of low-value information, improving information utilization efficiency. This can solve the problems of low retrieval accuracy and poor response relevance caused by the mixed information value in the agent-based memory processing methods in related technologies, and achieve the technical effect of improving retrieval accuracy and response relevance. Attached Figure Description

[0013] Figure 1 This is a schematic diagram illustrating an application scenario of a memory processing method based on an intelligent agent according to an embodiment of this application;

[0014] Figure 2 This is a hardware structure block diagram of an optional cloud server according to an embodiment of this application;

[0015] Figure 3 This is a structural block diagram of an optional memory system architecture according to an embodiment of this application;

[0016] Figure 4 This is a schematic flowchart of an optional agent-based memory processing method according to an embodiment of this application;

[0017] Figure 5This is a schematic diagram of an optional memory storage process according to an embodiment of this application;

[0018] Figure 6 This is a schematic diagram of an optional bidirectional collaborative memory flow according to an embodiment of this application;

[0019] Figure 7 This is a structural block diagram of an optional agent-based memory processing device according to an embodiment of this application;

[0020] Figure 8 This is a computer system architecture block diagram of an optional electronic device according to an embodiment of this application. Detailed Implementation

[0021] The embodiments of this application will be described in detail below with reference to the accompanying drawings and examples.

[0022] It should be noted that the terms "first," "second," etc., in the specification, claims, and drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.

[0023] According to one aspect of the embodiments of this application, a memory processing method based on an intelligent agent is provided. Optionally, in this embodiment, the above-described memory processing method based on an intelligent agent can be applied, but is not limited to, to applications such as... Figure 1 The diagram shows a collaborative architecture including terminal device 102 and cloud server 104. Cloud server 104 can connect to terminal device 102 via a network and can provide services (e.g., application services) to terminal device 102 or clients installed on terminal device 102. A database can be set up on or independently of cloud server 104 to provide data storage services to cloud server 104.

[0024] The aforementioned network may include, but is not limited to, at least one of the following: wired network and wireless network. The aforementioned wired network may include, but is not limited to, at least one of the following: wide area network (WAN), metropolitan area network (MAN), and local area network (LAN). The aforementioned wireless network may include, but is not limited to, at least one of the following: Wireless Fidelity (WIFI) and Bluetooth. Terminal device 102 may be, but is not limited to, a personal computer (PC), mobile phone, tablet computer, etc. Cloud server 104 may be, but is not limited to, a single server, a server cluster, or other server types.

[0025] Each component of the aforementioned collaborative architecture, supported by hardware, interaction, and data resources, enables the efficient operation of the intelligent agent's memory system (which can be referred to as the memory system). Among them, the cloud server, integrating hardware resources (e.g., main processing unit, cache, external database, input / output interfaces) and software resources (interaction model core and application logic), is the core operating carrier of the memory system.

[0026] Alternatively, an example of the hardware architecture of a cloud server could be as follows: Figure 2 As shown, Figure 2 This is a hardware structure block diagram of an optional cloud server according to an embodiment of this application. For example... Figure 2 As shown, a cloud server may include one or more ( Figure 2 Only one is shown in the image. A processor 202 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 204 for storing data are also shown. The cloud server may further include a transmission device 206 for communication functions and an input / output device 208. Those skilled in the art will understand that... Figure 2 The structure shown is for illustrative purposes only and does not limit the structure of the cloud server described above. For example, the cloud server may also include... Figure 2 The more or fewer components shown, or having the same Figure 2 The different configurations shown.

[0027] The memory 204 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the agent-based memory processing method in this embodiment. The processor 202 executes various functional applications and data processing by running the computer program stored in the memory 204, thus implementing the aforementioned method. The memory 204 may include high-speed random access memory and non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 204 may further include memory remotely located relative to the processor 202, and these remote memories can be connected to a cloud server via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0028] Transmission device 206 is used to receive or send data via a network. Optional examples of the network may include a wireless network provided by a cloud server's communication provider. In one example, transmission device 206 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, transmission device 206 may be a Radio Frequency (RF) module for wireless communication with the Internet.

[0029] This embodiment provides an agent-based memory processing method running on the aforementioned cloud server. This agent-based memory processing method can be applied to scenarios where human-computer interaction is performed using agents based on interaction models. An agent is an autonomous entity capable of perceiving, making decisions, and taking actions in its environment to achieve a goal, typically driven by an interaction model. An interaction model is the model used in human-computer interaction; it can be an LLM (Limited Learning Model), a large-scale model based on deep learning capable of understanding and generating natural language. In at least some examples of this application's embodiments, an LLM interaction model is used for explanation and illustration. Unless otherwise contradicted, the method described in this application's embodiments can be applied to other types of interaction models.

[0030] With the development of LLM technology and related tools, intelligent agents, as an important application, are widely used to build personalized assistants, intelligent customer service, and creative aids. One of the core capabilities of intelligent agents is their memory ability, that is, to understand, store, and apply user-related knowledge in long-term interactions. Mainstream technologies generally expand the model's memory through external knowledge bases, but simple information storage and retrieval mechanisms still have limitations and cannot support intelligent agents to achieve deep cognition and personalized responses in continuous interactions.

[0031] Currently, intelligent agents based on large-scale language models have become an important form of human-computer interaction. To achieve long-term, coherent, and personalized interaction, intelligent agents need to possess stable memory capabilities to retain user information across scenarios. The memory management of intelligent agents mainly relies on two schemes: short-term memory and long-term memory. The implementation methods can be as follows: short-term memory is only valid within the current dialogue flow, directly storing the dialogue history of the most recent rounds using the context window of the LLM. This method is simple but cannot remember long-term information. Long-term memory is a cross-session memory that can be retrieved at any time in any dialogue. When the dialogue history exceeds the context window, the dialogue content can be summarized or directly stored in an external database (e.g., a vector database). When new user input arrives, the database is retrieved through semantic similarity to find the most relevant historical information for the LLM to reference.

[0032] To meet diverse memory needs, a two-tiered memory architecture of "short-term memory + long-term memory" can be adopted as the memory storage scheme for intelligent agents. While this scheme can satisfy basic long-term memory needs, the information value is mixed and lacks hierarchy: all long-term information is stored indiscriminately in a single knowledge base, with important pattern memories mixed with trivial event memories. This leads to a large amount of low-value or even irrelevant noise information being recalled during memory retrieval, interfering with LLM judgments and resulting in low retrieval accuracy and poor relevance of responses.

[0033] Furthermore, the memory storage of intelligent agents is a passive storage, lacking the ability to actively cognize and summarize. Essentially, it is an information warehouse that only passively stores and retrieves historical dialogues, but cannot reflect on, summarize, and efficiently refine from a large number of fragmented dialogues, tasks, and events to form higher-level, abstract knowledge or patterns, and thus cannot achieve true adaptive growth.

[0034] To at least partially address the aforementioned technical problems, this embodiment provides a multi-level memory system, namely, a memory architecture comprising a first memory layer (L1), a second memory layer (L2), and a third memory layer (L3). The first memory layer stores historical dialogue information between at least one interactive object and the agent, and can be called the Instant Interaction Layer. The second memory layer stores structured events extracted from the historical dialogue information between at least one interactive object and the agent, and can be called the Structural Cognition Layer. The third memory layer stores pattern induction memory obtained by pattern induction of the structured events in the second memory layer, and can be called the Deep Archive Layer. This multi-level memory system mimics the hierarchical mechanism of human memory, integrating real-time operations, contextual events, and general knowledge to ensure that the agent can flexibly respond in complex environments.

[0035] Furthermore, through the knowledge enhancement process of event-based processing and pattern induction, intelligent agents are no longer passive, static information storage devices, but are able to actively and continuously learn, reflect on, and refine knowledge from experience, achieving cognitive deepening from knowing facts to understanding patterns, making their behavior more logical and predictive.

[0036] Optionally, the first memory layer can store the original interaction content (the immediate context of the current interaction, which can be the original context information of the current window dialogue and task, such as the dialogue history and task records of the most recent rounds), ensuring the immediate fluency of the interactive dialogue. It can serve as a short-term memory buffer for high-frequency read and write operations and can be implemented in a cached random access memory (RAM). The second memory layer, as medium- to long-term memory, can serve as a long-term memory bank storing the structured events extracted from the first memory layer. It refines, processes, and structures the immediate information from the first memory layer. Here, the unstructured dialogue of the first memory layer is transformed into structured events, accumulating key facts and contextual information, and ensuring the traceability of events. The third memory layer, as the long-term core memory, serves as a long-term memory bank storing abstract knowledge, patterns, and rules derived from structured events in the second memory layer. It stores core knowledge and experience with long-term value, including but not limited to at least one of user preferences, behavioral patterns, knowledge rules, and task strategies. Information is further integrated and generalized from the second memory layer and archived into the third memory layer, achieving knowledge abstraction and refinement. It can also construct the event evidence chain of the second memory layer under deep memory, representing the highest cognitive level of the memory system. Through induction and reasoning on a large number of structured events in the second memory layer, it extracts at least a portion of universally applicable abstract knowledge (e.g., user profiles, which may include user preferences), patterns (e.g., behavioral patterns), rules (e.g., knowledge rules), and strategies (e.g., task strategies), responsible for the depth and consistency of agent behavior.

[0037] Optionally, structured events can be key facts and contextual information extracted from historical dialogue information (unstructured dialogue content, which may be dialogue content to be eliminated) in the first memory layer after being processed by interaction models such as large language models (LLM), and stored in the second memory layer in a unified format. A structured event in the second memory layer can be generated according to a target event structure, which may include, but is not limited to, at least one of the following: event identifier; event description information, which describes the corresponding structured event, such as key facts and contextual information extracted from historical dialogue information; object identifier, which identifies the interactive object to which the corresponding structured event belongs; latest recall time, which is the time when the corresponding structured event was last recalled due to retrieval; recall count, which is the number of times the corresponding structured event has been recalled due to retrieval; encoding vector of event description information, which is a vector obtained by vectorizing the event description information of the corresponding structured event; event elements, which are event features specified for the corresponding structured event; and related event information, which indicates structured events that are related to the corresponding structured event.

[0038] Here, the event elements (also known as specific element attributes, key element attributes, or key feature attributes) of a structured event are the key features extracted for the corresponding structured event. These key features can be specified; that is, the event elements of a structured event are the specific event features extracted for the corresponding structured event, which can be customized according to the content and context of the event, aiming to capture the core information and uniqueness of the event. Event elements may differ for different application scenarios. For example, in a programming scenario, event elements may include technical fields (e.g., data science, front-end development), code elements (e.g., syntax structure, library usage), bug types (e.g., type errors, syntax errors), development actions (e.g., writing, debugging, refactoring), and associated code file locations. In a writing agent, event elements may cover dimensions such as the topic of discussion, text structure, core concepts, entity references, and task type. The extraction and storage of these event elements enable the agent to quickly and accurately classify and retrieve similar events, enhancing the organization of memory and retrieval efficiency, ensuring that the agent can provide more accurate and efficient responses based on past experience when processing related requests. The existence of unique element attributes enables intelligent agents to deeply understand and effectively utilize historical information.

[0039] For example, a large language model can extract key information from the interaction fragments to be processed in the L1 layer (i.e., historical dialogue information), generate structured events containing information such as a unique identifier event_id (i.e., event identifier), a user identifier user_id (i.e., object identifier), a timestamp (an example of the latest recall time, initially the time the structured event was generated, and later the time the structured event was retrieved), a recall count (an example of the recall count, initialized to 0), an event summary (an example of event description information) and its encoding vector summary_vector (used for similarity matching during memory retrieval), specific feature attributes, and related event information related_events (initialized to empty), and write them into a structured database.

[0040] Optionally, pattern inductive memory can be a more abstract and universal memory extracted from structured events through pattern recognition and induction, such as user preferences, behavioral patterns, knowledge rules, and task strategies. The generation of this type of memory can overcome the limitations of agents relying solely on information retrieval, endowing them with the ability to actively learn from experience and deepen their understanding. This allows agents to demonstrate a deeper level of understanding and personalized service in long-term interactions, enhancing the depth and consistency of communication with users. A pattern inductive memory in the third memory layer can be generated according to a target memory structure, which may include, but is not limited to, at least one of the following: memory identifier; memory type; memory content; object identifier (the object identifier of a pattern inductive memory is used to identify the interaction object to which the corresponding pattern inductive memory belongs); confidence level (the confidence level of a pattern inductive memory is used to represent the credibility of the corresponding structured event); and a source event list (the source event list of a pattern inductive memory records the event identifiers of the structured events used to obtain the corresponding pattern inductive memory through pattern induction).

[0041] For example, a memory system can retrieve relevant event clusters from the structural cognitive layer, perform inductive reasoning on the summaries and key information of the structured events within these clusters, and generate pattern-based inductive memories at the deep inductive layer (e.g., abstract knowledge and rule-based memories). Simultaneously, it records the event IDs of all structured events supporting this memory, ensuring the traceability of knowledge. A pattern-based inductive memory at the deep inductive layer may include: a unique identifier (schema_id, i.e., memory identifier), a type (i.e., memory type), content (i.e., memory content), confidence, source events (source_events, i.e., a list of source events), and may also include other necessary information. The range of memory types can include user preferences, behavioral patterns, knowledge rules, and task strategies, and may also include other memory types. Alternatively, memory types that do not belong to any of the user preferences, behavioral patterns, knowledge rules, and task strategies can be recorded as "Others". The memory content is the abstract knowledge and rule pattern memory extracted by LLM, and the confidence level is the system's quantitative score for the pattern memory, which can be applied to the knowledge reinforcement and correction part of the memory update process.

[0042] It should be noted that the historical dialogue information in the first memory layer, the structured events in the second memory layer, and the pattern inductive memory in the third memory layer can all be considered as a type of memory. The memory in the memory architecture is a carrier used to record historical dialogue information or information extracted from historical dialogue information, and can be stored in the form of data.

[0043] Memory systems based on the above memory architecture can run on cloud servers, and the system architecture of the memory system can be as follows: Figure 3 As shown, Figure 3 This is a structural block diagram of an optional memory system architecture according to an embodiment of this application. The system architecture may include the following components: a user interaction layer, an intelligent agent processing unit (…). Figure 3 The memory system consists of an intelligent agent, a memory management module (corresponding to the core memory hierarchy architecture), and external resource interfaces. The following explains each part of the memory system.

[0044] The user interaction layer comprises an input module and an output module. The input module serves as the entry point for the memory system to receive user commands. It captures user queries, performs preliminary processing and formatting of the raw, unstructured user input, and then passes it to the agent for further analysis. The output module is the outlet for the system to display results and execute actions to the user. It receives responses or behaviors generated by the agent. Responses generated by the agent can be text, speech, images, or other forms of content. Actions generated by the agent can include calling a program, controlling a device, or executing an Application Programming Interface (API) call. The output module is responsible for translating these internal commands (corresponding to the responses or behaviors generated by the agent) into results that the user can understand and perceive.

[0045] The agent processing unit is responsible for the main logical processing, reasoning, and decision-making. It can include agents and large language models (LLMs). The agent can be responsible for intent understanding, task decomposition, decision planning, tool invocation and process control, coordinate the operation of the LLM, memory system and external resources, integrate all processing results, form the final response or action instruction, and send it to the output module. The LLM performs specific cognitive tasks, including but not limited to natural language processing, knowledge reasoning and logical analysis, content generation, and memory retrieval and induction.

[0046] The memory management module mimics the workings of human memory, dividing memories into different layers to achieve efficient information management and long-term learning. This is a crucial component for realizing the personalization and continuous evolution of intelligent agents. The memory management module can include an immediate interaction layer (L1 layer), a structural cognition layer (L2 layer), and a deep archiving layer (L3 layer). Information can not only be progressively accumulated and solidified through these three layers, but can also be retrieved from deep memory (L3 / L2 layers) as needed to feed back to higher layers and support the current task. When the user provides new input, the information retrieved from the memory management module can be combined with the current context according to a preset template to form the final prompt, which is then submitted to the LLM core module for the final output.

[0047] Intelligent agents can interact with external resources (e.g., external information sources or services) through external resource interfaces, such as external databases or knowledge bases, API services, etc., to obtain information beyond their pre-trained data, verify facts, and perform actual tasks that interact with the external world.

[0048] Based on the above system architecture, the memory system can process user requests through a complete closed-loop process: receiving user requests from the input module, performing intent understanding and task planning through the intelligent agent, calling a large language model for thinking and reasoning, and using a multi-layered memory system to acquire context and store new knowledge. Finally, it provides a response to the user or performs corresponding actions through the output module.

[0049] For different application domains, the intelligent agent in the memory system can be of different types. For example, in the programming domain, the intelligent agent in the memory system can be a programming intelligent agent (also known as an Artificial Intelligence (AI) programming intelligent agent), while in the writing domain, the intelligent agent in the memory system can be a writing intelligent agent (also known as an AI writing intelligent agent). In the writing domain, a continuously evolving internalized capability can be built for the AI ​​writing intelligent agent. This technology enables it to learn user preferences over a long period, achieve seamless integration across document content, autonomously accumulate writing experience, and ultimately grow into a personalized intelligent entity that deeply resonates with the user's creative journey.

[0050] Taking a programmable intelligent agent as an example, the hardware deployment of the memory system can revolve around a three-layer architecture of "terminal device - network - cloud server". The terminal device is the development environment or command-line interface used by the programmer, interacting with the intelligent agent through plugins or APIs. The terminal device can include, but is not limited to, personal computers, tablets, or cloud development environments. The network is based on an internet connection using Transmission Control Protocol (TCP) / Internet Protocol (IP), supporting Wi-Fi or mobile networks to ensure real-time data transmission between the terminal device and the cloud server. The cloud server is the core operating platform of the intelligent agent memory management system, including: a main processing unit, which executes core algorithms and memory scheduling, runs large language models, and coordinates data flow among various hardware modules; a cache, which stores L1 layer data to ensure high-frequency read / write / low-latency access; an external database, which can be a non-relational database to store L2 and L3 layer memory data and supports vector indexing for similarity retrieval; and input / output interfaces, which receive user commands and code data, and return agent responses and output results to the user.

[0051] The memory architecture in the memory system can involve memories related to user code debugging tasks, with different memory layers storing different content. The L1 layer stores the immediate context information of the current session, which may include, but is not limited to, code snippets being written / debugged, error stacks and warnings during real-time compilation / runtime, the history of recently executed commands (e.g., debugging instructions, refactoring operations), and temporary variables and function definition snapshots generated during the interaction. By default, it stores the most recent rounds of the original dialogue, and the upper limit of the memory retention rounds can be flexibly configured according to the actual programming scenarios such as lightweight script writing or large project debugging. The L2 layer stores the programming context events of the current code project extracted and structured from the original interaction information of the L1 layer. This may include, but is not limited to, at least one of the following: a unique identifier (event_id), a user identifier (user_id), a timestamp, recall count, an event summary, and its encoding vector (summary_vector). Simultaneously, the LLM extracts specific attribute elements such as technical field, code element (e.g., syntax structure, library, framework components), bug type (e.g., TypeError), development action type, and associated code file location, forming efficiently searchable programming event cards (an example of structured events). Layer L3 can store a universal programming knowledge system formed by inductive reasoning and pattern extraction of structured events from Layer L2. It clusters the scattered behaviors of individual code projects in Layer L2 into reusable functional templates and user paradigms across code projects. This can include, but is not limited to, general solution libraries categorized by technical fields, user programming behavior preferences and technical inclinations, and cross-project technical association rules. The memory content in Layer L3 is associated with the structured event identifiers in Layer L2 through the source event's `source_events` field, ensuring traceability to the original scenario.

[0052] For memory systems in the writing field or other application scenarios, their hardware deployment and memory architecture are similar to those of memory systems in the programming field, which have already been explained and will not be repeated here.

[0053] The agent-based memory processing method provided in this application embodiment can be as follows: Figure 4 As shown, Figure 4 This is a flowchart illustrating an optional agent-based memory processing method according to an embodiment of this application. The process includes the following steps:

[0054] Step S402: In response to the current round dialogue input information initiated by the target interactive object in the current interactive dialogue to the agent, retrieve the target storage information associated with the current round dialogue input information from at least one memory layer in the memory architecture, and assemble the current round dialogue input information and the target storage information into the current prompt word.

[0055] Step S404: The agent submits the current prompt word to the specified interaction model and outputs the response result of the specified interaction model to the target interaction object.

[0056] In the current interactive dialogue, the target interactive object can initiate the current round of dialogue input information to the agent. Here, the target interactive object can be any one of at least one interactive object. An interactive object can be used to identify the user interacting with the agent, and the object information of the interactive object can be the user's account information logged in through a terminal device. After the target interactive object initiates the current interactive dialogue, it can enter interactive content in the input box, or provide interactive content through attachments or other forms, and initiate the current round of dialogue input information. The current round of dialogue input information can include the interactive content entered in the input box, interactive content provided through attachments or other forms, etc. The current round of dialogue input information can be provided to the memory system through an input request.

[0057] The memory system can receive the current input request initiated by the target interaction object, extract the current round of dialogue input information, and respond to the current round of dialogue input information. The agent can retrieve target stored information associated with the current round of dialogue input information from at least one memory layer in the memory architecture. For example, it can retrieve historical dialogue information associated with the current round of dialogue input information from the first memory layer, structured events associated with the current round of dialogue input information from the second memory layer, and pattern inductive memory associated with the current round of dialogue input information from the third memory layer. The retrieved target stored information can be assembled with the current round of dialogue input information to form the current prompt word.

[0058] The operation of assembling the current round of dialogue input information and target stored information into the current prompt word can be implemented using a preset template. The preset template limits the assembly method of the current round of dialogue input information and target stored information, such as data splicing, data fusion, etc. It can also be implemented using a specified assembly model. In this embodiment, the assembly method of the current round of dialogue input information and target stored information is not limited.

[0059] An agent can submit the current prompt word to a designated interaction model (e.g., LLM), which generates a response based on the submitted prompt word. The response is then processed by a cloud server and transmitted to the target interaction object's terminal device, completing one interaction.

[0060] For example, after retrieving stored information from the memory system, a Prompt can be constructed and a response generated. The Prompt assembly module in the memory system can integrate the retrieved stored information and the user's new input (i.e., the current round of dialogue input) into a structured Prompt (i.e., the current prompt) according to a preset template. The constructed Prompt is submitted to the LLM core module to generate a response. The response result is processed by the cloud server and then transmitted to the terminal device, completing one interaction.

[0061] Optionally, the agent-based memory processing method provided in this embodiment can be applied to various LLM agent scenarios that require long-term coherence and personalized interaction, including but not limited to at least one of the following: creative assistance tools, such as code programming assistants and AI writing design, which remember the background, plot setting, or code architecture of the entire project to ensure consistency in the long-term creative process; personal intelligent digital assistants, such as mobile phone voice assistants and smart home control systems, which deeply understand users' habits, preferences, and schedules to provide proactive and considerate services; advanced intelligent customer service, where the memory system can completely record and deeply understand all of the customer's historical interactions, records, and questions, understand the customer's personal preferences and emotions, and provide coherent, efficient, and personalized solutions to improve customer satisfaction; AI education and tutoring, where the memory system can track students' learning progress, knowledge gaps, and thinking habits over a long period of time, and adaptively and dynamically adjust teaching strategies and content to achieve personalized adaptive education; psychological companionship and health consultation, where the memory system can establish and maintain long-term, deep emotional connections, establish long-term user emotional and mental health profiles, provide empathetic support and companionship, and provide continuous care and support.

[0062] It should be noted that, regardless of the application scenario, the memory system processes user conversation information only after obtaining user authorization. Obtaining user authorization can be done during user registration, when the user starts the first conversation, when the scope of authorization needs to be changed, or at other times, as long as the processing of conversation information is within the scope of user authorization.

[0063] Optionally, timeout and circuit breaker mechanisms can be configured for proactive fault avoidance. When the response latency of any node exceeds a threshold, the memory system will interrupt the task to prevent resource locking and indefinite waiting. This design ensures that the agent's memory system remains stable, efficient, and resilient to crashes during complex interactions with large language models, enabling it to achieve deep cognitive capabilities while maintaining industrial-grade operational efficiency under high-intensity operation.

[0064] Through the above steps, in response to the current round of dialogue input information initiated by the target interactive object in the current interactive dialogue to the agent, the target stored information associated with the current round of dialogue input information is retrieved from at least one memory layer in the memory architecture, and the current round of dialogue input information and target stored information are assembled into a current prompt word. The agent submits the current prompt word to the specified interaction model and outputs the response result of the specified interaction model to the target interactive object. This solves the problems of low retrieval accuracy and poor response relevance caused by the mixing of information values ​​in the agent-based memory processing methods of related technologies, and improves the retrieval accuracy and response relevance.

[0065] In one exemplary embodiment, historical dialogue information can be stored in various ways, such as a dialogue information list or a cache queue. Considering the temporal nature of historical dialogue information, in this embodiment, the historical dialogue information of one round of interaction between the interactive object and the agent can be written into the cache queue as a cache item. In this case, the first memory layer may include a target cache queue, which is a cache queue corresponding to the target interactive object.

[0066] For example, the L1 layer can use a first-in, first-out (FIFO) queue structure as a data storage medium to temporarily cache recent dialogue records and task execution history data of the agent. After each round of new interaction, the memory management module can automatically add the complete information of that round of dialogue to the L1 layer's cached FIFO queue.

[0067] Taking a programming agent as an example, users can assign and initiate programming tasks to the programming agent through an interactive interface, and the programming agent will provide corresponding results and responses. After each round of new coding interaction, the memory management module can automatically add the complete information of that round (which may include code snippets, syntax error prompts, debugging logs, user instructions, and programming agent responses) to the L1 layer cache FIFO queue.

[0068] To improve the controllability and rationality of the transformation from historical conversation information in the first memory layer to structured events in the second memory layer, specific triggering conditions can be preset, namely, a first storage condition. In response to the satisfaction of the first storage condition, the process of converting unstructured dialogues into structured events is initiated. The first storage condition can involve dimensions of value and resources, and may include, but is not limited to, at least one of the following: the number of rounds of historical dialogue information in the cache queue reaches M rounds; the cache space occupied by the historical dialogue information in the cache queue reaches a first cache space threshold; the historical dialogue information in the cache queue forms a closed loop of an independent processing task.

[0069] Here, M is a positive integer greater than or equal to 1 (e.g., 50), which can be a fixed value, dynamically adjusted as needed, or set differently depending on the application scenario. The first cache space threshold can be a set value, or it can be determined based on the size of the cache space set for the first memory layer and a set percentage threshold (e.g., 80%). The formation of a closed loop of independent task processing based on historical dialogue information means that in a series of continuous dialogues, the agent has successfully completed a specific task proposed by the user or solved a problem for the user, and this process can be considered complete without further input or intervention. A closed loop refers to the agent receiving a user request, and through a series of interactions (which may include asking questions to obtain more information, providing solutions, performing actions, giving feedback, etc.), ultimately reaching a state that satisfies the user's needs, and this state can serve as the basis or reference point for subsequent dialogues or tasks.

[0070] For example, the triggering conditions for event-driven processing from L1 to L2 can involve dimensions of value and resources, including: a certain interaction record in L1 achieving an independent task loop, the number of dialogue rounds stored in the cache queue reaching M rounds, or the resource consumption of L1 reaching a set threshold standard. The upper limit M of the number of rounds to be retained in memory and the upper limit of the cache space threshold can be flexibly configured according to the needs of the scenario.

[0071] Correspondingly, the above method further includes: when the first storage condition is met, performing event-based processing on at least a portion of the historical dialogue information in the target cache queue to obtain structured events to be stored; storing the structured events to be stored in the second memory layer, and performing a deletion operation on at least a portion of the historical dialogue information in the cache queue.

[0072] In this embodiment, in response to the first storage condition being met, at least a portion of the historical dialogue information in the target cache queue can be processed into an event-based manner to obtain a structured event to be stored. The at least a portion of the historical dialogue information can be all the historical dialogue information in the target cache queue, or it can be a portion of the historical dialogue information. The at least a portion of the historical dialogue information can be extracted according to the time sequence in which the historical dialogue information was stored in the target cache queue, or it can be extracted based on the correlation between the historical dialogue information, or it can be extracted with reference to other information. In this embodiment, there is no limitation on the at least a portion of the historical dialogue information.

[0073] At least a portion of historical dialogue information can be processed into event-driven data, transforming it into structured events to be stored. This event-driven processing can be performed according to a target event structure, which is a data structure for storing structured events and may include multiple data fields to store different types of information. The target event structure can be flexibly configured according to the application scenario; this embodiment does not impose any limitations on it. After event-driven processing, at least a portion of the historical dialogue information can be deleted from the target cache queue to reduce the storage space occupied by historical dialogue information and improve the rationality of storage resource utilization.

[0074] For example, when the interaction process reaches a preset node (i.e., when specific triggering conditions are met), the process of converting unstructured dialogue into structured events can be initiated: the memory system will process the corresponding dialogue fragments (i.e., historical dialogue information, also known as interaction fragments) in the L1 layer into events, extract key information to generate structured events, and store them in the L2 layer (this can be achieved by writing to a structured database), forming a long-term searchable structured event memory. Simultaneously, redundant context in the processed L1 layer can be cleaned up to complete the transformation into structured events.

[0075] Taking a programming agent as an example, for the event-based processing of historical dialogue information from the L1 layer to the L2 layer, the memory granularity can be managed according to the code project dimension. The LLM in the main processing unit monitors the coding interaction of the L1 layer in real time. When a certain interaction record in the L1 layer (i.e., historical dialogue information) forms an independent code task loop, or when the storage resources of the L1 layer reach the set threshold standard, the extraction and storage of the L2 layer are automatically triggered. At the same time, the redundant context in the processed L1 layer is cleaned up to avoid data accumulation affecting the real-time coding response efficiency.

[0076] An example of a prompt word that performs event-driven processing can be shown below:

[0077] You are a highly specialized code interaction analysis engine. Your core responsibility is to parse the interaction logs between developers and programming assistants and transform them into a structured, machine-readable programming event object.

[0078] Your output must be a single, valid JSON object. Do not include any explanatory text or formatting before or after the JSON block. The output format should be as follows:

[0079] {

[0080] "event_id": "(String) A unique identifier for this memory",

[0081] "user_id": "(String) The unique identifier for this user",

[0082] "timestamp": "(String)ISO 8601 formatted string of the current time",

[0083] "recall_count": "(Integer)Initialized to 0",

[0084] "summary": "(String)A concise event summary describing the interaction content and result",

[0085] "summary_vector": "(Array)Convert the'summary' field into an encoded vector",

[0086] "exclusive_properties": {

[0087] "technical_domain": "(String)The technical domain involved. For example, 'Data Science', 'Front - end Development', 'Back - end Service'",

[0088] "code_elements": "(Array of Strings)List of syntax structures, libraries, and framework components included. For example: ['for loop', 'React component', 'numpy array operation']",

[0089] "bug_type": "(String)The type of error that exists, such as 'TypeError', 'SyntaxError'",

[0090] "development_action": "(String)The type of development action performed, such as 'writing', 'debugging','refactoring', 'testing'",

[0091] "related_file_location": "(String)The path location of the related code file. For example:'src / utils / helper.js'"

[0092] }

[0093] "related_events": "(Array of Strings)Initialized to an empty array []"

[0094] }

[0095] Now, please process the provided `<L1 interaction log>` and generate the corresponding JSON object.

[0096] In this embodiment, by setting trigger conditions for the transformation of historical dialogue information in the first memory layer into structured events in the second memory layer, and completing the transformation of historical dialogue information into structured events when the set trigger conditions are met, the controllability and rationality of information transformation can be improved. Cleaning up redundant historical dialogue information in the first memory layer can avoid memory accumulation affecting the high-frequency read and write efficiency of the first memory layer.

[0097] In one exemplary embodiment, before processing at least a portion of the historical dialogue information in the target cache queue into event-based data to obtain structured events to be stored, the historical dialogue information in the target cache queue that needs to be structured can be determined. There are several ways to determine the historical dialogue information in the cache queue that needs to be structured. For example, it can be determined according to a specified number of historical dialogues, or according to a specified number of historical dialogues and a specified cache space threshold (where the cache space threshold can be the minimum or maximum cache space occupied by the determined historical dialogue information), or according to the parameter value of the cognitive value parameter of the historical dialogue information, or by combining at least two types of information.

[0098] As an optional implementation, the N historical dialogue messages with the earliest write time in the target cache queue can be determined as at least a portion of the historical dialogue messages according to the write time sequence.

[0099] The number N of historical dialogue information that needs to be structured can be specified, where N is a positive integer greater than or equal to 2. It is understood that N is less than or equal to M. In this case, the N historical dialogue information entries with the earliest write time in the target cache queue can be determined as at least a portion of the historical dialogue information, based on their write order.

[0100] For example, when the resource usage of L1 layer reaches the above-set standard (e.g., the number of dialogue rounds stored in the cache queue reaches M rounds or the token occupies more than the warning limit percentage of the cache space), the intelligent agent system can automatically trigger the event processing of the earliest interaction record and the cleaning of the original information.

[0101] As another alternative implementation, one or more historical dialogue messages written earliest in the target cache queue can be identified as at least a portion of the historical dialogue messages, based on the write timing and the second cache space threshold.

[0102] Here, in addition to ensuring that the historical dialogue information processed by events is the earliest written historical dialogue information, the size of the cache space occupied by the historical dialogue information processed by events can also be controlled. At least some of the historical dialogue information, besides being the earliest written historical dialogue information to the target cache queue, occupies a cache space that reaches a set second cache space threshold, thereby ensuring the utilization of storage space. Alternatively, if the cache space occupied is lower than the set second cache space threshold, the correlation between the historical dialogue information in the first memory layer and the latest input dialogue information can be improved, thereby improving the relevance of information retrieval.

[0103] For example, taking a programming agent as an example, for the updates and cleanup of the L1 layer, the upper limit of the number of memory retention rounds and the upper limit of the cache space threshold can be flexibly configured according to the code complexity and the actual programming scenario. The upper limit of the number of rounds can be set to 50, and the upper limit of the warning can be set to 80%. When the number of interaction rounds stored in the cache queue reaches 50, or when the cache space occupied by code tokens and debugging information exceeds 80%, the memory system can automatically trigger the eventification of the earliest chronological coding interaction record, avoiding the accumulation of large blocks of code cache that affects the high-frequency read and write efficiency of the L1 layer to the real-time coding context.

[0104] As another alternative implementation, historical dialogue information in the target cache queue whose cognitive value parameter value is less than or equal to a specified parameter threshold can be identified as at least part of the historical dialogue information.

[0105] Here, a dynamic triggering mechanism based on cognitive value scoring can be introduced to replace fixed rounds or quantity thresholds, ensuring the timeliness and effectiveness of memory accumulation. The cognitive value parameter of a historical dialogue information in the target cache queue is obtained by evaluating the cognitive value based on at least one of the following features of the corresponding historical dialogue information: semantic density, number of entities, and correlation with the associated processing task.

[0106] For example, taking a writing agent as an example, users interact with the writing agent through an interactive interface. This interaction can include literature searches, argument construction, paragraph polishing, and citation format checks. The memory system can cache and evaluate the value of dialogue information at the L1 layer. After each round of dialogue, the dialogue information is stored in the L1 layer cache queue, and a dialogue complexity evaluation model is activated in real time to score the cognitive value of the dialogue information. This model comprehensively evaluates multiple features: semantic density, which characterizes whether the dialogue information contains new core concepts, theories, or methodologies; entity quantity, which characterizes the number and importance of entities such as authors, literature, theories, and data mentioned in the dialogue information; and task relevance, which characterizes the closeness of the connection between the dialogue information and the current core writing task. When the number of dialogue rounds or the total number of tokens in the cache queue reaches a preset warning limit, the memory system can prioritize triggering the dialogue information with the lowest cognitive value score in the cache queue for event-based processing and cleanup, ensuring that the L1 layer always retains the most valuable real-time interactive context and guarantees response efficiency.

[0107] For the event-based processing of historical dialogue information from Layer 1 to Layer 2, a dynamic value assessment and hybrid triggering mechanism can be introduced to replace the traditional fixed threshold. The LLM in the main processing unit not only monitors the interactions in Layer 1 in real time, but also analyzes each round of interaction in real time through a dialogue complexity assessment model. This model comprehensively considers features such as semantic density, task relevance, and the introduction of new concepts to generate a cognitive value score. When the accumulated value score of continuous dialogues in Layer 1 reaches the dynamic threshold, naturally forms an independent argument loop, or the user issues an explicit command, the memory system can automatically trigger the event-based extraction and storage in Layer 2, and simultaneously clean up redundant context in Layer 1 to ensure response efficiency.

[0108] This embodiment demonstrates how by flexibly setting the conditions that the historical dialogue information in the cache queue needs to be structured, the reliability of event-based processing can be guaranteed while improving its flexibility, thus adapting to different application scenarios.

[0109] In one exemplary embodiment, at least a portion of the historical dialogue information in the target cache queue is processed into an event-based manner to obtain a structured event to be stored, including: extracting information from at least a portion of the historical dialogue information using a specified interaction model, and generating a structured event to be stored based on the extracted event description information and the target event structure.

[0110] In this embodiment, the event-based processing of at least a portion of the historical dialogue information in the target cache queue can be performed by a specified interaction model. In this case, the specified interaction model can be used to extract information from at least a portion of the historical dialogue information, and based on the extracted event description information, a structured event to be stored can be generated according to the target event structure.

[0111] The target event structure may include an event identifier and event description information. In addition, the target event structure may also include at least one of the following: object identifier, latest recall time, number of recalls, event elements, and related event information. The definitions of each part of the target event structure are the same as or similar to those in the foregoing embodiments, and those already described will not be repeated here.

[0112] This embodiment uses a specified interaction model to extract information from at least a portion of historical dialogue information and constructs structured events according to a specific event structure, which can improve the accuracy of structured event construction and thus improve retrieval efficiency.

[0113] In an exemplary embodiment, the structured event to be stored includes the following information: event description information and related event information. The related event information of a structured event is used to indicate structured events that are associated with the corresponding structured event. The structured event to be stored may be generated by a specified interaction model. In addition to the event description information and related event information, the structured event to be stored includes at least one of the following: event identifier, object identifier, latest recall time, recall count, event elements. The meanings of these types of information are the same as or similar to those in the foregoing embodiments, and will not be repeated here as they have already been described.

[0114] In this embodiment, to improve the rationality of pattern induction, pattern induction can be performed on clusters of events with related relationships. To improve the convenience of identifying structured events with related relationships, when storing the structured events to be stored in the second memory layer, the structured events with related relationships among the structured events already stored in the second memory layer can be identified based on the semantic similarity between the event description information.

[0115] Correspondingly, storing the structured event to be stored in the second memory layer includes: based on the semantic similarity between the event description information of the structured event to be stored and the event description information of the structured events already stored in the second memory layer, performing association identification between the structured event to be stored and the structured events already stored in the second memory layer; if it is identified that the structured event to be stored and the first structured event already stored in the second memory layer are related events, updating the relevant event information of the structured event to be stored and the relevant event information of the first structured event, and storing the structured event to be stored in the second memory layer; if it is identified that the structured event to be stored and the second structured event already stored in the second memory layer are recurring events, updating the second structured event based on the structured event to be stored.

[0116] Optionally, the association recognition between the structured event to be stored and the structured events already stored in the second memory layer can be performed based on the semantic similarity between the event description information of the structured event to be stored and the event description information of the structured events already stored in the second memory layer. The semantic similarity between the event description information of two structured events can be represented by the cosine similarity between the encoding vectors corresponding to the two structured events. The encoding vector corresponding to a structured event refers to the encoding vector of the event description information of that structured event, and the encoding vector of the event description information is obtained by vectorizing the event description information.

[0117] If it is identified that the structured event to be stored and the first structured event already stored in the second memory layer are related events, in order to reflect the relationship between the structured event to be stored and the first structured event, the relevant event information of the structured event to be stored and the relevant event information of the first structured event can be updated, and the structured event to be stored can be stored as a new structured event in the second memory layer.

[0118] If the structured event to be stored is identified as a duplicate of the second structured event already stored in the second memory layer, storing the structured event to be stored as a new structured event would not only waste storage resources but also reduce retrieval efficiency. Therefore, the second structured event can be updated based on the structured event to be stored; for example, the event description information of the second structured event can be updated based on the event description information of the structured event to be stored.

[0119] Optionally, the semantic similarity between the event description information of the structured event to be stored and the event description information of the first structured event is greater than or equal to a first similarity threshold, and the semantic similarity between the event description information of the structured event to be stored and the event description information of the second structured event is greater than or equal to a second similarity threshold, wherein the second similarity threshold is greater than the first similarity threshold. Here, the condition for two structured events to be related events is that the semantic similarity between the event description information of the two structured events is greater than or equal to the first similarity threshold and less than the second similarity threshold, and the condition for two structured events to be repetitive events is that the semantic similarity between the event description information of the two structured events is greater than or equal to the second similarity threshold.

[0120] For example, before writing new events (new structured events) to the L2 layer, association identification is required. This can be achieved by comparing the similarity of the summary encoding vectors and key feature attributes to monitor the relationship between new and old events. If a new event to be stored is associated with an old event (an existing event, i.e., a stored structured event), an association update is performed. This update can include recording the association relationship, which can be done by noting the association relationship and the unique identifier of the target event (i.e., the old event associated with the new event) in the new event. If the events are highly similar or even duplicated, only the old event can be updated without generating a new event, thus achieving data deduplication and merging.

[0121] This embodiment identifies related and repetitive events based on the semantic similarity of event description information of structured events, records the correlation between related structured events, and performs deduplication and merging of structured events. This can enhance the organization and optimization of structured events, avoid redundant storage, and improve the quality of pattern induction.

[0122] In an exemplary embodiment, to improve the controllability and rationality of the transformation from structured events in the second memory layer to pattern inductive memory in the third memory layer, a specific triggering condition, namely a second storage condition, can be preset. In response to the satisfaction of the second storage condition, the deposition from structured events to pattern inductive memory is initiated. The second storage condition may include, but is not limited to, at least one of the following: the system time reaches a specified time period; the number of structured events under a dialogue topic reaches a first quantity threshold.

[0123] Here, the specified time period can be a specific off-peak period for the cloud server. Different types of cloud servers may have different specified time periods. For other types of execution devices, the specified time period can be adjusted according to the actual situation. The first quantity threshold is a specified quantity threshold that can be flexibly configured as needed.

[0124] For example, the memory system can periodically or cumulatively trigger the event cluster pattern induction process, carry out pattern recognition and induction on related event clusters with correlation in the structural cognition layer, call large language models for reasoning and summarizing, generate more advanced and abstract memory pattern induction results, and store them in the deep archiving layer, ultimately realizing the transformation and solidification from immediate information to long-term core knowledge.

[0125] Taking programming intelligent agents as an example, pattern-based induction adopts a dual-trigger mechanism to ensure the timeliness and effectiveness of code knowledge extraction: on the one hand, it automatically starts at regular intervals during server off-peak hours to batch summarize the structured events (code events) newly added in the L2 layer in the past 48 hours; on the other hand, when the cumulative number of structured events of the same functional module or the same error type in the L2 layer exceeds 10, a special induction is triggered.

[0126] Taking a writing agent as an example, pattern-based induction can use a three-trigger mechanism instead of a two-trigger mechanism to manage the induction process from structured events at layer L2 to abstract knowledge at layer L3. The three-trigger mechanism includes: an immediate trigger mechanism, a periodic trigger mechanism, and a threshold trigger mechanism. The immediate trigger mechanism means that pattern-based induction is driven by high-frequency problems. When the same type of logical or expressive problem under the same topic occurs multiple times consecutively within a short period, a temporary correction plan is automatically generated, and the correction plan can be marked as "pending verification." The periodic trigger mechanism means that pattern-based induction is automatically executed during set off-peak periods, batch processing recently added events and clustering them by argument topic or text structure to extract common organizational patterns and expressive frameworks. The threshold trigger mechanism means that pattern-based induction is triggered by scale conditions, including when the cumulative number of similar argument events from the same user reaches a certain amount, or when the cross-text reuse rate reaches a specific threshold. At this time, the memory system will generate standardized argument templates and optimization strategies, and can also update preference tags synchronously.

[0127] Correspondingly, the above method further includes: when the second storage condition is met, performing pattern induction on at least a portion of the structured events in the second memory layer to obtain the pattern induction memory to be stored, and storing the pattern induction memory to be stored in the third memory layer.

[0128] In this embodiment, in response to the satisfaction of the second storage condition, at least a portion of the structured events in the second memory layer can be subjected to pattern induction to obtain a pattern induction memory to be stored. This pattern induction memory can then be stored in the third memory layer. Different triggering mechanisms may be used for pattern induction, and the at least a portion of the structured events may also differ. For example, the at least a portion of the structured events may be newly added structured events in the second memory layer, structured events of the same type under the same topic, structured events of similar arguments from the same user, or structured events that satisfy other conditions. This embodiment does not limit these limitations.

[0129] By configuring the triggering conditions for pattern induction of structured events in the second memory layer in the above manner, the agent can automatically start the pattern induction process at appropriate times and under appropriate conditions, thereby realizing the dynamic construction and updating of pattern memory and improving the agent's ability to understand and predict user needs.

[0130] Optionally, the structured events to be patterned induction in the second memory layer may differ for different triggering conditions (i.e., second storage conditions). Therefore, the structured events for pattern induction in the second memory layer can be determined based on the satisfied triggering conditions.

[0131] As an optional implementation, before performing pattern induction on at least some of the structured events in the second memory layer, the method further includes: when the system time reaches a specified time period, identifying the structured events newly added in the second memory layer during the historical time period as at least some of the structured events.

[0132] In this embodiment, when the second storage condition is that the system time reaches a specified time period, at least some of the structured events are newly added structured events in the second memory layer within a historical time period, and the historical time period is earlier than the specified time period. Correspondingly, in response to the system time reaching the specified time period, the newly added structured events in the historical time period before the specified time period can be identified as structured events to be patterned in the second memory layer. Here, for the periodic triggering mechanism, the specified time period can be considered as the start time period of a cycle, and the historical time period refers to the update cycle preceding the update cycle in which the specified time period is located.

[0133] For example, if the update cycle is 2 days and the specified time period is 0:00-1:00, if today is the start of a new update cycle, then at some point between 0:00 and 1:00 today, the structured events newly added in the past two days will be identified as structured events to be patterned and summarized in the L2 layer.

[0134] As another optional implementation, before performing pattern induction on at least some of the structured events in the second memory layer, the method further includes: in the second memory layer, when the number of structured events under the target dialogue topic reaches a first quantity threshold, determining the structured events under the target dialogue topic as at least some structured events.

[0135] In this embodiment, when the second storage condition is met—that the number of structured events under the target dialogue topic reaches a first threshold—at least a portion of the structured events are structured events under the target dialogue topic in the second memory layer. Correspondingly, in response to the number of structured events under the target dialogue topic in the second memory layer reaching the first threshold, the structured events under the target dialogue topic can be identified as structured events in the second memory layer to be pattern-summarized. Here, for the immediate triggering mechanism, a dialogue topic can be considered as a dialogue topic whose structured events have not been pattern-summarized. For the case where structured events in the same dialogue topic are continuously updated, newly added structured events under the target dialogue topic can be identified as structured events in the second memory layer to be pattern-summarized. Correspondingly, the same dialogue topic can correspond to one or more pattern-summarization memories. For the case where the same dialogue topic corresponds to one pattern-summarization memory, the information obtained by pattern-summarizing newly added structured events under the target dialogue topic can be used to update the pattern-summarization memory corresponding to that dialogue topic. Alternatively, all structured events under the target dialogue topic can be identified as structured events in the second memory layer to be pattern-summarized. Correspondingly, the same dialogue topic can correspond to a pattern inductive memory. After a new pattern inductive memory is generated, the previous pattern inductive memory can be deleted.

[0136] For example, the pattern-based summarization uses a dual-trigger mechanism to ensure timeliness and effectiveness: on the one hand, it automatically starts at regular intervals during off-peak server periods to summarize the structured events newly added in the L2 layer over a set period of time in the past; on the other hand, it is triggered when the number of structured events for a certain topic in the L2 layer exceeds a preset threshold, and the structured events under that topic are summarized and integrated.

[0137] In this embodiment, by identifying structured events within a specific time period as the structured events to be used for pattern induction, it is ensured that pattern induction is based on the latest structured events, providing a more accurate information foundation for the construction of pattern induction memory and improving the timeliness of the induction results. By identifying structured events under a specific dialogue topic as the structured events to be used for pattern induction, it is ensured that pattern induction is based on highly relevant structured events, providing a more targeted information foundation for the construction of pattern induction memory and improving the practicality of the induction results.

[0138] In one exemplary embodiment, pattern induction is performed on at least a portion of the structured events in the second memory layer to obtain a pattern induction memory to be stored, including: extracting associated event clusters from at least a portion of the structured events according to object identifiers and event elements; inputting the event description information of the structured events in the associated event clusters into a specified interaction model, so that the specified interaction model performs pattern induction on the event description information of the structured events in the associated event clusters to obtain the pattern induction result of the specified interaction model; and generating the pattern induction memory to be stored according to the target memory structure based on the pattern induction result.

[0139] In this embodiment, pattern induction of at least a portion of the structured events in the second memory layer can be performed by a specified interaction model. To improve the accuracy of pattern induction, associated event clusters can first be extracted from at least a portion of the structured events. These associated event clusters can be determined based on the related event information of the structured events, or based on object identifiers and event elements, as long as the structured events in the extracted associated event clusters are related.

[0140] The event description information of structured events extracted from the associated event clusters can be input into a specified interaction model. The specified interaction model performs pattern induction on the event description information of the structured events in the associated event clusters, obtaining the pattern induction result output by the specified interaction model. Based on the pattern induction result, a pattern induction memory to be stored can be generated according to the target memory structure.

[0141] The target memory structure may include a memory identifier, a memory type, and memory content. Furthermore, the target memory structure may also include at least one of the following: an object identifier, a confidence level, and a list of source events. The definitions of each part of the target memory structure are the same as or similar to those in the foregoing embodiments, and those already described will not be repeated here.

[0142] For example, the memory system can first retrieve relevant event clusters (i.e., associated event clusters) from the L2 layer based on user identifiers and unique element attributes. It then submits summaries and key information (i.e., event descriptions) of the structured events within these clusters to the LLM, instructing it to perform inductive reasoning to generate abstract knowledge and rule-based memories at the L3 layer. Simultaneously, it records the event IDs of all structured events at the L2 layer that support this memory, ensuring the traceability of the knowledge.

[0143] Taking a programming intelligent agent as an example, the memory system first retrieves relevant event clusters from the L2 layer according to user identification and code-specific attributes, and submits the core code snippets, solution summaries, and key information from debugging logs contained therein to the LLM, instructing it to summarize abstract knowledge such as general processing rules for similar problems, high-frequency code task strategy templates, user programming preferences, and programming patterns.

[0144] An example of a prompt word that instructs an LLM to perform pattern planning could be as follows:

[0145] You are a highly specialized programming knowledge summarization engine. Your core responsibility is to uncover implicit patterns and extract reusable knowledge from structured programming events, generate abstract memories that are universal and traceable, and provide long-term behavioral guidance and decision-making basis for programming intelligent agents.

[0146] Your output must be a single, valid JSON object. Do not include any explanatory text or formatting before or after the JSON block. The output format should be as follows:

[0147] {

[0148] "schema_id": "(String) The unique identifier for this memory",

[0149] "type": "(String) Classify this memory, choosing the type from ['user_preference', 'behavioral_pattern', 'knowledge_rule', 'task_strategy']. Here, user_preference is a conclusion about a user's persistent choices of tools, libraries, or paradigms; behavioral_pattern is a pattern exhibited by the user when interacting, asking questions, or solving problems, manifested as a recurring programming style or problem-solving approach; knowledge_rule is a general rule or fact derived from the user's project or environment; and task_strategy is a successful workflow or method for completing a specific type of task."

[0150] "content": "(String) A clear, actionable statement describing the pattern for this memory, written in the form of an instruction for the assistant. For example, 'When generating Python code for HTTP requests, prioritize the 'requests' library and ensure robust exception handling logic is included.'"

[0151] "confidence": (Float) The default initial value is 100, representing the confidence level of the applicability of this memory under specific environmental conditions.

[0152] "source_events": (Array of Strings) A list containing all event_ids that support this memory.

[0153] }

[0154] Among them, when summarizing the content field, the following requirements should be followed in the thinking process: First, extract the valid event records with complete core attributes in the event, and eliminate the invalid events with incomplete information and no clear technical orientation to ensure the accuracy of the induction basis; count the repeated technical choices, coding habits, and task processes in the event cluster, locate the persistent behavioral characteristics, and挖掘高频共性; write the field content in the structure of "scene + behavior + constraint" to avoid vague expressions and ensure that the instructions can directly guide the subsequent behavior of the programming agent.

[0155] Now, please process the provided `<L2 structured programming event>` and generate the corresponding JSON object.

[0156] Through this embodiment, the interaction model is used to perform pattern induction on the event description information of the structured event, and a pattern induction memory is generated according to the pattern induction result and the target memory structure, which can form a pattern memory with a rigorous structure and rich content, providing strong support for the in-depth cognition and decision-making of the intelligent agent.

[0157] In an exemplary embodiment, in order to improve the retrieval efficiency of the structured event and reduce the occupancy of storage resources by the structured event, the structured events in the second memory layer can be systematically scanned to perform an archiving (i.e., soft deletion) operation on the structured events in the second memory layer, and a forgetting (i.e., hard deletion) operation can also be performed on the structured events in the second memory layer. The above systematic scanning, archiving operation, and forgetting operation can be executed by the memory deletion module in the memory architecture, and the memory deletion module can be a separate program module, independent of the program module related to asynchronous memory storage. The conditions satisfied by the structured events to be executed for the archiving operation can be set, that is, the first suppression condition, and the first suppression condition includes at least one of the following: the recall rate is less than the recall rate threshold, and the duration of not being accessed reaches the first time threshold. Here, the recall rate of a structured event can be the ratio of the number of recall times of the structured event to the total number of retrievals performed on the memory architecture.

[0158] Optionally, in this embodiment, the method further includes: marking the third structured event in the second memory layer as a first suppression state when the third structured event in the second memory layer satisfies the first suppression condition. The third structured event in the second memory layer is a structured event in the second memory layer. In response to the third structured event in the second memory layer satisfying the first suppression condition, the third structured event can be marked as a first suppression state. The first suppression condition includes at least one of the following: recall rate is less than a recall rate threshold, and the duration of non-access reaches a first time threshold. The first suppression state is a state in which the corresponding structured event is prohibited from being retrieved, but is allowed to be reactivated in the case of backtracking. Here, by suppressing structured events with extremely low recall rates, long periods without access records, or extremely low recall rates and long periods without access records, such structured events no longer participate in retrieval matching, which can improve the retrieval efficiency of structured events. When deep backtracking is required, such structured events can be reactivated to ensure the accuracy of deep backtracking.

[0159] Optionally, for a third structured event in the first suppression state, if the duration of the third structured event in the first suppression state reaches a second time threshold, it indicates that the storage value of the third structured event is extremely low, and the third structured event can be cleaned up, that is, a deletion operation is performed on the third structured event, thereby improving the utilization rate of storage resources.

[0160] Optionally, in this embodiment, if the second pattern inductive memory in the third memory layer satisfies the second inhibition condition, the second pattern inductive memory is marked as a second inhibition state. The second pattern inductive memory in the third memory layer is a pattern inductive memory within the third memory layer. In response to the second pattern inductive memory in the third memory layer satisfying the second inhibition condition, it can be marked as a second inhibition state. The second inhibition condition includes: a confidence level less than a first confidence threshold. The second inhibition state is a state where the corresponding pattern inductive memory is prohibited from being retrieved, but is allowed to be reactivated during backtracking. Here, by inhibiting pattern inductive memories with a confidence level less than the first confidence threshold, such pattern inductive memories no longer participate in retrieval matching, which can improve the reliability of retrieved pattern inductive memories. When deep backtracking is required, such pattern inductive memories can be reactivated to ensure the accuracy of deep backtracking.

[0161] Optionally, for the second pattern inductive memory in the second inhibition state, if the duration of the second pattern inductive memory in the second inhibition state reaches a third time threshold, it indicates that the storage value of the second pattern inductive memory is extremely low, and the second pattern inductive memory can be cleaned up, that is, a deletion operation is performed on the second pattern inductive memory, thereby improving the utilization rate of storage resources.

[0162] For example, a dedicated memory deletion module can be set up. This module periodically performs a systematic scan of the L2 and L3 layer memories (L2 layer memories are structured events, and L3 layer memories are pattern induction memories) to execute soft deletion (i.e., archiving) and hard deletion (i.e., forgetting) strategies. For structured events in the L2 layer with extremely low recall and no access records for a long time, and pattern induction memories in the L3 layer with confidence levels consistently below a preset threshold, the memory system performs soft deletion. First, it marks them as archived (i.e., suppressed state, such as first suppressed state, second suppressed state). In this state, the relevant memories are actively masked and ignored in the normal retrieval process and no longer participate in retrieval matching, but can be reactivated when deep backtracking is needed. If such archived memories remain inactive (i.e., suppressed state) for a longer period in the future, the memory system performs hard deletion, performs physical deletion operations, completes the cleanup of redundant memories, and releases storage space.

[0163] In this embodiment, a memory suppression and deletion mechanism is adopted for the structured events of the second memory layer and the pattern induction memory of the third memory layer. By setting the suppression state and time threshold, memories with low access frequency and low confidence can be placed in the suppression state and hard deleted in a timely manner. This can maintain the health of the memory system and avoid interference from information overload and invalid memories.

[0164] In an exemplary embodiment, the confidence level of the pattern induction memory in the third memory layer is used to represent the reliability of the corresponding pattern induction memory. As dialogue information increases, structured events also increase, and the confidence level of the pattern induction memory changes accordingly. To improve the reliability of the pattern induction memory's confidence level while reducing the waste of computational resources caused by excessively high update frequency, the confidence level of the pattern induction memory associated with the structured event to be patterned can be updated during the pattern induction process of the structured events in the second memory layer. Here, the association between the structured event and the pattern induction memory can be: the structured event supports the pattern induction memory (positive association, the event description information of the structured event is consistent with the memory content of the pattern induction memory), or the structured event conflicts with the pattern induction memory (reverse association, the event description information of the structured event contradicts the memory content of the pattern induction memory).

[0165] As an optional implementation, during the pattern induction process of the fourth structured event in the second memory layer, if it is determined that the fourth structured event supports the third pattern induction memory already stored in the third memory layer, the memory content of the third pattern induction memory is updated using the event description information of the fourth structured event, the confidence of the third pattern induction memory is increased, and the event identifier of the fourth structured event is added to the source event list of the third pattern induction memory.

[0166] The fourth structured event is a structured event in the second memory layer, and the third pattern inductive memory is a pattern inductive memory already stored in the third memory layer. During the pattern induction process for the fourth structured event, the correlation between the fourth structured event and the various pattern inductive memories already stored in the third memory layer can be determined. If it is determined that the fourth structured event supports the third pattern inductive memory already stored in the third memory layer, the confidence level of the third pattern inductive memory can be increased. For example, the confidence level of the third pattern inductive memory can be increased by a fixed value, or the confidence level of the third pattern inductive memory can be increased based on the degree of correlation between the event description information of the fourth structured event and the memory content of the third pattern inductive memory. The higher the degree of correlation, the greater the increase in confidence level.

[0167] Optionally, considering that the fourth structured event supports the third pattern induction memory already stored in the third memory layer, it can be used as a source structured event of the third memory layer without constructing a new pattern induction memory based on the fourth structured event. In this case, the event identifier of the fourth structured event can be added to the source event list of the third pattern induction memory for easy backtracking. Similar to the previous embodiments, the source event list of the third pattern induction memory is used to record the event identifiers of the structured events used to obtain the third pattern induction memory through pattern induction. The memory content of the third pattern induction memory may not fully reflect the event description information of the fourth structured event. Therefore, the memory content of the third pattern induction memory can be updated using the event description information of the fourth structured event.

[0168] As another optional implementation, during the pattern induction process of the fifth structured event in the second memory layer, if it is determined that the fifth structured event conflicts with the fourth pattern induction memory already stored in the third memory layer, the confidence level of the fourth pattern induction memory is lowered.

[0169] The fifth structured event is a structured event in the second memory layer, and the fourth pattern inductive memory is a pattern inductive memory already stored in the third memory layer. During the pattern induction process for the fifth structured event, the correlation between the fifth structured event and the various pattern inductive memories already stored in the third memory layer can be determined. If a conflict is found between the fifth structured event and the fourth pattern inductive memory already stored in the third memory layer, the confidence level of the fourth pattern inductive memory can be lowered. For example, the confidence level of the fourth pattern inductive memory can be lowered by a fixed value. Alternatively, based on the correlation between the event description information of the fifth structured event and the memory content of the fourth pattern inductive memory, the confidence level of the third pattern inductive memory can be lowered. The higher the correlation, the greater the reduction in confidence level.

[0170] For example, if, during a new induction process, a structured event in layer L2 supports an existing pattern induction memory in layer L3, the content of the supported pattern induction memory can be improved, its confidence increased, and the new event identifier can be added to the source_events list of the supported pattern induction memory, forming a dynamic extension of the evidence chain. If a structured event in layer L2 conflicts with an existing pattern induction memory in layer L3, the confidence of the conflicting pattern induction memory is reduced.

[0171] Taking a programming agent as an example, in terms of memory updates, for instance, if a user successfully solves a problem again using the same template, supporting the pattern planning memory of that template in the L3 layer, the memory system will supplement edge case descriptions, increase the confidence by 5-10 points, and update the evidence chain; if it is found that the original rule is not applicable under a specific framework, the confidence is reduced and an exception description is added, with each conflict reducing the confidence by 15 points.

[0172] Taking the writing agent as an example, in the process of pattern induction from L2 to L3, the confidence of the pattern induction memory in L3 can be calibrated. The confidence adjustment range is adjusted to a dynamic value, for example, the base value ± the current cluster size × 0.5. A cluster refers to the set of source events of the pattern induction memory.

[0173] In this embodiment, by incorporating pattern memory update and conflict resolution processes, the confidence of pattern inductive memory is enhanced when a structured event supporting existing pattern planning memory is detected; conversely, the confidence of pattern inductive memory is reduced when no structured event is detected. This enhances the self-correction capability of the memory system and ensures the accuracy and applicability of pattern memory.

[0174] In an exemplary embodiment, after lowering the confidence level of the fourth pattern inductive memory, the method further includes: when the confidence level of the lowered fourth pattern inductive memory is less than a second confidence threshold, performing pattern induction on a set of conflict structured events that conflict with the fourth pattern inductive memory to obtain a fifth pattern inductive memory that competes with the fourth pattern inductive memory.

[0175] If the confidence level of the lowered fourth pattern inductive memory is less than the second confidence threshold, it indicates that the credibility of the fourth pattern inductive memory is low. Correspondingly, the credibility of the structured events that conflict with it is high. Therefore, pattern induction can be performed on a set of conflicting structured events that conflict with the fourth pattern inductive memory. The resulting fifth pattern inductive memory is a pattern inductive memory that competes with the fourth pattern inductive memory.

[0176] For example, when the accumulated conflict between structured events and pattern inductive memory causes the confidence level of pattern inductive memory to fall below a critical threshold, a temporary pattern induction can be triggered, generating a new memory with a lower initial confidence level to compete with it. Through the parallel existence of dual-track memories, the self-calibration and evolutionary adaptation of the deep inductive layer knowledge system can be achieved.

[0177] Taking a programming intelligent agent as an example, when the confidence level is below 30, it automatically triggers temporary induction to generate competitive memory (the initial confidence level is set to 50), and achieves self-calibration of the code knowledge system through the parallel existence of dual-track memory.

[0178] Taking the writing agent as an example, when the confidence level drops to a certain threshold or below, the memory system can automatically associate relevant knowledge nodes to form a solution network and add a "context adaptation" attribute to distinguish the applicability of rules for different writing styles or normative requirements.

[0179] In this embodiment, when the confidence level of the pattern inductive memory is lower than a certain threshold, competitive induction is initiated to re-evaluate or generate new pattern inductive memories. This ensures that the memory system can self-adjust when receiving new information, avoids the solidification of erroneous memories, and promotes the healthy evolution of the knowledge system and the continuous growth of the intelligent agent.

[0180] The agent-based memory processing method in this application embodiment will be explained below with reference to optional examples. In this optional example, the interaction model is specified as LLM, the first memory layer is the immediate interaction layer (L1 layer), the second memory layer is the structural cognition layer (L2 layer), and the third memory layer is the deep archiving layer (L3 layer).

[0181] In this optional example, based on human memory mechanisms, the memory system is divided into three interconnected but distinct layers, forming a three-layer memory architecture (a three-layer heterogeneous memory architecture) to address memory needs at different time scales and abstraction levels, achieving a balance between efficiency and depth. Based on this memory architecture, a top-down asynchronous memory storage flow can be adopted. This process is memory evolution (i.e., memory storage and updating), running continuously or periodically in the background. Dynamic memory storage and updates are achieved through timed tasks and event-triggered mechanisms, allowing the agent's memory to continuously evolve with user interaction.

[0182] like Figure 5 As shown, the L1 layer serves as a short-term memory buffer for high-frequency reads and writes, storing immediate context window content (e.g., recent dialogues and task records), following a FIFO queue structure to ensure the fluency and coherence of dialogues. The L2 layer, serving as medium- to long-term memory, transforms the unstructured dialogues of the L1 layer into structured events, accumulating key facts and contextual information, and is responsible for the traceability of events. Structured events can include unique identifiers, user identifiers, timestamps, recall counts, event summaries, encoding vectors, specific element attributes, related events, and other information. The L3 layer, serving as long-term core memory, extracts abstract knowledge (core knowledge) with universal applicability, such as user preferences, behavioral patterns, knowledge rules, and task strategies, through induction and reasoning of a large number of structured events from the L2 layer. It is responsible for the depth and consistency of agent behavior. The core knowledge stored in the core knowledge base is pattern inductive memory, including unique identifiers, types, content, confidence levels, source events, and other information.

[0183] In this optional example, the memory retrieval of the memory system can employ an adaptive dynamic coordination mechanism: when a user request only requires short-term memory support, the memory system can directly rely on the immediate context to complete the processing; when the request involves long-term memory, a bottom-up synchronous memory retrieval flow is automatically triggered. The top-down asynchronous memory storage flow can include: the update and cleanup process at layer L1, the event-driven process from layer L1 to layer L2, and the pattern-based induction process from layer L2 to layer L3. Each process is described below.

[0184] For L1 layer updates and cleanups, after each round of new interaction, the memory management module can automatically add the complete information of that round of dialogue to the L1 layer cache queue. When L1 layer resource usage reaches a set standard (for example, when the number of dialogue rounds stored in the cache queue reaches M rounds or the token occupies more than the warning limit percentage of cache space), the memory system can automatically trigger event processing of the earliest interaction record and clean up the original information to avoid memory accumulation affecting the high-frequency read and write efficiency of L1 layer.

[0185] The event-based process from L1 to L2 refers to using LLM to extract unstructured dialogues into structured events containing metadata and key-value pairs such as unique identifiers, user identifiers, timestamps, recall counts, event summaries and their encoding vectors, specific feature attributes, and related events. This enables the orderly storage of dialogue information, significantly reduces subsequent retrieval costs, and lays the foundation for deep memory processing.

[0186] For additions or corrections to the same core content, the memory system can create new event cards with version associations and link them to old version events through internal pointers. This ensures that the latest and most accurate memory content is presented first during retrieval while preserving the complete evolutionary timeline.

[0187] The patterned inductive process from L2 to L3 refers to triggering LLM to perform inductive reasoning on relevant event clusters in L2 through a certain triggering mechanism, generating deep knowledge in L3. This can realize the orderly storage of dialogue information, greatly reduce the subsequent retrieval cost, and lay the foundation for deep memory processing.

[0188] The triggering conditions for the event-driven process from L1 to L2 can be: the interaction record (i.e., historical dialogue information) reaches an independent task loop, or resource consumption reaches a set threshold. Here, L1 has a certain cache space threshold, retaining the most recent M rounds of original dialogue by default, where M is a dynamically adjustable parameter that can be flexibly configured according to the needs of the implementation scenario to limit the number of rounds to be retained. This layer has the fastest information access speed, but its capacity is limited and it is easily overwritten by new information. In the event-driven process from L1 to L2, LLM can be responsible for extracting event summaries and their encoding vectors, refining key element attribute information, etc. Structured events can be key-value pairs in a structured format that stores event summaries and other event content.

[0189] The triggering condition for the pattern-based induction process from L2 to L3 layers can be: the number of topic events (structured events under the same topic) exceeding a preset threshold, or automatic activation during off-peak hours. L2 provides the agent with more refined and valuable cognitive information than the original dialogue history, ensuring the traceability of events. L3, on the other hand, can provide the agent with relevant deep memories when new requests arrive, when the agent needs to engage in deep reflection, or when dealing with complex and abstract problems, ensuring the depth and consistency of the agent's behavior.

[0190] In related technologies, memory in memory systems is static and fixed, lacking dynamic evolution and forgetting mechanisms. The memory bank is a static archive; outdated or even erroneous information is permanently stored and may be mistakenly recalled in subsequent interactions, causing the agent to exhibit obsolete or contradictory behavior. Memory systems lack effective mechanisms to update, correct, or even forget memories that are no longer important or have been falsified.

[0191] In this optional example, the memory system is capable of distinguishing information levels, possessing proactive cognitive and inductive abilities, and dynamically evolving and self-correcting. Its memory architecture is a multi-layered, dynamic long-term memory architecture. The three-layer memory architecture may further include a memory update module and a memory deletion module, which can operate independently of the asynchronous memory storage stream. The memory update module can perform repetitive monitoring and correlated updates on structured events in layer L2. Repetitive monitoring refers to monitoring recurring events, and correlated updates refer to identifying correlated events and updating their content. The memory deletion module can periodically perform systematic scans of the memories in layers L2 and L3 to execute soft and hard deletion strategies.

[0192] It should be noted that the agent-based memory processing method in this optional example revolves around a collaborative architecture of "user terminal-network-cloud server". The storage form of the three-layer heterogeneous memory architecture can be flexibly configured as needed. For example, the abstract knowledge form of the deep archiving layer can be set as an attribute-based knowledge graph, storing knowledge and related logic in a "entity node-relationship node-edge structure", retaining necessary metadata and adding knowledge granularity labels and association weights, and achieving traceability through evidence chain edge association events; the structured event storage of the structural cognition layer can be set as a lightweight event graph, storing basic metadata in event nodes and adding type labels and core entity sets, using edge structures to replace the related_events field to record event associations, and mapping edge annotations to the association type with L3 layer knowledge. By optimizing the storage form, the efficiency of knowledge organization and interaction can be improved.

[0193] Optionally, the triggering conditions for event-based processing and pattern-based induction can be associated with triggering thresholds calculated in real time by a dialogue complexity assessment model. This model can dynamically calculate the triggering thresholds by combining features such as semantic density, number of entities, and task relevance. The processing flow is initiated when the cognitive value score of the interactive information reaches the dynamic threshold (i.e., the dynamically calculated triggering threshold). Alternatively, a hybrid triggering mode can be adopted, integrating explicit user commands, implicit system judgments, and periodic scheduling to form a multi-dimensional triggering system. Intelligent adjustment of triggering conditions can maintain the timeliness and effectiveness of memory retention.

[0194] This optional example demonstrates how, based on a three-layer heterogeneous memory architecture, a top-down asynchronous memory storage stream is used to gradually accumulate information. By leveraging LLM to extract unstructured dialogues into structured events, and through a certain triggering mechanism, LLM is triggered to perform inductive reasoning on related event clusters in the L2 layer, generating deep knowledge in the L3 layer. This enables the orderly storage of dialogue information, significantly reducing subsequent retrieval costs and laying the foundation for deep memory processing.

[0195] In one exemplary embodiment, the memory retrieval process can employ a bottom-up synchronous memory retrieval flow (i.e., a synchronous bottom-up processing flow) to construct comprehensive and accurate contextual information for generating new responses. For the current round of dialogue input, memory retrieval can be performed in the order of third memory layer → second memory layer → first memory layer, progressively retrieving relevant memories.

[0196] For example, when a user initiates a new input request through their terminal device that requires long-term memory, a bottom-up synchronous memory retrieval flow (i.e., a bottom-up retrieval process) is triggered. This process locates key information layer by layer, from long-term abstract experience to real-time interactive scenarios. The new input request can be a new programming requirement that relies on historical memory, such as code writing, bug debugging, or tool invocation requests. The terminal device can convert the raw input into standardized data and transmit it to the server. The memory management module retrieves information in the order of L3 → L2 → L1, obtaining core knowledge from L3, filtering relevant events from L2, and extracting real-time dialogues from L1, thus progressively retrieving relevant memories.

[0197] In this embodiment, retrieving target stored information associated with the current round of dialogue input information from at least one memory layer in the memory storage architecture includes: retrieving a first pattern induction memory that matches the current round of dialogue input information from the pattern induction memory of the third memory layer; retrieving a set of target structured events from the structured events of the second memory layer based on the current round of dialogue input information and the first pattern induction memory; and extracting a set of historical dialogue information from the first memory layer.

[0198] For the current round of dialogue input, the first pattern inductive memory matching the current round of dialogue input can be retrieved from the three-layer pattern inductive memory. The retrieval of the pattern inductive memory can be based on the object identifier of the target interaction object and the dialogue topic to which the current round of dialogue input belongs. This allows for the precise identification of core knowledge strongly associated with the target interaction object and the current task, setting a cognitive benchmark and overall tone for subsequent responses, defining the overall direction and constraints of the agent's output answers and task execution, and avoiding responses that contradict general rules and long-term characteristics.

[0199] For example, the L3 layer, as the core layer storing abstract knowledge, long-term user patterns, and general rules, relies on accurately locating core knowledge strongly correlated with the current user and task. When a new request arrives, and the agent can engage in deep reflection or handle complex, abstract problems, it will retrieve relevant deep memories from the L3 layer, ensuring the depth and consistency of the agent's behavior. Upon receiving a user input request, if the memory system needs to access long-term memories in the memory bank, it can trigger a bottom-up synchronous memory retrieval mechanism. This mechanism first retrieves core knowledge and patterns related to the user or topic from the L3 layer, thereby establishing the overall tone and constraints of the response.

[0200] Upon initial retrieval, the memory management module can retrieve relevant abstract and inductive memories in Layer 3 based on the current user identifier or dialogue topic. Examples include retrieving user profiles, long-term preferences, and established rules. Knowledge in Layer 3 has the highest priority and is used to set the cognitive benchmark and overall tone for subsequent responses. It defines the overall direction and constraints for the agent's output responses and task execution, preventing responses that contradict general rules and long-term characteristics.

[0201] Based on the current turn-based dialogue input information and the first pattern inductive memory, a set of target structured events can be retrieved from the structured events in the second memory layer. Each target structured event in the retrieved set is associated with the first pattern inductive memory; for example, they are all source events of the first pattern inductive memory. That is, the structured events in the first pattern inductive memory obtained through pattern induction can be selected from the set of structured events represented by the list of source events in the first pattern inductive memory. Furthermore, each target structured event is associated with the current turn-based dialogue input information. This association can be determined based on the semantic similarity between the event description information and the current turn-based dialogue input information, or it can be determined based on other information. This embodiment does not limit this.

[0202] For example, when retrieving relevant events from the L2 layer, the source can be traced back to the memory of the patterns retrieved in the L3 layer, and the corresponding L2 layer source event list (source_events) can be extracted to locate and retrieve structured events in the L2 layer that can provide factual support for the current request.

[0203] To ensure the accuracy of the recall count and the latest recall time, the structured events in the second memory layer have dynamic update characteristics. When a structured event is used as a reference in subsequent retrieval, its recall count and the latest recall time are automatically updated.

[0204] For example, the L2 layer also has a current memory update mechanism to ensure the timeliness of stored memories. When a structured event in the L2 layer is successfully retrieved and a prompt word is generated in the bottom-up synchronous memory retrieval stream, its recall count is automatically incremented by 1, and the timestamp is updated to the current latest memory recall time.

[0205] Taking a programming agent as an example, the L2 layer also adapts to the update mechanism of the current layer's memory. When an L2 event is successfully invoked in a subsequent retrieval, its recall count (recall_count) is automatically incremented by 1, and the timestamp (timestamp) is updated to the current latest memory recall time. If there are subsequent additions or corrections to the same code issue, the content summary and attributes of the corresponding event are updated instead of creating a new card, ensuring the consistency and timeliness of the memory.

[0206] For the current round of dialogue input, associated historical dialogue information can also be extracted from the first memory layer to obtain a set of historical dialogue information. The basis for extracting historical dialogue information may include semantic similarity between dialogue information, proximity to the current round, or other criteria.

[0207] It should be noted that if the historical dialogue information retrieved from the first memory layer is unrelated to the structured events retrieved from the second memory layer, the historical dialogue information can be retrieved from the first memory layer first, or the memories can be retrieved from the first memory layer and other memory layers simultaneously.

[0208] The aforementioned target stored information may include at least one of the following: a set of historical dialogue information, a first pattern inductive memory (which may be the memory content therein), and a set of target structured events (which may be the event description information therein). For example, the target stored information may include a set of historical dialogue information; another example is that the target stored information may include a set of historical dialogue information and a set of target structured events; yet another example is that the target stored information may include a set of historical dialogue information, a first pattern inductive memory, and a set of target structured events.

[0209] For example, all information retrieved from the three-layer memory architecture can be assembled together with the user's new input into a structured prompt, which is then submitted to the LMM core module to generate the final response. During the assembly of the prompt and response generation, the Prompt assembly module can integrate core knowledge from layer 3, relevant events from layer 2, immediate context from layer 1, and the user's new input into a structured prompt according to a preset template. The constructed prompt can then be submitted to the LLM core module to generate a response. After processing by the cloud server, the response is transmitted to the terminal device, completing one interaction.

[0210] Taking a programming agent as an example, three layers of memory can be aggregated to form task-adaptive retrieval results: general abstract experience from layer L3, project-level events from layer L2, and real-time scenario information from layer L1 are aggregated according to the logic of "cross-project rules → specific project experience → real-time operational details" to form complete memory support. The memory management module can integrate the information obtained from the three layers of memory into a rich and detailed Prompt and send it to the LLM. This Prompt is more comprehensive than the user's initial input, providing accurate information for subsequent code generation, bug fixing, or tool invocation decisions.

[0211] This optional example demonstrates a bottom-up, synchronous memory retrieval flow for memory retrieval. It integrates real-time dialogue, pattern inductive memory, and structured events to build a comprehensive context, ensuring that the response output of the interaction model is based not only on immediate input but also on long-term memory and personal preferences. This enhances the depth and personalization of the interaction, and improves the comprehensiveness of the retrieval and the accuracy of the response.

[0212] In one exemplary embodiment, pattern induction memory can be retrieved from the third memory layer based on at least one of object identifier and dialogue topic. Optionally, retrieving a first pattern induction memory that matches the current round of dialogue input information from the pattern induction memory of the third memory layer includes: retrieving a first pattern induction memory that matches the current round of dialogue input information from the pattern induction memory of the third memory layer based on the object identifier of the target interactive object and the dialogue topic of the current interactive dialogue.

[0213] There can be multiple pattern-based inductive memories corresponding to a target interaction object. Retrieving all of these memories would not only slow down the retrieval process (due to the excessive number of structured events to be searched) but also reduce its accuracy. In this embodiment, pattern-based memory retrieval is performed based on the object identifier of the target interaction object and the dialogue topic of the current interaction. This reduces the number of retrieved pattern-based memories and improves the relevance of the retrieved memories to the current round of dialogue input.

[0214] Optionally, a pattern-inductive memory in the third memory layer is used to describe at least one of the following: the object profile of the corresponding interactive object, the object behavior pattern of the corresponding interactive object, the knowledge rules of the corresponding interactive object, and the task processing plan (i.e., task strategy) for the corresponding interactive object to complete a processing task under an object theme. By setting a set of memory types, the specified interaction model summarizes the event description information of structured events, selects the corresponding memory type from the set of memory types, and summarizes the memory content, that is, the memory description corresponding to the selected memory type.

[0215] For example, for a programming agent, general knowledge can be retrieved first in the L3 layer based on the user ID and the current programming task type. This knowledge may include at least one of the following: a general solution library for the corresponding technical field, the user's long-term programming paradigm, reusable code templates across projects, and defining the experience boundaries and general methodologies for the current task.

[0216] This optional example allows you to locate the most relevant core memories by matching object identifiers and dialogue topics, avoiding interference from memories that are irrelevant or mismatched with the current task, thus improving the accuracy of pattern memory retrieval and the relevance of the response.

[0217] In an exemplary embodiment, based on the current turn-based dialogue input information and the first pattern inductive memory, a set of target structured events is retrieved from the structured events of the second memory layer. This includes: filtering structured events associated with the first pattern inductive memory from the structured events of the second memory layer to obtain a set of associated structured events; filtering a set of candidate structured events from the set of associated structured events based on the semantic similarity between the current turn-based dialogue input information and the event description information of each associated structured event in the set of associated structured events; and selecting a set of target structured events from the set of candidate structured events according to the event weight of each candidate structured event in the set of candidate structured events.

[0218] To improve the efficiency of structured event retrieval, we can first filter out structured events from the second memory layer that are associated with the first pattern inductive memory, thus obtaining a set of associated structured events. The filtering of this set of associated structured events can be performed based on the list of source events from the first pattern inductive memory.

[0219] For the selected set of related structured events, a group of candidate structured events can be selected from the set based on the semantic similarity between the event description information of each related structured event and the current turn's input information. The semantic similarity between the event description information of each related structured event and the current turn's input information can be calculated by a network model with natural language understanding capabilities. To improve retrieval efficiency, the cosine similarity between the encoded vector of the current turn's input information and the encoded vector of each related structured event (i.e., the encoded vector obtained by vectorizing the event description information of each related structured event) can be used as the semantic similarity between the event description information of each related structured event and the current turn's input information.

[0220] Optionally, before selecting a set of candidate structured events from the set of associated structured events based on the semantic similarity between the current round dialogue input information and the event description information of each associated structured event in the set of associated structured events, the method further includes: vectorizing the current round dialogue input information to obtain the current dialogue input encoding vector corresponding to the current round dialogue input information; and determining the cosine similarity between the current dialogue input encoding vector and the encoding vector of each associated structured event as the semantic similarity between the current round dialogue input information and each associated structured event.

[0221] Selecting a set of candidate structured events from the set of associated structured events can be performed based on a set quantity threshold or a set similarity threshold. As an optional implementation, K associated structured events can be selected from the set of associated structured events in descending order of semantic similarity between the current turn's input information and the event description information of each associated structured event, where K is a positive integer greater than or equal to 1. As another optional implementation, a set of candidate structured events can be obtained by selecting associated structured events from the set of associated structured events whose semantic similarity between their event description information and the current turn's input information is greater than or equal to a third similarity threshold.

[0222] Based on the event weight of each candidate structured event in a set of candidate structured events, a set of target structured events can be selected from the set of candidate structured events. Here, the event weight of each candidate structured event is determined according to the activity level and importance of each candidate structured event. The higher the activity level of a structured event, the greater its event weight; the higher its importance, the greater its event weight.

[0223] Selecting a set of target structured events from a set of candidate structured events can be based on a set quantity threshold or a set event weight threshold. As an optional implementation, L candidate structured events can be selected from a set of candidate structured events in descending order of their event weights, resulting in a set of target structured events, where L is a positive integer greater than or equal to 1. If both candidate and target structured events are selected based on set quantity thresholds, then K ≥ L. As another optional implementation, candidate structured events with event weights greater than or equal to the event weight threshold can be selected from a set of candidate structured events to obtain a set of target structured events.

[0224] For example, when retrieving relevant events from the L2 layer, the encoding module can be invoked to vectorize the standardized text of the user's new input request. The extracted structured events are then semantically matched using vector cosine similarity to initially select the Top-K candidate structured events with the highest similarity. The candidate event set is then ranked using a dual-dimensional weighted scoring system, based on both memory activity and importance. The memory system can then select the Top-L structured events with the highest scores as the final event evidence. Both K and L values ​​are configurable hyperparameters to flexibly adapt to the retrieval accuracy and breadth requirements of different scenarios.

[0225] For programming agents, the general knowledge retrieved from the L3 layer can be vectorized. In the programming event cards of the L2 layer, the vector similarity is used for initial screening, and the top-10 (K=10) events with the highest similarity are selected as the list to be re-screened. Then, combined with the weighted scoring of the programming scenario-specific dimension, the top-5 (L=5) similar structured events are selected to realize the anchoring of general knowledge to specific project scenarios.

[0226] This embodiment combines semantic similarity, event weights, and multi-dimensional evaluation to quickly locate a subset of information highly relevant to the current task from a large number of structured events, ensuring the efficiency of the retrieval process and the relevance of the response, and achieving fine matching and efficient retrieval of target events.

[0227] In an exemplary embodiment, the activity level of each candidate structured event is represented by the parameter value of the activity parameter corresponding to each candidate structured event, and the importance level of each candidate structured event is represented by the parameter value of the importance parameter corresponding to each candidate structured event. Here, the activity parameter can also be called the recency parameter.

[0228] Correspondingly, before selecting a set of target structured events from a set of candidate structured events according to the event weight of each candidate structured event, the above method further includes: determining the event weight of each candidate structured event by weighting the parameter value of the activity parameter corresponding to each candidate structured event and the parameter value of the importance parameter corresponding to each candidate structured event.

[0229] To improve retrieval efficiency, the event weight of a structured event can be calculated using a weighted summation method. Specifically, the event weight is determined by weighting the values ​​of the activity parameter and the importance parameter corresponding to each candidate structured event according to the first weight coefficient of the activity parameter and the second weight coefficient of the importance parameter. The resulting weighted sum is then used to determine the event weight of each candidate structured event. The first and second weight coefficients can be fixed values ​​or dynamically adjusted based on historical search results; this embodiment does not impose such limitations.

[0230] For example, candidate event sets can be ranked using a dual-dimensional weighted scoring system, based on both the recency score and the importance score. The recency score R is determined by the most recent recall timestamp of the structured event; the more recent the timestamp, the higher the score. The importance score I is calculated based on the recall count of the structured event; the more recalls, the higher the score. These two dimensions are fused using a configurable comprehensive weighted scoring model to calculate the final comprehensive score S, using the formula: S = α R+β I; where α and β are their respective weight percentages, with a default balance of 0.5 for both, meaning that relevance and importance are given equal weight.

[0231] This embodiment uses a weighted sum of activity and importance parameters as the event weight to improve the rationality of event value assessment. Prioritizing recent and important events can improve retrieval efficiency and result quality.

[0232] In one exemplary embodiment, the value of the activity parameter may be set based on the time when the corresponding structured event was last retrieved and recalled (i.e., the aforementioned latest recall time). Correspondingly, the method further includes: determining the value of the activity parameter corresponding to each candidate structured event based on the time difference corresponding to each candidate structured event.

[0233] In this embodiment, for each candidate structured event, the time difference corresponding to each candidate structured event can be determined first. This time difference is the difference between the current time and the latest recall time of each candidate structured event, where the latest recall time is the time when the candidate structured event was most recently recalled due to retrieval. Then, based on the time difference corresponding to each candidate structured event, the parameter value of the activity parameter corresponding to each candidate structured event is determined. The parameter value of the activity parameter corresponding to each candidate structured event is negatively correlated with the time difference corresponding to each candidate structured event. Optionally, the latest recall time of each candidate structured event can be used as input, and the parameter value of the activity parameter corresponding to each candidate structured event can be directly calculated using an activity calculation model.

[0234] The negative correlation between the activity parameter value corresponding to each candidate structured event and the time difference corresponding to each candidate structured event can be varied. For example, the two can be exponentially negatively correlated or non-exponentially negatively correlated. This embodiment does not limit this.

[0235] For example, the recency score uses an exponential decay function, R = e -λ(current_time-timestamp) Where timestamp is the latest recall timestamp, current_time is the current time, and λ is the decay coefficient. λ can control the rate at which the score decays over time, and its value is within (0, 1). The larger λ is, the more obvious the score advantage of recent events.

[0236] Alternatively, an adaptive weighting model can be used instead of a fixed equilibrium weighting. A reinforcement learning algorithm can dynamically optimize the weight parameters α and β for recency and importance based on historical retrieval results, making the scoring model S=α. R+β I has scene adaptive capabilities.

[0237] In this embodiment, the time difference is used as a measure of activity, allowing the agent to assign higher weights to more recent structured events, thereby reflecting the impact of information freshness on decision-making, promoting the self-updating of the memory system, and maintaining the timeliness and relevance of memory.

[0238] In an exemplary embodiment, the evaluation method for the importance parameter corresponding to a structured event can be varied. For example, it can be determined based on the number of times the corresponding structured event is retrieved (i.e., the aforementioned recall number), or based on the number of times the corresponding structured event is retrieved and the storage time of the corresponding structured event, or based on other information.

[0239] As an optional implementation, the above method further includes: determining the parameter value of the importance parameter corresponding to each candidate structured event based on the recall count and the maximum recall count of each candidate structured event.

[0240] Here, the recall count for each candidate structured event is the number of times a candidate structured event is recalled due to retrieval, and the maximum recall count is the maximum of the recall counts of all candidate structured events in a set. The value of the importance parameter corresponding to each candidate structured event is positively correlated with the recall count of each candidate structured event and negatively correlated with the maximum recall count. This approach, compared to determining the value of the importance parameter for each candidate structured event based on its recall count and the corresponding time difference, or solely based on its recall count, improves the ability of the importance parameter value to characterize the relative importance among structured events, thereby enhancing the accuracy of structured event screening.

[0241] For example, the importance score of a structured event can be calculated using the square root function I = √recall_count / √max(recall_count), where max(recall_count) is the maximum number of recalls for events in the initial screening list, ensuring that the score increases smoothly with the number of recalls.

[0242] As another optional implementation, the above method further includes: predicting the parameter value of the importance parameter corresponding to each candidate structured event based on the multi-dimensional features corresponding to each candidate structured event, so as to obtain the predicted parameter value of the importance parameter corresponding to each candidate structured event.

[0243] In this embodiment, the importance of structured events can be predicted using multi-dimensional features. The multi-dimensional features corresponding to each candidate structured event include at least one of the following: the semantic similarity between each candidate structured event and the current round of dialogue input information; the object features of the target interaction object; the task type of the processing task corresponding to each candidate structured event; and may also include other features that can characterize the importance of each candidate structured event. In this case, based on the multi-dimensional features corresponding to each candidate structured event, the parameter value of the importance parameter corresponding to each candidate structured event can be predicted, thus obtaining the predicted parameter value of the importance parameter corresponding to each candidate structured event.

[0244] Predicting the importance parameter value for each candidate structured event can be achieved by weighted summation of the feature values ​​for each dimension of the candidate structured event, or by using a deep neural network model to fuse the multi-dimensional features of each candidate structured event and outputting the predicted importance parameter value for each candidate structured event.

[0245] For example, deep neural network models (e.g., Transformer-based memory relevance predictors) can be introduced. These models can integrate multi-dimensional features such as event content similarity, user preference characteristics, and task type to directly output a memory importance score, thereby improving retrieval accuracy.

[0246] In this embodiment, the importance parameter value of the corresponding structured event is determined based on the recall number and maximum recall number of the structured event, or the importance parameter value of the corresponding structured event is predicted based on the multi-dimensional features corresponding to the structured event. This enables the agent to identify frequently used or highly relevant structured events in specific contexts, ensuring the flexibility and targeting of memory retrieval.

[0247] In one exemplary embodiment, there may be multiple ways to extract a set of historical dialogue information from the first memory layer, including at least one of the following: selecting historical dialogue information associated with a set of target structured events from the historical dialogue information of the first memory layer to obtain a set of historical dialogue information; or extracting the last P rounds of dialogue information before the current round of dialogue input information from the historical dialogue information of the first memory layer to obtain a set of historical dialogue information.

[0248] As an optional implementation, a set of historical dialogue information can be filtered from the first memory layer based on the event description information in a set of target structured events retrieved in the second memory layer. The semantic similarity between each filtered historical dialogue information and the event structured information of at least one target structured event reaches a set similarity threshold. Furthermore, the filtering of historical dialogue information can also be based on the round difference between the historical dialogue information and the current round's input information. For example, filtering can be done only from the most recent rounds of historical dialogue information. Alternatively, the semantic similarity between the historical dialogue information and the event structured information of the target structured event can be adjusted based on the round difference between the historical dialogue information and the current round's input information; the larger the round difference between the historical dialogue information and the current round's input information, the greater the reduction in the semantic similarity between the historical dialogue information and the event structured information of the target structured event.

[0249] For example, for a programming agent, based on the key information in the structured events retrieved in the L2 layer, the relevant raw interaction data from the most recent rounds can be accurately extracted in the L1 layer. This data can include code snippets being debugged, real-time error stacks, and records of executed tool calls, supplementing the real-time scene details of the current task and ensuring that the retrieval results are consistent with real-time operations.

[0250] As an alternative implementation, the last P rounds of dialogue information before the current round of dialogue input can be extracted from the historical dialogue information in the first memory layer to obtain a set of historical dialogue information, where P is a positive integer greater than or equal to 1. P can be a fixed value, or it can be dynamically adjusted according to the number of historical dialogue information in the first memory layer. The more historical dialogue information in the first memory layer, the larger the value of P.

[0251] For example, the memory system can directly obtain the most recent dialogue history from the L1 layer to ensure continuity: it can directly extract the original interaction history (historical dialogue information) from the dialogue queue of the L1 layer, which may include the user's specific instructions in the previous round, the agent's previous response, the real-time feedback of the tool execution, etc., to ensure the fluency and continuity of the dialogue.

[0252] This embodiment allows for the rapid acquisition of necessary background information during the retrieval process by selecting historical dialogue information based on its relevance to the target structured event or by directly selecting information from the last few rounds of dialogue. This lays the foundation for constructing complete prompts, ensuring the integrity and relevance of the immediate context, and thereby improving the accuracy and coherence of the response.

[0253] The agent-based memory processing method in this application embodiment will be explained below with reference to optional examples. In this optional example, the interaction model is specified as LLM, the first memory layer is the immediate interaction layer (L1 layer), the second memory layer is the structural cognition layer (L2 layer), and the third memory layer is the deep archiving layer (L3 layer).

[0254] In this optional example, based on a three-layer memory architecture, a bottom-up synchronous memory retrieval flow can be adopted. This memory retrieval flow can be combined with the aforementioned top-down asynchronous memory storage flow to form a bidirectional collaborative memory flow (i.e., a bidirectional memory cognitive storage and retrieval flow). The bidirectional collaborative memory flow can work in conjunction with the three-layer memory architecture, and with the memory dynamic update mechanism, the agent can precipitate structured events from raw interactions and summarize deep knowledge from them. Ultimately, this achieves dynamic evolution and precise retrieval of memory, making the agent's memory system a self-correcting, continuously learning organism, thereby significantly improving the agent's performance in various complex tasks. Correspondingly, the three-layer memory architecture can be called a bidirectional collaborative memory hierarchical architecture, and the agent can be called an agent based on the bidirectional collaborative memory hierarchical architecture, such as a programming agent based on the bidirectional collaborative memory hierarchical architecture and a writing agent based on the bidirectional collaborative memory hierarchical architecture.

[0255] This optional example provides an agent memory management scheme based on a bidirectional collaborative memory hierarchical architecture, which can be used for memory management of agents driven by large language models. This enables the agent to build a stable, profound, and dynamic user model that retains core preferences while updating changes in needs, thus maintaining consistency over long-term interactions. This provides users with highly personalized services that closely match their long-term needs, avoids the disconnect from generalized responses, and improves the personalization and consistency of long-term interactions.

[0256] The intelligent agent memory management scheme based on a bidirectional collaborative memory hierarchical architecture can include memory storage, memory retrieval, and memory updating. Memory storage can employ the aforementioned top-down asynchronous memory storage flow, while memory retrieval can utilize a bottom-up synchronous memory retrieval flow. Memory updating can be a dynamic evolution mechanism that runs through the entire memory storage and retrieval process, achieving accuracy and efficiency through the synergy of multi-dimensional update strategies and active forgetting mechanisms. During retrieval, the recall count and most recently accessed timestamp of any successfully invoked memory in the structural cognition layer are updated, directly affecting its future retrieval priority. In the hierarchical information accumulation storage process, the structural cognition layer identifies the association between old and new events and synchronously records the relationships between events. Furthermore, new events strengthen or correct existing deep memories based on their content. The memory system also incorporates an active forgetting module, which scans the memory data in the structural cognition layer and deep archiving layer according to preset parameters, soft-archiving or even hard-deleting memories that have not been accessed for a long time, have low importance, or consistently insufficient confidence, ensuring the entire memory system can metabolize and maintain high efficiency and accuracy.

[0257] The memory system in this optional example is a dynamically evolving memory system. By introducing recall counting, association, confidence scoring, and forgetting mechanisms, the memory system can dynamically adjust according to new interactions, strengthen important memories, correct outdated information, and forget irrelevant content, enabling the agent to grow together with the user and enhancing the agent's adaptability.

[0258] For the memory retrieval process, when responding to users' requests for long-term memory, the concept of moving from abstract to concrete is adopted. Following the retrieval order of "L3 layer setting the strategy framework → L2 layer providing case events → L1 layer maintaining real-time details", first, core knowledge is obtained from L3 layer, then relevant factual evidence is found from L2 layer, and finally, combined with the real-time context window content of L1 layer, high-quality prompts with clear hierarchy and emphasis are constructed. This ensures that the response is strategically correct, factually supported, and scenario-adaptable, and efficiently outputs high-quality prompts.

[0259] For example, such as Figure 6 As shown, a user can initiate a new request through their terminal device. The memory system vectorizes the user's new request and retrieves core knowledge (i.e., pattern inductive memory) from layer L3. Core knowledge in layer L3 has the highest priority compared to other layers. Then, the memory system retrieves relevant events from layer L2. Next, it obtains the immediate context from layer L1. Finally, the memory system assembles all the information retrieved from the three-layer memory architecture along with the user's new request into a structured prompt, which is then submitted to the LMM core module to generate the final response.

[0260] Here, the retrieval performed by the memory system at the structural cognition layer is a hybrid retrieval. This retrieval considers vector similarity and combines the recentity (timestamp) and importance (recall frequency) of events for weighted scoring to select the most relevant historical structured events as supporting evidence. The memory system can extract structured events indicated by the source event list of the core knowledge retrieved from the L2 layer, and perform semantic matching based on vector similarity. From the structured events indicated by the source event list of the core knowledge retrieved, the top-K structured events with the highest semantic similarity to the new request are selected to obtain a candidate event set. The memory system performs a dual-dimensional weighted scoring and ranking of the candidate event set, with the scoring criteria including both the recentity and importance of the memory. The candidate structured events in the candidate event set are ranked according to the weighted scores of the recentity and importance dimensions, and the top-L candidate structured events with the highest scores are selected as the final event evidence. The formula for calculating the final comprehensive score S using the dual-dimensional weighted scoring model is: S = α R+β I.

[0261] This optional example demonstrates how to store, retrieve, update, and optimize the agent's memory. Through a three-layer heterogeneous memory architecture and bidirectional collaborative memory flow, it effectively integrates immediate context with long-term experience, enabling hierarchical management, proactive summarization, and dynamic evolution of the agent's memory. This supports efficient processing of complex tasks. By asynchronous processing, hierarchical isolation, and dynamic triggering of memory storage and accumulation, the stability of the memory system is maintained. This approach can solve the problems of organizing, refining, and dynamically evolving the agent's memory, improving the contextual consistency and coherence of long-term interactions, the level of personalized service capabilities, and the depth of cognition and decision-making intelligence.

[0262] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0263] According to another aspect of the embodiments of this application, an agent-based memory processing device is also provided, which is used to implement the above embodiments and preferred embodiments, and will not be repeated hereafter. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0264] The agent-based memory processing device in this embodiment can be applied to an agent-based memory system. The agent-based memory architecture includes a first memory layer, a second memory layer, and a third memory layer. The first memory layer is used to store historical dialogue information of at least one interactive object and the agent. The second memory layer is used to store structured events extracted from the historical dialogue information of at least one interactive object and the agent. The third memory layer is used to store pattern induction memory obtained by pattern induction of the structured events of the second memory layer.

[0265] Figure 7 This is a structural block diagram of an optional agent-based memory processing device according to an embodiment of this application, such as... Figure 7 As shown, the device may include:

[0266] The first execution unit 702 is configured to, in response to the current round dialogue input information initiated by the target interactive object of at least one interactive object to the agent in the current interactive dialogue, retrieve target storage information associated with the current round dialogue input information from at least one memory layer in the memory architecture, and assemble the current round dialogue input information and the target storage information into a current prompt word.

[0267] The second execution unit 704 is used to submit the current prompt word to the specified interaction model through the agent, and output the response result of the specified interaction model to the target interaction object.

[0268] It should be noted that the first execution unit 702 in this embodiment can be used to execute the above step S402, and the second execution unit 704 in this embodiment can be used to execute the above step S404.

[0269] The embodiments provided in this application, in response to the current round dialogue input information initiated by the target interactive object in the current interactive dialogue to the agent, retrieve target stored information associated with the current round dialogue input information from at least one memory layer in the memory architecture, and assemble the current round dialogue input information and the target stored information into a current prompt word; the agent submits the current prompt word to a specified interaction model and outputs the response result of the specified interaction model to the target interactive object, thereby solving the problems of low retrieval accuracy and poor response relevance caused by the mixing of information values ​​in the related technologies of agent-based memory processing methods, and improving the retrieval accuracy and response relevance.

[0270] In an exemplary embodiment, the first memory layer includes a target cache queue, where historical dialogue information from one round of interaction between the target interactive object and the agent is written as a cache item into the target cache queue. The apparatus further includes: an event processing unit, configured to, when a first storage condition is met, perform event processing on at least a portion of the historical dialogue information in the target cache queue to obtain structured events to be stored; and a third execution unit, configured to store the structured events to be stored in the second memory layer and perform a deletion operation on at least a portion of the historical dialogue information in the target cache queue. The first storage condition includes at least one of the following: the number of rounds of historical dialogue information in the target cache queue reaches M rounds, where M is a positive integer greater than or equal to 1; the cache space occupied by the historical dialogue information in the target cache queue reaches a first cache space threshold; and the historical dialogue information in the target cache queue forms a closed loop of an independent processing task.

[0271] In an exemplary embodiment, the apparatus further includes: a first determining unit, configured to perform one of the following before processing at least a portion of the historical dialogue information in the target cache queue into an event-based manner to obtain a structured event to be stored: determining the N historical dialogue information messages with the earliest write time in the target cache queue as at least a portion of the historical dialogue information according to the write time sequence, wherein N is a positive integer greater than or equal to 1; determining one or more historical dialogue information messages with the earliest write time in the target cache queue as at least a portion of the historical dialogue information according to the write time sequence and a second cache space threshold, wherein the cache space occupied by the at least a portion of the historical dialogue information is greater than or equal to the second cache space threshold, or the cache space occupied by the at least a portion of the historical dialogue information is less than the second cache space threshold; determining historical dialogue information messages in the target cache queue whose cognitive value parameter value is less than or equal to a specified parameter threshold as at least a portion of the historical dialogue information, wherein the cognitive value parameter value of a historical dialogue information message in the target cache queue is obtained by cognitive value evaluation based on at least one of the following features of the corresponding historical dialogue information: semantic density, number of entities, and correlation with the associated processing task.

[0272] In an exemplary embodiment, the event processing unit includes: a first execution module, configured to extract information from at least a portion of historical dialogue information using a specified interaction model, and generate a structured event to be stored based on the extracted event description information according to a target event structure. The target event structure includes an event identifier and event description information, wherein the event description information of a structured event describes the corresponding structured event. The target event structure further includes at least one of the following: an object identifier, used to identify the interaction object to which the corresponding structured event belongs; a latest recall time, the time when the corresponding structured event was last recalled due to retrieval; a recall count, the number of times the corresponding structured event has been recalled due to retrieval; an encoding vector for the event description information, obtained by vectorizing the event description information of the corresponding structured event; event elements, event elements of a structured event being event features specified for the corresponding structured event; and related event information, used to indicate structured events that are associated with the corresponding structured event.

[0273] In an exemplary embodiment, the structured event to be stored includes the following information: event description information and related event information, wherein the related event information of a structured event is used to indicate structured events that are associated with the corresponding structured event.

[0274] The third execution unit includes: an identification module, used to identify the association between the structured event to be stored and the structured events already stored in the second memory layer based on the semantic similarity between the event description information of the structured event to be stored and the event description information of the structured events already stored in the second memory layer; and a second execution module, used to update the relevant event information of the structured event to be stored and the relevant event information of the first structured event when it is identified that the structured event to be stored and the first structured event already stored in the second memory layer are related events, and to store the structured event to be stored in the second memory layer, wherein the semantic similarity between the event description information of the structured event to be stored and the event description information of the first structured event is greater than or equal to a first similarity threshold; and to update the second structured event based on the structured event to be stored when it is identified that the structured event to be stored and the second structured event already stored in the second memory layer are repetitive events, wherein the semantic similarity between the event description information of the structured event to be stored and the event description information of the second structured event is greater than or equal to a second similarity threshold, and the second similarity threshold is greater than the first similarity threshold.

[0275] In one exemplary embodiment, the apparatus further includes: a fourth execution unit, configured to, when a second storage condition is met, perform pattern induction on at least a portion of the structured events in the second memory layer to obtain a pattern induction memory to be stored, and store the pattern induction memory to be stored in the third memory layer. The second storage condition includes at least one of the following: the system time reaches a specified time period, wherein at least a portion of the structured events are newly added structured events in the second memory layer within a historical time period, and the historical time period is earlier than the specified time period; the number of structured events under a dialogue topic reaches a first quantity threshold, wherein at least a portion of the structured events are structured events under a target dialogue topic in the second memory layer, and the number of structured events under the target dialogue topic reaches the first quantity threshold.

[0276] In an exemplary embodiment, the fourth execution unit includes: a third execution module, configured to extract associated event clusters from at least a portion of structured events according to object identifiers and event elements, input event description information of the structured events in the associated event clusters into a specified interaction model, so that the specified interaction model performs pattern induction on the event description information of the structured events in the associated event clusters to obtain a pattern induction result of the specified interaction model, wherein the associated event clusters include one or more structured events, and the pattern induction result includes memory type and memory content; and a first generation module, configured to generate a pattern induction memory to be stored according to a target memory structure based on the pattern induction result, wherein the target memory structure includes a memory identifier, a memory type, and memory content. The target memory structure further includes at least one of the following: an object identifier, wherein the object identifier of a pattern induction memory is used to identify the interaction object to which the corresponding pattern induction memory belongs; a confidence level, wherein the confidence level of a pattern induction memory is used to represent the credibility of the corresponding structured event; and a source event list, wherein the source event list of a pattern induction memory is used to record the event identifiers of the structured events used to obtain the corresponding pattern induction memory through pattern induction.

[0277] In one exemplary embodiment, the first execution unit includes: a first retrieval module, configured to retrieve a first pattern inductive memory matching the current round of dialogue input information from the pattern inductive memory of a third memory layer; a second retrieval module, configured to retrieve a set of target structured events from the structured events of a second memory layer based on the current round of dialogue input information and the first pattern inductive memory; and an extraction module, configured to extract a set of historical dialogue information from the first memory layer. The target stored information includes at least one of the following: a set of historical dialogue information, the first pattern inductive memory, and a set of target structured events.

[0278] In an exemplary embodiment, the first retrieval module includes: a first retrieval submodule, configured to retrieve a first pattern induction memory matching the current round of dialogue input information from the pattern induction memory of the third memory layer based on the object identifier of the target interactive object and the dialogue topic of the current interactive dialogue, wherein a pattern induction memory of the third memory layer is used to describe at least one of the following: the object profile of the corresponding interactive object, the object behavior pattern of the corresponding interactive object, the knowledge rules of the corresponding interactive object, and the task processing scheme of the corresponding interactive object to complete a processing task under an object topic.

[0279] In an exemplary embodiment, the second retrieval module includes: a first filtering submodule, configured to filter structured events associated with the first pattern inductive memory from the structured events of the second memory layer to obtain an associated structured event set; a second filtering submodule, configured to filter a set of candidate structured events from the associated structured event set based on the semantic similarity between the current turn dialogue input information and the event description information of each associated structured event in the associated structured event set; and a selection submodule, configured to select a set of target structured events from the set of candidate structured events according to the event weight of each candidate structured event in the set of candidate structured events, wherein the event weight of each candidate structured event is determined based on the activity level and importance of each candidate structured event.

[0280] In one exemplary embodiment, the activity level of each candidate structured event is represented by the parameter value of the activity parameter corresponding to each candidate structured event, and the importance level of each candidate structured event is represented by the parameter value of the importance parameter corresponding to each candidate structured event.

[0281] The aforementioned apparatus further includes: a second determining unit, configured to determine the event weight of each candidate structured event by weighting the parameter values ​​of the activity parameter corresponding to each candidate structured event and the parameter values ​​of the importance parameter corresponding to each candidate structured event before selecting a set of target structured events from the set of candidate structured events according to the event weight of each candidate structured event in the set of candidate structured events.

[0282] In an exemplary embodiment, the apparatus further includes a third determining unit, configured to determine the parameter value of the activity parameter corresponding to each candidate structured event based on the time difference corresponding to each candidate structured event, wherein the time difference corresponding to each candidate structured event is the time difference between the current time and the latest recall time of each candidate structured event, the latest recall time of each candidate structured event is the time when each candidate structured event was most recently recalled due to retrieval, and the parameter value of the activity parameter corresponding to each candidate structured event is negatively correlated with the time difference corresponding to each candidate structured event.

[0283] In an exemplary embodiment, the apparatus further includes a fourth determining unit, configured to perform one of the following: determining a parameter value of an importance parameter corresponding to each candidate structured event based on the recall count and maximum recall count of each candidate structured event, wherein the recall count of each candidate structured event is the number of times each candidate structured event is recalled due to retrieval, the maximum recall count is the maximum value of the recall counts of candidate structured events in a set of candidate structured events, and the parameter value of the importance parameter corresponding to each candidate structured event is positively correlated with the recall count of each candidate structured event and negatively correlated with the maximum recall count; predicting the parameter value of the importance parameter corresponding to each candidate structured event based on the multi-dimensional features corresponding to each candidate structured event, to obtain the predicted parameter value of the importance parameter corresponding to each candidate structured event. The multi-dimensional features corresponding to each candidate structured event include at least one of the following: the semantic similarity between each candidate structured event and the current turn-based dialogue input information, the object features of the interactive object, and the task type of the processing task corresponding to each candidate structured event.

[0284] In an exemplary embodiment, the extraction module includes at least one of the following: a first extraction unit, configured to select historical dialogue information associated with a set of target structured events from the historical dialogue information of the first memory layer to obtain a set of historical dialogue information; and a second extraction unit, configured to extract the last P rounds of dialogue information before the current round of dialogue input information from the historical dialogue information of the first memory layer to obtain a set of historical dialogue information, wherein P is a positive integer greater than or equal to 1.

[0285] In one exemplary embodiment, the apparatus further includes at least one of the following: a fifth execution unit, configured to mark a third structured event in the second memory layer as a first inhibition state when the third structured event in the second memory layer satisfies a first inhibition condition, wherein the first inhibition condition includes at least one of the following: recall rate is less than a recall rate threshold, the duration of unaccessed events reaches a first time threshold, and the first inhibition state is a state in which the corresponding structured event is prohibited from being retrieved but is allowed to be reactivated in the case of backtracking; and to perform a deletion operation on the third structured event when the duration of the third structured event in the first inhibition state reaches a second time threshold; a sixth execution unit, configured to mark a second pattern inductive memory in the third memory layer as a second inhibition state when the second inhibition condition is satisfied, wherein the second inhibition condition includes: confidence level is less than a first confidence threshold, the second inhibition state is a state in which the corresponding pattern inductive memory is prohibited from being retrieved but is allowed to be reactivated in the case of backtracking; and to perform a deletion operation on the second pattern inductive memory when the duration of the second pattern inductive memory in the second inhibition state reaches a third time threshold.

[0286] In an exemplary embodiment, the above-described apparatus further includes at least one of the following: a seventh execution unit, configured to, during the process of pattern induction of a fourth structured event in the second memory layer, if it is determined that the fourth structured event supports a third pattern induction memory already stored in the third memory layer, update the memory content of the third pattern induction memory using the event description information of the fourth structured event, increase the confidence level of the third pattern induction memory, and add the event identifier of the fourth structured event to the source event list of the third pattern induction memory, wherein the source event list of the third pattern induction memory is used to record the event identifiers of the structured events used to obtain the third pattern induction memory through pattern induction; and an eighth execution unit, configured to, during the process of pattern induction of a fifth structured event in the second memory layer, if it is determined that the fifth structured event conflicts with the fourth pattern induction memory already stored in the third memory layer, decrease the confidence level of the fourth pattern induction memory.

[0287] In an exemplary embodiment, the above apparatus further includes: a pattern induction unit, configured to, after lowering the confidence level of the fourth pattern induction memory, and when the confidence level of the lowered fourth pattern induction memory is less than a second confidence level threshold, perform pattern induction on a set of conflict structured events that conflict with the fourth pattern induction memory to obtain a fifth pattern induction memory that competes with the fourth pattern induction memory.

[0288] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.

[0289] According to another aspect of the embodiments of this application, a computer-readable storage medium is also provided, wherein a computer program is stored therein, wherein the computer program is configured to perform the steps in any of the above method embodiments when it is run.

[0290] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as USB flash drives, read-only memory (ROM), RAM, portable hard drives, magnetic disks, or optical disks.

[0291] According to another aspect of the embodiments of this application, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.

[0292] In one exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.

[0293] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.

[0294] According to another aspect of the embodiments of this application, a computer program product is also provided, comprising a computer program / instructions containing program code for performing the methods shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via a communication section 809, and / or installed from a removable medium 811. When the computer program is executed by a central processing unit 801, it performs various functions provided in the embodiments of this application. The sequence numbers of the embodiments of this application above are merely descriptive and do not represent the superiority or inferiority of the embodiments.

[0295] Figure 8 A schematic block diagram of a computer system architecture for implementing the electronic device of the embodiments of this application is shown. Figure 8 As shown, the computer system 800 includes a CPU 801, which can perform various appropriate actions and processes based on programs stored in ROM 802 or loaded into RAM 803 from storage section 808. Random access memory 803 also stores various programs and data required for system operation. The central processing unit 801, read-only memory 802, and random access memory 803 are interconnected via bus 804. Input / output (I / O) interface 805 is also connected to bus 804.

[0296] The following components are connected to I / O interface 805: an input section 806 including a keyboard, mouse, etc.; an output section 807 including a cathode ray tube (CRT), liquid crystal display (LCD), and speakers, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card, such as a local area network card or modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to I / O interface 805 as needed. Removable media 811, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 810 as needed so that computer programs read from them can be installed into storage section 808 as needed.

[0297] Specifically, according to embodiments of this application, the processes described in the various method flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 809, and / or installed from removable medium 811. When the computer program is executed by central processing unit 801, it performs various functions defined in the system of this application.

[0298] It should be noted that, Figure 8 The computer system 800 of the electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0299] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those described herein, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.

[0300] The above are merely preferred embodiments of this application and are not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the principles of this application should be included within the protection scope of this application.

[0301] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.

[0302] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the principles of this application should be included within the protection scope of this application.

Claims

1. A memory processing method based on intelligent agents, characterized in that, The agent's memory architecture includes a first memory layer, a second memory layer, and a third memory layer. The first memory layer stores historical dialogue information between at least one interactive object and the agent. The second memory layer stores structured events extracted from the historical dialogue information between the at least one interactive object and the agent. The third memory layer stores pattern induction memory obtained by pattern induction of the structured events in the second memory layer. The method includes: In response to a current round dialogue input information initiated by a target interactive object in the at least one interactive object to the agent in the current interactive dialogue, target storage information associated with the current round dialogue input information is retrieved from at least one memory layer in the memory architecture, and the current round dialogue input information and the target storage information are assembled into a current prompt word; The agent submits the current prompt word to the specified interaction model and outputs the response result of the specified interaction model to the target interaction object.

2. The method according to claim 1, characterized in that, The first memory layer includes a target cache queue, and the historical dialogue information of one round of interaction between the target interaction object and the agent is written into the target cache queue as a cache item; The method further includes: If the first storage condition is met, at least a portion of the historical dialogue information in the target cache queue is processed into an event-based manner to obtain the structured events to be stored. The structured events to be stored are stored in the second memory layer, and a deletion operation is performed on at least a portion of the historical dialogue information in the target cache queue; The first storage condition includes at least one of the following: the number of rounds of the historical dialogue information in the target cache queue reaches M rounds, where M is a positive integer greater than or equal to 1; the cache space occupied by the historical dialogue information in the target cache queue reaches a first cache space threshold; and the historical dialogue information in the target cache queue forms a closed loop of an independent processing task.

3. The method according to claim 2, characterized in that, The process of performing event-based processing on at least a portion of the historical dialogue information in the target cache queue to obtain structured events to be stored includes: The specified interaction model is used to extract information from at least a portion of the historical dialogue information, and based on the extracted event description information, the structured event to be stored is generated according to the target event structure. The target event structure includes an event identifier and event description information, and the event description information of a structured event is used to describe the corresponding structured event. The target event structure further includes at least one of the following: Object identifier: An object identifier for a structured event is used to identify the interactive object to which the corresponding structured event belongs; The latest recall time is the time when the corresponding structured event was last recalled due to retrieval. Recall count: The recall count of a structured event is the number of times the corresponding structured event is recalled due to retrieval. The encoding vector of event description information: The encoding vector of event description information of a structured event is a vector obtained by vectorizing the event description information of the corresponding structured event. Event elements: Event elements of a structured event are the event characteristics specified for the corresponding structured event; Related event information: Related event information for a structured event is used to indicate structured events that are associated with the corresponding structured event.

4. The method according to claim 2, characterized in that, The structured events to be stored include the following information: event description information and related event information. The related event information of a structured event is used to indicate structured events that are associated with the corresponding structured event. The step of storing the structured event to be stored in the second memory layer includes: Based on the semantic similarity between the event description information of the structured event to be stored and the event description information of the structured events already stored in the second memory layer, the structured event to be stored and the structured events already stored in the second memory layer are associated and identified. If it is identified that the structured event to be stored is related to the first structured event already stored in the second memory layer, the relevant event information of the structured event to be stored and the relevant event information of the first structured event are updated, and the structured event to be stored is stored in the second memory layer, wherein the semantic similarity between the event description information of the structured event to be stored and the event description information of the first structured event is greater than or equal to a first similarity threshold. If it is identified that the structured event to be stored and the second structured event already stored in the second memory layer are duplicate events, the second structured event is updated based on the structured event to be stored, wherein the semantic similarity between the event description information of the structured event to be stored and the event description information of the second structured event is greater than or equal to a second similarity threshold, and the second similarity threshold is greater than the first similarity threshold.

5. The method according to claim 1, characterized in that, The method further includes: When the second storage condition is met, at least a portion of the structured events in the second memory layer are subjected to pattern induction to obtain the pattern induction memory to be stored, and the pattern induction memory to be stored is stored in the third memory layer. The second storage condition includes at least one of the following: When the system time reaches a specified time period, the at least some of the structured events are structured events newly added in the second memory layer within the historical time period, and the historical time period is earlier than the specified time period; The number of structured events under a dialogue topic reaches a first quantity threshold, wherein at least some of the structured events are structured events under a target dialogue topic in the second memory layer, and the number of structured events under the target dialogue topic reaches the first quantity threshold.

6. The method according to claim 5, characterized in that, The step of performing pattern induction on at least a portion of the structured events in the second memory layer to obtain the pattern induction memory to be stored includes: Based on object identifiers and event elements, related event clusters are extracted from at least some of the structured events. The event description information of the structured events in the related event clusters is input into the specified interaction model, so that the specified interaction model performs pattern induction on the event description information of the structured events in the related event clusters to obtain the pattern induction result of the specified interaction model. The related event clusters include one or more structured events, and the pattern induction result includes memory type and memory content. Based on the pattern induction results, the pattern induction memory to be stored is generated according to the target memory structure, wherein the target memory structure includes memory identifier, memory type and memory content; The target memory structure further includes at least one of the following: Object identifier: An object identifier for a pattern inductive memory is used to identify the interactive object to which the corresponding pattern inductive memory belongs; Confidence, the confidence of a pattern inductive memory is used to represent the credibility of the corresponding structured event; The source event list is a list of source events for pattern inductive memory, used to record the event identifiers of the structured events used to obtain the corresponding pattern inductive memory through pattern induction.

7. The method according to claim 1, characterized in that, Retrieving target stored information associated with the current round of dialogue input from at least one memory layer in the memory architecture includes: Retrieve the first pattern inductive memory that matches the current round of dialogue input information from the pattern inductive memory of the third memory layer; Based on the current round of dialogue input information and the first pattern inductive memory, a set of target structured events is retrieved from the structured events of the second memory layer; Extract a set of historical dialogue information from the first memory layer; The target stored information includes at least one of the following: the set of historical dialogue information, the first pattern inductive memory, and the set of target structured events.

8. The method according to claim 7, characterized in that, The step of retrieving the first pattern inductive memory that matches the current round of dialogue input information from the pattern inductive memory of the third memory layer includes: Based on the object identifier of the target interactive object and the dialogue topic of the current interactive dialogue, the first pattern inductive memory that matches the current round of dialogue input information is retrieved from the pattern inductive memory of the third memory layer. The pattern inductive memory of the third memory layer is used to describe at least one of the following: the object profile of the corresponding interactive object, the object behavior pattern of the corresponding interactive object, the knowledge rules of the corresponding interactive object, and the task processing scheme of the corresponding interactive object to complete a processing task under an object topic.

9. The method according to claim 7, characterized in that, The step of retrieving a set of target structured events from the structured events of the second memory layer based on the current round of dialogue input information and the first pattern inductive memory includes: From the structured events of the second memory layer, structured events associated with the first pattern inductive memory are selected to obtain a set of associated structured events; Based on the semantic similarity between the current round of dialogue input information and the event description information of each associated structured event in the associated structured event set, a set of candidate structured events is selected from the associated structured event set; The target structured events are selected from the set of candidate structured events according to the event weight of each candidate structured event, wherein the event weight of each candidate structured event is determined based on the activity level and importance of each candidate structured event.

10. The method according to claim 9, characterized in that, The activity level of each candidate structured event is represented by the parameter value of the activity parameter corresponding to each candidate structured event, and the importance level of each candidate structured event is represented by the parameter value of the importance parameter corresponding to each candidate structured event. Before selecting the target structured event from the set of candidate structured events according to the event weight of each candidate structured event in the set of candidate structured events, the method further includes: The event weight of each candidate structured event is determined by the weighted sum of the activity parameter value and the importance parameter value corresponding to each candidate structured event.

11. The method according to any one of claims 1 to 10, characterized in that, The method further includes at least one of the following: If a third structured event in the second memory layer satisfies a first inhibition condition, the third structured event is marked as a first inhibition state, wherein the first inhibition condition includes at least one of the following: recall rate is less than a recall rate threshold, the duration of unaccessed events reaches a first time threshold, and the first inhibition state is a state in which the corresponding structured event is prohibited from being retrieved, but is allowed to be reactivated in the case of backtracking; if the duration of the third structured event in the first inhibition state reaches a second time threshold, a deletion operation is performed on the third structured event; When the second pattern inductive memory in the third memory layer satisfies the second inhibition condition, the second pattern inductive memory is marked as a second inhibition state. The second inhibition condition includes: the confidence level is less than the first confidence threshold. The second inhibition state is a state in which the corresponding pattern inductive memory is prohibited from being retrieved, but is allowed to be reactivated in the case of backtracking. When the duration of the second pattern inductive memory in the second inhibition state reaches a third time threshold, the second pattern inductive memory is deleted.

12. The method according to claim 11, characterized in that, The method further includes at least one of the following: During the pattern induction process of the fourth structured event in the second memory layer, if it is determined that the fourth structured event supports the third pattern induction memory already stored in the third memory layer, the memory content of the third pattern induction memory is updated using the event description information of the fourth structured event, the confidence of the third pattern induction memory is increased, and the event identifier of the fourth structured event is added to the source event list of the third pattern induction memory. The source event list of the third pattern induction memory is used to record the event identifiers of the structured events used to obtain the third pattern induction memory through pattern induction. During the pattern induction process of the fifth structured event in the second memory layer, if it is determined that the fifth structured event conflicts with the fourth pattern induction memory already stored in the third memory layer, the confidence level of the fourth pattern induction memory is lowered.

13. The method according to claim 12, characterized in that, After lowering the confidence level of the fourth mode inductive memory, the method further includes: If the confidence level of the fourth pattern inductive memory after adjustment is less than the second confidence level threshold, pattern induction is performed on a set of conflict structured events that conflict with the fourth pattern inductive memory to obtain a fifth pattern inductive memory that competes with the fourth pattern inductive memory.

14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the method according to any one of claims 1 to 13.

15. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 13.

Citation Information

Patent Citations

  • Structured abstract dialogue method and system for background information enhancement, electronic equipment and storage medium

    CN117453890A

  • Human-computer interaction method, device and equipment based on historical dialogues and storage medium

    CN118940842A

  • Memory system of AI intelligent agent and updating method and retrieval method thereof

    CN120875055A

Cited By

  • Memory management method of multi-agent interaction system, related equipment and program product

    CN121434926A

  • Memory management method of multi-agent interaction system, related device and program product

    CN121434926B

  • Memory data processing method and device, storage medium and computer program product

    CN121562658A

  • Intelligent agent memory management method and device based on asynchronous processing and storage medium

    CN121598989A

  • AI intelligent agent memory management method and device based on PostgreSQL database

    CN122285707A