Memory processing method based on 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.

CN121168679BActive Publication Date: 2026-03-27ZTE CORP

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-24
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

In existing methods for processing memory information in intelligent agents, the mixed information values ​​lead to 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 CN121168679B_ABST
    Figure CN121168679B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a memory processing method based on an agent, a storage medium and an electronic device, wherein the memory architecture of the 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 an interactive dialogue between at least one interactive object and the agent, the second memory layer is used to store structured events extracted from the historical dialogue information, and the third memory layer is used to store pattern induction memories obtained by pattern induction on the structured events; the method includes: in response to current round dialogue input information of a target interactive object, retrieving target stored information associated with the current round dialogue input information from at least one memory layer in the memory architecture, and assembling the current round dialogue input information and the target stored information into a current prompt; submitting the current prompt to a specified interactive model through the agent, and outputting a response result of the specified interactive model to the interactive object.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] Embodiments of the present application relate to the technical field of artificial intelligence and human-computer interaction, in particular, to a memory processing method based on an agent, a storage medium and an electronic device. BACKGROUND

[0002] At present, agents are widely used to build personalized assistants, intelligent customer service, creative assistance tools, etc., and become an important form of human-computer interaction. In order to realize long-term and coherent personalized interaction, the agent needs to have stable memory ability to retain cross-scene user information. The memory management of the agent can be a scheme relying on short-term memory, which is also called session-level memory. It is only valid in the current dialogue process, and can directly store the recent dialogue history by using the context window of the interactive model such as a large language model (LLM). Such a scheme is simple, but cannot remember long-term information.

[0003] Therefore, a memory management scheme relying on long-term memory can be used. Long-term memory is a cross-session memory, which can be called at any time in any dialogue. When the dialogue history exceeds the context window, the dialogue content can be stored in an external database. When there is new user input, the most relevant historical information can be found by searching the database to provide reference for the interactive model.

[0004] However, all long-term information is indiscriminately stored in a single knowledge base, and the information values are mixed, resulting in a large amount of low-value or irrelevant noise information being recalled during memory retrieval, which interferes with the judgment of the interactive model and reduces the accuracy of retrieval and the relevance of response.

[0005] Therefore, the memory processing method based on the agent in the related art has the problem of low retrieval accuracy and poor response relevance due to mixed information values. SUMMARY

[0006] Embodiments of the present application provide a memory processing method based on an agent, a storage medium and an electronic device to at least solve the problem of low response accuracy due to mixed information values in the related art memory processing method based on an agent.

[0007] According to an embodiment of the present application, a memory processing method based on an agent is provided, the memory architecture of the 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 an interactive dialogue between 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 the interactive dialogue between the at least one interactive object and the agent, and the third memory layer is used to store pattern induction memories obtained by pattern induction on the structured events of the second memory layer; the method includes: in response to current round dialogue input information initiated by a target interactive object in the at least one interactive object to the agent in a 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, and assembling the current round dialogue input information and the target stored information into a current prompt; submitting the current prompt to a specified interaction model through the agent, and outputting a response result of the specified interaction model to the target interactive object.

[0008] According to another embodiment of the present application, an agent-based memory processing device is provided, the memory architecture of the 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 an interactive dialogue between 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 the interactive dialogue between the at least one interactive object and the agent, and the third memory layer is used to store pattern induction memories obtained by pattern induction on the structured events of the second memory layer; the device includes: a first execution unit configured to, in response to current round dialogue input information initiated by a target interactive object in the at least one interactive object to the agent in a 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; and a second execution unit configured to submit the current prompt to a specified interaction model through the agent, and output a response result of the specified interaction model to the target interactive object.

[0009] According to still another embodiment of the present application, a computer readable storage medium is also provided, the computer readable storage medium stores a computer program, wherein the computer program is configured to execute the steps in any of the method embodiments when running.

[0010] According to a further embodiment of the present application, an electronic device is also provided, comprising a memory and a processor, the memory having stored therein a computer program, the processor being arranged to execute the computer program to perform the steps of any of the method embodiments described above.

[0011] According to a further embodiment of the present application, a computer program product is also provided, comprising a computer program which, when executed by a processor, implements the steps of any of the method embodiments described above.

[0012] According to the above embodiments of the present application, since the memory architecture of the agent is divided into three interrelated but well-defined three levels, i.e., the first memory layer for storing the historical dialogue information of the interactive dialogue between the interactive object and the agent, the second memory layer for storing the structured events extracted from the historical dialogue information of the interactive dialogue between the interactive object and the agent, and the third memory layer for storing the pattern induction memory obtained by pattern induction (or patternized induction) on the structured events of the second memory layer, this three-layer heterogeneous memory architecture simulates the hierarchical mechanism of human memory, effectively separates the instant dialogue, structured facts and abstract experience, and when performing information retrieval, the target stored information associated with the current round of dialogue input information can be retrieved from at least one memory layer in the memory architecture, and the current round of dialogue input information and the target stored information are assembled into a current prompt, the agent can submit the current prompt to a specified interactive model and output the response result of the specified interactive model to the interactive object. In this way, the agent can hierarchically call information on demand when building context, avoiding the interference of original massive low-value information, improving the information utilization efficiency, and solving the problem of low retrieval accuracy and poor relevance of response due to mixed information value in the related art memory processing method based on an agent, achieving the technical effects of improving the accuracy of retrieval and the relevance of response. BRIEF DESCRIPTION OF DRAWINGS

[0013] Figure 1 is an application scenario diagram of an agent-based memory processing method according to an embodiment of the present application;

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

[0015] Figure 3 is a system architecture structure block diagram of an optional memory system according to an embodiment of the present application;

[0016] Figure 4 is a flow diagram of an optional agent-based memory processing method according to an embodiment of the present 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] The various links of the above-mentioned collaborative architecture are supported by hardware, interaction and data resources, and realize efficient operation of the agent memory system (which can be referred to as a memory system). Among them, the cloud server integrates hardware resources (for example, a main processing unit, a cache, an external database, an input / output interface) and software resources (an interaction model core and application logic), which is the core running carrier of the memory system.

