An agent task execution method and device based on memory content
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
- Filing Date
- 2026-03-04
- Publication Date
- 2026-06-26
AI Technical Summary
Existing technologies are costly in maintaining the memory content of intelligent agents, which affects the efficiency and reliability of their reasoning ability.
By iteratively retrieving and reasoning with a large model, and utilizing event-level segmentation and a key fact catalog, the retrieval and reasoning process of the memory content is gradually optimized, thereby reducing the maintenance cost of the memory content.
It significantly reduces the maintenance cost of memory content while retaining the reasoning ability of large models, thus improving the reliability and efficiency of the agent's question-and-answer process.
Smart Images

Figure CN122285818A_ABST
Abstract
Description
Technical Field
[0001] This specification relates to the field of artificial intelligence technology in one or more embodiments, and in particular to a method and apparatus for intelligent agent task execution based on memory content. Background Technology
[0002] An agent is a concrete application of artificial intelligence (AI) technology. It integrates components such as large models, perception modules, and tool invocation, enabling it to proactively perceive its environment, plan tasks, and execute operations (such as smart shopping, booking flights, and data analysis), achieving an end-to-end task loop. Agent memory is the ability of an AI system to record and recall past experiences to improve decision-making and behavior. Agents with memory can retain contextual information as memory content and perform adaptive optimization based on this content. Memory provides agents with persistent context, enabling them to perform consistently in multi-turn dialogues, task planning, and long-term interactions, thereby significantly improving their reasoning, planning, and personalized service capabilities. During data processing, agents need to protect user privacy data from leakage. Currently, maintaining memory content is costly.
[0003] Therefore, we hope to find an improved solution that can significantly reduce the maintenance cost of the memory content while retaining the reasoning ability of large models. Summary of the Invention
[0004] This specification describes one or more embodiments of an agent task execution method and apparatus based on memory content, which significantly reduces the maintenance cost of memory content while retaining the reasoning ability of large models. The specific technical solution is as follows.
[0005] In a first aspect, the embodiment provides a method for executing intelligent agent tasks based on memory content. The intelligent agent includes a retrieval model and an inference model. The method is executed through several rounds of iteration, and any one round of iteration includes:
[0006] The search prompts are input into the large search model to obtain the target memory content; the search prompts include the current question, the memory content, and a first task description, the first task description being used to indicate the retrieval of target memory content related to the current question from the memory content; the first question to be answered is used as the initial current question, which is obtained based on the user task to be performed;
[0007] Inputting reasoning prompts into a large reasoning model yields either the answer to the first question or a new question. The reasoning prompts include the first question, current memory content, and a second task description. The current memory content is determined based on the previous memory content and the target memory content. The second task description indicates: when the current memory content satisfies the answer conditions for the first question, the answer to the first question is determined; when the current memory content does not satisfy the answer conditions, missing information is determined based on the current memory content, and a new question is generated based on the missing information.
[0008] Update the new question to the current question, and return to the step of inputting search suggestions into the large search model;
[0009] Perform the user task based on the answer to the first question.
[0010] In one implementation, the search suggestions are constructed in the following way:
[0011] A first task description is determined such that the first task description is used to instruct the retrieval of target memory content related to the current problem from the memory content; wherein the relevance includes relevance in terms of semantic similarity and logical relationship between entities;
[0012] The search suggestion words are constructed based on the current problem, the memory content, and the first task description.
[0013] In one implementation, the step of constructing the search suggestion words includes:
[0014] Obtain multiple key facts; these key facts correspond to several memory units respectively, and are extracted and summarized from these memory units, which correspond to several events respectively, and are obtained by dividing the memory content into blocks according to the event themes;
[0015] Based on the current problem, multiple key facts, and the first task description, search suggestions are constructed such that the search suggestions include the current problem, the multiple key facts, and the first task description, wherein the first task description is used to indicate the retrieval of target key facts related to the current problem from the multiple key facts;
[0016] The step of inputting search suggestions into the search model to obtain target memory content includes: inputting the search keywords into the search model to obtain target key facts.
[0017] In one implementation, the step of obtaining multiple key facts includes:
[0018] The segmentation prompts are input into the segmentation model to obtain several memory units. The segmentation prompts include the memory content and a third task description. The third task description is used to instruct the memory content to be divided into event-level blocks according to event topics to obtain memory units corresponding to several event topics respectively.
[0019] The summary prompts are input into the large model to obtain several key facts corresponding to any memory unit. The summary prompts include several memory units and a fourth task description. The fourth task description is used to indicate that for any memory unit, the core content is extracted and summarized from the content contained in the memory unit to obtain several corresponding key facts.
[0020] In one implementation, the segmentation prompts are constructed in the following manner:
[0021] A third task description is determined such that the third task description is specifically used to instruct the following operations: dividing the memory content into event-level segments according to event themes to obtain content boundaries of several events; dividing the memory content into segments using a sliding window overlapping block method to obtain several initial memory units; adjusting the content of the several initial memory units according to the content boundaries of the several events to obtain memory units corresponding to several event themes;
[0022] The segmentation prompts are constructed based on the memory content and the third task description.
[0023] In one implementation, the step of adjusting the contents of the plurality of initial memory units according to the content boundaries of the plurality of events includes:
[0024] Based on the content boundary of any event, determine the content to be adjusted from the plurality of initial memory units;
[0025] By extracting content summaries, the content to be adjusted is processed to obtain memory units corresponding to several event themes.
[0026] In one implementation, the agent further includes a large-scale model, wherein the current memory content is determined in the following way:
[0027] Construct summary prompts such that the summary prompts include the first question, the previous memory content, the target key fact, and a fifth task description, wherein the fifth task description is used to indicate how to summarize the current memory content related to the first question from the previous memory content and the target key fact;
[0028] Input the summary prompts into the summary model to obtain the current memory content.
[0029] In one implementation, the step of constructing the summary prompt includes:
[0030] From the plurality of memory units, determine the target memory unit corresponding to the target key fact;
[0031] A summary prompt is constructed based on the target memory unit, such that the summary prompt specifically includes the first question, the previous memory content, the target key fact, the target memory unit, and a fifth task description, wherein the fifth task description is used to indicate how to summarize the current memory content related to the first question from the previous memory content, the target key fact, and the target memory unit.
[0032] In one implementation, after inputting search suggestions into the search model, the method further includes:
[0033] Update the retrieval count; when the retrieval count reaches a preset number, input the final reasoning prompt into the reasoning model to obtain the answer to the first question; the final reasoning prompt includes the first question, the current memory content, and the sixth task description, the current memory content is determined based on the previous memory content and the target memory content, and the sixth task description is used to indicate the answer to the first question based on the current memory content.
[0034] Secondly, an embodiment provides an intelligent agent task execution device based on memory content, wherein the intelligent agent includes a retrieval large model and an inference large model, and the device includes:
[0035] The memory retrieval module is configured to input search prompts into the retrieval model to obtain target memory content; the search prompts include the current question, memory content, and a first task description, wherein the first task description is used to indicate the retrieval of target memory content related to the current question from the memory content; the first question to be answered serves as the initial current question, which is obtained based on the user task to be executed;
[0036] The answer reasoning module is configured to input reasoning prompts into a large reasoning model to obtain the answer to the first question or a new question. The reasoning prompts include the first question, current memory content, and a second task description. The current memory content is determined based on the previous memory content and the target memory content. The second task description indicates that: when the current memory content meets the answer conditions for the first question, the answer to the first question is determined; when the current memory content does not meet the answer conditions, the missing information is determined based on the current memory content, and a new question is generated based on the missing information.
[0037] The question update module is configured to update the new question to the current question and then return to execute the step of inputting search suggestions into the large search model.
[0038] The task execution module is configured to execute the user task based on the answer to the first question.
[0039] Thirdly, the embodiments provide a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to perform the method described in any one of the first aspects.
[0040] Fourthly, an embodiment provides a computing device including a memory and a processor, wherein the memory stores executable code, and the processor executes the executable code to implement the method described in any one of the first aspects.
[0041] In the methods and apparatus provided in the embodiments of this specification, a large retrieval model is used to retrieve target memory content from the memory content, and a large reasoning model is used to determine whether the retrieved target memory content can answer a question. If not, a new question is generated based on the missing information, and the large retrieval model is invoked to retrieve target memory content related to the new question. Through this iterative approach, the large reasoning model can flexibly explore the space of memory content, uncovering potential logical relationships between different memory contents through new questions. Therefore, the reasoning capability of the large reasoning model can be achieved without maintaining the memory content in a complex form, thus significantly reducing the maintenance cost of the memory content. Attached Figure Description
[0042] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are merely some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without any creative effort.
[0043] Figure 1 This is a schematic diagram illustrating an implementation scenario of one embodiment disclosed in this application;
[0044] Figure 2 A schematic diagram illustrating an example of segmenting and compressing memory content, provided for an embodiment.
[0045] Figure 3 A schematic diagram of a process for constructing a memory bank based on memory content is provided for an embodiment.
[0046] Figure 4 An example illustration of content adjustment via a summary method provided for this embodiment;
[0047] Figure 5 A flowchart illustrating an intelligent agent task execution method based on memory content is provided for an embodiment.
[0048] Figure 6 A schematic diagram of an example retrieval process provided for the embodiments;
[0049] Figure 7 A schematic diagram illustrating an example of the reasoning process provided for the embodiments;
[0050] Figure 8 This is a schematic block diagram of an intelligent agent task execution device based on memory content, provided for an embodiment. Detailed Implementation
[0051] The solution provided in this specification will now be described with reference to the accompanying drawings.
[0052] Figure 1 This is a schematic diagram illustrating an implementation scenario of an embodiment disclosed in this application. It includes a computing device, a segmentation model N1, a refinement model N2, a memory bank, a retrieval model N3, and a reasoning model N4. The computing device serves as the carrier of the intelligent agent, used to implement the agent's functions. The computing device invokes the segmentation model N1 to segment the original memory content according to events, obtaining multiple memory units. Next, the computing device invokes the refinement model N2 to summarize the content of each memory unit, extracting key facts. The computing device stores each memory unit corresponding to the key facts in the memory bank. The key facts serve as the content index and directory of the memory units, used for retrieval of the memory units.
[0053] When the computing device determines the question to be answered, it iteratively executes the reasoning process by calling the retrieval model N3 and the reasoning model N4 to ultimately obtain the answer. In any iteration, the computing device calls the retrieval model N3 to retrieve key facts related to the question from multiple key facts, thus obtaining the target memory content. Next, the computing device calls the reasoning model N4 to determine whether the current memory can answer the question. If it can, an answer is made based on the current memory; if not, the missing information is determined based on the current memory, and a new question is identified based on the missing information. The computing device takes the new question as the current question, calls the retrieval model N3 to determine the key facts corresponding to the current question, and obtains the corresponding target memory content. Then, the computing device updates the target memory content into the current memory and continues to call the reasoning model N4 to determine whether the updated current memory can answer the question. By iteratively invoking the reasoning model N4 and the retrieval model N3, the computing device can progressively optimize the reflection and feedback process, thus forming a closed-loop and controllable question-answering framework, improving the reliability and interpretability of the overall reasoning. This process includes a memory storage stage and a question reasoning stage.
[0054] Figure 1 This is merely one real-world scenario of the agent task execution method provided in this application. In practical applications, when the computing power of the computing device is sufficient, one or more of the segmentation large model N1, refinement large model N2, retrieval large model N3, and inference large model N4 can also be implemented in the aforementioned computing device. Alternatively, one or more of the aforementioned large models can be implemented in other devices besides the aforementioned computing device. Multiple of the segmentation large model N1, refinement large model N2, retrieval large model N3, and inference large model N4 can be implemented through a single large model or separately through different large models, resulting in higher accuracy and faster speed. The memory can be stored in a dedicated storage system. The aforementioned computing device can be implemented through any device, equipment, platform, device cluster, etc., with computing and processing capabilities.
[0055] The following explains the concepts and technical background involved in this application.
[0056] In this specification, Agent Memory can be understood as a technology, the memory content of an agent, or simply memory or context. Agent Memory is the historical interaction content between an agent and the user, recorded by the agent.
[0057] Memory can originate from various sources, including short-term memory, long-term memory, contextual memory, and meta-memory. Short-term memory stores immediately relevant information from the current session, helping the agent track the current task state, dialogue history, or user requests. It maintains focus on the current conversation, ensuring the task context isn't lost during multiple interactions. Long-term memory preserves important information that may span multiple sessions or tasks. It allows the agent to "remember" more historical conversational content with the user, such as project details or recording the movement of objects during household tasks, for future reuse. Contextual memory emphasizes capturing the current external environment or dialogue context, including the user's current environment, task objectives, and user personalization settings. This is closely related to short-term memory but can be maintained across task segments. Contextual memory allows the agent to "keep up the flow" when repeating tasks or continuing sessions, improving interaction consistency. Meta-memory is an agent's ability to recognize and manage its own memory state; it is essentially "memory about memories." It includes self-censorship and metacognitive functions, enabling agents to evaluate their decisions, identify information gaps, and adjust their memory strategies. For example, meta-memory mechanisms can record past erroneous decisions, forming a reflective log to guide future avoidance of repeating mistakes.
[0058] In this specification, the memory content exists in text form, and may also be referred to as memory text. The original memory content can be stored in an unstructured form in a disk file system, or in a semi-structured form in a database.
[0059] After event-level segmentation, the original memory content is divided into multiple memory chunks. These memory chunks also exist in text form. The memory chunks are stored in a memory bank, which can be understood as a semi-structured database. In this application, the multiple memory chunks are not stored as vectors in a vector database, nor as knowledge graphs in a graph database, thus reducing storage costs and maintenance complexity.
[0060] Key facts are concise phrases or sentences abstracted from all the core content of a memory unit, including event summaries, keywords, themes, and data characteristics. Key facts are a high-level summary of the core content of a memory unit and also serve as an index of the unit's content. One memory unit corresponds to one or more key facts. Key facts can serve as a directory for multiple memory units in a memory bank, with the directory containing multiple key facts. Key facts can be stored as text in a list or within the memory bank.
[0061] An intelligent agent is based on a large model, which acts as its brain to provide cognitive capabilities, integrating modules such as perception, planning, and action to achieve autonomous task execution. An intelligent assistant is one product implementation of an intelligent agent. In this application, an intelligent agent can be understood as comprising a segmentation large model N1, a refinement large model N2, a retrieval large model N3, and a reasoning large model N4. Alternatively, an intelligent agent can comprise a retrieval large model N3 and a reasoning large model N4.
[0062] An intelligent agent is an intelligent entity capable of perceiving its environment, making autonomous decisions, and executing actions to achieve specific tasks. It is not merely a tool responding to instructions, but more like a virtual agent with the ability to "observe, think, and act," capable of independently completing complex tasks and continuously learning and optimizing in the process. When an intelligent agent receives a user task, such as "Please book me a flight to Hangzhou in the next two days," the agent will break this user task down into multiple sub-tasks and invoke different tools or applications (Apps) to complete them. For example, the sub-tasks might include:
[0063] Check the weather forecast for the next two days;
[0064] Inquire about users' preferences for airplane seats;
[0065] I booked a flight on xxapp based on the information I found.
[0066] Among these, some of the sub-tasks can have their answers determined based on the agent's memory. For example, the first two sub-tasks, which are questions to be answered, can have their answers determined based on the agent's memory. The third task requires execution by calling the application App based on the retrieved information. Therefore, when an agent performs a user task, it includes processes such as answering questions and calling tools or applications.
[0067] In this specification, the inference model N1, retrieval model N2, summarization model N2, segmentation model, and extraction model can be implemented using large models and used to achieve their respective functions. Multiple large models can be implemented using pre-trained large models. The following section explains the basic large models.
[0068] Large Language Models (LLMs) are natural language processing models based on deep learning techniques. They typically have billions to hundreds of billions of parameters, possessing powerful language understanding and generation capabilities. LLMs can employ the Transformer architecture or its variants (such as GPT and BERT), which utilizes attention mechanisms to globally model sequential data, efficiently handling long-distance dependencies and thus performing exceptionally well in natural language tasks. By pre-training on large-scale corpora, LLMs learn the statistical features and semantic relationships of language, giving them excellent generalization abilities. The core capabilities of LLMs include, but are not limited to: understanding contextual semantics, generating coherent and grammatically correct text, performing logical reasoning, and handling multi-task scenarios. Their usage typically includes two modes: direct inference and fine-tuning. In direct inference mode, users design prompts to guide the LLM in generating specific outputs. Prompts can be textual descriptions of the task or instructions used to stimulate the LLM's semantic understanding and generation capabilities. In fine-tuning mode, large models are further trained on small datasets within a specific domain to optimize their performance on specific tasks. The powerful generalization ability and flexibility of large models make them an important tool in the field of artificial intelligence, providing efficient and accurate solutions for automated text generation and understanding, capable of performing various natural language processing tasks such as text generation, question answering, and translation.
[0069] In some embodiments, large models can also possess the ability to understand and generate data from other modalities (such as visual, audio, etc.). In this case, large models can also be called Multimodal Large Language Models (MLLMs). MLLMs provide a richer and more natural interactive experience by integrating multiple types of inputs and outputs, such as text, images, and sound. The core advantage of MLLMs lies in their ability to process and understand information from different modalities and fuse this information to accomplish complex tasks. For example, MLLMs can analyze an image and generate descriptive text, or generate a corresponding image based on a text description. This cross-modal understanding and generation capability makes MLLMs widely applicable across multiple fields.
[0070] It should be noted that the key technologies of large models can be found in the detailed description in the paper "A Survey of Large Language Models" (paper number: arXiv:2303.18223v16, published on March 11, 2025), and will not be repeated here.
[0071] When an agent answers a question, it typically incorporates remembered information as context into the current prompt and appends it to the context window. However, due to limitations in the context length of large models, even though the number of text units (tokens) in the context window of current large models has expanded to the millions, redundant information often leads to a reduced proportion of effective information and slower processing speed, thus affecting the model's answer quality and response speed. Existing technologies have improved the way remembered information is utilized to address these issues. However, common improvements still suffer from high implementation and maintenance costs, as well as high storage costs.
[0072] To significantly reduce the implementation, maintenance, and storage costs of memory content while retaining the reasoning capabilities of large models, this application provides a method for agent task execution based on memory content. This method involves a memory storage stage and a problem reasoning stage. The memory storage stage is used to segment and compress the original memory content, i.e., segmenting it into memory units and compressing it into a key fact directory. The problem reasoning stage is used to reason about the answer to the problem using the segmented and compressed memory units and the key fact directory. In practical applications, the memory storage stage and the problem reasoning stage can be performed alternately. When the amount of newly added memory content reaches a certain level, the segmentation and compression operations of the memory storage stage can be performed to increase the content of the memory bank.
[0073] The following is a combination of... Figure 2 and Figure 3 The memory storage stage will be explained.
[0074] During the memory storage phase, the original memory content is divided into multiple event-level blocks. Each block is extracted into several key facts, and a many-to-one mapping is established between the key facts and the blocks. After this, the divided blocks are stored in the memory bank as a memory unit, and the key facts are used to update the current directory.
[0075] Figure 2This is an example illustration of segmenting and compressing memory content provided for an implementation. The original memory content includes timestamps and multi-turn dialogues between a user (represented by "user") and an agent (represented by "agent"), specifically as follows: Time: June 15, 2024. User: Hello, please introduce yourself. Agent: Hello, I am the intelligent assistant of xx company. Feel free to ask me any questions. User: Please help me check and summarize Zhang San's expenses this month. Agent: Okay, just a moment… This is Zhang San's detailed bill for this month. A large expense was discovered last month, which may indicate a risk or anomaly. User: Please help me compile Zhang San's detailed expenses into a document, which I will report at the weekly meeting. Agent: Okay, just a moment, here is the detailed document:… User: Okay, thank you. Also, I am a new employee. Could you please explain the internal rules and regulations of xx company to me? Agent: Okay, welcome to xx company. Here are the basic rules and regulations:…
[0076] After dividing the above memory content into event-level blocks in chronological order, three memory units are obtained, each containing a corresponding portion of the memory content text. Extracting key facts from the first memory unit yields two key facts, 1 and 2; extracting key facts from the second memory unit yields three key facts, 3-5; and extracting key facts from the third memory unit yields three key facts, 6-8.
[0077] Figure 3 This is a schematic diagram illustrating a process for constructing a memory bank based on memory content, provided as an embodiment. This memory storage stage can be executed by a computing device, specifically by an intelligent agent, and includes the following steps.
[0078] Step S310: Construct segmentation prompt1 based on the memory content to be processed, and input segmentation prompt1 into the segmentation model N1 to obtain several memory units.
[0079] The segmentation prompt 1 includes the aforementioned memory content and the third task description. The third task description instructs the memory content to be divided into event-level blocks according to event topics, resulting in memory units corresponding to several event topics. The segmentation model N1 can perform the corresponding operations according to the instructions of the third task description to obtain the segmentation result, which includes several memory units. "Several" can include one or more memory units.
[0080] When constructing the segmentation prompt word prompt1, the memory content to be processed and the third task description can be determined, and the prompt word can be constructed based on the determined memory content and the third task description.
[0081] Specifically, a corresponding prompt template can be constructed based on the placeholders corresponding to the memory content and the description of the third task, so that the prompt template contains the text of the placeholders corresponding to the memory content and the description of the third task. When the segmentation prompt word prompt1 needs to be constructed, the text of the memory content is filled into the placeholder in the prompt template.
[0082] When the third task description is used to instruct the memory content to be divided into event-level chunks according to event topics, it can be understood as directly dividing the memory content into event-level chunks according to event topics by segmenting the large model N1. A maximum sequence length M for each chunk can also be set. When the sequence length of a chunk exceeds this maximum sequence length M, the chunk content can be reduced by extracting a summary to obtain memory units that meet the requirements.
[0083] In one implementation, the text describing the third task can be set according to the following steps 1 to 3.
[0084] Step 1: Divide the above-mentioned memory content into event-level categories according to the event theme to obtain the content boundaries T of several events.
[0085] Step 2: Divide the above memory content into several initial memory units W by using a sliding window overlapping block method.
[0086] Step 3: Adjust the contents of several initial memory units W according to the content boundaries T of several events to obtain memory units corresponding to the themes of several events.
[0087] The execution of steps 1 and 2 above is not sequential. These three steps are presented in the segmentation prompt word `prompt1` in the form of a text description. Step 2 produces initial memory units W with a fixed sequence length. Step 3 avoids semantic fragmentation of memory units, ensuring that each memory unit, or block, corresponds to one event topic. Furthermore, through the execution of steps 1-3, the sequence length of each memory unit will be relatively balanced and will not exceed the maximum sequence length M.
[0088] Step 1 can be understood as using the language understanding capabilities of the large model to directly identify the content corresponding to the event topic. Step 2 can be found in existing technologies and will not be detailed here. Steps 1 through 3 are all assigned to the segmentation model N1 as tasks, causing N1 to perform the corresponding operations as required.
[0089] Step 3 may specifically include: determining the content to be adjusted from several initial memory units based on the content boundary T of any event; processing the content to be adjusted by extracting a content summary to obtain memory units corresponding to the themes of several events. Although the content summary method is used here to replace some of the original text, the content summary can reflect the main idea of the original text in a relatively detailed way compared to the key facts, so the obtained memory units can still be called the original text. The specific processing may include the following situations.
[0090] For any content boundary T of an event, determine the corresponding initial memory unit X. When the number of initial memory units X does not exceed a preset number, determine the content related to the event in the memory units other than the first initial memory unit in the initial memory unit X, extract the summary information of the content, add the summary information to the first initial memory unit, obtain the memory unit corresponding to the event, and delete the content related to the event in the memory units other than the first initial memory unit.
[0091] When the number of initial memory units X exceeds a preset number, the multiple initial memory units X are processed a second time, that is, the multiple initial memory units X are divided equally, the first part is retained, the summary information of the other parts is extracted, and the summary information is added to the first part to obtain the memory unit corresponding to the event.
[0092] When the content length N > M of a single event, multiple initial memory units X can be divided equally into (N / M) + 1 parts, resulting in multiple parts. The remaining (N / M) parts, excluding the first part, are simplified into summary content of length MN / [(N / M) + 1]. Simultaneously, the summary content is merged into the first part to obtain the memory unit corresponding to the event, ensuring the coherence of the memory context. Here, () represents the floor function.
[0093] For example, assuming M=100 and N=250, where the numerical unit is the number of text units (tokens), the initial memory unit X is re-divided into [250 / 100]+1=3 parts. The second and third parts are compressed, and their summary content is extracted. The length of the extracted summary is limited to 100-250 / [(250 / 100)+1]=17.
[0094] The first document usually contains the key information about the event, so it should be retained first. The other documents are usually more detailed descriptions and can be presented as summaries.
[0095] Figure 4This is a schematic diagram illustrating an example of content adjustment via a summary method provided in the embodiment. Memory units 1-5 are initial memory units obtained by dividing the original memory content into overlapping blocks using a sliding window approach. Events a and b are two events obtained by dividing the aforementioned memory content into event-level segments according to event themes. Event a corresponds to memory units 1 and 2, and event b corresponds to memory units 2-5.
[0096] Assuming the preset quantity is 3, if the number of memory units corresponding to event a does not exceed the preset quantity, the text content between boundary T and boundary W can be added to memory unit 1 in the form of a summary, and the updated memory unit 1 can be used as the memory unit corresponding to event a.
[0097] If the number of memory units corresponding to event b exceeds the preset number, then memory units 2-5 can be processed a second time. They can be divided equally, the content of the first portion is retained, and the content summaries of the other portions are extracted and added to the first portion. The updated first portion is then used as the memory unit corresponding to event b. Simultaneously, the division method of memory units 2-5 can be deleted.
[0098] The length of the memory units obtained through steps 1 to 3 is controlled within a certain range, which facilitates storage and retrieval and reduces space waste.
[0099] Step S320: Input the summary prompt2 into the large model N2 to obtain several key facts corresponding to any memory unit.
[0100] The summary prompt2 comprises several memory units and a fourth task description. When constructing the summary prompt2, the corresponding memory units and fourth task description can be determined, and the prompt is constructed based on these determined memory units and fourth task descriptions. Specifically, a corresponding summary prompt2 can be constructed for each memory unit, in which case it contains one memory unit. Alternatively, a summary prompt2 can be constructed for multiple memory units, in which case it contains all those memory units.
[0101] Specifically, a corresponding prompt template can be constructed based on the placeholders of the determined memory units and the fourth task description, such that the prompt template contains the placeholders for the memory units and the text of the fourth task description. When the summary prompt word prompt2 needs to be constructed, the text of the memory unit is filled into the placeholders of the prompt template.
[0102] The fourth task description instructs you to extract and summarize the core content from the contents of any given memory unit, resulting in several key facts. The maximum sequence length of each key fact can be specified in the fourth task description text. Typically, key facts are phrases or sentences, and their sequence length is much shorter than that of a typical memory unit.
[0103] All memory units can be input into the large model N2 only once, without the need for multiple extractions and inputs, thus not causing a large amount of token consumption.
[0104] Step S330: Store several memory units and corresponding key facts in a memory bank. The memory bank is used to store the correspondence between multiple memory units and key facts.
[0105] Alternatively, instead of directly storing key facts in the memory bank, you can store the corresponding numbers for each key fact. For example, you can use serial numbers as a substitute for key facts.
[0106] In one implementation, the large model N2 can be derived from a model with a small number of parameters to improve computational speed.
[0107] According to cognitive science theory, when making decisions, humans often first recall the general content and thought framework based on summary memory, and then conduct further in-depth exploration and reflection based on the degree of completion of the problem. Based on this thinking pattern, this embodiment designs event-level segmentation and key directory extraction.
[0108] Before a memory segment is incorporated into the memory bank, the segmentation model N1 first divides it into event-level subdivisions based on topics, ensuring that each memory unit tells the same story as much as possible. This is done to guarantee the integrity of the narrative of the same event and to avoid overly discrete storage in the memory space.
[0109] For each memory unit, this embodiment performs a fine-grained breakdown of key events at the atomic level. Specifically, the extraction model N2 is used to abstract and refine all core content in the memory unit, including event overviews, keywords, themes, and data features, into concise phrases or sentences, thereby forming a highly summarized content index. This method provides a structured index foundation for the subsequent self-retrieval process of the retrieval model N3.
[0110] The following will continue to combine Figure 5 The problem reasoning stage will be explained. This stage uses key facts to deduce the answer to the problem.
[0111] Figure 5This is a flowchart illustrating a method for executing tasks using an intelligent agent based on memory content, provided in an embodiment. The method is executed by a computing device, specifically by an intelligent agent. When the intelligent agent receives a user task, if the user task is complex, it can decompose it into several subtasks, identifying any subtask that can be answered based on memory content as the first question Q0 to be answered. Once the first question Q0 is determined, it can be used as the initial current question, and the answer to the first question Q0 can be determined through several iterations. For other subtasks that can be answered based on memory content, the same processing is performed to obtain their answers. When the user task is simple and can be answered directly using memory content, the user task can be directly used as the first question Q0.
[0112] The first question, Q0, can be a single-hop problem or a multi-hop problem. A single-hop problem is one in which the answer can be obtained directly from the knowledge base or memory through a single information retrieval or reasoning step. For example, "What's the weather like today?" is a single-hop problem.
[0113] Multi-hop problems are those that require combining multiple pieces of relevant information and going through two or more information retrieval or reasoning steps to arrive at the final answer. For example, "The author of book xx was born in which city?" is a multi-hop problem; to answer it, you need to first find the author of the book and then find their birthplace.
[0114] Determining the answer to the first question Q0 may require multiple iterations. Each iteration includes the following steps.
[0115] Step S510: Based on the current question, multiple key facts, and the first task description, construct the search prompt term prompt3. Input the search prompt term prompt3 into the large search model N3 to obtain the target key facts, which are used as the target memory content Mi. In the first iteration, the first question Q0 is used as the current question.
[0116] Several key facts represent the memory content. These key facts correspond to several memory units, which are extracted and summarized from these memory units. Each memory unit corresponds to several events, and the memory content is divided into blocks according to the themes of the events.
[0117] The search prompt3 includes the current question, several key facts, and a primary task description. When constructing the search prompt3, the current question, several key facts, and the primary task description can be identified, and the prompts are constructed based on this information.
[0118] Specifically, a corresponding prompt template can be constructed based on the placeholders for the current question, multiple key facts, and the description of the first task. This prompt template should contain the placeholders for the current question, the text of the multiple key facts, and the text of the first task description. When constructing the search prompt term (prompt3), the current question is determined, and the text of the current question is filled into the placeholders in the prompt template.
[0119] The first task description instructs the retrieval of a target key fact from a pool of key facts that is relevant to the current problem. The target key fact may be one or more. Relevance may include semantic similarity, or it may include relevance in terms of semantic similarity and logical connection between entities.
[0120] When retrieving multiple key facts, they can be obtained from a memory or from a stored list of data.
[0121] Figure 6 This is a schematic diagram illustrating an example of the retrieval process provided in this embodiment. The current question is "Is there any anomaly in Zhang San's financial report for June?", and the corresponding retrieval suggestion term prompt3 is:
[0122] We need to determine if there are any anomalies in Zhang San's financial report for June. Please retrieve the relevant items from the following list of key facts. Requirements: Relevant from semantic, entity logic, and other possible perspectives. List of Key Facts: 1. Agent's identity, 2. Zhang San's financial report, ..., 95. Company xx's rules and regulations, 96. Li Si's attendance, ..., 150. Mid-term performance review, ...
[0123] Inputting the search suggestion term prompt3 into the large-scale retrieval model N3, the target key fact obtained from the search results is "2. Zhang San's financial report". The process of constructing the search suggestion term prompt3, inputting it into the large-scale retrieval model N3, and obtaining the search results can be constructed as a self-retrieval module. The obtained target key fact can be used to retrieve the corresponding original text from the memory database.
[0124] This step involves inputting multiple key facts into the large retrieval model N3, enabling it to search within the retrieval space corresponding to these key facts. This significantly reduces the total consumption of text unit tokens. Thanks to... Figure 3 The concise and efficient memory content processing method in this embodiment significantly compresses the original lengthy and redundant context retrieval space. With a small amount of data on multiple key facts and a limited number of text unit tokens, this process significantly improves retrieval accuracy and efficiency, enabling large models to more specifically and quickly identify potentially high-value information, contributing positive feedback to the final answer generation.
[0125] If the memory content is processed globally all at once (Full context), or if the memory content to be processed is divided into N blocks and then input into the retrieval model N3, then the entire context needs to be processed serially for each question-and-answer retrieval, with a time complexity of O(N). When multiple key facts are input into the retrieval model N3, the retrieval and reasoning processes can be performed in parallel, and the time complexity of each question-and-answer retrieval is at the constant level of O(1).
[0126] In this step, prompt words enable the large model to match from possible relevance perspectives such as semantics and logic, achieving more accurate positioning of potential answers and comprehensively mining knowledge fragments closely related to the question, thereby more completely supporting the answer generation process.
[0127] Step S520: Construct a reasoning prompt 4 based on the first question Q0 and the current memory content mi, and input the reasoning prompt 4 into the reasoning model N4 to obtain the answer to the first question Q0 or a new question.
[0128] The reasoning prompt4 includes the first question Q0, the current memory content mi, and the second task description. When constructing the reasoning prompt4, the current memory content mi and the second task description can be determined, and the prompt is constructed based on these determined elements.
[0129] Specifically, a corresponding prompt template can be constructed based on the placeholders corresponding to the first question Q0 and the current memory content mi, as well as the description of the second task. This prompt template should contain the placeholders for the first question Q0 and the current memory content mi, and the text of the second task description. When constructing the inference prompt word prompt4, the text of the first question Q0 and the current memory content mi is filled into the placeholders in the prompt template.
[0130] Alternatively, a corresponding prompt template can be constructed based on the placeholders corresponding to the current memory content mi, the text of the first question Q0, and the text of the second task description. This prompt template would contain the placeholders for the current memory content mi, the text of the first question Q0, and the text of the second task description. When the inference prompt word prompt4 needs to be constructed, the text of the current memory content mi is filled into the placeholders of the prompt template.
[0131] The current memory content is determined based on the previous memory content mi-1 and the target memory content Mi. In the initial iteration, the previous memory content mi-1 can be replaced by k short-term memories. The k short-term memories can be understood as the most recent questions or answers in the current session, which can be used to enhance the context of the first question Q0.
[0132] The target memory content Mi can be a key target fact, or it can be a key target fact and its corresponding target memory unit. In practical applications, the target memory unit corresponding to the key target fact can be determined from several memory units contained in the memory bank.
[0133] When determining the current memory content mi, the previous memory content mi-1 and the target memory content Mi can be directly used as the current memory content mi. Alternatively, the content related to the first problem Q0 can be summarized from the previous memory content mi-1 and the target memory content Mi by summarizing the large model N5, and used as the current memory content mi. The large model N5 can be included in the agent.
[0134] Specifically, a summary prompt word (prompt5) can be constructed and input into the summary model N5 to obtain the current memory content (mi). The summary prompt word (prompt5) includes the first question (Q0), the previous memory content (mi-1), the target memory content (Mi), and a fifth task description. The fifth task description is used to indicate how to summarize the current memory content (mi) related to the first question (Q0) from the previous memory content (mi-1) and the target memory content (Mi).
[0135] The process of constructing the summary prompt word prompt5 can be found in the documentation on the construction methods of other prompt words, and will not be repeated here.
[0136] The second task description is used to indicate: determine whether the current memory content mi satisfies the answer conditions of the first question Q0. If it does, determine the answer to the first question Q0 based on the text of the current memory content mi; if it does not, determine the missing information based on the current memory content mi, and generate a new question Q′ based on the missing information.
[0137] Any iteration can contain two sub-iterations. In the first sub-iteration, the key facts of the target are used as target memory content Mi to perform the reasoning process of step S520. If the reasoning model N4 cannot obtain the answer to the question, no new question is generated, and the second sub-iteration is performed. The key facts of the target and the corresponding target memory units are used as target memory content Mi to perform the reasoning process. If no answer is obtained, a new question is determined. If the answer to the question is obtained in the first sub-iteration, the second sub-iteration is not performed.
[0138] The target memory unit contains more original information and more information than key facts, making it easier to obtain the answer to the question when it is used as the target memory content Mi. Conversely, using target key facts as the target memory content Mi can reduce the number of tokens and improve processing speed.
[0139] Step S530: Update the new question Q′ to the current question, and return to the step S510 in which the search prompt term prompt3 was input into the large search model N3.
[0140] In the process of human thinking based on memory, we often first recall memories directly related to the question and attempt to abstract them into the required answer. However, for multi-step or more complex questions, this process is often not a one-time event. During recall and question-and-answer sessions, some implicit, dependent questions often do not appear explicitly in the original question, or as the question deepens, more advanced questions (new questions) may arise. This embodiment mimics the human thinking pattern and designs a dynamic model self-reflection paradigm, which can be divided into three stages: summarizing, reflecting, and generating.
[0141] Specifically, the state can be defined as Ti = {Q0, mi} for the first question Q0 and the current memory content mi. Let the state of the first iteration be T0 = {Q0, m0}, where Q0 is the initial first question, and the initial m0 is either empty or the k most recent short-term memories. The AI will first call the retrieval model N3 based on the first question Q0 to retrieve the target memory content needed for the first round.
[0142] M0 = R(Q0) (1)
[0143] Then, the summary model N5 will be invoked to extract the required parts from m0 and M0 based on the first question Q0 and generate the current memory content m1:
[0144] m1=S(Q0,m0,M0) (2)
[0145] Based on m1, the large reasoning model N4 determines whether the current state T1={Q0, m1} satisfies the question answering conditions.
[0146] If the conditions are not met, the process enters a reflection phase, and the state parameter `finished` is marked as `False`. The large-scale reasoning model N4 independently considers what information is missing in the current state and identifies new questions to initiate the next round of retrieval, filling in the knowledge gaps discovered in the previous round.
[0147] As the reasoning progresses, the initially complex problem is gradually broken down into a series of single-hop atomic problems: a new problem Q′={q1,q2,q3,…}. Let the state at the i-th reasoning step be Ti = {Q0, mi}, where…
[0148] mi=S(Q0,mi-1,Mi-1) (3)
[0149] Here, mi-1 represents the previous memory content. If the current memory content mi is sufficient to answer the first question Q0, the finished state is set to True and the answer is returned, ending the reasoning process. To prevent the model from getting stuck in an infinite loop due to misunderstanding the question, a maximum number of retrievals t can be set. When i=t, finished is forcibly set to True, and the large reasoning model N4 provides the answer based on the current memory content mi.
[0150] In other words, a retrieval count is maintained during the iteration process. In S510, after inputting the retrieval prompt3 into the retrieval model N3, the retrieval count is updated. When the retrieval count reaches the preset count, i.e., the maximum retrieval count t, the final inference prompt6 is input into the inference model N4 to obtain the answer to the first question Q0.
[0151] The final reasoning prompt, prompt6, includes the first question Q0, the current memory content mi, and the sixth task description. The current memory content mi is determined based on the previous memory content and the target memory content Mi; the determination process can be found in the explanation above. The sixth task description is used to instruct on determining the answer to the first question Q0 based on the current memory content mi.
[0152] Step S540: Perform the above user task based on the answer to the first question Q0.
[0153] When a user task is broken down into multiple subtasks, the answers to the subtasks can be determined using the memory content through the steps S510~S530 above; based on the obtained answers, the tool or application call continues to be executed to complete the execution of the user task.
[0154] For example, a user task is "Please help me book a flight to Hangzhou in the next two days." The subtasks that break this down can include:
[0155] Check the weather forecast for the next two days;
[0156] Inquire about users' preferences for airplane seats;
[0157] I booked a flight on xxapp based on the information I found.
[0158] Through steps S510 to S530, the answer 1 for "checking the weather for the next two days" and the answer 2 for "checking the user's preference for airplane seats" are determined respectively. Based on the answers 1 and 2, the xxapp is invoked to book the flight tickets on the xxapp.
[0159] If the user's task is "Are there any abnormalities in Zhang San's financial statements since he joined the company?", the answer can be directly pushed to the user, thus completing the task.
[0160] In this embodiment, the model self-retrieval and reflective reasoning processes are decoupled into two parts, and the judgment of complex logical relationships between memories is uniformly summarized and executed by the reflective reasoning process. Due to the atomic design of the key fact catalog content, its number of tokens is small, allowing the self-retrieval and reflective reasoning processes to be processed in parallel. Since the number of tokens in the input model is small, steps S510 and S520 can be executed in parallel, improving processing efficiency.
[0161] Figure 7 This is a schematic diagram illustrating an example of the reasoning process provided in the embodiment. The first question, Q0, is "Are there any anomalies in Zhang San's financial statements since he joined the company?" This is a multi-hop question. Initially, based on the first question Q0, the self-retrieval module retrieves the target key fact "Zhang San joined the company at the end of May" from multiple key facts. The first question Q0 and the target key fact are input into the large-scale reasoning model N4. The large-scale reasoning model N4 determines that an answer cannot be given at present and generates a new question Q1: "Are there any anomalies in Zhang San's financial statements for June?"
[0162] Based on the new question Q1, the target key fact "Zhang San's financial report in June" is retrieved from multiple key facts using the self-retrieval module. Based on this target key fact, the specific content of Zhang San's financial report in June is retrieved from the memory bank, and the current memory content is updated to: Zhang San joined the company at the end of May, and Zhang San's financial report in June is as follows...
[0163] Based on the current memory content, the reasoning model N4 is invoked to continue the judgment. The reasoning model N4 gives a new question Q2: "What are the judgment rules for financial statement anomalies?"
[0164] Based on the new question Q2, the target key fact, "judgment rules for financial statement anomalies," is retrieved from multiple key facts using a self-retrieval module. The specific content of the judgment rules for financial statement anomalies is then obtained from the memory based on this target key fact, and the current memory content is updated to: Zhang San joined the company at the end of May, and Zhang San's financial statement for June is as follows…, and the judgment rules for financial statement anomalies are as follows….
[0165] Based on the current memory content, the reasoning model N4 is invoked to continue the judgment. The reasoning model N4 gives the answer: "Zhang San's financial reports since joining the company have not shown any abnormalities."
[0166] In another embodiment of this application, when the amount of memory content data is small, the segmented memory content or the original memory content can also be used as the data of the target space for retrieval.
[0167] In this embodiment, in step S510, a search prompt word prompt3 is constructed based on the current question, the memory content, and the first task description. The search prompt word prompt3 is input into the large search model N3 to obtain the target memory content Mi.
[0168] In the first iteration, the first question Q0 is set as the current question. The search prompt 3 includes the current question, the memory content, and the first task description, which indicates that the target memory content Mi related to the current question should be retrieved from the memory content.
[0169] In step S520, a reasoning prompt word prompt4 is constructed based on the first question Q0 and the current memory content. The reasoning prompt word prompt4 is input into the reasoning model N4 to obtain the answer to the first question Q0 or a new question.
[0170] The reasoning prompts include the first question Q0, the current memory content mi, and the second task description. The current memory content mi is determined based on the previous memory content mi-1 and the target memory content Mi. The second task description indicates: when the current memory content mi satisfies the answer conditions for the first question Q0, the answer to the first question Q0 is determined; when the current memory content mi does not satisfy the answer conditions, the missing information is determined based on the current memory content mi, and a new question Q′ is generated based on the missing information.
[0171] The method described in this application was tested and evaluated on the open-source dataset LoCoMo. LoCoMo is an open-source dataset specifically designed to evaluate the long-term dialogue memory capabilities of large language models. Previous datasets typically contain only 4 to 5 conversations with a total of approximately 1,000 tokens, while LoCoMo provides much longer conversations, averaging up to 9,000 text units per turn, and spanning up to 35 conversations. Therefore, it is particularly suitable for testing a model's ability to handle long-distance dependencies and maintain consistency in long-duration dialogues. The LoCoMo dataset includes various question types: Single-Hop questions, which can be answered directly from a single conversation; Multi-Hop questions, which require integrating information across multiple conversations to solve; Open Domain questions, which examine the model's understanding of time-related information; and Temporal questions, which require the model to make comprehensive judgments by combining dialogue context with external knowledge. The first question Q1 in this application can be any of the above types of questions.
[0172] The experimental process of this application uses the gpt-4.1-mini model as the basic model of the memory system. Based on the evaluation LLM, the processing effect of the method of this embodiment on four tasks on the LoCoMo dataset is evaluated, and the evaluation effect of existing agent architectures (A-Mem, Mem0, MIRIX) on the LoCoMo dataset is compared, as shown in Table 1.
[0173] Table 1
[0174]
[0175] Table 1 shows the average accuracy of the question answers. For example, the first value, "39.79," represents the average accuracy when using the A-Mem agent architecture to predict all single-hop questions in the LoCoMo dataset. A higher value indicates a better agent performance. The experimental results in Table 1 demonstrate that the method in this application comprehensively outperforms existing state-of-the-art (SOTA) methods. Average Accuracy
[0176] In summary, the method in this embodiment, by constructing a key directory and combining it with the LLM autonomous retrieval mechanism, significantly improves the hit rate of the retrieval module while reducing storage costs, thereby enhancing the reliability of contextual information when the model responds.
[0177] Furthermore, the embodiment employs an atomic-level cataloging strategy and decouples the retrieval and reflection modules in its design. This parallel processing paradigm of retrieval modules and continuous interaction between retrieval and reflection modules enables reliable reasoning without information loss with only constant-time complexity.
[0178] Regarding the potential logical relationships within memory units, this embodiment shifts the explicit construction of logical relationships between memory entities from the memory storage stage to the self-reflective stage during model reasoning. The model constructs valid relational links based on its own state and returns them as new questions. Through this design, large models can still flexibly explore the memory space based on the potential logical relationships between different memory units during reasoning, without maintaining additional memory content processing strategies. This significantly reduces system implementation and maintenance costs while preserving reasoning capabilities.
[0179] The above embodiments are different implementations based on the same inventive concept. When describing the various embodiments, the focus is on illustrating the differences between the embodiments. The same or corresponding parts of the various embodiments can be referred to each other.
[0180] It is understood that before or during the use of the technical solutions of the various embodiments in this disclosure, users will be informed of the type, scope of use, and usage scenarios of the personal information involved in an appropriate manner in accordance with relevant laws and regulations, and user authorization will be obtained.
[0181] For example, upon receiving a user's active request, a prompt message is sent to the user to explicitly inform them that the requested operation will require the acquisition and use of the user's personal information. This allows the user to independently choose, based on the prompt message, whether to provide personal information to the software or hardware such as electronic devices, applications, servers, or storage media performing the operations of this disclosed technical solution.
[0182] As an optional but not limited implementation, in response to a user's active request, sending a prompt message to the user can be done via a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0183] It is understood that the above notification and user authorization process are merely illustrative and do not constitute a limitation on the implementation of this disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of this disclosure.
[0184] In this specification, the terms "first" in phrases such as "first task description" and "first problem," as well as the corresponding "second" (if any) in the text, are used merely for the convenience of distinction and description, and do not have any limiting meaning.
[0185] The foregoing description describes specific embodiments of this specification; other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than those shown in the embodiments, and the desired result may still be achieved. Furthermore, the processes depicted in the drawings do not necessarily need to follow the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
[0186] Figure 8 This is a schematic block diagram of an intelligent agent task execution device based on memory content, provided for an embodiment. This device embodiment is similar to... Figure 3 and Figure 5The method embodiment shown corresponds to this. The intelligent agent includes a retrieval big model and a reasoning big model. The device 800 is deployed in a computing device and includes a memory retrieval module 810, an answer reasoning module 820, a question update module 830, and a task execution module 890. The memory retrieval module 810 is configured to input retrieval prompts into the retrieval big model to obtain target memory content. The retrieval prompts include the current question, the memory content, and a first task description. The first task description indicates that target memory content related to the current question should be retrieved from the memory content. The first question to be answered is used as the initial current question, which is obtained based on the user task to be executed. The answer reasoning module 820 is configured to input reasoning prompts into the reasoning big model to obtain the answer to the first question or a new question. The reasoning prompts include the first question, the current memory content, and a second task description. The current memory content is determined based on the previous memory content and the target memory content. The second task description indicates that: when the current memory content meets the answer conditions for the first question, the answer to the first question is determined; when the current memory content does not meet the answer conditions, the missing information is determined based on the current memory content, and a new question is generated based on the missing information. The question update module 830 is configured to update the current question with a new question and return to execute the input of search suggestions into the large search model. The task execution module 890 is configured to execute the user task based on the answer to the first question.
[0187] In one implementation, the apparatus 800 further includes a task determination module 840 and a prompt construction module 850. The task determination module 840 is configured to determine a first task description such that the first task description is used to instruct the retrieval of target memory content related to the current question from the memory content. The relevance includes semantic similarity and logical correlation between entities. The prompt construction module 850 is configured to construct search prompts based on the current question, the memory content, and the first task description.
[0188] In one implementation, the prompt construction module 850 includes an acquisition submodule 51 and a construction submodule 52. The acquisition submodule 51 is configured to acquire multiple key facts. These multiple key facts correspond to several memory units, and are extracted and summarized from these memory units. Each memory unit corresponds to several events, and the memory content is divided into blocks according to event themes. The construction submodule 52 is configured to construct search prompts based on the current problem, the multiple key facts, and a first task description, such that the search prompts include the current problem, the multiple key facts, and the first task description. The first task description is used to indicate the retrieval of target key facts related to the current problem from the multiple key facts. The memory retrieval module 810 is specifically configured to input search keywords into a large retrieval model to obtain target key facts.
[0189] In one implementation, the acquisition submodule 51 includes a segmentation unit 51_1 and a refinement unit 51_2. The segmentation unit 51_1 is configured to input segmentation prompts into a large segmentation model to obtain several memory units. The segmentation prompts include memory content and a third task description, which instructs the memory content to be divided into event-level blocks according to event themes, obtaining memory units corresponding to several event themes respectively. The refinement unit 51_2 is configured to input summarization prompts into a large refinement model to obtain several key facts corresponding to any memory unit. The summarization prompts include several memory units and a fourth task description, which instructs the extraction and summarization of core content from the content contained in any memory unit to obtain several corresponding key facts.
[0190] In one implementation, the acquisition submodule 51 further includes a construction unit 51_3. The construction unit 51_3 is configured to construct segmentation prompts using the following operations: determining a third task description, and constructing segmentation prompts based on the memory content and the third task description. Specifically, the third task description instructs the following operations: dividing the memory content into event-level segments according to event themes to obtain content boundaries for several events; dividing the memory content into segments using a sliding window overlapping block method to obtain several initial memory units; and adjusting the content of the several initial memory units according to the content boundaries of the several events to obtain memory units corresponding to the several event themes.
[0191] In one implementation, adjusting the content of the plurality of initial memory units according to the content boundaries of the plurality of events includes: determining the content to be adjusted from the plurality of initial memory units according to the content boundary of any one event, processing the content to be adjusted by extracting a content summary, and obtaining memory units corresponding to the themes of the plurality of events.
[0192] In one implementation, the agent further includes a large summarization model, and the device 800 further includes a memory summarization module 860. The memory summarization module 860 is configured to determine the current memory content by: constructing a summary prompt, inputting the summary prompt into the large summarization model, and obtaining the current memory content. The summary prompt includes a first question, previous memory content, key facts of the target, and a fifth task description. The fifth task description is used to indicate how to summarize the current memory content related to the first question from the previous memory content and the key facts of the target.
[0193] In one implementation, the memory summarization module 860, when constructing the summary prompt, includes: determining a target memory unit corresponding to the target key fact from the plurality of memory units, and constructing a summary prompt based on the target memory unit. Specifically, the summary prompt includes a first question, previous memory content, target key fact, target memory unit, and a fifth task description. The fifth task description is used to indicate how to summarize the current memory content related to the first question from the previous memory content, target key fact, and target memory unit.
[0194] In one implementation, the device 800 further includes a count update module 870 and a reasoning termination module 880. The count update module 870 is configured to update the search count after the search prompts are input into the large search model. The reasoning termination module 880 is configured to input a termination reasoning prompt into the large reasoning model when the search count reaches a preset number, thereby obtaining the answer to the first question; the termination reasoning prompt includes the first question, the current memory content, and a sixth task description, where the current memory content is determined based on the previous memory content and the target memory content, and the sixth task description is used to indicate the answer to the first question based on the current memory content.
[0195] The above-described apparatus embodiments correspond to the method embodiments, and detailed descriptions can be found in the description of the method embodiments section, which will not be repeated here. The apparatus embodiments are derived based on the corresponding method embodiments and have the same technical effects as the corresponding method embodiments; detailed descriptions can be found in the corresponding method embodiments.
[0196] This specification also provides a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to perform... Figures 1 to 7 Any one of the methods described.
[0197] This specification also provides a computing device, including a memory and a processor, wherein the memory stores executable code, and the processor executes the executable code to implement... Figures 1 to 7 Any one of the methods described.
[0198] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the embodiments for storage media and computing devices are basically similar to the method embodiments, so they are described more simply; relevant parts can be referred to the descriptions of the method embodiments.
[0199] Those skilled in the art will recognize that the functions described in the embodiments of the present invention in one or more of the above examples can be implemented using hardware, software, firmware, or any combination thereof. When implemented in software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or code on a computer-readable medium.
[0200] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above descriptions are merely specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, or improvements made based on the technical solutions of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for executing intelligent agent tasks based on memory content, wherein the intelligent agent includes a retrieval model and an inference model, and the method is executed through several rounds of iteration, wherein any one round of iteration includes: Input the search suggestions into the search model to obtain the target memory content; The search prompts include the current question, the memory content, and the first task description, wherein the first task description is used to indicate the retrieval of target memory content related to the current question from the memory content; The first question to be answered serves as the initial current question, which is derived from the user task to be performed. Inputting reasoning prompts into a large reasoning model yields either the answer to the first question or a new question. The reasoning prompts include the first question, current memory content, and a second task description. The current memory content is determined based on the previous memory content and the target memory content. The second task description indicates: when the current memory content satisfies the answer conditions for the first question, the answer to the first question is determined; when the current memory content does not satisfy the answer conditions, missing information is determined based on the current memory content, and a new question is generated based on the missing information. Update the new question to the current question, and return to the step of inputting search suggestions into the large search model; Perform the user task based on the answer to the first question.
2. The method according to claim 1, wherein the search suggestion terms are constructed in the following manner: determining a first task description, such that the first task description is used to instruct to retrieve target memory content related to the current question from the memory content; wherein, The relevance includes relevance in terms of semantic similarity and logical relationship between entities; The search suggestion words are constructed based on the current problem, the memory content, and the first task description.
3. The method according to claim 2, wherein the step of constructing the search suggestion words includes: Obtain multiple key facts; these key facts correspond to several memory units respectively, and are extracted and summarized from these memory units, which correspond to several events respectively, and are obtained by dividing the memory content into blocks according to the event themes; Based on the current problem, multiple key facts, and the first task description, search suggestions are constructed such that the search suggestions include the current problem, the multiple key facts, and the first task description, wherein the first task description is used to indicate the retrieval of target key facts related to the current problem from the multiple key facts; The step of inputting search suggestions into the search model to obtain target memory content includes: inputting the search keywords into the search model to obtain target key facts.
4. The method according to claim 3, wherein the step of obtaining multiple key facts includes: Input the segmentation prompts into the large segmentation model to obtain several memory units; The segmentation prompt includes the memory content and a third task description. The third task description is used to instruct the memory content to be divided into event-level blocks according to event topics, so as to obtain memory units corresponding to several event topics respectively. The summary prompts are input into the large model to obtain several key facts corresponding to any memory unit. The summary prompts include several memory units and a fourth task description. The fourth task description is used to indicate that for any memory unit, the core content is extracted and summarized from the content contained in the memory unit to obtain several corresponding key facts.
5. The method according to claim 4, wherein the segmentation prompt words are constructed in the following manner: A third task description is determined such that the third task description is specifically used to instruct the following operations: dividing the memory content into event-level segments according to event themes to obtain content boundaries of several events; dividing the memory content into segments using a sliding window overlapping block method to obtain several initial memory units; adjusting the content of the several initial memory units according to the content boundaries of the several events to obtain memory units corresponding to several event themes; The segmentation prompts are constructed based on the memory content and the third task description.
6. The method according to claim 5, wherein the step of adjusting the content of the plurality of initial memory units according to the content boundaries of the plurality of events includes: Based on the content boundary of any event, determine the content to be adjusted from the plurality of initial memory units; By extracting content summaries, the content to be adjusted is processed to obtain memory units corresponding to several event themes.
7. The method according to claim 3, wherein the agent further comprises a summary model, and the current memory content is determined in the following manner: Construct summary prompts such that the summary prompts include the first question, the previous memory content, the target key fact, and a fifth task description, wherein the fifth task description is used to indicate how to summarize the current memory content related to the first question from the previous memory content and the target key fact; Input the summary prompts into the summary model to obtain the current memory content.
8. The method according to claim 7, wherein the step of constructing summary prompts includes: From the plurality of memory units, determine the target memory unit corresponding to the target key fact; A summary prompt is constructed based on the target memory unit, such that the summary prompt specifically includes the first question, the previous memory content, the target key fact, the target memory unit, and a fifth task description, wherein the fifth task description is used to indicate how to summarize the current memory content related to the first question from the previous memory content, the target key fact, and the target memory unit.
9. The method according to claim 1, further comprising, after inputting search suggestions into the search model: Update search count; When the number of searches reaches a preset number, the final reasoning prompt is input into the reasoning model to obtain the answer to the first question; The final reasoning prompt includes the first question, the current memory content, and the sixth task description. The current memory content is determined based on the previous memory content and the target memory content. The sixth task description is used to indicate the answer to the first question based on the current memory content.
10. A memory-based agent task execution device, the agent comprising a retrieval model and a reasoning model, the device comprising: The memory retrieval module is configured to input search suggestions into the retrieval model to obtain the target memory content; The search prompts include the current question, the memory content, and the first task description, wherein the first task description is used to indicate the retrieval of target memory content related to the current question from the memory content; The first question to be answered serves as the initial current question, which is derived from the user task to be performed. The answer reasoning module is configured to input reasoning prompts into a large reasoning model to obtain the answer to the first question or a new question. The reasoning prompts include the first question, current memory content, and a second task description. The current memory content is determined based on the previous memory content and the target memory content. The second task description indicates that: when the current memory content meets the answer conditions for the first question, the answer to the first question is determined; when the current memory content does not meet the answer conditions, the missing information is determined based on the current memory content, and a new question is generated based on the missing information. The question update module is configured to update the new question to the current question and then return to execute the step of inputting search suggestions into the large search model. The task execution module is configured to execute the user task based on the answer to the first question.
11. A computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to perform the method of any one of claims 1-9.
12. A computing device comprising a memory and a processor, wherein the memory stores executable code, and the processor, when executing the executable code, implements the method of any one of claims 1-9.