[0026] Optionally, an example of the hardware structure of the cloud server can be as shown in Figure 2 Figure 2 is a hardware structure block diagram of an optional cloud server according to an embodiment of the present application. As shown in Figure 2 , the cloud server can include one or more (only one is shown in Figure 2 ) processor 202 (the processor 202 can include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 204 for storing data, wherein the cloud server can further include a transmission device 206 for communication function and an input / output device 208. Those skilled in the art can understand that Figure 2 The structure shown in is only schematic, which does not limit the structure of the above-mentioned cloud server. For example, the cloud server can further include more or less components than those shown in Figure 2 , or have a different configuration from Figure 2 .

[0027] The memory 204 can be used to store computer programs, for example, software programs of application software and modules, such as the computer program corresponding to the agent-based memory processing method in the embodiment of the present application. The processor 202 executes various functional applications and data processing by running the computer program stored in the memory 204, that is, realizes the above-mentioned method. The memory 204 can include a high-speed random access memory, and can also include a non-volatile memory, such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories. In some examples, the memory 204 can further include a memory remotely arranged with respect to the processor 202, which can be connected to the cloud server through a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network and a combination thereof.

[0028] ​The transmission device 206 is configured to receive or send data via a network. An optional example of the network can include a wireless network provided by a communication provider of a cloud server. In an example, the transmission device 206 includes a network interface controller (NIC) that can be connected to other network devices through a base station to communicate with the Internet. In an example, the transmission device 206 can be a radio frequency (RF) module configured to communicate with the Internet in a wireless manner.

[0029] In the present embodiment, an agent-based memory processing method running on the cloud server is provided, which can be applied to a scenario of human-computer interaction using an agent based on an interaction model. An agent is an autonomous entity that can perceive, make decisions, and take actions in an environment to achieve a goal, usually driven by an interaction model. The interaction model is a model used for human-computer interaction, which can be an LLM, i.e., a large-scale model based on deep learning that can understand and generate natural language. In at least some examples of the present embodiment, the interaction model is taken as an LLM, and the methods described in the present embodiment can be applied to other types of interaction models without contradiction.

[0030] With the development of LLM technology and related tools, agents, as an important application, are widely used to build personalized assistants, intelligent customer service, and creative assistance tools. One of the core capabilities of an agent is its memory capability, i.e., understanding, storing, and using user-related knowledge in long-term interaction. The mainstream technology generally extends the memory of the model through an external knowledge base, but the simple information storage and retrieval mechanism still has limitations and is difficult to support the agent to achieve deep cognition and personalized response in continuous interaction.

[0031] At present, an agent based on a large language model has become an important form of human-computer interaction. To achieve long-term and coherent personalized interaction, an agent needs to have stable memory capability to retain cross-scene user information. The memory management of an agent mainly relies on short-term memory and long-term memory, and the implementation can be: short-term memory is only valid in the current dialogue process, and the context window of the LLM is used to directly store the dialogue history of the last few rounds. This method is simple but cannot remember long-term information; long-term memory is a cross-session memory that can be called 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 (for example, a vector database), and when there is new user input, the database is retrieved by semantic similarity to find the most relevant historical information for the LLM to reference.

[0032] To meet different memory needs, a double-layer memory architecture of "short-term memory + long-term memory" can be used as the memory storage scheme of the intelligent agent. The above scheme can meet the basic long-term memory needs, but the information value is mixed and lacks hierarchy: all long-term information is stored in a single knowledge base without discrimination, important pattern memory is mixed with trivial event memory, resulting in a large number of low-value or irrelevant noise information being recalled during memory retrieval, interfering with the judgment of the LLM, and there are problems of low retrieval accuracy and poor relevance of the response.

[0033] In addition, the memory storage of the intelligent agent is passive, lacks active cognition and induction ability, and is essentially an information warehouse that only passively stores and retrieves historical dialogues, but cannot reflect, induce and efficiently extract higher-level and abstract knowledge or patterns from a large number of scattered dialogues, tasks and events, and cannot realize true self-adaptive growth.

[0034] To at least partially solve the above technical problems, in the present embodiment, a multi-level memory system is provided, i.e., a memory architecture including a first memory layer (L1), a second memory layer (L2) and a third memory layer (L3), the first memory layer is used to store the historical dialogue information of the interactive dialogue between the at least one interactive object and the intelligent agent, which can be called the instant interaction layer (Instant Interaction Layer), the second memory layer is used to store the structured events extracted from the historical dialogue information of the interactive dialogue between the at least one interactive object and the intelligent agent, which can be called the structural cognition layer (Structural Cognition Layer), and the third memory layer is used to store the pattern induction memory obtained by pattern induction on the structured events of the second memory layer, which can be called the deep archive layer (Deep Archive Layer). The above multi-level memory system simulates the hierarchical mechanism of human memory, integrates real-time operation, situational events and general knowledge, and ensures that the intelligent agent can flexibly cope with complex environments.

[0035] In addition, through the event processing and pattern induction knowledge sublimation process, the intelligent agent is no longer a passive and static information storage, but can actively and continuously learn, reflect and extract knowledge from experience, realize cognitive deepening from knowing facts to understanding patterns, and make its behavior more logical and predictable.

[0036] Optionally, the first memory layer can store original interaction content (immediate context of the current interaction, which can be original context information of the current window dialogue and task, for example, dialogue history and task record of the last few rounds), guaranteeing the immediate fluency of the interaction dialogue, which can be a short-term memory buffer with high-frequency read-write, and can be implemented in a cache random access memory (RAM). The second memory layer as a medium and long-term memory can be a long-term memory bank for storing structured events extracted from the first memory layer, and can extract, process and store structured information from the first memory layer. Here, the unstructured dialogue of the first memory layer is converted into structured events, key facts and scene information are deposited, and the traceability of events is responsible. The third memory layer as a long-term core memory can be a long-term memory bank for storing abstract knowledge, patterns and rules etc. induced from structured events in the second memory layer, and can store core knowledge and experience with long-term value, which can include but is not limited to at least one of user preferences, behavior patterns, knowledge rules and task strategies. Information is further integrated and generalized from the second memory layer to the third memory layer, realizing the abstraction and sublimation of knowledge, and can build an event evidence chain of the second memory layer under the deep memory, which is the highest cognitive level of the memory system. By induction and reasoning on a large number of structured events in the second memory layer, at least part of the abstract knowledge (for example, user portrait, which can include user preferences), patterns (for example, behavior patterns), rules (for example, knowledge rules) and strategies (for example, task strategies) with universality are extracted, and the depth and consistency of the agent behavior are responsible.

[0037] Optionally, the structured event can be the key facts and scenario information distilled from the historical dialogue information (unstructured dialogue content, which can be dialogue content to be eliminated) in the first memory layer after processing by a large language model (LLM) or other interaction model, which is stored in a unified format in the second memory layer. A structured event in the second memory layer can be generated according to a target event structure, which can include at least one of the following: event identification; event description information, which is used to describe the corresponding structured event, e.g., key facts and scenario information distilled from historical dialogue information; object identification, which is used to identify the interaction 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 times, which is the number of times the corresponding structured event was 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 characteristics specified for the corresponding structured event; and related event information, which is used to indicate structured events that have an association with the corresponding structured event.

[0038] Here, the event elements (also referred to as exclusive element attributes, key element attributes, key feature attributes) of a structured event are key features extracted for the corresponding structured event. These key features can be specified, i.e., the event elements of a structured event are specified event characteristics 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. For different application scenarios, event elements can be different. For example, in a programming scenario, event elements can include technical fields (e.g., data science, front-end development), code elements (e.g., syntax structure, library usage), bug types (e.g., type error, syntax error), development actions (e.g., writing, debugging, refactoring), and associated code file locations, etc. In a writing agent, event elements can cover dimensions such as discussion topics, text structure, core concepts, entity references, task types, etc. The extraction and storage of these event elements enable the agent to quickly and accurately classify and retrieve similar events, enhancing the organization and retrieval efficiency of memory, and ensuring that the agent can provide more accurate and efficient responses based on past experience when processing related requests. The existence of exclusive element attributes enables the agent to deeply understand and effectively utilize historical information.

[0039] For example, a large language model can extract key information from the interaction fragment (i.e., historical dialogue information) to be processed in the L1 layer, generate a structured event containing unique identification event_id (i.e., event identification), user identification user_id (i.e., object identification), timestamp timestamp (an example of the latest recall time, initially the structured event generation time, and then the latest recall retrieval time of the structured event), recall count recall_count (an example of the number of recalls, initialized to 0), event summary summary (an example of event description information) and its encoding vector summary_vector (used for similarity matching when memory retrieval), exclusive element attributes, related event information related_events (initialized to empty), and other information, and write it to the structured database.

[0040] Optionally, the pattern induction memory can be a more abstract and general memory extracted from structured events through pattern recognition and induction, such as user preferences, behavior patterns, knowledge rules, task strategies, etc. The generation of such memories can overcome the limitations of the agent simply relying on information retrieval, giving it the ability to actively learn and cognitively deepen from experience, enabling the agent to exhibit deep understanding and personalized service in long-term interactions, and enhancing the depth and consistency of communication with the user. One pattern induction memory in the third memory layer can be generated according to a target memory structure, which can include but is not limited to at least one of the following: memory identification; memory type; memory content; object identification, the object identification of a pattern induction memory is used to identify the corresponding interactive object to which the pattern induction memory belongs; confidence, the confidence of a pattern induction memory is used to represent the credibility of the corresponding structured event; source event list, the source event list of a pattern induction memory is used to record the event identification of the structured event used to obtain the corresponding pattern induction memory through pattern induction.

[0041] For example, the memory system can retrieve a relevant event cluster from the structural cognitive layer, make inductive reasoning on the summary and key information of the structured events in the relevant event cluster, generate a pattern inductive memory of the deep inductive layer (e.g., abstract knowledge and rule memory), and record the event IDs of all structured events supporting the memory to ensure traceability of the knowledge. A pattern inductive memory of the deep inductive layer can include a unique schema_id (i.e., memory identifier), a type type (i.e., memory type), a content content (i.e., memory content), a confidence, source events (i.e., a list of source events), and possibly other necessary information. The type of the memory type can include user preference, behavioral pattern, knowledge rule, and task strategy, and possibly other memory types, or the memory type of a pattern inductive memory that does not belong to any of the user preference, behavioral pattern, knowledge rule, and task strategy can be recorded as Others; the memory content is the abstract knowledge and rule pattern memory extracted by the LLM, and the confidence is the quantitative score of the system on the pattern inductive memory, which can be used for part of knowledge reinforcement and correction in the memory updating link.

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

[0043] The memory system based on the above memory architecture can run on a cloud server. The system architecture of the memory system can be as shown in Figure 3 Figure 3 is a structural block diagram of an optional system architecture of a memory system according to an embodiment of the present application. The system architecture can include the following parts: a user interaction layer, an agent processing unit (Agent) in Figure 3 , a memory management module (corresponding to the core memory hierarchical architecture, memory), and an external resource interface. The parts of the memory system are explained below.

[0044] ​The user interaction layer includes an input module and an output module. The input module is the entrance for the memory system to receive user instructions, responsible for capturing user queries and performing preliminary processing and formatting on raw, unstructured user input, and then passing it to the agent for further analysis. The output module is the exit for the system to show results and perform actions to the user, which can receive responses or behaviors generated by the agent. The responses generated by the agent can be generated text, voice, images or other forms of content, and the actions generated by the agent can be calling a certain program, controlling a certain device or executing a certain API call. The output module is responsible for converting these internal instructions (corresponding to the responses or behaviors generated by the agent) into results that users can understand and perceive.

[0045] The agent processing unit is responsible for main logic processing, reasoning and decision-making, which can include an agent and a large language model (LLM). The agent can be responsible for intent understanding, task decomposition, decision planning, tool invocation and process control, coordinating the operation of LLM, memory system and external resources, integrating all processing results to form the final response or action instruction, and sending 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 extraction and induction.

[0046] The memory management module can mimic the way human memory works by dividing memory into different levels to achieve efficient management and long-term learning, which is an important part of realizing the individualization and continuous evolution of the agent. The memory management module can include an immediate interaction layer (L1 layer), a structured cognitive layer (L2 layer) and a deep archiving layer (L3 layer). Information can not only be deposited and solidified layer by layer from the three-layer architecture, but also retrieved from deep memory (L3 layer / L2 layer) as needed to support the upper layer for the current task. When the user has new input, the retrieved information in the memory management module can be assembled into the final prompt word with the current context according to the preset template, submitted to the LLM core module and obtained the final output.

[0047] The agent can interact with external resources (such as external information sources or services) through an external resource interface, such as external databases or knowledge bases, API services, etc., to obtain information other than pre-training data, verify facts, and perform actual tasks interacting 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, understanding the intention and task planning through the agent, calling large language models for thinking and reasoning, and obtaining context and storing new knowledge with the help of multi-level memory system, and finally providing responses or performing corresponding actions to the user through the output module.

[0049] For different application fields, the agent in the memory system can be different types of agents, for example, in the programming field, the agent in the memory system can be a programming agent (also known as an Artificial Intelligence (AI) programming agent), and in the writing field, the agent in the memory system can be a writing agent (also known as an AI writing agent). Among them, in the writing field, a sustainable evolving internalization capability can be built for the AI writing agent, which enables it to learn user preferences for a long time, achieve seamless connection across document content, and autonomously deposit writing experience, and ultimately grow into a personalized intelligent entity that deeply resonates with the user's creative journey.

[0050] Taking the programming agent as an example, the hardware deployment of the memory system can be carried out around the "terminal device-network-cloud server" three-layer architecture, wherein the terminal device is the development environment or command line interface used by programmers, which interacts with the agent through plug-ins or APIs. The terminal device can include, but is not limited to, a personal computer, a tablet, or a cloud development environment. The network is based on Transmission Control Protocol (TCP) / Internet Protocol (IP) Internet connection, supports Wi-Fi or mobile network, and ensures real-time data transmission between the terminal device and the cloud server. The cloud server is the core running platform of the agent memory management system, including: a main processing unit, which can execute core algorithms and memory scheduling, run large language models, and coordinate the data flow of various hardware modules. The main processing unit can be a Central Processing Unit (CPU) or a Graphics Processing Unit (GPU); a cache, which can store L1 layer data to ensure high-frequency read / write and low-latency access, and can be RAM; an external database, which can be a non-relational database, storing L2 and L3 layer memory data, and supporting vector indexing for similarity retrieval; an input / output interface, which can be used to receive user instruction requests and code data, and the output interface can return agent responses and output results to the user.

[0051] The memory architecture in the memory system can be related to user code debugging task related memory, and the storage content of different memory layers is different. The L1 layer can store the immediate context information of the current session, which can include but is not limited to the code fragment being written / debugged, the error stack and warning information of the real-time compilation / run-time, the command history (for example, debugging instructions, refactoring operations) recently executed, and temporary variables, function definition snapshots generated in the interaction process, etc. The original dialogue in the last few rounds is stored by default, and the round threshold upper limit of memory retention is flexibly configured according to the actual programming scene demand such as lightweight script writing or large project debugging. The L2 layer can store the programming scene events of the current code project refined and structured from the original interaction information of the L1 layer. It can include but is not limited to at least one of the following: unique identification event_id, user identification user_id, timestamp, recall times, event summary summary and its encoding vector summary_vector, at the same time, LLM extracts technical field, code element (for example, syntax structure, library, framework component), bug type (for example, TypeError), development action type, associated code file location and other exclusive element attributes, forming a programming event card (an example of a structured event) that can be efficiently retrieved. The L3 layer can store the universal programming knowledge system formed by inductive reasoning and pattern extraction of the structured events in the L2 layer, and cluster the scattered behaviors of the independent code single project in the L2 layer into reusable function templates and user paradigms across code projects, which can include but is not limited to a general solution library classified by technical field, user programming behavior preference and technical tendency, cross-project technical association rule, etc. The memory content in the L3 layer is associated with the structured event identification in the L2 layer through the source event source_events field, to ensure that the original scene can be traced back.

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

[0053] The memory processing method based on the agent provided in the embodiments of the present application can be as shown in Figure 4 Figure 4 is a flow diagram of an optional memory processing method based on an agent according to an embodiment of the present application, which includes the following steps:

[0054] Step S402, in response to the current round dialogue input information initiated by the target interaction object in at least one interaction object to the agent in the current interaction dialogue, retrieving target storage information associated with the current round dialogue input information from at least one memory layer in the memory architecture, and assembling the current round dialogue input information and the target storage information into a current prompt word; ​

[0055] Step S404, submitting the current prompt to the specified interaction model by the intelligent agent, and outputting the response result of the specified interaction model to the target interaction object.

[0056] In the current interaction dialogue, the target interaction object can initiate the current round of dialogue input information to the intelligent agent, and the target interaction object is any one of the at least one interaction object. An interaction object can be used to identify a user who performs human-computer interaction with the intelligent agent, and the object information of the interaction object can be account information logged in by the user through a terminal device. After the target interaction object opens the current interaction dialogue, the target interaction object can input interaction content in the input box, or provide interaction content through attachments or other forms, and initiate the current round of dialogue input information, which can include the interaction content input in the input box, the interaction 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 therefrom, and in response to the current round of dialogue input information, the intelligent agent can retrieve target storage information associated with the current round of dialogue input information from at least one memory layer in the memory architecture, for example, retrieve historical dialogue information associated with the current round of dialogue input information from the first memory layer, for example, retrieve structured events associated with the current round of dialogue input information from the second memory layer, and for example, retrieve pattern induction memories associated with the current round of dialogue input information from the third memory layer. The retrieved target storage information can be assembled with the current round of dialogue input information to form a current prompt.

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

[0059] The intelligent agent can submit the current prompt to the specified interaction model (for example, LLM), and the specified interaction model generates a response based on the submitted current prompt. The response result is processed by the cloud server and transmitted to the terminal device of the target interaction object, completing an interaction.

[0060] For example, after retrieving the stored information from the memory system, a Prompt can be constructed and a response can be generated. The Prompt assembly module in the memory system can integrate the retrieved stored information and the new user input (i.e., the current round of dialogue input information) 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, and the response result is transmitted to the terminal device after being processed by the cloud server, completing one interaction.

[0061] Optionally, the agent-based memory processing method provided in the embodiment can be applied to various LLM agent scenarios that require long-term continuity and personalized interaction, and can include but is not limited to at least one of the following: creative assistance tools, such as code programming assistants and AI writing designs, remembering the background, plot setting or code architecture of the entire project to ensure consistency during the long-term creation process; personal intelligent digital assistants, such as mobile phone voice assistants and smart home central controls, deeply understanding the habits, preferences and schedules of users to provide proactive and thoughtful services; advanced intelligent customer service, the memory system can record and deeply understand all historical interactions, records and problems of customers, understand the personal preferences and emotions of customers, and provide consistent, efficient and personalized solutions to improve customer satisfaction; AI education and tutoring, the memory system can track the learning progress, weak points in knowledge and thinking habits of students for a long time, dynamically adjust the teaching strategies and content to achieve adaptive education for different people; psychological companionship and health consultation, the memory system can establish and maintain long-term and in-depth emotional connections, establish long-term user emotional and psychological health files, provide empathetic support and companionship, and provide continuous care and support.

[0062] It should be noted that, regardless of the application scenario, the processing of the dialogue information of the user by the memory system is performed on the premise of obtaining the authorization of the user. The operation of obtaining the authorization of the user can be completed when the user registers, can be completed when the user starts the first session, can be completed when the authorization range needs to be changed, or can be completed at other times, as long as the processing of the dialogue information is within the authorization range of the user.

[0063] Optionally, a timeout and fuse mechanism can be set to actively avoid faults. When the response delay of any node exceeds a threshold, the memory system will interrupt the task to prevent resource locking and indefinite waiting. Through this design, the agent memory system remains stable, efficient and not prone to collapse in complex interactions with large language models, enabling it to achieve deep cognitive capabilities while maintaining industrial-level operating efficiency under high-intensity operation.

[0064] By the above steps, in response to the current round of dialogue input information initiated by the target interaction object in at least one interaction object to the agent in the current interaction dialogue, the target storage 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 the target storage information are assembled into the 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, which solves the problem of low retrieval accuracy and poor relevance of the response due to mixed information value in the related art memory processing method based on the agent, improves the accuracy of retrieval and the relevance of response.

[0065] In one example embodiment, the storage mode of historical dialogue information can be various, such as a dialogue information list, a cache queue, etc. Considering the time sequence of historical dialogue information, in this embodiment, one round of historical dialogue information of the interaction dialogue between the interaction object and the agent can be written into the cache queue as a cache item, in which case the first memory layer can include a target cache queue corresponding to the target interaction object.

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

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

[0068] In order to improve the controllability and rationality of the conversion of historical session information of the first memory layer to structured events of the second memory layer, a specific trigger condition, i.e., a first storage condition, can be preset, and in response to the first storage condition being met, the precipitation from unstructured dialogue to structured events is started. The first storage condition can involve the dimensions of value and resource, and can include 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 (for example, 50), which can be a fixed value, dynamically adjusted as needed, or set differently according to application scenarios. The first cache space threshold can be a set value, or determined according to the size of the cache space set for the first memory layer and the set proportion threshold (for example, 80%). The formation of a closed loop of an independent processing task by historical dialogue information means that the agent has successfully completed a specific task proposed by the user or solved a problem of the user in a series of continuous dialogue processes, and this process can be considered as ended without further input or intervention. The closed loop refers to that the agent receives a user request, through a series of interactions (which can include asking questions to obtain more information, providing solutions, performing actions, giving feedback, etc.), finally reaches a state that meets the user's demand, and this state can be used as a basis or reference point for subsequent dialogue or tasks.

[0070] For example, the trigger condition of the eventization processing of the L1 layer to the L2 layer can involve the dimensions of value and resource, and can include: the independent task closed loop reached by a certain interaction record in the L1 layer, the number of dialogue turns stored in the cache queue reaching M, or the resource occupation of the L1 layer reaching the set threshold standard. The upper limit M of memory reservation and the set upper limit of the cache space threshold can be flexibly configured according to the scene requirements.

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

[0072] In this embodiment, in response to the first storage condition being met, at least part of the historical dialogue information in the target cache queue can be eventized to obtain a structured event to be stored. The at least part of the historical dialogue information can be all of the historical dialogue information in the target cache queue, or part of the historical dialogue information. The at least part of the historical dialogue information can be extracted according to the time sequence in which the historical dialogue information is stored in the target cache queue, based on the association between the historical dialogue information, or in reference to other information. The at least part of the historical dialogue information is not limited in this embodiment.

[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", "timestamp": "String",

[0083] "recall_count": "Integer", "recall_count": "Integer",

[0084] "summary": "String", "summary": "String",

[0085] "summary_vector": "Array", "summary_vector": "Array",

[0086] "exclusive_properties": {

[0087] "technical_domain": "String", "technical_domain": "String",

[0088] "code_elements": "Array of Strings", "code_elements": "Array of Strings",

[0089] "bug_type": "String", "bug_type": "String",

[0090] "development_action": "String", "development_action": "String",

[0091] "related_file_location": "String", "related_file_location": "String"

[0092] }

[0093] "related_events": "Array of Strings", "related_events": "Array of Strings"

[0094] }

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

[0096] By setting the trigger condition of the historical dialogue information in the first memory layer to the conversion of the structured event in the second memory layer, and completing the conversion of the historical dialogue information to the structured event when the set trigger condition is met, the controllability and rationality of information conversion can be improved, and the redundant historical dialogue information in the first memory layer can be cleaned up, so as to avoid the influence of memory accumulation on the high-frequency read-write efficiency of the first memory layer.

[0097] In one example embodiment, before eventizing the at least part of the historical dialogue information in the target cache queue to obtain the structured event to be stored, the historical dialogue information in the target cache queue that needs to be structured can be determined. There are many ways to determine the historical dialogue information in the cache queue that needs to be structured, for example, the number of specified historical dialogue information can be determined, the number of specified historical dialogue information and the specified cache space threshold (here, the cache space threshold can be the minimum cache space or the maximum cache space occupied by the determined historical dialogue information) can be determined, the parameter value of the cognitive value parameter of the historical dialogue information can be determined, or at least two kinds of information can be determined.

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

[0099] The number N of historical dialogue information that needs to be structured can be specified, N is a positive integer greater than or equal to 2, and it can be understood that N is less than or equal to M. In this case, the N historical dialogue information with the earliest writing time in the target cache queue can be determined as the at least part of the historical dialogue information according to the writing time sequence.

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

[0101] As another optional implementation, one or more historical dialogue information with the earliest writing time in the target cache queue can be determined as the at least part of the historical dialogue information according to the writing time sequence and the second cache space threshold.

[0102] Here, in addition to ensuring that the eventized historical dialogue information is the earliest written historical dialogue information, the size of the cache space occupied by the eventized historical dialogue information can also be controlled. At least part of the historical dialogue information, in addition to being the earliest written historical dialogue information into the target cache queue, occupies a cache space reaching a set second cache space threshold, thereby ensuring the utilization rate of storage space, or the occupied cache space is lower than the set second cache space threshold, which can improve the relevance between the historical dialogue information in the first memory layer and the latest input dialogue information, and further improve the relevance of information retrieval.

[0103] For example, taking a programmed agent as an example, for the update and cleaning of the L1 layer, the memory retention round limit of the L1 layer and the setting of the warning limit of the cache space threshold can be flexibly configured according to the code complexity and the actual programming scene, wherein the round limit can be set to 50, and the warning limit can be set to 80%. When the interaction round stored in the cache queue reaches 50 rounds, or the code token and the debugging information occupy more than 80% of the cache space, the memory system can automatically trigger the eventization of the earliest timing coding interaction record, avoiding the accumulation of large code cache affecting the high-frequency read-write efficiency of the L1 layer to the real-time coding context.

[0104] As another optional implementation, the 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 determined 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 the fixed round or quantity threshold, to ensure the timeliness and effectiveness of memory deposition. The parameter value of the cognitive value parameter of a historical dialogue information in the target cache queue is obtained based on cognitive value evaluation of at least one of the following features of the corresponding historical dialogue information: semantic density, entity quantity, and relevance between associated processing tasks.

[0106] For example, taking the writing agent as an example, the user interacts with the writing agent in the interaction interface, and the content can include literature query, argument construction, paragraph polishing, and reference format checking. The memory system can cache and value evaluate the L1 layer of the dialogue information. After each round of dialogue, the dialogue information of this round is stored in the cache queue of the L1 layer, and a dialogue complexity evaluation model is started in real time to evaluate the cognitive value of the dialogue information of this round. The model comprehensively evaluates multiple features: semantic density, which is used to represent whether the dialogue information contains new core concepts, theories or methodologies; entity quantity, which is used to represent the number and importance of entities such as authors, literature, theories, and data mentioned in the dialogue information; task relevance, which is used to represent the closeness of the association between the dialogue information and the current core writing task. When the dialogue turns or the total token number of the cache queue reaches the preset warning upper limit, the memory system can preferentially trigger the dialogue information with the lowest cognitive value score in the cache queue to be eventized and cleaned up, ensuring that the L1 layer always retains the most valuable real-time interaction context and ensures response efficiency.

[0107] For the eventization processing of the historical dialogue information in the L1 layer to the L2 layer, a dynamic value evaluation and mixed triggering mechanism can be introduced instead of the traditional fixed threshold: the LLM in the main processing unit not only monitors the interaction in the L1 layer in real time, but also analyzes each round of interaction in real time through a dialogue complexity evaluation model. The model comprehensively considers features such as semantic density, task relevance, and introduction of new concepts to generate a cognitive value score. When the value scores of consecutive dialogues in the L1 layer accumulate to reach a dynamic threshold, naturally form an independent discourse closed loop, or the user issues an explicit instruction, the memory system can automatically trigger eventization refinement and storage to the L2 layer, and simultaneously clean up redundant context in the L1 layer to ensure response efficiency.

[0108] Through the embodiment, by flexibly setting the conditions that the historical dialogue information in the cache queue needs to be structured, the reliability of eventization processing can be ensured while the flexibility of eventization processing is improved, so that different application scenarios can be adapted.

[0109] In one example embodiment, the at least part of the historical dialogue information in the target cache queue is eventized to obtain a structured event to be stored, including: using a specified interaction model to extract information from the at least part of the historical dialogue information, and generating the structured event to be stored according to a target event structure based on the extracted event description information.

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

[0111] The target event structure can include event identification and event description information. In addition, the target event structure can also include at least one of the following: object identification, latest recall time, recall times, event elements, and related event information, in which the definitions of the various parts of the target event structure are the same as or similar to those in the foregoing embodiments, and have been described above and will not be repeated here.

[0112] Through the embodiment, the specified interaction model is used to extract information from at least part of the historical dialogue information, and the structured event is constructed according to the specific event structure, which can improve the accuracy of the construction of the structured event, and further improve the efficiency of the retrieval.

[0113] In one 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 the structured event having an association relationship with the corresponding structured event. The structured event to be stored can be generated by the specified interaction model. In addition to the event description information and the related event information, the structured event to be stored can include at least one of the following information: event identification, object identification, latest recall time, recall times, event elements, and the meanings of various types of information are the same as or similar to those in the foregoing embodiments, which have been described above and will not be repeated here.

[0114] In the embodiment, in order to improve the rationality of the pattern induction, the pattern induction can be performed on the event cluster having an association relationship. In order to improve the convenience of the structured event identification of the association relationship, when the structured event to be stored is stored in the second memory layer, based on the semantic similarity between the event description information, the structured event having an association relationship with the structured event to be stored can be identified from the structured events already stored in the second memory layer.

[0115] Correspondingly, the structured event to be stored is stored into the second memory layer, including: performing association identification on the structured event to be stored and the structured events already stored in the second memory layer based on semantic similarity of event description information of the structured event to be stored and event description information of the structured events already stored in the second memory layer; in a case where it is identified that the structured event to be stored and a first structured event already stored in the second memory layer are association events, updating related event information of the structured event to be stored and related event information of the first structured event, and storing the structured event to be stored into the second memory layer; in a case where it is identified that the structured event to be stored and a second structured event already stored in the second memory layer are repetitive events, updating the second structured event based on the structured event to be stored.

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

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

[0118] In the case where 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, if the structured event to be stored is stored as a new structured event, not only the storage resource will be wasted, but also the retrieval efficiency will be reduced. 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 is updated based on the event description information of the structured event to be stored.

[0119] Optionally, the semantic similarity of the event description information of the to-be-stored structured event and the event description information of the first structured event is greater than or equal to a first similarity threshold, and the semantic similarity of the event description information of the to-be-stored structured event and the event description information of the second structured event is greater than or equal to a second similarity threshold, the second similarity threshold being greater than the first similarity threshold. Here, the condition for the two structured events being the relevance event is that the semantic similarity of 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 the two structured events being the repetitive event is that the semantic similarity of the event description information of the two structured events is greater than or equal to the second similarity threshold.

[0120] For example, the new event (new structured event) to be stored needs to be associated and identified before being written into the L2 layer, and the relationship between the new and old events can be monitored by comparing the similarity of the abstract coding vectors and the key feature attributes. If the to-be-stored new event is associated with the old event (existing event, i.e., the stored structured event), the relevance update is performed, which can include recording the association relationship. The way to record the association relationship can be to note the association relationship and the unique identifier of the target event (i.e., the old event having the association relationship with the new event) in the new event. If it is a highly similar event or a repetitive event, only the old event can be updated without generating a new event, thereby realizing the deduplication and merging of data.

[0121] Through the embodiment, the relevance event and the repetitive event are identified based on the semantic similarity of the event description information of the structured event, the relevance between the structured events related to the association relationship is recorded, and the deduplication and merging of the structured events are performed, which can strengthen the organization and optimization of the structured events, avoid redundant storage, and improve the quality of the pattern induction.

[0122] In one exemplary embodiment, in order to improve the controllability and rationality of the pattern induction memory conversion of the structured events of the second memory layer to the third memory layer, a specific trigger condition, i.e., a second storage condition, can be preset, and the deposition from the structured event to the pattern induction memory is started in response to the second storage condition being met. The second storage condition can include, but is not limited to, at least one of the following: the system time reaches a specified period; the number of structured events under a dialogue topic reaches a first number threshold.

[0123] Here, the specified period can be a specified low peak period of a cloud server, and the specified period can be different for different types of cloud servers. For other types of execution devices, the specified period can be adjusted according to actual conditions. The first number threshold is a specified number threshold, which can be flexibly configured as needed.

[0124] For example, the memory system can periodically or cumulatively trigger the event clustering patternization induction process, perform pattern recognition and induction on the associated event clusters in the structural cognitive layer that have a correlation relationship, call a large language model for reasoning and summarization, generate a more highly abstract memory pattern induction result, and store the memory pattern induction result in the deep archiving layer, thereby ultimately realizing the transformation and solidification of instant information into long-term core knowledge.

[0125] Taking a programmed agent as an example, the patternization induction adopts a double-trigger mechanism to ensure the timeliness and effectiveness of code knowledge extraction: on the one hand, the mechanism automatically starts at a low peak period of the server to batch-induce the structured events (code events) added in the past 48 hours in the L2 layer; on the other hand, the mechanism triggers a special induction when the structured events of the same function module or the same error type in the L2 layer cumulatively exceed 10.

[0126] Taking a writing agent as an example, the patternization induction can adopt a triple-trigger mechanism to manage the induction process from the structured events in the L2 layer to the abstract knowledge in the L3 layer, the triple-trigger mechanism including an instant-trigger mechanism, a periodic-trigger mechanism, and a threshold-trigger mechanism. The instant-trigger mechanism means that the patternization induction is driven by high-frequency problems, and when the same type of logic or expression problem under the same topic occurs multiple times in a short period of time, a temporary correction scheme is automatically generated, and the correction scheme can be marked as a “to-be-verified” state. The periodic-trigger mechanism means that the patternization induction is automatically executed at a set low peak period to batch-process the newly added events, and the events are clustered according to the discussion topics or text structures to extract general organization patterns and expression frameworks. The threshold-trigger mechanism means that the patternization induction is triggered by a size condition, including that the cumulative number of the same type of discussion events of the same user reaches a certain number, or the cross-text reuse rate of a cluster reaches a certain threshold, at this time, the memory system generates a standardized discussion template and an optimization strategy, and can also update the preference label synchronously.

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

[0128] In this embodiment, in response to the second storage condition being met, at least part of the structured events in the second memory layer can be subjected to pattern induction to obtain a to-be-stored pattern induction memory, and the to-be-stored pattern induction memory can be stored in the third memory layer. Depending on the trigger mechanism adopted by the patternization induction, the at least part of the structured events can also be different. For example, the at least part of the structured events can be the structured events newly added in the second memory layer, the same type of structured events under the same topic, the same type of discussion structured events of the same user, or other structured events meeting other conditions, which are not limited in this embodiment.

[0129] By the above manner, the trigger condition of the pattern induction of the structured events in the second memory layer is configured, so that the agent can automatically start the pattern induction process at appropriate time and condition, the dynamic construction and update of the pattern memory can be realized, and the understanding and prediction ability of the agent to the user demand is improved.

[0130] Optionally, the structured events to be induced in the second memory layer can be different for different trigger conditions (i.e., the second storage condition). In this regard, the structured events to be induced in the second memory layer can be determined based on the satisfied trigger condition.

[0131] As an optional implementation, before the at least part of the structured events in the second memory layer are induced, the method further includes: in the case that the system time reaches a specified period, determining the structured events newly added in a historical period in the second memory layer as the at least part of the structured events.

[0132] In this embodiment, for the case that the satisfied second storage condition is that the system time reaches a specified period, the at least part of the structured events are the structured events newly added in a historical period in the second memory layer, and the historical period is earlier than the specified period. Correspondingly, in response to the system time reaching the specified period, the structured events newly added in the historical period before the specified period can be determined as the structured events to be induced in the second memory layer. Here, for the periodic trigger mechanism, the specified period can be regarded as the start period of a period, and the historical period refers to the previous update period of the update period in which the specified period is located.

[0133] For example, the update period is 2 days, the specified period is 0:00-1:00, and if today is the start of a new update period, the structured events newly added in the past two days are triggered at a time between 0:00-1:00 today to determine the structured events to be induced in the L2 layer.

[0134] As another optional implementation, before the at least part of the structured events in the second memory layer are induced, the method further includes: in the case that the number of the structured events under the target dialogue topic in the second memory layer reaches a first quantity threshold, determining the structured events under the target dialogue topic as the at least part of the structured events.

[0135] In this embodiment, for the case that the second storage condition is met, i.e., the number of structured events under the target dialogue topic reaches the first number threshold, at least part of the structured events are the 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 number threshold, the structured events under the target dialogue topic can be determined as the structured events to be subjected to pattern induction in the second memory layer. Here, for the instant triggering mechanism, a dialogue topic can be considered as a dialogue topic whose structured events are not subjected to pattern induction. For the case of continuous update of structured events in the same dialogue topic, the newly added structured events under the target dialogue topic can be determined as the structured events to be subjected to pattern induction in the second memory layer, and correspondingly, the same dialogue topic can correspond to one or more pattern induction memories. For the case that the same dialogue topic corresponds to one pattern induction memory, the information obtained by performing pattern induction on the newly added structured events under the target dialogue topic can be used to update the pattern induction memory corresponding to the dialogue topic. Alternatively, all the structured events under the target dialogue topic can be determined as the structured events to be subjected to pattern induction in the second memory layer. Correspondingly, the same dialogue topic can correspond to one pattern induction memory. After the new pattern induction memory is generated, the historical pattern induction memories can be deleted.

[0136] For example, the pattern induction employs a double triggering mechanism to ensure timeliness and effectiveness: on the one hand, it is automatically started at a low peak period of the server and is used to perform batch induction on the structured events added in the L2 layer in a certain set time in the past; on the other hand, it is triggered when the number of structured events under a certain topic in the L2 layer accumulates to exceed a preset threshold, and is used to perform induction and integration on the structured events under the topic.

[0137] Through this embodiment, by determining the structured events in a specific period as the structured events to be subjected to pattern induction, it can be ensured that the pattern induction is performed based on the latest structured events, a more accurate information basis is provided for the construction of the pattern induction memory, and the timeliness of the induction result is improved; by determining the structured events under a specific dialogue topic as the structured events to be subjected to pattern induction, it can be ensured that the pattern induction is performed based on structured events with high relevance, a more targeted information basis is provided for the construction of the pattern induction memory, and the practicality of the induction result is improved.

[0138] In an example embodiment, the pattern induction on the at least part of the structured events in the second memory layer obtains a pattern induction memory to be stored, including: extracting an associated event cluster from the at least part of the structured events according to the object identifier and the event element, inputting the event description information of the structured events in the associated event cluster into the specified interaction model to perform pattern induction on the event description information of the structured events in the associated event cluster by the specified interaction model, and obtaining a 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 the example embodiment, the pattern induction on the at least part of the structured events in the second memory layer can be performed by the specified interaction model. In order to improve the accuracy of the pattern induction, the associated event cluster can be extracted from the at least part of the structured events first. The associated event cluster can be determined based on the related event information of the structured events, or can be determined based on the object identifier and the event element, as long as the structured events in the extracted associated event cluster have the association.

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

[0141] The target memory structure can include a memory identifier, a memory type, and a memory content. In addition, the target memory structure can further include at least one of the following: an object identifier, a confidence degree, and a source event list. The definitions of each part of the target memory structure are the same as or similar to those in the foregoing embodiments, which have been described and will not be repeated here.

[0142] For example, the memory system can first retrieve the relevant event cluster (i.e., the associated event cluster) from the L2 layer according to the user identifier and the exclusive element attribute, submit the summary and key information (i.e., the event description information) of the structured events in the relevant event cluster to the LLM, and instruct it to perform induction reasoning to generate the abstracted knowledge and rule memory of the L3 layer. At the same time, record the event IDs of all the structured events in the L2 layer supporting the memory to ensure the traceability of the knowledge.

[0143] Taking a programming agent as an example, the memory system first retrieves the relevant event cluster from the L2 layer according to the user identifier and the code exclusive attribute, submits the core code segment, solution summary, and debugging log key information contained in the relevant event cluster to the LLM, and instructs it to induce the abstracted knowledge such as the general processing rules of 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, please follow the following requirements in your thinking: prioritize extracting valid event records with complete core attributes in events, eliminate invalid events with incomplete information and no clear technical direction, and ensure the accuracy of the induction basis; count the repeated technical choices, coding habits, and task processes in event clusters, locate persistent behavior characteristics, and mine high-frequency commonalities; write field content in the structure of "scene + behavior + constraint", avoid ambiguous statements, and ensure that the instructions can directly guide the subsequent behavior of the programming agent.

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

[0156] Through this embodiment, the interaction model is used to induce patterns from the event description information of structured events, 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 rigorous structure and rich content, and provide strong support for the deep cognition and decision-making of the agent.

[0157] In an example embodiment, in order to improve the retrieval efficiency of structured events and reduce the occupation of storage resources by structured events, the structured events in the second memory layer can be systematically scanned to perform archiving (i.e., soft deletion) operations on the structured events in the second memory layer, and the structured events in the second memory layer can also be subjected to forgetting (i.e., hard deletion) operations. The above-mentioned systematic scanning, archiving operations and forgetting operations can be performed by a memory deletion module in the memory architecture, which can be a separate program module independent of the program modules related to asynchronous memory storage. The conditions that the structured events to be subjected to archiving operations must satisfy, i.e., the first inhibition condition, include at least one of the following: the recall rate is less than a recall rate threshold, and the duration of not being accessed reaches a first time threshold. Here, the recall rate of a structured event can be the ratio of the number of recalls of the structured event to the total number of retrievals performed on the memory architecture.

[0158] Optionally, in the embodiment, the method further comprises: in the case that the third structured event in the second memory layer meets the first inhibition condition, marking the third structured event as a first inhibition state. The third structured event in the second memory layer is one structured event in the second memory layer, and the third structured event can be marked as the first inhibition state in response to the third structured event in the second memory layer meeting the first inhibition condition. The first inhibition condition comprises at least one of the following: the recall rate is less than a recall rate threshold, and the duration of not being accessed reaches a first time threshold. The first inhibition state is a state in which the corresponding structured event is prohibited from being retrieved, while being allowed to be reactivated in the case of backtracking. Here, by inhibiting the structured event with an extremely low recall rate, a long period of no access record, or both, the structured event is prevented from participating in retrieval matching, thereby improving the retrieval efficiency of the structured event. When deep backtracking is needed, the structured event can be reactivated to ensure the accuracy of the deep backtracking.

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

[0160] Optionally, in the embodiment, in the case that the second pattern induction memory in the third memory layer meets a second inhibition condition, the second pattern induction memory is marked as a second inhibition state. The second pattern induction memory in the third memory layer is one pattern induction memory in the third memory layer, and the second pattern induction memory can be marked as the second inhibition state in response to the second pattern induction memory in the third memory layer meeting the second inhibition condition. The second inhibition condition comprises: the confidence degree is less than a first confidence degree threshold. The second inhibition state is a state in which the corresponding pattern induction memory is prohibited from being retrieved, while being allowed to be reactivated in the case of backtracking. Here, by inhibiting the pattern induction memory with a confidence degree less than the first confidence degree threshold, the pattern induction memory is prevented from participating in retrieval matching, thereby improving the reliability of the retrieved pattern induction memory. When deep backtracking is needed, the pattern induction memory can be reactivated to ensure the accuracy of the deep backtracking.

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

[0162] For example, a dedicated memory deletion module can be set up to periodically perform systematic scanning on the memories in the L2 layer and the L3 layer (the memories in the L2 layer are structured events, and the memories in the L3 layer are pattern induction memories) to implement soft deletion (i.e., archiving) and hard deletion (i.e., forgetting) strategies: for structured events in the L2 layer with a very low recall rate and a long period of no access records, and for pattern induction memories in the L3 layer with a confidence level continuously below a preset threshold, the memory system performs soft deletion, first, marks them as archived (i.e., inhibited state, such as a first inhibited state, a second inhibited state), in which state the relevant memories are actively shielded and ignored in the regular retrieval process and no longer participate in retrieval matching, but can be reactivated when deep backtracking is needed; if such memories in the archived state remain inactive (i.e., inhibited state) for a longer period of time, the memory system performs hard deletion, performs physical deletion operations, completes the cleaning of redundant memories, and releases storage space.

[0163] Through this embodiment, the structured events in the second memory layer and the pattern induction memories in the third memory layer are subjected to memory inhibition and deletion mechanisms, by setting the inhibited state and the time threshold, memories with low access frequency and low confidence level can be placed in the inhibited state and timely hard deleted, the health status of the memory system can be maintained, and the interference of information overload and invalid memories is avoided.

[0164] In one example embodiment, the confidence level of the pattern induction memories in the third memory layer is used to represent the degree of reliability of the corresponding pattern induction memories. As the dialog information increases, the structured events also increase, and the confidence level of the pattern induction memories also changes as the structured events associated with them increase. In order to improve the degree of reliability of the confidence level of the pattern induction memories, while reducing the waste of computing resources caused by too high update frequency, the confidence level of the pattern induction memories associated with the structured events to be pattern induced can be updated in the process of pattern induction of the structured events in the second memory layer. Here, the association between the structured events and the pattern induction memories can be: the structured events support the pattern induction memories (positive association, the event description information of the structured events is consistent with the memory content of the pattern induction memories), the structured events conflict with the pattern induction memories (negative association, the event description information of the structured events is contrary to the memory content of the pattern induction memories).

[0165] As an optional implementation, in the process of pattern induction on the fourth structured event in the second memory layer, if it is determined that the fourth structured event supports the third pattern induction memory 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 induction memory is a pattern induction memory stored in the third memory layer. In the process of pattern induction on the fourth structured event, the relevance of the fourth structured event to each pattern induction memory stored in the third memory layer can be determined. If it is determined that the fourth structured event supports the third pattern induction memory stored in the third memory layer, the confidence of the third pattern induction memory can be increased, for example, the confidence of the third pattern induction memory is increased by a fixed value, or based on the relevance between the event description information of the fourth structured event and the memory content of the third pattern induction memory, the confidence of the third pattern induction memory is increased, wherein the higher the relevance, the greater the value of the increased confidence.

[0167] Optionally, considering that the fourth structured event supports the third pattern induction memory stored in the third memory layer, it can be regarded 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 to facilitate backtracking. Similar to the foregoing embodiment, 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 does not necessarily fully reflect the event description information of the fourth structured event, and 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, in the process of pattern induction on 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 stored in the third memory layer, the confidence of the fourth pattern induction memory is decreased.

[0169] The fifth structured event is a structured event in the second memory layer, and the fourth schema induction memory is a schema induction memory stored in the third memory layer. In the process of schema induction of the fifth structured event, the relevance of the fifth structured event to each schema induction memory stored in the third memory layer can be determined. If it is determined that the fifth structured event conflicts with the fourth schema induction memory stored in the third memory layer, the confidence of the fourth schema induction memory can be lowered, for example, the confidence of the fourth schema induction memory is lowered by a fixed value, or based on the relevance of the event description information of the fifth structured event to the memory content of the fourth schema induction memory, the confidence of the third schema induction memory is lowered, wherein the higher the relevance, the greater the value of the lowered confidence.

[0170] For example, if in the new induction process, the structured event of the L2 layer supports an existing schema induction memory in the L3 layer, the memory content of the supported schema induction memory can be perfected, the confidence of the supported schema induction memory is improved, and the new event identifier is included in the source event list of the supported schema induction memory to form a dynamic extension of the evidence chain. If the structured event of the L2 layer conflicts with an existing schema induction memory in the L3 layer, the confidence of the conflicting schema induction memory is lowered.

[0171] Taking a programming agent as an example, in terms of memory updating, for example, if the user successfully solves the problem using the same template again, the schema planning memory of the template in the L3 layer is supported, the memory system will supplement the edge case explanation, 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 lowered, and an exception explanation is added, and the conflict is reduced by 15 points.

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

[0173] Through the embodiment, by adding a schema memory updating and conflict processing process, when a structured event supporting an existing schema planning memory is detected, the confidence of the schema induction memory is enhanced, otherwise, the confidence of the schema induction memory is lowered, which can enhance the self-correction ability of the memory system and ensure the accuracy and applicability of the schema memory.

[0174] In an example embodiment, after the confidence of the fourth mode induction memory is adjusted, the method further comprises: in the case that the confidence of the fourth mode induction memory after adjustment is less than the second confidence threshold, performing mode induction on a set of conflict structured events that conflict with the fourth mode induction memory, to obtain a fifth mode induction memory that competes with the fourth mode induction memory.

[0175] If the confidence of the fourth mode induction memory after adjustment is less than the second confidence threshold, it indicates that the fourth mode induction memory has a low degree of credibility, and correspondingly, the structured events that conflict with it have a high degree of credibility. Therefore, mode induction can be performed on a set of conflict structured events that conflict with the fourth mode induction memory, and the obtained fifth mode induction memory is a mode induction memory that competes with the fourth mode induction memory.

[0176] For example, when the conflict between the structured events and the mode induction memory continues to accumulate and the confidence of the mode induction memory is lower than the critical threshold, a temporary mode induction can be triggered to generate a new memory with an initial low confidence that competes with it. Through the parallel survival of double-track memory, self-calibration and evolutionary adaptation of the deep induction layer knowledge system are realized.

[0177] Taking a programmed agent as an example, when the confidence is lower than 30, a temporary induction is automatically triggered to generate a competitive memory (with an initial confidence of 50), and through the parallel survival of double-track memory, self-calibration of the code knowledge system is realized.

[0178] Taking a writing agent as an example, when the confidence falls below a certain threshold, 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 styles or specifications.

[0179] Through this embodiment, when the confidence of the mode induction memory is lower than a certain threshold, competitive induction is started to re-evaluate or generate a new mode induction memory, which ensures that the memory system can adjust itself when receiving new information, avoids the solidification of false memories, and promotes the healthy evolution of the knowledge system and the continuous growth of the intelligent agent.

[0180] The memory processing method based on intelligent agents in the embodiments of the present application will be explained and described below in combination with optional examples. In this optional example, the specified interaction model is LLM, the first memory layer is the immediate interaction layer (L1 layer), the second memory layer is the structural cognitive layer (L2 layer), and the third memory layer is the deep archiving layer (L3 layer).

[0181] In this optional example, the human-based memory mechanism divides the memory system into three interrelated but well-defined levels, 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 the memory architecture, an asynchronous memory storage flow from top to bottom can be adopted. This flow is the process of memory evolution (i.e., memory storage and updating), which runs continuously or periodically in the background. Through timing tasks and event triggering mechanisms, dynamic memory storage and updating are achieved, allowing the memory of the intelligent agent to evolve continuously with user interaction.

[0182] As shown in Figure 5 , L1 layer as a short-term memory buffer for high-frequency read and write, stores the content of the immediate context window (such as recent conversations and task records), follows the FIFO queue structure, and ensures the fluency and coherence of the conversation; L2 layer as a medium and long-term memory, converts the unstructured conversation of L1 layer into structured events, deposits key facts and scenario information, and is responsible for the traceability of events. Structured events can include information such as unique identifier, user identifier, timestamp, recall times, event summary, encoding vector, exclusive element attribute, related events, etc.; L3 layer as a long-term core memory, through induction and reasoning on a large number of structured events in L2 layer, abstract knowledge (core knowledge) such as user preferences, behavior patterns, knowledge rules and task strategies with universality is extracted, and is responsible for the depth and consistency of the intelligent agent behavior. The core knowledge stored in the core knowledge base in L3 layer is pattern induction memory, including information such as unique identifier, type, content, confidence, source event, etc.

[0183] In this optional example, the memory retrieval of the memory system can adopt an adaptive dynamic coordination mechanism: when the user request only needs short-term memory support, the memory system can directly rely on the immediate context to complete the processing; when the demand involves long-term memory, a synchronous memory retrieval flow from bottom to top is automatically triggered. The asynchronous memory storage flow from top to bottom can include the updating and cleaning process of L1 layer, the eventization process from L1 layer to L2 layer, and the patternization induction process from L2 layer to L3 layer. Each process is described below.

[0184] For the updating and cleaning of L1 layer, after each new interaction ends, the memory management module can automatically add the complete information of the conversation of this round to the cache queue of L1 layer. When the L1 layer resource occupancy reaches the set standard (for example, the conversation round stored in the cache queue reaches M rounds or the token occupies the cache space more than the warning upper limit percentage), the memory system can automatically trigger the eventization processing of the earliest interaction record and the cleaning of the original information, avoiding the accumulation of memory affecting the high-frequency read and write efficiency of L1 layer.

[0185] The eventization process from the L1 layer to the L2 layer refers to extracting unstructured conversations into structured events containing unique identifiers, user identifiers, timestamps, recall times, event summaries and their encoding vectors, exclusive element attributes, related events, and other metadata and key-value pairs using the LLM. This can achieve ordered storage of conversation information, significantly reduce subsequent retrieval costs, and lay the foundation for deep memory processing.

[0186] For supplements or corrections of the same core content, the memory system can create a new event card with version association and link it with the old version event through internal pointers, thereby preserving the complete evolution context while ensuring that the latest and most accurate memory content is presented first during retrieval.

[0187] The patterned induction process from the L2 layer to the L3 layer refers to triggering the LLM to induce and reason related event clusters in the L2 layer through certain triggering mechanisms, generating deep knowledge in the L3 layer, which can achieve ordered storage of conversation information, significantly reduce subsequent retrieval costs, and lay the foundation for deep memory processing.

[0188] The triggering condition of the eventization process from the L1 layer to the L2 layer can be that the interaction record (i.e., historical conversation information) reaches an independent task closed loop, or the resource occupation reaches a set threshold standard. Here, the L1 layer has a certain cache space threshold, which by default retains the last M rounds of original conversations, where M is a dynamically adjustable parameter that can be flexibly configured according to the implementation scene requirements to set the upper limit of the number of rounds of memory retention. The information access speed of this layer is the fastest, but the capacity is limited and easy to be overwritten by new information. In the eventization process from the L1 layer to the L2 layer, the LLM can be responsible for extracting event summaries and their encoding vectors, refining key element attribute information, etc., and the structured event can be a structured format key-value pair that stores event summaries and other event content.

[0189] The triggering condition of the patterned induction process from the L2 layer to the L3 layer can be that the number of theme events (structured events under the same theme) exceeds the preset threshold, or that the low peak automatically starts. The L2 layer provides more refined and valuable cognitive information than the original conversation history for the agent, ensuring the traceability of events, while the L3 layer can provide relevant deep memory for the agent when a new request arrives and the agent needs to reflect deeply or handle complex and abstract problems, ensuring the depth and consistency of the agent's behavior.

[0190] The memory in the memory system in the related art is static and fixed, lacking dynamic evolution and forgetting mechanisms. The memory library is a static archive, and outdated or even incorrect information is permanently stored and may be incorrectly recalled in subsequent interactions, leading to outdated or contradictory behavior of the agent. The memory system lacks 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, having active cognitive induction ability, and being capable of dynamic evolution and self-correction. The memory architecture is a multi-level, dynamic long-term memory architecture. In the three-layer memory architecture, a memory updating module and a memory deleting module can be included. The memory updating module and the memory deleting module can be independent of and asynchronous with the memory storage flow. The memory updating module can repeatedly monitor and update the structured events in the L2 layer. Repeated monitoring refers to monitoring repetitive events, and associated updating refers to identifying associated events and updating the event content of the associated events. The memory deleting module can periodically perform systematic scanning of the memories in the L2 layer and the L3 layer to execute soft deletion and hard deletion strategies.

[0192] It should be noted that the memory processing method based on the agent in this optional example is developed around the 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 knowledge graph to store knowledge and associated logic in the form of "entity node-relation node-edge structure", retain necessary metadata, and add knowledge granularity tags and association weights. The evidence chain edge is used to associate events to achieve traceability. The structured events stored in the structured cognitive layer can be set as a lightweight event graph to store basic metadata in event nodes and add type tags and core entity sets. The edge structure is used to replace the related_events field to record event association, and the associated type of the L3 layer knowledge is marked through the mapping edge. Through the optimization of the storage form, the efficiency of knowledge organization and interaction can be improved.

[0193] Optionally, the triggering condition of event processing and pattern induction can be associated with the triggering threshold calculated in real time by a dialogue complexity evaluation model. The dialogue complexity evaluation model can dynamically calculate the triggering threshold by combining features such as semantic density, entity quantity, and task relevance. The processing flow is started when the cognitive value score of the interaction information reaches the dynamic threshold (i.e., the dynamically calculated triggering threshold). Alternatively, a hybrid triggering mode can be used to integrate user explicit instructions, system implicit judgments, and periodic scheduling to form a multi-dimensional triggering system. Through intelligent adjustment of the triggering condition, the timeliness and effectiveness of memory deposition can be maintained.

[0194] Through this optional example, on the basis of the three-layer heterogeneous memory architecture, the top-down asynchronous memory storage flow is used to complete the step-by-step deposition of information. The LLM is used to extract unstructured dialogues into structured events. The LLM is triggered by a certain triggering mechanism to induce and reason related event clusters in the L2 layer, and generate deep knowledge in the L3 layer. This can realize the ordered storage of dialogue information, greatly reduce the subsequent retrieval cost, and lay the foundation for deep memory processing.

[0195] In an example embodiment, for the memory retrieval process, a bottom-up synchronous memory retrieval flow (i.e., a synchronous bottom-up processing flow) can be employed to build comprehensive and accurate context information for generating a new response. For the current round of dialogue input information, memory retrieval can be performed in the order of the third memory layer, the second memory layer, and the first memory layer, and relevant memories are retrieved step by step.

[0196] For example, when a new input request initiated by a user through a terminal device requires long-term memory, a bottom-up synchronous memory retrieval flow (i.e., a bottom-up retrieval flow) is triggered to locate key information layer by layer from long-term abstract experience to immediate interaction scenarios. The new input request can be a new programming requirement that needs to rely on historical memory, such as code writing, bug debugging, and tool invocation request. The terminal device can convert the original input into standardized data and transmit it to the server. The memory management module retrieves in the order of L3 layer, L2 layer, and L1 layer, obtains core knowledge from the L3 layer, filters relevant events from the L2 layer, and extracts immediate dialogue from the L1 layer, and relevant memories are retrieved step by step.

[0197] In the embodiment, retrieving target storage 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 matching the current round of dialogue input information from the pattern induction memories of the third memory layer; based on the current round of dialogue input information and the first pattern induction memory, retrieving a group of target structured events from the structured events of the second memory layer; and extracting a group of historical dialogue information from the first memory layer.

[0198] For the current round of dialogue input information, a first pattern induction memory matching the current round of dialogue input information can be retrieved from the pattern induction memories of the three memory layers. The object identifier of the target interactive object and the dialogue topic to which the current round of dialogue input information belongs can be used to retrieve the pattern induction memory, so as to accurately locate the core knowledge strongly associated with the target interactive object and the current task, set the cognitive basis and overall tone for subsequent responses, define the overall direction and constraint rules for the intelligent agent to output answers and perform tasks, and avoid responses that conflict with general rules and long-term characteristics.

[0199] For example, the L3 layer, as the core layer for storing abstract knowledge and user long-term patterns and general rules, the key is to accurately locate the core knowledge strongly associated with the current user and the current task. When a new request arrives, the intelligent agent can reflect deeply or handle complex and abstract problems, and relevant deep memories can be called from the L3 layer to ensure the depth and consistency of the intelligent agent behavior. After the memory system receives a user input request, if it needs to call long-term memory in the memory library, a bottom-up synchronous memory retrieval mechanism can be triggered, and first, the core knowledge and patterns related to the user or the topic are retrieved from the L3 layer to establish the overall tone and constraints of the response.

[0200] At the initial start of retrieval, the memory management module can retrieve relevant abstract inductive memories in the L3 layer according to the current user identification or the topic of the dialogue, such as retrieving user portraits, long-term preferences, formed rules, etc. The knowledge in the L3 layer has the highest priority, which is used to set the cognitive benchmark and overall tone of the subsequent response, define the overall direction and constraint rules of the intelligent agent output answer and task execution, and avoid responses that conflict with general rules and long-term characteristics.

[0201] Based on the current round of dialogue input information and the first mode 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 of target structured events is associated with the first mode inductive memory, such as belonging to the source events of the first mode inductive memory, i.e., the structured events obtained by inductive mode of the first mode inductive memory can be selected from the structured event set represented by the source event list of the first mode inductive memory. And each target structured event is associated with the current round of dialogue input information, where the association can be determined based on the semantic similarity of event description information and the current round of dialogue input information, or based on other information, which is not limited in the present embodiment.

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

[0203] In order to ensure the accuracy of the recall count (recall_count) and the latest recall time (timestamp), the structured events in the second memory layer have the dynamic updating feature, when a structured event is recalled as a reference by subsequent retrieval, its recall count and latest recall time will be automatically updated.

[0204] For example, the L2 layer is equipped with an update mechanism of the corresponding layer memory to ensure the timeliness of the stored memory, when a structured event in the L2 layer is successfully retrieved and a prompt word is generated in the bottom-up synchronous memory retrieval flow, its recall count recall_count is automatically incremented by 1, and the timestamp is updated to the current latest memory recall time.

[0205] Taking a programmed agent as an example, the L2 layer simultaneously adapts the update mechanism of the layer memory. When an L2 event is successfully called in subsequent retrieval, its recall count is automatically increased by 1, and the timestamp is updated to the latest memory recall time. If there is a supplement or correction to the same code problem subsequently, the content summary and attributes of the corresponding event are updated, rather than creating a new card, ensuring the consistency and timeliness of the memory.

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

[0207] It should be noted that, for the case of retrieving historical dialogue information in the first memory layer and retrieving structured events from the second memory layer, historical dialogue information can also be retrieved from the first memory layer first, or memories can be retrieved from the first memory layer and other memory layers simultaneously.

[0208] The aforementioned target storage information can include at least one of the following: a set of historical dialogue information, a first mode induction memory (which can be the memory content therein), and a set of target structured events (which can be event description information therein). For example, the target storage information includes a set of historical dialogue information, for another example, the target storage information includes a set of historical dialogue information and a set of target structured events, and for another example, the target storage information can include a set of historical dialogue information, a first mode induction memory, and a set of target structured events.

[0209] For example, all information retrieved from the three-layer memory architecture can be assembled with the user's new input into a structured prompt and submitted to the LMM core module to generate the final response. When assembling the Prompt and generating the response, the Prompt assembly module can integrate the core knowledge of the L3 layer, the relevant events of the L2 layer, the immediate context of the L1 layer, and the user's new input into a structured Prompt according to a preset template. The constructed Prompt can be submitted to the LLM core module to generate a response, and the response result is processed by the cloud server and transmitted to the terminal device, completing an interaction.

[0210] Taking a programmed agent as an example, three layers of memories can be aggregated to form a task-adaptive retrieval result: the general abstract experience of the L3 layer, the project-level event of the L2 layer, and the real-time scene information of the L1 layer are aggregated according to the logic of “cross-project rule → specific project experience → real-time operation detail” to form a complete memory support. The memory management module can integrate the information obtained from the three layers of memories 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] Through this optional example, a bottom-up synchronous memory retrieval flow is used for memory retrieval, which can comprehensively use real-time dialogue, pattern induction memory, and structured events to build a comprehensive context, ensuring that the response output by the interactive model is not only based on the immediate input, but also considers long-term memory and personal preferences, enhancing the depth and personalization of the interaction and improving the comprehensiveness of the retrieval and the accuracy of the response.

[0212] In an example embodiment, pattern induction memories can be retrieved from the third memory layer according to at least one of the object identifier and the dialogue topic. Optionally, the first pattern induction memory matching the current round of dialogue input information is retrieved from the pattern induction memories of the third memory layer, including: retrieving the first pattern induction memory matching the current round of dialogue input information from the pattern induction memories of the third memory layer according to the object identifier of the target interactive object and the dialogue topic of the current interactive dialogue.

[0213] There can be multiple patterned induction memories corresponding to the target interactive object. If all patterned induction memories corresponding to the target interactive object are retrieved, not only will the retrieval speed be reduced (the number of structured events to be retrieved is too large), but also the accuracy of the retrieval will be reduced. In this embodiment, pattern induction memory retrieval is performed according to the object identifier of the target interactive object and the dialogue topic of the current interactive dialogue, which can reduce the number of retrieved pattern induction memories and improve the relevance of the retrieved pattern induction memories to the current round of dialogue input information.

[0214] Optionally, one pattern induction memory of the third memory layer is used to describe at least one of the following: the object image of the belonging interactive object, the object behavior pattern of the belonging interactive object, the knowledge rule of the belonging interactive object, and the task processing scheme (i.e., task strategy) of the belonging interactive object for completing a processing task under an object topic. By setting a memory type set, the event description information of the structured event is induced by the specified interactive model, a corresponding memory type is selected from the memory type set, and the memory content, i.e., the memory description corresponding to the selected memory type, is induced.

[0215] For example, for a programming agent, according to the user ID and the current programming task type, the general-purpose knowledge can be preferentially retrieved in the L3 layer, which can include at least one of the following: a general solution library corresponding to the technical field, a user long-term programming paradigm, a cross-project reusable code template, and an experience boundary and general methodology for the current task.

[0216] Through this optional example, by matching the object identification and the dialogue topic, the most relevant core memory can be located, and irrelevant or mismatched memories are avoided to interfere with the response, thereby improving the accuracy of pattern memory retrieval and the relevance of the response.

[0217] In an example embodiment, based on the current round of dialogue input information and the first mode induction memory, a set of target structured events is retrieved from the structured events of the second memory layer, including: filtering the structured events associated with the first mode induction memory from the structured events of the second memory layer 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 set of associated structured events, a set of candidate structured events is filtered from the set of associated structured events; and according to the event weight of each candidate structured event in the set of candidate structured events, a set of target structured events is selected from the set of candidate structured events.

[0218] In order to improve the efficiency of structured event retrieval, the set of associated structured events can be first filtered from the structured events of the second memory layer. The way to filter the set of associated structured events can be performed according to the source event list of the first mode induction memory.

[0219] For the set of filtered associated structured events, a set of candidate structured events can be filtered from the set of associated structured events based on the semantic similarity between the event description information of each associated structured event in the set of associated structured events and the current round of dialogue input information. The semantic similarity between the event description information of each associated structured event and the current round of dialogue input information can be calculated by a network model with natural language understanding function. In order to improve the efficiency of retrieval, the cosine similarity between the encoding vector of the current round of dialogue input information and the encoding vector of each associated structured event (i.e., the encoding vector obtained by vectorizing the event description information of each associated structured event) can be used as the semantic similarity between the event description information of each associated structured event and the current round of dialogue input information.

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

[0221] Filtering the set of candidate structured events from the set of associated structured events can be performed based on a set number threshold or based on a set similarity threshold. As an optional implementation, K associated structured events can be filtered from the set of associated structured events in descending order of semantic similarity between the current round of dialogue input information and event description information of each associated structured event to obtain the set of candidate structured events, K being a positive integer greater than or equal to 1. As another optional implementation, the set of candidate structured events can be obtained by filtering, from the set of associated structured events, associated structured events whose semantic similarity with the current round of dialogue input information is greater than or equal to a third similarity threshold.

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

[0223] Selecting the set of target structured events from the set of candidate structured events can be performed based on a set number threshold or based on a set event weight threshold. As an optional implementation, L candidate structured events can be selected from the set of candidate structured events in descending order of event weight of each candidate structured event to obtain the set of target structured events, L being a positive integer greater than or equal to 1. If the candidate structured events and the target structured events are both performed based on the set number threshold, K≥L. As another optional implementation, the set of target structured events can be obtained by selecting, from the set of candidate structured events, candidate structured events whose event weight is greater than or equal to an event weight threshold.

[0224] For example, when retrieving a relevant event from the L2 layer, a coding module can be called to vectorize the standardized text of the user's new input request, perform semantic matching on the extracted structured events through vector cosine similarity, and preliminarily screen out the Top-K candidate structured events with the highest similarity. The candidate event set is scored and ranked in two dimensions, and the score is based on the memory activity level and importance. The memory system can select the Top-L structured events with the highest scores as the final event evidence according to the final score. Among them, K and L values are configurable hyperparameters to flexibly adapt to the retrieval accuracy and breadth requirements in different scenarios.

[0225] For a programmed agent, the general knowledge retrieved by the L3 layer can be vectorized, and the Top-10 (K=10) events with the highest similarity are selected as the re-screening list in the programming event card of the L2 layer. Then, the Top-5 (L=5) structured events of the same type are selected by combining the programming scene-specific dimension weighted score, so as to realize the anchoring of general knowledge to specific project scenarios.

[0226] Through the embodiment, the information subset highly related to the current task is quickly located from a large number of structured events by combining semantic similarity, event weight and multi-dimensional evaluation, which guarantees the efficiency and pertinence of the retrieval process, and realizes fine matching and efficient retrieval of target events.

[0227] In an example 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 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 referred to as 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 in the set of candidate structured events, the above method further includes: determining the weighted sum of 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 as the event weight of each candidate structured event.

[0229] To improve the efficiency of the retrieval, the event weight of a structured event can be calculated by a weighted sum, i.e., 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 are weighted and summed according to a first weight coefficient of the activity parameter and a second weight coefficient of the importance parameter, and the obtained weighted sum is determined as the event weight of each candidate structured event. The first weight coefficient and the second weight coefficient can be fixed values or dynamically adjusted according to historical retrieval results, which is not limited in the embodiment.

[0230] For example, the candidate event set can be scored and ranked in a dual-dimension manner according to a recency score and an importance score. The recency score R is determined according to the latest recall timestamp of the structured event, and the score is higher when the time is closer; the importance score I is calculated according to the recall count of the structured event, and the score is higher when the count is higher. The dual-dimension is fused by a configurable comprehensive weighted score model to calculate the final comprehensive score S, and the formula is: S = aR + bI; wherein a and b are the respective weight proportions, and the default balanced consideration is 0.5, i.e., the recency and the importance have the same weight.

[0231] Through the embodiment, by taking the weighted sum of the activity parameter and the importance parameter as the event weight, the rationality of evaluating the event value can be improved, the events with recency and importance are given priority, and the retrieval efficiency and the result quality can be improved.

[0232] In an example embodiment, the parameter value of the activity parameter can be set according to the time when the corresponding structured event is last retrieved and recalled (i.e., the latest recall time mentioned above). Correspondingly, the method further includes: determining the parameter value of the activity parameter corresponding to each candidate structured event according to the time difference corresponding to each candidate structured event.

[0233] ​​In this embodiment, for each candidate structured event, a time difference corresponding to each candidate structured event can be determined first, the time difference corresponding to each candidate structured event being a time difference between a current time and a latest recall time of each candidate structured event, the latest recall time of each candidate structured event being a time when each candidate structured event is last recalled due to retrieval; then, according to the time difference corresponding to each candidate structured event, a parameter value of an activity parameter corresponding to each candidate structured event is determined, the parameter value of the activity parameter corresponding to each candidate structured event being negatively correlated with the time difference corresponding to the candidate structured event. Optionally, the latest recall time of each candidate structured event can be taken as an input, and a parameter value of an activity parameter corresponding to each candidate structured event can be directly calculated using an activity calculation model.

[0234] The parameter value of the activity parameter corresponding to each candidate structured event and the time difference corresponding to the candidate structured event can be negatively correlated in various ways, for example, the two can be exponentially negatively correlated, or can be non-exponentially negatively correlated, which is not limited in this embodiment.

[0235] For example, the recency score uses an exponential decay function, R = e -λ(current_time-timestamp) wherein timestamp is the latest recall timestamp, current_time is the current time, and λ is a decay coefficient, λ can control the speed of score decay over time, and λ is taken in (0, 1), the greater λ is, the more obvious the score advantage of recent events is.

[0236] Optionally, an adaptive weight model can be used instead of a fixed balanced weight distribution, and the weight parameters α and β of recency and importance are dynamically optimized according to historical retrieval effects by a reinforcement learning algorithm, so that the scoring model S = α R+β I has the ability of scene self-adaptation.

[0237] Through this embodiment, the time difference is taken as a measure of activity, so that the agent can give higher weight to more recent structured events, thereby reflecting the influence of the freshness of information on decision-making, promoting the self-updating of the memory system, and maintaining the timeliness and relevance of the memory.

[0238] In one exemplary embodiment, the activity parameter corresponding to each structured event can be determined in various ways, for example, according to the number of times the corresponding structured event is recalled (i.e., the aforementioned recall times), or according to the number of times the corresponding structured event is recalled and the storage time of the corresponding structured event, or according to other information.

[0239] As an optional implementation, the method further comprises: determining the parameter value of the importance parameter corresponding to each candidate structured event according to the recall number of each candidate structured event and the maximum recall number.

[0240] Here, the recall number of each candidate structured event is the number of times each candidate structured event is recalled due to retrieval, and the maximum recall number is the maximum value of the recall numbers of the candidate structured events in the group of candidate structured events. The parameter value of the importance parameter corresponding to each candidate structured event is positively correlated with the recall number of each candidate structured event and negatively correlated with the maximum recall number. Here, relative to determining the parameter value of the importance parameter corresponding to each candidate structured event according to the recall number of each candidate structured event and the time difference corresponding to each candidate structured event, or determining the parameter value of the importance parameter corresponding to each candidate structured event only according to the recall number of each candidate structured event, the ability of the parameter value of the importance parameter to represent the relative importance between structured events can be improved, and the accuracy of structured event screening can be improved.

[0241] For example, the importance score of a structured event can use a square root function I = √recall_count / √max(recall_count), where max(recall_count) is the maximum recall number of events in the preliminary screening list, to ensure that the score increases smoothly with the recall number.

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

[0243] In this embodiment, the importance of a structured event can be predicted through a multi-dimensional feature. The multi-dimensional feature corresponding to each candidate structured event includes at least one of the following: the semantic similarity between each candidate structured event and the current round of dialogue input information, the object feature of the target interactive object, the task type of the processing task corresponding to each candidate structured event, and other features that can represent the importance of each candidate structured event. In this case, the parameter value of the importance parameter corresponding to each candidate structured event can be predicted based on the multi-dimensional feature corresponding to each candidate structured event, to obtain the predicted parameter value of the importance parameter corresponding to each candidate structured event.

[0244] The parameter value of the importance parameter corresponding to each candidate structured event can be obtained by weighting and summing the feature values of each dimension feature corresponding to each candidate structured event, or can be obtained by using a deep neural network model to fuse the multi-dimensional features corresponding to each candidate structured event, and outputting the parameter value of the importance parameter of each candidate structured event predicted by the deep neural network model.

[0245] For example, a deep neural network model (for example, a memory correlation predictor based on Transformer) can be introduced, which fuses the multi-dimensional features such as event content similarity, user preference features, task types, and directly outputs the memory importance score, which can improve the retrieval accuracy.

[0246] According to the embodiment, the parameter value of the importance parameter of the corresponding structured event is determined based on the number of recalls of the structured event and the maximum number of recalls, or the parameter value of the importance parameter of the corresponding structured event is predicted based on the multi-dimensional features corresponding to the structured event, so that the agent can identify the structured event that is frequently used or has strong relevance in a specific context, and the flexibility and pertinence of memory retrieval are ensured.

[0247] In an example embodiment, the manner of extracting a set of historical dialogue information from the first memory layer can be various, and can include 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; 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 selected from the first memory layer according to the event description information in the set of target structured events retrieved in the second memory layer. The semantic similarity between each selected historical dialogue information and the event structured information of at least one target structured event reaches a set similarity threshold. In addition, the selection of historical dialogue information can also be based on the round difference between the current round of dialogue input information, for example, only selecting historical dialogue information in the last few rounds, and for example, adjusting the semantic similarity between the historical dialogue information and the event structured information of the target structured event based on the round difference between the historical dialogue information and the current round of dialogue input information. The greater the round difference between the historical dialogue information and the current round of dialogue input information, the greater the degree of adjustment of the semantic similarity between the historical dialogue information and the event structured information of the target structured event.

[0249] For example, for a programmed agent, the relevant raw interaction data of the last few rounds can be accurately extracted in the L1 layer according to the key information in the structured event retrieved in the L2 layer, which can include the code fragment being debugged, the real-time error stack, the executed tool call record, and the immediate scene details supplementing the current task, to ensure that the retrieval results are consistent with the real-time operation.

[0250] As another optional implementation, the last P rounds of dialogue information before the current round of dialogue input information can be extracted from the historical dialogue information in the first memory layer to obtain a set of historical dialogue information, and P is a positive integer greater than or equal to 1. P can be a fixed value, or 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 greater the value of P.

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

[0252] Through this embodiment, by selecting historical dialogue information or directly selecting the last few rounds of dialogue information according to the relevance to the target structured event, necessary background materials can be quickly obtained in the retrieval process, laying a foundation for constructing complete prompt words, ensuring the completeness and relevance of the immediate context, and further improving the accuracy and coherence of the response.

[0253] The intelligent agent-based memory processing method in the embodiments of the present application will be explained and described below in conjunction with optional examples. In this optional example, the specified interaction model is LLM, the first memory layer is the immediate interaction layer (L1 layer), the second memory layer is the structure cognition layer (L2 layer), and the third memory layer is the deep archiving layer (L3 layer).

[0254] In this optional example, based on the three-layer memory architecture, a bottom-up synchronous memory retrieval flow can be adopted, which 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), which can work with the three-layer memory architecture to cooperate with the memory dynamic updating mechanism so that the agent can precipitate structured events from the original interaction and induce deep knowledge from them, and finally realize the dynamic evolution and precise calling of memory, so that the agent memory system becomes an organism that can self-correct and continuously learn, thereby significantly improving the performance of the agent 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, a writing agent based on the bidirectional collaborative memory hierarchical architecture.

[0255] An agent memory management scheme based on a bidirectional collaborative memory hierarchical architecture is provided in this optional example, which can be used for memory management of large language model driven agents, so that the agent can build a stable, deep and dynamic user model, not only retaining core preferences but also updating demand changes, thereby maintaining consistency in long-term interactions and providing personalized services that highly fit long-term needs of users, avoiding the disconnection problem of generalized responses, and improving the personalization and consistency of long-term interactions.

[0256] The agent memory management scheme based on the bidirectional collaborative memory hierarchical architecture can include memory storage, memory retrieval and memory updating, wherein the memory storage can adopt the aforementioned top-down asynchronous memory storage flow, the memory retrieval can adopt the bottom-up synchronous memory retrieval flow, and the memory updating can be a dynamic evolution mechanism throughout the memory storage and memory retrieval process, which realizes the precision and efficiency of the memory system through the cooperation of multi-dimensional updating strategy and active forgetting mechanism. When retrieving, the recall times and the latest access timestamp of any successfully called memory of the structured cognitive layer will be updated, which will directly affect the priority of its future retrieval. In the storage process of information gradually precipitating, the structured cognitive layer performs correlation identification of new and old events and synchronously records the correlation between events, and in addition, new events will strengthen or correct existing deep memories according to their content. The memory system also has an active forgetting module, which scans the memory data in the structured cognitive layer and the deep archiving layer according to the preset, and soft archives or hard deletes the memories that have not been accessed for a long time, are low in importance, or have a continuously insufficient confidence, to ensure that the entire memory system can metabolize and remain efficient and accurate.

[0257] The memory system in this optional example is a dynamic evolving memory system. By introducing recall count, association, confidence score and forgetting mechanism, the memory system can dynamically adjust according to new interactions, strengthen important memories, correct outdated information and forget irrelevant content, so that the agent can grow together with the user and enhance the adaptability of the agent.

[0258] For the memory retrieval process, in response to the user's request for long-term memory, the retrieval order is from abstract to specific, that is, "L3 layer setting strategy framework→L2 layer providing case events→L1 layer keeping instant details". First, the core cognition is obtained from the L3 layer, then the relevant factual basis is searched from the L2 layer, and finally the instant context window content of the L1 layer is combined to construct a high-quality prompt word with clear hierarchy and prominent key points, so as to ensure that the response has strategic correctness, factual support and scene adaptability, and efficiently outputs high-quality prompt words.

[0259] Exemplarily, as shown in Figure 6 , the user can initiate a new request through the terminal device, and the memory system will vectorize the user's new request, retrieve core knowledge from the L3 layer (i.e., pattern induction memory), and the core knowledge in the L3 layer has the highest priority compared to other layers. Then, the memory system retrieves relevant events from the L2 layer. Then, the instant context is obtained from the L1 layer. Finally, the memory system assembles all the information retrieved from the three-layer memory architecture together with the user's new request into a structured prompt word, submits it to the LMM core module, and generates the final response.

[0260] Here, the retrieval performed by the memory system at the structural cognition layer is a hybrid retrieval that considers vector similarity and weighs the recency (timestamp) and importance (recall count) of events to score and filter out the most relevant historical structured events as evidence. The memory system can extract the structured events indicated by the source event list of the retrieved core knowledge from the L2 layer, and perform semantic matching based on vector similarity to filter out the Top-K structured events with the highest semantic similarity to the new request from the structured events indicated by the source event list of the retrieved core knowledge, to obtain a candidate event set. The memory system performs double-dimensional weighted scoring and sorting on the candidate event set, and the scoring is based on the recency and importance of the memory. The candidate structured events in the candidate event set are sorted according to the weighted score of the recency and importance, and the Top-L candidate structured events with the highest score are selected as the final event evidence. The formula for calculating the final comprehensive score S of the double-dimensional weighted scoring model is: S = a R + β I.

[0261] Through the optional example, the memory of the intelligent agent is stored, retrieved, updated and optimized, the effective integration from the immediate context to the long-term experience is realized through the three-layer heterogeneous memory architecture and the bidirectional collaborative memory flow, the layered management, the active induction and the dynamic evolution of the intelligent agent memory are realized, the efficient processing of complex tasks is supported, the stability of the memory system is maintained through the asynchronous processing, the layered isolation and the dynamic triggering of the memory storage, the organization, the refining and the dynamic evolution problem of the intelligent agent memory is solved, and the context consistency and the coherence of the long-term interaction of the intelligent agent, the individual service ability level and the cognitive depth and decision intelligence are improved.

[0262] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be realized by means of software and the necessary general hardware platform, of course, it can also be realized by hardware, but in many cases, the former is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes a plurality of instructions for causing a terminal device (which can be a mobile phone, computer, server, or network device) to execute the methods described in the embodiments of the present application.

[0263] According to another aspect of the embodiments of the present application, a memory processing device based on an intelligent agent is also provided, which is used to realize the above-mentioned embodiments and preferred embodiments, which have been described and will not be repeated. 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, or a combination of software and hardware is also possible and is contemplated.

[0264] The memory processing device based on an intelligent agent in the embodiments can be applied to a memory system based on an intelligent agent, 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 an interactive dialogue 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 dialogue between at least one interactive object and the intelligent agent, and the third memory layer is used to store pattern induction memories obtained by pattern induction on the structured events of the second memory layer.

[0265] Figure 7 is a structure block diagram of an optional memory processing device based on an intelligent agent according to the embodiments of the present application, as shown in Figure 7 The device can include:

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

[0267] The second execution unit 704 is configured to submit the current prompt word to the specified interactive model by the agent, and output a response result of the specified interactive model to the target interactive object.

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

[0269] According to the embodiments provided in the present application, in response to the current round of dialogue input information initiated by the 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 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 the target storage information are assembled into a current prompt word. The current prompt word is submitted to the specified interactive model by the agent, and the response result of the specified interactive model is output to the target interactive object. The problem of low retrieval accuracy and poor relevance of response due to mixed information value in the related art memory processing method based on the agent is solved, and the retrieval accuracy and the relevance of response are improved.

[0270] In one example embodiment, the first memory layer includes a target cache queue, and a round of historical dialogue information of the interactive dialogue between the target interactive object and the agent is written into the target cache queue as a cache item. The apparatus further includes an event processing unit configured to perform event processing on at least part of the historical dialogue information in the target cache queue to obtain a structured event to be stored, in a case where a first storage condition is met. The apparatus further includes a third execution unit configured to store the structured event to be stored into the second memory layer, and perform a deletion operation on at least part 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, M being 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 example embodiment, the apparatus further includes a first determining unit configured to, before the eventizing the at least part of the historical dialogue information in the target cache queue to obtain the structured event to be stored, perform one of the following: according to a write time sequence, determine N historical dialogue information with the earliest write time in the target cache queue as the at least part of the historical dialogue information, where N is a positive integer greater than or equal to 1; according to the write time sequence and a second cache space threshold, determine one or more historical dialogue information with the earliest write time in the target cache queue as the at least part of the historical dialogue information, where the cache space occupied by the at least part 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 part of the historical dialogue information is less than the second cache space threshold; determine historical dialogue information in the target cache queue with a parameter value of a cognitive value parameter less than or equal to a specified parameter threshold as the at least part of the historical dialogue information, where the parameter value of the cognitive value parameter of a historical dialogue information in the target cache queue is obtained based on cognitive value evaluation of at least one of the following features of the corresponding historical dialogue information: semantic density, entity quantity, and relevance to the associated processing task.

[0272] In an example embodiment, the eventizing unit includes a first execution module configured to perform information extraction on the at least part of the historical dialogue information using a specified interaction model, and generate the structured event to be stored according to a target event structure based on the extracted event description information, where 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: an object identifier, an object identifier of a structured event is used to identify the interaction object to which the corresponding structured event belongs; a latest recall time, a latest recall time of a structured event is the time when the corresponding structured event was last recalled due to retrieval; a recall number, a recall number of a structured event is the number of times the corresponding structured event was recalled due to retrieval; an encoding vector of event description information, an 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; an event element, an event element of a structured event is an event feature specified for the corresponding structured event; and related event information, related event information of a structured event is used to indicate a structured event having an association relationship with the corresponding structured event.

[0273] In an example embodiment, the structured event to be stored includes the following information: event description information and related event information, and the related event information of a structured event is used to indicate a structured event having an association relationship with the corresponding structured event.

[0274] The third execution unit comprises: an identification module, configured to perform association identification on the to-be-stored structured event and the structured events already stored in the second memory layer based on semantic similarity of event description information of the to-be-stored structured event and event description information of the structured events already stored in the second memory layer; a second execution module, configured to, in a case where it is identified that the to-be-stored structured event and a first structured event already stored in the second memory layer are association events, update relevant event information of the to-be-stored structured event and relevant event information of the first structured event, and store the to-be-stored structured event into the second memory layer, wherein semantic similarity of event description information of the to-be-stored structured event and event description information of the first structured event is greater than or equal to a first similarity threshold; in a case where it is identified that the to-be-stored structured event and a second structured event already stored in the second memory layer are repetitive events, update the second structured event based on the to-be-stored structured event, wherein semantic similarity of event description information of the to-be-stored structured event and 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 an example embodiment, the apparatus further comprises: a fourth execution unit, configured to, in a case where a second storage condition is met, perform mode induction on at least part of the structured events in the second memory layer to obtain a to-be-stored mode induction memory, and store the to-be-stored mode induction memory into a third memory layer. The second storage condition comprises at least one of: a system time reaching a specified period, wherein the at least part of the structured events are structured events in the second memory layer that are added in a historical period, and the historical period is earlier than the specified period; a number of structured events under a dialogue topic reaching a first number threshold, wherein the at least part of the structured events are structured events in the second memory layer under a target dialogue topic, and the number of structured events under the target dialogue topic reaches the first number threshold.

[0276] In an example embodiment, the fourth execution unit comprises: a third execution module configured to extract a relevant event cluster from the at least partially structured event according to the object identifier and the event element, input event description information of the structured event in the relevant event cluster to the specified interaction model, and perform pattern induction on the event description information of the structured event in the relevant event cluster by the specified interaction model to obtain a pattern induction result of the specified interaction model, wherein the relevant event cluster comprises one or more structured events, and the pattern induction result comprises a memory type and a 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 comprises a memory identifier, a memory type, and a memory content. The target memory structure further comprises at least one of the following: an object identifier, an object identifier of a pattern induction memory is used to identify an interaction object to which the corresponding pattern induction memory belongs; a confidence level, a confidence level of a pattern induction memory is used to represent a trust degree of the corresponding structured event; and a source event list, a source event list of a pattern induction memory is used to record event identifiers of the structured events used to obtain the corresponding pattern induction memory through pattern induction.

[0277] In an example embodiment, the first execution unit comprises: a first retrieval module configured to retrieve a first pattern induction memory matching the current round of dialogue input information from the pattern induction memories of the third memory layer; a second retrieval module configured to retrieve 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 an extraction module configured to extract a set of historical dialogue information from the first memory layer. The target stored information comprises at least one of the following: the set of historical dialogue information, the first pattern induction memory, and the set of target structured events.

[0278] In an example embodiment, the first retrieval module comprises: a first retrieval submodule configured to retrieve a first pattern induction memory matching the current round of dialogue input information from the pattern induction memories of the third memory layer according to an object identifier of the target interaction object and a dialogue topic of the current interaction dialogue, wherein a pattern induction memory of the third memory layer is used to describe at least one of the following: an object image of the corresponding interaction object, an object behavior pattern of the corresponding interaction object, a knowledge rule of the corresponding interaction object, and a task processing scheme of the corresponding interaction object for completing a processing task under an object topic.

[0279] In an example embodiment, the second retrieving module comprises: a first screening submodule configured to screen the structured events associated with the first pattern induction memory from the structured events of the second memory layer to obtain a set of associated structured events; a second screening submodule configured to screen a set of candidate structured events from the set of associated structured events based on semantic similarity between the current round of dialogue input information and event description information of each associated structured event in the set of associated structured events; and a selection submodule configured to select a set of target structured events from the set of candidate structured events according to an 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 according to an activity level of each candidate structured event and an importance level of each candidate structured event.

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

[0281] The above apparatus further comprises a second determining unit configured to determine, before the selection submodule selects the 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, a weighted sum of 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 as the event weight of each candidate structured event.

[0282] In an example embodiment, the above apparatus further comprises a third determining unit configured to determine, according to a time difference corresponding to each candidate structured event, a parameter value of an activity parameter corresponding to each candidate structured event, wherein the time difference corresponding to each candidate structured event is a time difference between a current time and a latest recall time of each candidate structured event, the latest recall time of each candidate structured event is a time when each candidate structured event is recalled for the last time 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 example 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 according to a recall number of each candidate structured event and a maximum recall number, wherein the recall number of each candidate structured event is a number of times each candidate structured event is recalled due to retrieval, the maximum recall number is a maximum value of the recall numbers of the candidate structured events in the group of candidate structured events, the parameter value of the importance parameter corresponding to each candidate structured event is positively correlated with the recall number of each candidate structured event and negatively correlated with the maximum recall number; predicting the parameter value of the importance parameter corresponding to each candidate structured event based on a multi-dimension feature corresponding to each candidate structured event, to obtain a predicted parameter value of the importance parameter corresponding to each candidate structured event. The multi-dimension feature corresponding to each candidate structured event includes at least one of the following: a semantic similarity between each candidate structured event and the current round of dialogue input information, an object feature of the interactive object, a task type of a processing task corresponding to each candidate structured event.

[0284] In an example embodiment, the extraction module includes at least one of the following: a first extraction unit configured to select historical dialogue information associated with a group of target structured events from the historical dialogue information of the first memory layer, to obtain a group of historical dialogue information; a second extraction unit configured to extract 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 group of historical dialogue information, wherein P is a positive integer greater than or equal to 1.

[0285] In an example embodiment, the apparatus further includes at least one of the following: a fifth execution unit configured to, in a case where the third structured event in the second memory layer satisfies a first suppression condition, mark the third structured event as a first suppression state, wherein the first suppression condition includes at least one of the following: a recall rate is less than a recall rate threshold, a duration of not being accessed reaches a first time threshold, the first suppression state is a state in which the corresponding structured event is prohibited from being retrieved, and is allowed to be reactivated in the case of backtracking; in a case where a duration of the third structured event being in the first suppression state reaches a second time threshold, performing a deletion operation on the third structured event; a sixth execution unit configured to, in a case where the second pattern induction memory in the third memory layer satisfies a second suppression condition, mark the second pattern induction memory as a second suppression state, wherein the second suppression condition includes: a confidence degree is less than a first confidence degree threshold, the second suppression state is a state in which the corresponding pattern induction memory is prohibited from being retrieved, and is allowed to be reactivated in the case of backtracking; in a case where a duration of the second pattern induction memory being in the second suppression state reaches a third time threshold, performing a deletion operation on the second pattern induction memory.

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

[0287] In an example embodiment, the apparatus further includes a pattern induction unit configured to, after decreasing confidence of the fourth pattern induction memory, perform pattern induction on a group of conflict structured events conflicting with the fourth pattern induction memory to obtain a fifth pattern induction memory in competition with the fourth pattern induction memory, when the decreased confidence of the fourth pattern induction memory is less than the second confidence threshold.

[0288] It should be noted that each of the above modules can be implemented by software or hardware, and for the latter, the following implementation manners can be used, but are not limited thereto: all of the above modules are located in the same processor; or each of the above modules is located in different processors in any combination.

[0289] According to still another aspect of the embodiments of the present application, a computer readable storage medium is provided, which stores a computer program. The computer program is configured to perform the steps in any of the above method embodiments when executed.

[0290] In an example embodiment, the computer readable storage medium can include, but is not limited to, a U disk, a Read-Only Memory (ROM), a RAM, a mobile hard disk, a magnetic disk or an optical disk, and various media that can store computer programs.

[0291] According to still another aspect of the embodiments of the present application, an electronic device is provided, which includes a memory storing a computer program and a processor configured to execute the computer program to perform the steps in any of the above method embodiments.

[0292] In one example embodiment, the electronic device described above can further include a transmission device connected to the processor, and an input / output device connected to the processor.

[0293] The specific examples in the present embodiment can refer to the examples described in the above embodiments and exemplary implementations, which will not be repeated here.

[0294] According to yet another aspect of the embodiments of the present application, a computer program product is provided, which includes computer programs / instructions containing program codes for executing the methods shown in the flowcharts. In such embodiments, the computer programs can be downloaded and installed from a network by the communication part 809, and / or installed from the removable medium 811. When the computer programs are executed by the central processing unit 801, various functions provided by the embodiments of the present application are performed. The above-mentioned serial numbers of the embodiments of the present application are only for description, and do not represent the advantages or disadvantages of the embodiments.

[0295] Figure 8 A computer system structure block diagram for implementing the electronic device of the embodiments of the present application is schematically shown. As shown in the figure, Figure 8 The computer system 800 includes a CPU 801, which can perform various appropriate actions and processes according to programs stored in the ROM 802 or programs loaded from the storage part 808 into the RAM 803. In the random access memory 803, various programs and data required for system operation are also stored. The central processing unit 801, the read-only memory 802, and the random access memory 803 are connected to each other through a bus 804. An input / output (Input / Output, referred to as I / O) interface 805 is also connected to the bus 804.

[0296] The following components are connected to the I / O interface 805: an input part 806 including a keyboard, a mouse, and the like; an output part 807 including a cathode ray tube (Cathode Ray Tube, referred to as CRT), a liquid crystal display (Liquid Crystal Display, referred to as LCD), and the like, as well as a speaker, and the like; a storage part 808 including a hard disk, and the like; and a communication part 809 including a network interface card such as a local area network card, a modem, and the like. The communication part 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the input / output interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, and the like, is mounted on the drive 810 as needed, so that computer programs read therefrom are installed in the storage part 808 as needed.

[0297] In particular, in accordance with the embodiments of the present application, the processes described in the various method flow diagrams can be implemented as computer software programs. For example, embodiments of the present application include a computer program product comprising a computer program carried on a computer readable medium, the computer program containing program code for executing the methods illustrated by the flow diagrams. In such embodiments, the computer program can be downloaded and installed from a network via the communication section 809, and / or installed from the removable media 811. When the computer program is executed by the central processing unit 801, various functions defined in the system of the present application are performed.

[0298] It should be noted that, Figure 8 The computer system 800 shown in the figure is merely an example, and should not impose any limitation on the functions and usage range of the embodiments of the present application.

[0299] Obviously, those skilled in the art should understand that the above-mentioned modules or steps of the present application can be realized by general computing devices, which can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, which can be realized by program codes executable by computing devices, so that they can be stored in storage devices and executed by computing devices, and in some cases, the steps shown or described can be executed in different order, or they can be made into individual integrated circuit modules, or multiple modules or steps can be made into a single integrated circuit module. Thus, the present application is not limited to any specific hardware and software combination.

[0300] The above is only the preferred embodiment of the present application, and is not used to limit the present application. For those skilled in the art, the present application can have various modifications and changes. Any modification, equivalent replacement, improvement, etc. within the principles of the present application shall be included in the protection scope of the present application.

[0301] Obviously, those skilled in the art should understand that the above-mentioned modules or steps of the present application can be realized by general computing devices, which can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, which can be realized by program codes executable by computing devices, so that they can be stored in storage devices and executed by computing devices, and in some cases, the steps shown or described can be executed in different order, or they can be made into individual integrated circuit modules, or multiple modules or steps can be made into a single integrated circuit module. Thus, the present application is not limited to any specific hardware and software combination.

[0302] The above descriptions are only the preferred embodiments of the present application, and are not intended to limit the present application. The present application can have various modifications and changes for those skilled in the art. Any modifications, equivalent replacements, improvements, etc. within the principles of the present application shall be included in the protection scope of the present application.

Claims

1. An agent-based memory processing method, characterized by, 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 configured to store historical dialogue information of an interactive dialogue between at least one interactive object and the intelligent agent. The second memory layer is configured to store structured events extracted from the historical dialogue information of the interactive dialogue between the at least one interactive object and the intelligent agent. The third memory layer is configured to store pattern induction memories obtained by pattern induction on the structured events of the second memory layer. One pattern induction memory in the third memory layer is generated according to a target memory structure. The target memory structure includes a list of source events. The list of source events of one pattern induction memory is configured to record event identifiers of the structured events used to obtain the corresponding pattern induction memory by pattern induction. The method includes: In response to current round dialogue input information initiated by a target interactive object in the at least one interactive object to the intelligent agent in a current interactive dialogue, target stored 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 stored information are assembled into a current prompt word; The current prompt word is submitted to a specified interaction model by the intelligent agent, and a response result of the specified interaction model is output to the target interactive object; The target stored information associated with the current round dialogue input information is retrieved from at least one memory layer in the memory architecture, including: retrieving a first pattern induction memory matching the current round dialogue input information from the pattern induction memories of the third memory layer; based on the current round dialogue input information and the first pattern induction memory, a group of target structured events are retrieved from the structured events of the second memory layer; a group of historical dialogue information is extracted from the first memory layer; wherein the target stored information includes at least one of the following: the group of historical dialogue information, the first pattern induction memory, and the group of target structured events.

2. The method of claim 1, wherein, The first memory layer includes a target cache queue. A round of historical dialogue information of an interactive dialogue between the target interactive object and the intelligent agent is written into the target cache queue as a cache item. The method further includes: In a case where a first storage condition is met, at least part of the historical dialogue information in the target cache queue is eventized to obtain a structured event to be stored; The structured event to be stored is stored in the second memory layer, and a deletion operation is performed on the at least part 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, 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; the historical dialogue information in the target cache queue forms a closed loop of an independent processing task.

3. The method of claim 2, wherein, The eventization processing on the at least part of the historical dialogue information in the target cache queue obtains a structured event to be stored, including: information extraction on the at least part of the historical dialogue information using the specified interaction model, and generation of the structured event to be stored according to a target event structure based on the extracted event description information, wherein the target event structure includes event identification and event description information, and the event description information of one structured event is used to describe the corresponding structured event; wherein the target event structure further includes at least one of the following: object identification, the object identification of one structured event is used to identify the interactive object to which the corresponding structured event belongs; the latest recall time, the latest recall time of one structured event is the time when the corresponding structured event is recalled for the last time due to retrieval; recall times, the recall times of one structured event is the number of times when the corresponding structured event is recalled due to retrieval; the encoding vector of the event description information, the encoding vector of the event description information of one structured event is a vector obtained by vectorizing the event description information of the corresponding structured event; event elements, the event elements of one structured event are event features specified for the corresponding structured event; related event information, the related event information of one structured event is used to indicate the structured event having an association relationship with the corresponding structured event.

4. The method of claim 2, wherein, The structured event to be stored includes the following information: event description information and related event information, the related event information of one structured event is used to indicate the structured event having an association relationship with the corresponding structured event; The storing of the structured event to be stored into 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 event already stored in the second memory layer, the structured event to be stored and the structured event already stored in the second memory layer are associated and identified; in the case that the structured event to be stored and the first structured event already stored in the second memory layer are identified as associated events, the related event information of the structured event to be stored and the related event information of the first structured event are updated, and the structured event to be stored is stored into 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; in the case that the structured event to be stored and the second structured event already stored in the second memory layer are identified as repetitive 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 of claim 1, wherein, The method further includes: in a case where a second storage condition is met, performing pattern induction on at least part of the structured events in the second memory layer to obtain a pattern-induction memory to be stored, and storing the pattern-induction memory to be stored into the third memory layer; The second storage condition includes at least one of the following: The system time reaches a specified time period, wherein the at least part of the structured events are structured events newly added 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 number threshold, wherein the at least part of the structured events are structured events under a target dialogue topic in the second memory layer, and the number of the structured events under the target dialogue topic reaches the first number threshold.

6. The method of claim 5, wherein, The pattern induction on the at least part of the structured events in the second memory layer includes: extracting an associated event cluster from the at least part of the structured events according to object identification and event elements, inputting event description information of the structured events in the associated event cluster into the specified interaction model to perform pattern induction on the event description information of the structured events in the associated event cluster by the specified interaction model, and obtaining a pattern induction result of the specified interaction model, wherein the associated event cluster includes one or more structured events, and the pattern induction result includes a memory type and a memory content; generating the pattern-induction memory to be stored according to the target memory structure based on the pattern induction result, wherein the target memory structure further includes a memory identification, a memory type, and a memory content; The target memory structure further includes at least one of the following: An object identification, wherein the object identification of a pattern-induction memory is used to identify an interactive object to which the corresponding pattern-induction memory belongs. A confidence degree, wherein the confidence degree of a pattern-induction memory is used to represent a confidence degree of the corresponding structured event.

7. The method of claim 1, wherein, The retrieval of the first pattern-induction memory matching the current round of dialogue input information from the pattern-induction memories of the third memory layer includes: According to the object identification of the target interactive object and the dialogue topic of the current interactive dialogue, the first pattern-induction memory matching the current round of dialogue input information is retrieved from the pattern-induction memories of the third memory layer, wherein the pattern-induction memory of the third memory layer is used to describe at least one of the following: an object image of the corresponding interactive object, an object behavior pattern of the corresponding interactive object, a knowledge rule of the corresponding interactive object, and a task processing scheme of the corresponding interactive object for completing a processing task under an object topic.

8. The method of claim 1, wherein, The retrieval of a group 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 includes: Filtering the structured events associated with the first pattern-induction memory from the structured events of the second memory layer to obtain an associated structured event set; filtering a set of candidate structured events from the set of associated structured events based on semantic similarity between the current round of dialog input information and event description information of each associated structured event in the set of associated structured events; selecting the set of target structured events from the set of candidate structured events according to 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 according to activity level of the each candidate structured event and importance level of the each candidate structured event.

9. The method of claim 8, wherein, the activity level of each candidate structured event is represented by a parameter value of an activity parameter corresponding to the each candidate structured event, and the importance level of each candidate structured event is represented by a parameter value of an importance parameter corresponding to the each candidate structured event; before the selecting the set of target structured events from the set of candidate structured events according to event weight of each candidate structured event in the set of candidate structured events, the method further comprises: determining a weighted sum of the parameter value of the activity parameter corresponding to the each candidate structured event and the parameter value of the importance parameter corresponding to the each candidate structured event as the event weight of the each candidate structured event.

10. The method according to any one of claims 1 to 9, characterized in that, the method further comprises at least one of: in a case where a third structured event in the second memory layer satisfies a first inhibition condition, marking the third structured event as a first inhibition state, wherein the first inhibition condition comprises at least one of: recall rate being less than a recall rate threshold, duration of not being accessed reaching a first time threshold, the first inhibition state being a state in which the corresponding structured event is prohibited from being retrieved and allowed to be reactivated in a case of backtracking; in a case where duration of the third structured event being in the first inhibition state reaches a second time threshold, performing a deletion operation on the third structured event; in a case where a second pattern induction memory in the third memory layer satisfies a second inhibition condition, marking the second pattern induction memory as a second inhibition state, wherein the second inhibition condition comprises: confidence being less than a first confidence threshold, the second inhibition state being a state in which the corresponding pattern induction memory is prohibited from being retrieved and allowed to be reactivated in a case of backtracking; in a case where duration of the second pattern induction memory being in the second inhibition state reaches a third time threshold, performing a deletion operation on the second pattern induction memory.

11. The method of claim 10, wherein, the method further comprises at least one of: In the process of pattern induction on the fourth structured event in the second memory layer, if it is determined that the fourth structured event supports a third pattern induction memory 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 a 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; In the process of pattern induction on the fifth structured event in the second memory layer, if it is determined that the fifth structured event conflicts with a fourth pattern induction memory stored in the third memory layer, the confidence of the fourth pattern induction memory is reduced.

12. The method of claim 11, wherein, After the confidence of the fourth pattern induction memory is reduced, the method further comprises: If the confidence of the reduced fourth pattern induction memory is less than a second confidence threshold, a group of conflict structured events conflicting with the fourth pattern induction memory are subjected to pattern induction to obtain a fifth pattern induction memory in competition with the fourth pattern induction memory.

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

14. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the steps of the method in any one of claims 1 to 12.

Citation Information

Patent Citations

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

    CN120875055A

Cited By

  • 基于智能体与人类交互式通讯的运维授权自愈方法及系统

    CN122575357A