Processing method and apparatus
Patent Information
- Application Number
- CN202611177056.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-04
- Publication Date
- 2026-10-30
AI Technical Summary
该方式虽然能够使大语言模型获得一定的历史上下文信息,但召回得到的记忆数据可能在类型、作用以及与当前任务的匹配关系上存在差异,导致输出内容与当前任务不匹配
Smart Images

Figure CN123014178A_ABST
Abstract
Description
Technical Field
[0001] This application relates to information processing technology, and more particularly to processing methods and equipment. Background Technology
[0002] With the increasing application of Large Language Models (LLMs) in intelligent agents, dialogue systems, and task processing systems, these systems typically need to combine users' historical interaction data, historical behavior data, or other historical experience data to process the user's current input task data. To enable the LLM to generate feedback content that better meets user needs, these systems usually retrieve related historical memory data from their memory bank after obtaining the user's current task data, and then provide this retrieved historical memory data along with the current task data to the LLM.
[0003] In related technologies, the use of memory data is usually quite simple. For example, a system can recall several relevant memory data from the memory bank based on the similarity between the current task data and various historical memory data in the memory bank. Then, the recalled relevant memory data is directly concatenated with the current task data to form the input content, which is then provided to a large language model for processing. Although this method can enable the large language model to obtain some historical contextual information, the recalled memory data may differ in type, function, and matching relationship with the current task, resulting in a mismatch between the output content and the current task. Summary of the Invention
[0004] This application provides at least one processing method and device.
[0005] The technical solution of this application is implemented as follows: Firstly, this application provides a processing method, which includes at least: In response to obtaining task data, a target memory dataset corresponding to the task data is obtained, which includes at least one historical memory data point selected from the memory bank; multiple inference templates are obtained, each used to define the inference framework and memory organization method of the large language model for inference on the task data; based on the task data and the target memory dataset, a target inference template matching the task data is selected from the multiple inference templates; system prompt words are constructed based on the target inference template; and the system prompt words are provided to the large language model so that the large language model can generate feedback data for the task data based on the system prompt words.
[0006] Secondly, this application provides a processing apparatus, comprising at least: The first obtaining unit is used to obtain a target memory dataset corresponding to the task data in response to obtaining task data. The target memory dataset includes at least one historical memory data obtained from the memory bank. The second acquisition unit is used to acquire multiple inference templates. Each inference template is used to define the inference framework and memory organization method of the large language model for inference on task data. The processing unit is used to select a target inference template that matches the task data from multiple inference templates based on the task data and the target memory dataset. Construction unit, used to construct system prompts based on target reasoning template; The output unit is used to provide system prompts to the large language model, so that the large language model can generate feedback data for the task data based on the system prompts.
[0007] Thirdly, this application provides an electronic device, which includes: Input elements are used to obtain task data; A processor, in response to acquiring task data, acquires a target memory dataset corresponding to the task data, the target memory dataset including at least one historical memory data point filtered from a memory bank; based on the task data and the target memory dataset, determines a memory usage pattern matching the task data, the memory usage pattern defining the reasoning framework for the large language model to reason about the task data; processes the target memory dataset based on the memory usage pattern to generate a memory usage report, the memory usage report including memory analysis results obtained from analyzing the target memory dataset based on the reasoning framework; and based on the task data and the memory usage report, constructs prompt information for providing to the large language model; the prompt information is provided to the large language model to enable the large language model to generate feedback data for the task data based on the memory usage report. Output element, used to output feedback data.
[0008] Fourthly, this application provides a computer-readable storage medium storing a computer program or instructions that, when executed by a processor, implement the method provided in the first aspect.
[0009] Fifthly, this application provides a computer program product, which includes a computer program or instructions that, when executed by a processor, implement the method provided in the first aspect. Attached Figure Description
[0010] Figure 1 A schematic flowchart illustrating an optional memory processing method in the related technology provided in the embodiments of this application; Figure 2A schematic diagram of a first optional processing method provided in an embodiment of this application; Figure 3 A schematic diagram of a second optional processing method provided in an embodiment of this application; Figure 4 A schematic diagram of a third optional processing method provided in an embodiment of this application; Figure 5 A schematic diagram of a fourth optional processing method provided in an embodiment of this application; Figure 6 A schematic diagram of a fifth optional processing method provided in an embodiment of this application; Figure 7 A schematic diagram of a sixth optional processing method provided in an embodiment of this application; Figure 8 A schematic diagram of a seventh optional processing method provided in an embodiment of this application; Figure 9 A schematic diagram of an eighth optional processing method provided in an embodiment of this application; Figure 10 A schematic diagram of the structure of a user-based task data processing system provided in an embodiment of this application; Figure 11 This is an optional flowchart illustrating the processing procedure of the memory integration module provided in an embodiment of this application. Figure 12 This is a schematic diagram of an optional structure of the processing apparatus provided in an embodiment of this application.
[0011] It should be noted that the terms "first" and "second" mentioned above are only used to distinguish between different options and do not represent the degree of superiority or inferiority of the options or their priority in the implementation process. Detailed Implementation
[0012] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the specific technical solutions of the application will be further described in detail below with reference to the accompanying drawings of the embodiments of this application. The following embodiments are used to illustrate this application, but are not intended to limit the scope of this application.
[0013] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0014] In the following description, the terms "first," "second," and "third" are used only to distinguish different objects and do not represent a specific order of objects, nor are they constituting a chronological order. It is understood that "first," "second," and "third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.
[0015] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0016] This application provides processing methods, apparatus, devices, storage media, and computer program products. In practical applications, the processing method can be implemented by an information processing device, and the functional entities in the information processing device can be implemented collaboratively by the hardware resources of the electronic device, such as computing resources and communication resources like processors.
[0017] This application provides a processing method comprising: in response to obtaining task data, obtaining a target memory dataset corresponding to the task data, the target memory dataset including at least one historical memory data obtained from a memory bank; obtaining multiple inference templates, each inference template defining the inference framework and memory organization method of a large language model for inference on the task data; selecting a target inference template matching the task data from the multiple inference templates based on the task data and the target memory dataset; constructing system prompts based on the target inference templates; and providing the system prompts to the large language model so that the large language model generates feedback data for the task data based on the system prompts. The processing method provided in this application, after obtaining the task data, does not directly concatenate the historical memory data obtained from the memory bank with the task data and provide it to the large language model, but instead selects a target inference template matching the task data from multiple inference templates based on the task data and the target memory dataset, and constructs system prompts based on the target inference templates. Therefore, the system prompts provided to the large language model can simultaneously include a reasoning framework matching the current task and a memory organization method adapted to that framework. This allows the large language model to use the target memory dataset according to the reasoning path matching the current task, reducing the interference of irrelevant historical memory data on the model's reasoning process and improving the accuracy of utilizing historical memory data in the current task processing. Furthermore, since different reasoning templates can define different reasoning frameworks and memory organization methods, the system can select the target reasoning template based on the characteristics of the task data and the target memory dataset, enabling different types of tasks to adopt different memory usage methods. In this way, the reasoning framework and memory organization method in the system prompts can be matched with the current task, thereby reducing the interference of irrelevant historical memory data on the large language model's reasoning process, improving the accuracy of utilizing historical memory data in the current task processing, and ultimately improving the matching degree between the feedback data generated by the large language model and the current task.
[0018] Firstly, embodiments of this application provide a processing method. This method, upon obtaining user task data, can process the memory data if the task data requires access to memory data in a memory bank.
[0019] To facilitate understanding, some of the technical terms used in the embodiments are explained.
[0020] Task data: refers to the query or request content currently entered by the user, including the problem to be solved, the target description or contextual information, which is the original input that triggers the intelligent agent's memory retrieval and reasoning process.
[0021] Target memory dataset: A set of relevant historical memory data selected from the memory bank based on task data, representing the set of memories most relevant to the current task.
[0022] System Prompt: As the core input guiding the large language model to perform high-quality inference, it ensures that the LLM generates expected feedback data based on an understanding of the user's background and historical experience.
[0023] To facilitate differentiation, the memory processing methods in related technologies are explained. (Reference) Figure 1 The process may include, but is not limited to, S101 to S104 described below.
[0024] S101. The user inputs a request through the session, generating task data.
[0025] S102. Retrieve relevant memories from the memory bank based on similarity according to the task data.
[0026] S103. Send the task data and related memories to the large language model.
[0027] S104. The large language model generates corresponding feedback information based on task data and related memories.
[0028] S105. Output feedback information to the user.
[0029] The processing method provided in the embodiments of this application will be described below. The subject executing this method can be an intelligent agent, or a device or equipment on which an intelligent agent is deployed.
[0030] refer to Figure 2 As shown in Example 1, the processing method may include, but is not limited to, the following: Figure 1 S201 to S205 are shown.
[0031] S201. In response to obtaining task data, obtain the target memory dataset corresponding to the task data.
[0032] The target memory dataset includes at least one historical memory data point selected from the memory bank.
[0033] Task data refers to the query or request content currently entered by the user, which includes the problem to be solved, the description of the target, or contextual information. It is the original input that triggers the intelligent agent's memory retrieval and reasoning process.
[0034] For example, when a user asks, "I plan to switch to full-stack development this year. Should I learn React first, or prepare for the Amazon Web Services (AWS) exam first, and what are the risks?", this query text is task data. Another example is asking, "Design the architecture for a full-stack practice project," which is also typical task data.
[0035] Task data can be natural language text, structured query statements, or even multimodal input (such as images + text), but this embodiment is mainly aimed at natural language scenarios.
[0036] The core role of task data is to serve as the starting point for memory retrieval and template selection. The semantic content of task data determines the direction of subsequent memory recall and the choice of reasoning framework.
[0037] A target memory dataset refers to a collection of memory data related to task data retrieved from a memory bank. This target memory dataset can be obtained based on similarity matching, or determined based on constraints such as similarity, timeliness, and reliability.
[0038] In practice, after receiving task data, the agent first performs semantic parsing to identify key intentions and contextual information. Then, it invokes the memory retrieval module to generate a query vector based on the task data, retrieving the most relevant memory data from the memory bank as the target memory dataset.
[0039] In some implementations, after recalling the most relevant memory data, since these memory data may have conflicts and overlaps, the memory units can be conflict-resolved, deduplicated, and integrated to form a target memory dataset.
[0040] S202, Obtain multiple reasoning templates.
[0041] Each inference template is used to define the inference framework and memory organization method for the large language model to reason about task data.
[0042] Inference templates, also known as schemas, are predefined structured frameworks used to guide large language models on how to perform memory-based inference for specific types of tasks. They define the inference framework and memory organization methods for large language models to reason about task data.
[0043] In one possible implementation, each inference template contains a fixed inference instruction area and typified memory slots. The inference instruction area specifies the inference pattern that the large language model should follow, such as risk-priority, decision support, or hierarchical architecture; the memory slots define the specific memory categories that need to be filled, such as user profiles, professional skills, and goal plans.
[0044] For example, the risk-priority reasoning template numbered S2 requires the large language model to systematically identify risks before giving a conclusion, while the architecture design reasoning template numbered S4 requires the large language model to adopt a layered decomposition approach, first clarifying the interface contract and then discussing the implementation details.
[0045] Another example is the coach-guided reasoning template numbered S5. The coach-guided reasoning template numbered S5 requires the large language model not to give the answer directly, but to guide the user to deduce it themselves by asking questions.
[0046] The purpose of reasoning templates is to concretize abstract reasoning logic into executable instruction structures, and at the same time, to achieve precise memory injection through typed slots, avoiding irrelevant information from interfering with the reasoning process.
[0047] In actual implementation, the system maintains a preset reasoning template library. The reasoning template library is generated offline and fixed from historical dialogue data, and contains multiple (e.g., 6) reasoning templates covering the main task types.
[0048] The six reasoning templates mentioned above are not dynamically adjusted, but rather accumulated experiential assets, ensuring consistency and stability in each use. The technical effect of this implementation step is that, by introducing a standardized and structured reasoning framework, it significantly improves the controllability and consistency of the reasoning process in the large language model, making the output results more consistent with expectations, while providing a clear path for the organization and injection of memory.
[0049] S203. Based on the task data and the target memory dataset, select the target reasoning template that matches the task data from multiple reasoning templates.
[0050] The target reasoning template is used to instruct the target memory dataset to be organized according to the memory organization method.
[0051] In one possible implementation, the selection of the target reasoning template may be based on at least one of the following: task data, the semantic intent of the task data, and the categories of memories stored by the user.
[0052] For example, first, the system categorizes the task data by intent and maps it to candidate inference templates. For instance, for a query to evaluate a solution / identify a risk, the system would initially match the risk-priority inference template numbered S2.
[0053] Furthermore, when the intent is ambiguous, the system reads the user's existing memory and assigns a weighted score to the candidate reasoning templates according to four dimensions: whether the memory of the target plan is empty (affecting the risk-priority reasoning template number S2 or the decision support reasoning template number S3), whether there are shortcomings in professional skills (affecting the coaching-guided reasoning template number S5), whether the memory of interpersonal relationships matches the collaborative words in the query content (affecting the architecture design reasoning template number S4), and whether the historical schema usage preference exceeds the threshold (affecting frequently used reasoning templates). The reasoning template with the highest final score is selected as the target reasoning template.
[0054] For example, when a user asks me how to plan full-stack learning, the intent of the query is vague. The system detects that the user has a memory of a goal plan to transform into a full-stack developer in 2024, and the risk-priority reasoning template with the historical preference number S2 accounts for 60%. Therefore, the risk-priority reasoning template with the number S2 has the highest score and is selected.
[0055] S204. Construct system prompt words based on target reasoning template.
[0056] The system prompt is a complete instruction text generated after the target inference template is filled in. It includes an explanation of the inference mode, the filled memory context information, and the current task content.
[0057] The construction process is as follows: The system extracts the content of the reasoning instruction area of the selected target reasoning template; then, from the target memory dataset, according to the type declared in each memory slot of the target reasoning template, it filters out the matching memory data and fills it into the corresponding slot; finally, the filled target reasoning template is merged and organized with the current task data to form a complete system prompt word.
[0058] For example, for the risk-priority inference template numbered S2, the system fills the user profile, professional background, goals and constraints into the corresponding slots, and then combines them with the task data of learning React first or preparing for AWS exam to form a structured System Prompt.
[0059] S205. Provide the system prompts to the large language model so that the large language model can generate feedback data for the task data based on the system prompts.
[0060] After receiving system prompts, the large language model processes the memory data according to the constraints of the target inference template in the system prompts, and obtains processed memory data. Based on the processed data and the task data, it performs inference to generate feedback data for the task data.
[0061] For example, under the risk-priority reasoning template S2, the large language model will first list risk points such as insufficient time leading to parallel development of two lines of work, and lack of front-end practical experience potentially causing project failure, and bind them to specific memory bases. Then, it will provide mitigation strategies, such as suggesting prioritizing learning React and developing a phased plan. Another example is under the architecture design reasoning template S4, where the large language model will output a layered structure of front-end-back-data layer-infrastructure, clearly define the REST API interface contract, and suggest that Zhang Ming be responsible for the back-end and Xiao Li for the front-end, while pointing out that the learning cost of TypeScript may become a bottleneck.
[0062] In practice, this step transforms structured prompts into high-quality feedback. Guided by system prompts, the large language model moves beyond blind guessing or general answers, instead employing reasoning based on the user's historical experience and current goals to generate content that is both professional and personalized. The technical effect of this step lies in significantly improving the agent's decision-making quality, response efficiency, and user satisfaction through precise reasoning guided by memory, truly realizing the value of empowering subjective memory.
[0063] The processing method provided in this application drives memory retrieval and inference template selection based on task data. It uses a target inference template to limit the processing method of the target memory dataset, obtaining the memory data processing method most suitable for the task data. This guides the large language model to adopt the memory data processing method most suitable for the task data, thereby generating high-quality feedback data. The processing method provided in this application overcomes the limitations of blind memory processing in traditional memory systems, achieving a strong correlation between memory and task data, selecting the most suitable memory combination method for processing the task data, and improving the accuracy and efficiency of memory data usage.
[0064] In some embodiments, specifically Example 2, the multiple inference templates can be pre-defined templates, and the multiple inference models correspond to different task processing types.
[0065] In one possible approach, the service processing type includes at least two of the following: fact clarification type, risk analysis type, decision support type, architecture design type, learning guidance type, and exploratory analysis type.
[0066] The above task processing types cover six core task scenarios commonly encountered by intelligent agents in actual interactions. Each task processing type corresponds to a unique reasoning paradigm and memory utilization strategy.
[0067] For example, the fact-clarification type is suitable when users query specific concepts or information, employing exact matching reasoning; the risk analysis type is suitable when assessing the feasibility of a solution, emphasizing identifying risks before drawing conclusions. Different task processing types determine which reasoning template is subsequently selected, thus affecting the quality of the final reasoning output.
[0068] There is a strong correlation between task processing types and inference templates. Each task processing type maps to one or more predefined inference templates, which embed the inference instructions and memory slot configurations required for the corresponding task processing type. Once the system identifies the task processing type based on the current user request, it can directly load the corresponding inference template.
[0069] In practical applications, when a user asks, "I plan to switch to full-stack development this year. Should I learn React first or prepare for the AWS exam? What are the risks?", the system identifies this question as a risk analysis task and automatically loads a risk analysis-type inference template. This template contains inference instructions that first identify risks and then draw conclusions, and sets memory slots for user profiles, professional backgrounds, goals, and constraints. The system retrieves the corresponding type of memory from the memory bank and fills it in, ultimately forming a complete prompt input to the large language model. This process ensures that the inference results both meet the user's current needs and fully utilize the system's historical experience.
[0070] In this embodiment, by binding multiple inference templates with different task processing types, fine-grained control over the inference behavior of a large language model is achieved. This ensures that when faced with different types of user requests, the system in this embodiment can automatically select the most suitable inference template and memory organization method, thereby improving the accuracy and personalization of inference, and ultimately enhancing the system's memory utilization efficiency and overall interactive experience.
[0071] The generation process of reasoning templates: Reasoning templates are not fixed rules manually written by developers, but rather formed through offline mining and experience accumulation of massive amounts of historical dialogue data. First, cluster analysis is performed on a large number of historical interactions to summarize the recurring task patterns of users in different contexts (such as fact clarification, risk analysis, decision support, architecture design, learning guidance, and exploratory analysis). Then, dialogues that demonstrate high-quality reasoning results due to the reasonable use of memory are manually or mechanically labeled and selected. Their common structures (i.e., reasoning logic and the types of memory used) are extracted, and finally, these validated "reasoning instructions" and "typed memory slot configurations" are solidified into predetermined templates. The entire process is completed offline in one go, relying entirely on historical data, without real-time dynamic adjustments based on individual dialogues, ensuring the stability and generalization of the templates.
[0072] The implementation of the reasoning template will be explained below.
[0073] In some embodiments, reference Figure 3 The content shown includes multiple reasoning templates, including a reasoning instruction area and a memory filling area. Example 3 may include, but is not limited to, S301 to S306 described below.
[0074] S301. In response to obtaining task data, obtain the target memory dataset corresponding to the task data.
[0075] For specific implementation details, please refer to the detailed description in S201, which will not be repeated here.
[0076] S302, Obtain multiple reasoning templates.
[0077] Each inference template is used to define the inference framework and memory organization method for the large language model to reason about task data.
[0078] Each reasoning template includes a reasoning instruction area and a memory filling area.
[0079] The inference instruction area is used to define the inference order, inference focus, and output format of the large language model for task data.
[0080] This inference instruction area, as the core control part of the inference template, constrains and guides the inference behavior of the large language model through preset text instructions. The main functions of this area include three aspects: first, setting the inference order, such as listing risk points before providing solutions; second, clarifying the focus of inference, such as requiring consideration of user goals; and third, standardizing the output format, such as listing risks, impact modules, and mitigation strategies in bullet points. The instructions in this area are typically written in clear, structured language to ensure that the large language model can accurately understand and follow them.
[0081] The design of this inference instruction area directly impacts the inference quality of large language models. A well-designed inference instruction area can prevent large language models from making irrelevant inferences or excessive divergence, improving the accuracy and consistency of responses. Simultaneously, standardizing the output format can enhance the readability of the model's output and the efficiency of subsequent processing. For example, in technical consultation scenarios, using a unified problem-cause-solution output structure allows users to quickly obtain key information in technical consultation situations.
[0082] The memory-filling area in this inference template is a dynamic part that carries personalized data and consists of multiple memory slots. Each memory slot is assigned a specific memory category label, such as user information, professional skills, goals, and plans, and can only be filled with memory data of the corresponding category. This typified memory slot design enables precise matching and efficient utilization of memory data. For example, the goal and constraint memory slots only receive memories related to user goals and time constraints, while the collaboration context memory slots are dedicated to filling interpersonal relationship data.
[0083] This mechanism not only improves the accuracy of memory usage but also avoids interference from irrelevant information. For example, in architecture design tasks, if a memory slot is not filled with any interpersonal relationship memories, the system will not force it to be filled, thus maintaining the simplicity of the prompts.
[0084] S303. Based on the task data and the target memory dataset, select the target inference template that matches the task data from multiple inference templates.
[0085] The target reasoning template includes a target reasoning instruction area and a target memory filling area.
[0086] The target inference instruction area is used to define the inference order, inference focus, and output format of the large language model for task data.
[0087] The content of the target instruction area is different for each inference template. The target inference instructions in the target inference template are applicable to the task data, that is, they limit the inference order, inference focus and output format of the large language model for the current task data.
[0088] S304. Based on the memory category corresponding to the memory slot, determine the corresponding target memory data from the target memory dataset and fill it into the corresponding memory slot.
[0089] After determining the target reasoning template, the most relevant and matching target memory data is first retrieved and filtered from the target memory dataset according to the memory categories corresponding to each memory slot in the reasoning template. Then, this target memory data is filled into the corresponding memory slots according to their categories. This process ensures that the memory content injected into the prompts is highly consistent with the requirements of the reasoning template.
[0090] The specific implementation of this step includes: 1) parsing the memory slots and their corresponding memory categories in the inference template; 2) filtering candidate target memory data from the target memory dataset by category; 3) applying strategies such as similarity matching, time sorting, and success rate weighting to optimize the candidate target memory data from the target memory dataset; and 4) replacing the placeholders in the inference template with the selected target memory data. For example, when the inference template contains a memory slot for "Professional Background," the most recently recorded skill status will be selected from the professional ability category in the target memory dataset to fill it.
[0091] S305. Construct system prompt words based on target reasoning templates.
[0092] For specific implementation details, please refer to the detailed description in S204, which will not be repeated here.
[0093] S306. Provide the system prompts to the large language model so that the large language model can generate feedback data for the task data based on the system prompts.
[0094] For specific implementation details, please refer to the detailed description in S205, which will not be repeated here.
[0095] In this embodiment of the application, the reasoning template is divided into a reasoning instruction area and a memory filling area, and the system accurately fills the target memory data based on the memory slot category before constructing the system prompt words. This ensures that the large language model follows a preset logical framework during reasoning while fully utilizing personalized memory information, thereby generating answers that highly match the user's background and task requirements. This significantly improves the agent's reasoning depth, personalization, and practical application effectiveness.
[0096] In some embodiments, the target reasoning template is determined based on task intent. Example 4, see reference... Figure 4 The process may include, but is not limited to, S401 to 406 below.
[0097] S401. In response to obtaining task data, obtain the target memory dataset corresponding to the task data.
[0098] For specific implementation details, please refer to the detailed description in S201, which will not be repeated here.
[0099] S402, Obtain multiple reasoning templates.
[0100] Each inference template is used to define the inference framework and memory organization method for the large language model to reason about task data.
[0101] For specific implementation details, please refer to the detailed description in S202; they will not be repeated here.
[0102] S403. Determine the task intent corresponding to the task data.
[0103] Task intent refers to the core purpose or behavioral direction implied in the current user input or task request. It reflects the specific type of work the user hopes the system will accomplish, such as risk assessment, system design, or learning path planning. Identifying task intent is the first step in understanding user needs and directly influences the selection of subsequent inference templates and memory retrieval strategies.
[0104] In practical applications, task intent can be analyzed using natural language processing techniques (such as semantic classification models) to extract key verbs, target objects, and contextual features from user queries, thus mapping them to predefined intent categories. For example, when a user asks how to plan full-stack learning, the system can identify that the task intent belongs to learning path planning, thereby triggering the corresponding reasoning process. Accurate identification of task intent ensures that the system selects the most suitable reasoning framework, avoiding output content that deviates from the user's actual needs due to misjudgment.
[0105] S404. Based on the task intent, determine the target candidate reasoning template from multiple reasoning templates.
[0106] Reasoning templates are standardized prompting frameworks pre-designed for specific types of tasks, containing fixed reasoning instructions and memory slot structures. Each reasoning template corresponds to a core reasoning pattern, such as risk-prioritizing, decision support, or architecture design, and includes built-in variable placeholders for filling different types of memories (such as user profiles, professional skills, and goal plans). These reasoning templates are not manually written, but rather solidified into experience assets by extracting high-success-rate interaction patterns through cluster analysis and effect backtracking of historical dialogue data.
[0107] In this implementation, the identified task intent is directly mapped to the corresponding inference template. For example, if the task intent is determined to be solution evaluation + risk identification, the corresponding risk-priority inference template will be loaded. If the intent points to system design + technical solution, the corresponding architecture design inference template will be selected.
[0108] This mapping process enables an efficient conversion from user intent to reasoning paradigm, allowing large language models to reason within a clear thought framework, thereby improving the professionalism, logic, and personalization of the output results.
[0109] S405. Construct system prompt words based on target reasoning templates.
[0110] For specific implementation details, please refer to the detailed description in S204, which will not be repeated here.
[0111] S406. Provide the system prompts to the large language model so that the large language model can generate feedback data for the task data based on the system prompts.
[0112] For specific implementation details, please refer to the detailed description in S205, which will not be repeated here.
[0113] For example, when a user asks, "I want to do a personal project to practice full-stack development, using Python for the backend and collaborating with Xiao Li on the frontend. How should the architecture be designed reasonably?", the system first uses semantic analysis to determine that the task intent of the question belongs to the category of system design + technical solution. Then, the system automatically matches and loads an inference template, which embeds hierarchical architecture-based inference instructions and has typified slots for technical background, collaboration context, and target boundaries. Next, it retrieves memory data matching the above slot types from the target memory dataset, such as the user's programming skills, the relationship information between the user and collaborator Xiao Li, and the project's completion time constraints. The retrieved memory data is then filled into the corresponding slots, and finally, a structured system prompt text is generated and sent to the large language model. This approach not only ensures the consistency of the inference process but also effectively utilizes the user's historical memory, making the answer more relevant to the user's actual situation and preferences.
[0114] In this implementation, the task intent corresponding to the task data is first determined, and then a matching target inference template is selected based on the determined task intent. This enables a precise mapping from the user's original input to a standardized inference framework, thereby improving the system's accuracy in understanding user needs. This, in turn, enhances the professionalism, logic, and personalization of the inference output, ultimately improving user experience and task completion efficiency.
[0115] In some embodiments, determining the target reasoning template also requires a matching score of the target memory dataset, see Example 5, see reference. Figure 5 The process may include, but is not limited to, S501 to 508.
[0116] S501. In response to obtaining task data, obtain the target memory dataset corresponding to the task data.
[0117] For specific implementation details, please refer to the detailed description in S201, which will not be repeated here.
[0118] S502. Obtain multiple inference templates, each of which is used to define the inference framework and memory organization method of the large language model for reasoning on task data.
[0119] For specific implementation details, please refer to the detailed description in S202; they will not be repeated here.
[0120] S503. Determine the task intent corresponding to the task data.
[0121] For specific implementation details, please refer to the detailed description in S403; they will not be repeated here.
[0122] S504. Based on the task intent, determine the target candidate reasoning template from multiple reasoning templates.
[0123] For specific implementation details, please refer to the detailed description in S404; they will not be repeated here.
[0124] S505. If multiple candidate reasoning templates are determined from multiple reasoning templates based on task intent, the multiple candidate reasoning templates are matched and scored based on the target memory dataset.
[0125] Candidate inference templates refer to multiple inference templates that conform to semantic or structural features after initial screening based on task intent. These candidate inference templates typically come from a predefined set of schemas (such as S1-S6), and each candidate inference template corresponds to a specific task type and inference pattern.
[0126] When the task intent is ambiguous or there are multiple reasonable interpretations, several candidate reasoning templates will be returned for further filtering. For example, if a user asks how to plan full-stack learning, it may simultaneously hit the S2 risk-priority template and the S5 coaching guidance template, thus generating multiple candidate reasoning templates.
[0127] Matching scoring refers to the process of weighting and evaluating each candidate reasoning template based on key information in the target memory dataset. For example, the matching scoring mechanism combines multiple dimensions, such as: whether the target plan memory supports the S2 candidate reasoning template, whether the professional competence deficiency triggers the S5 candidate reasoning template, whether interpersonal relationship memory and collaboration words activate the S4 candidate reasoning template, and whether historical usage preferences reinforce specific types of candidate reasoning templates.
[0128] Each dimension is assigned a different weight, and the matching score of each candidate inference template is calculated. For example, in the scenario of planning full-stack learning, candidate inference template S2 receives +0.2 points for matching the target constraint of 10 hours per week and +0.1 points for high historical usage, with a matching score of 0.8; candidate inference template S5 receives +0.3 points for the weakness tag of learning React, with a matching score of 0.7; ultimately, candidate inference template S2 has the highest matching score.
[0129] In actual implementation, when the system detects multiple candidate inference templates, it calls the target memory dataset and compares them item by item across multiple weighted dimensions. For example, regarding the question of whether to learn React first or prepare for the AWS exam, the target memory dataset is read as follows: If there is a clear goal plan, candidate inference templates S2 and S3 are weighted; if there is no front-end practical experience, candidate inference template S5 is weighted; if collaboration is not mentioned, candidate inference template S4 is not weighted; if historically, candidate inference template S2 is frequently used, candidate inference template S2 is weighted with its base score. Through matching and scoring, the system achieves a transition from vague intent to precise template selection.
[0130] It should be noted that if there is only one candidate inference template, then that candidate inference template will be used directly as the target inference template.
[0131] S506. The candidate reasoning template with the highest matching score is determined as the target reasoning template.
[0132] The candidate reasoning template with the highest matching score is the one with the highest matching score among all candidate reasoning templates after weighted evaluation using the target memory dataset. The candidate reasoning template with the highest matching score represents the reasoning paradigm that best fits the current user context, memory characteristics, and historical preferences. For example, in the example above, the S2 risk-priority template, with a score of 0.8, was selected as the target reasoning template, higher than the S5 coaching guidance template's 0.7 score.
[0133] The target inference template not only matches the current query intent, but also makes full use of the target memory dataset to ensure that subsequent inference is targeted.
[0134] In practical applications, the choice of the target reasoning template directly determines the response quality of the agent. Taking the design of a full-stack project architecture as an example, if the S1 fact clarification template is mistakenly selected as the candidate reasoning template, the system will only provide conceptual explanations and ignore the architectural design requirements; if the S4 architecture design template is correctly selected as the target reasoning template, it can guide the LLM to output hierarchical structure, interface contract and responsibility division suggestions, significantly improving the practicality and personalization of the solution.
[0135] In this embodiment, after initially filtering multiple candidate reasoning templates based on task intent, a target memory dataset is introduced for matching and scoring, thereby achieving intelligent decision-making from fuzzy intent to precise template selection. This approach fully integrates the user's historical memory characteristics with current task requirements, thereby improving the accuracy and personalization of reasoning template matching, and ultimately enhancing the relevance, effectiveness, and user experience of the agent's response.
[0136] There is a close logical connection between the candidate reasoning template, the target memory dataset, the matching score, and the target reasoning template. The candidate reasoning template, as the initial candidate set, is generated driven by the task intent; the target memory dataset serves as the evaluation basis, providing personalized contextual information for the user; the matching score, as a quantification mechanism, performs a weighted comparison of the candidate reasoning templates; and the final target reasoning template serves as the decision result, guiding subsequent prompt generation and reasoning execution. This transmission chain of intent → candidate → evaluation → selection achieves a precise mapping from a general template library to a personalized reasoning path.
[0137] S507. Construct system prompt words based on target reasoning templates.
[0138] For specific implementation details, please refer to the detailed description in S204, which will not be repeated here.
[0139] S508. Provide system prompts to the large language model so that the large language model can generate feedback data for the task data based on the system prompts.
[0140] For specific implementation details, please refer to the detailed description in S205, which will not be repeated here.
[0141] In a practical system, the processing flow can include: inputting the user's plan for full-stack learning → the intelligent system identifies ambiguous intents, with candidate inference templates including the S2 risk-priority template, the S3 goal-oriented template, and the S5 coach-guided template → accessing the target memory dataset (containing 10 hours per week, no front-end experience, etc.) → calculating the matching score of each candidate inference template → the S2 risk-priority template has the highest matching score → selecting the S2 risk-priority template as the target inference template → filling the slots in the target memory dataset into the target inference template to generate a System Prompt → LLM outputting risk analysis and phased solutions. The entire process is automated and requires no manual intervention.
[0142] Through the above mechanism, not only is the passivity and static nature of traditional memory systems overcome, but the target memory dataset is also actively integrated into the decision-making process, enabling the agent to possess true subjective memory capabilities. This disambiguation strategy based on memory signals is particularly suitable for complex query scenarios with ambiguous or polysemous intent, significantly improving the agent's performance and adaptability in long-cycle, multi-round tasks.
[0143] In some embodiments, matching and scoring are performed based on memories of the target memory category, referring to... Figure 6 The content shown in Embodiment 6 may include, but is not limited to, the following S601 to S609.
[0144] S601. In response to obtaining task data, obtain the target memory dataset corresponding to the task data.
[0145] For specific implementation details, please refer to the detailed description in S201, which will not be repeated here.
[0146] S602, Obtain multiple reasoning templates.
[0147] Each inference template is used to define the inference framework and memory organization method for the large language model to reason about task data.
[0148] For specific implementation details, please refer to the detailed description in S202; they will not be repeated here.
[0149] S603. Determine the task intent corresponding to the task data.
[0150] For specific implementation details, please refer to the detailed description in S403; they will not be repeated here.
[0151] S604. Based on the task intent, determine the target candidate reasoning template from multiple reasoning templates.
[0152] For specific implementation details, please refer to the detailed description in S404; they will not be repeated here.
[0153] S605. If multiple candidate reasoning templates are determined from multiple reasoning templates based on task intent, identify whether the target memory dataset includes memories of the target memory category.
[0154] Target memory categories refer to specific types of memory content directly related to the current task or user goals, such as goal plans, professional skill gaps, and interpersonal relationships. These categories are predefined by the system and identified through metadata tags.
[0155] For example, when a user requests advice on how to plan full-stack learning, the system checks the user's memory dataset for memories labeled as target plans (e.g., transitioning to full-stack in 2024, 10 hours per week) and memories indicating skill gaps (e.g., currently learning React, lacking practical experience with front-end frameworks). This identification step determines whether the target memory category contains crucial information that directly impacts current task decisions, thus deciding whether to weight candidate inference templates relevant to the current task. This identification process dynamically assesses the relevance of target memory categories, avoiding ineffective processing of irrelevant memories and improving resource utilization efficiency.
[0156] S606. If the target memory dataset includes memories of the target memory category, improve the matching score of the candidate inference template corresponding to the target memory category based on the target memory category.
[0157] When a specific target memory category is identified in the target memory dataset, the matching score of the candidate inference templates that match the target memory category will be weighted according to the semantic attributes of the target memory category.
[0158] For example, if a goal-plan type memory is detected, the matching score of candidate reasoning template S2 (risk priority) and candidate reasoning template S3 (decision support) will be improved first, because these two candidate reasoning templates have embedded goal and constraint slots, which can directly utilize the aforementioned professional skill deficiency type memory; if a professional skill deficiency type memory is detected, the matching score of candidate reasoning template S5 (coach guidance) will be improved, because candidate reasoning template S5 adopts guided reasoning, which is more suitable for the user's current learning stage.
[0159] The weighted logic is based on a pre-defined rule base, with each target memory category corresponding to one or more highly suitable candidate inference templates. This dynamic weighting mechanism enables the system to disambiguate by using signals conveyed by the target memory category when the user's query intent is ambiguous, selecting the inference path that best matches the user's current state and needs, significantly improving the accuracy and personalization of candidate inference template selection.
[0160] There is a mapping relationship between different target memory categories and specific candidate reasoning templates, which is based on patterns that have been validated in historical interaction data.
[0161] For example, memories related to goals and plans are mainly associated with candidate reasoning templates S2 and S3, as these templates perform better when handling tasks with time constraints or goal orientation. Memories related to professional skill gaps are mainly associated with candidate reasoning template S5, as it is designed to help users fill skill gaps. Memories related to interpersonal relationships trigger the matching and scoring weighting mechanism of candidate reasoning template S4 when the user's query contains collaboration keywords, in order to support the architecture design in collaborative scenarios.
[0162] The mapping between categories and templates ensures that the target memory category signal can accurately guide the system to select the most suitable reasoning framework for the current situation. By establishing a category-template mapping table, efficient conversion from unstructured memory data to structured reasoning strategies is achieved, enabling the system to dynamically adjust its thinking patterns according to the context.
[0163] S607. The candidate reasoning template with the highest matching score is determined as the target reasoning template.
[0164] For specific implementation details, please refer to the detailed description in S506, which will not be repeated here.
[0165] S608. Construct system prompt words based on target reasoning templates.
[0166] For specific implementation details, please refer to the detailed description in S204, which will not be repeated here.
[0167] S609. Provide system prompts to the large language model so that the large language model can generate feedback data for the task data based on the system prompts.
[0168] For specific implementation details, please refer to the detailed description in S205, which will not be repeated here.
[0169] In this embodiment, a target memory category identification and weighting mechanism is introduced during the matching and scoring process. This enables semantic understanding and value assessment of memory data, allowing for dynamic optimization of the selection priority of candidate reasoning templates. Consequently, the system in this embodiment can improve decision-making accuracy and personalized service levels in complex tasks.
[0170] In some embodiments, memory slots are filled based on memory category, referencing Figure 7 The contents shown in Embodiment 7 may include, but are not limited to, S701 to S708.
[0171] S701, In response to obtaining task data, obtain the target memory dataset corresponding to the task data.
[0172] For specific implementation details, please refer to the detailed description in S201, which will not be repeated here.
[0173] S702, Obtain multiple reasoning templates.
[0174] Each inference template is used to define the inference framework and memory organization method for the large language model to reason about task data.
[0175] For specific implementation details, please refer to the detailed description in S202; they will not be repeated here.
[0176] S703. Based on task data and target memory dataset, select the target reasoning template that matches the task data from multiple reasoning templates.
[0177] For specific implementation details, please refer to the detailed description in S303; they will not be repeated here.
[0178] S704. Determine the target memory category corresponding to each memory slot.
[0179] A memory slot is a variable placeholder in a pre-defined reasoning template used to fill a specific type of memory data. Each memory slot is predefined to receive a specific type of memory, such as user information, professional skills, or goals and plans.
[0180] The target memory category is the memory type declared for the memory slot. For example, the user profile memory slot corresponds to the user information type, and the professional background memory slot corresponds to the professional ability type.
[0181] In a real system, these memory slots and their corresponding memory categories are fixed in the schema template extracted from historical dialogue data during the offline phase, and do not change dynamically with each interaction.
[0182] For example, the S2 Risk Priority template includes user profile memory slots, professional background memory slots, and goal and constraint memory slots, which correspond to user information type, professional ability type, and goal plan type, respectively.
[0183] By clearly defining the target memory category for each memory slot, matching data can be accurately filtered from the recalled memory pool, avoiding interference from irrelevant information and ensuring that the prompts injected into the LLM have high relevance and structured features. This enables precise matching of memory data, thereby improving the quality of prompt generation and ultimately enhancing the accuracy and personalization of the agent's reasoning.
[0184] S705. Filter historical memory data that are consistent with the target memory category from the target memory dataset.
[0185] The target memory dataset refers to a set of highly relevant, reliable, and timely memory entries obtained after conflict resolution, deduplication, and comprehensive reordering. The screening process retrieves historical memory data of matching types from the target memory dataset based on the target memory category corresponding to each memory slot.
[0186] For example, when processing user profile memory slots, all historical memory data belonging to the user information category, such as name, age, and occupation, are extracted from the target memory dataset. The selection criteria include not only the memory type label but also semantic similarity, weight (importance), and timestamp (timeliness) to ensure that the selected historical memory data best meets the needs of the current task.
[0187] In practice, each record in the target memory dataset is traversed, and the metadata tag of the record is checked to see if it matches the target memory category of the current memory slot. The semantic relevance of the record to the current task query is calculated, and finally, the records are sorted by comprehensive score and the top N records are selected as candidates.
[0188] This allows for efficient and accurate filtering of historical memory data, ensuring that the historical memory data filled into the memory slots is both accurate and representative, thereby supporting higher-quality reasoning output.
[0189] S706. The filtered historical memory data is identified as the target memory data that matches the corresponding predefined memory slot, and then filled into the corresponding memory slot.
[0190] Target memory data refers to specific memory content that has been selected and confirmed as suitable for filling a particular memory slot. This binding process essentially completes the binding between historical memory data and template memory slots, that is, mapping the selected historical memory data instances that match the type and are of high quality to the corresponding memory slot positions.
[0191] For example, for the goal and constraint memory slots in the S2 template, the user's historical memory data of their goal plan (only 10 hours of study time per week) will be filled into these slots. This structured binding ensures that each memory slot is correctly filled when constructing subsequent system prompts, forming a complete context.
[0192] S707. Construct system prompt words based on target reasoning templates.
[0193] For specific implementation details, please refer to the detailed description in S204, which will not be repeated here.
[0194] S708. Provide system prompts to the large language model so that the large language model can generate feedback data for the task data based on the system prompts.
[0195] For specific implementation details, please refer to the detailed description in S205, which will not be repeated here.
[0196] In this embodiment, the transformation from raw historical memory data to structured data that can be directly used for prompt word construction is realized, enabling LLM to clearly understand the semantic purpose and contextual role of each historical memory data fragment. This allows for the structured integration of historical memory data, thereby improving the logical coherence of system prompt words and enhancing the agent's understanding of user background and context.
[0197] In some embodiments, system prompt words need to be compiled based on the target reasoning template, refer to Figure 8 The contents shown in Embodiment 8 may include, but are not limited to, the following S801 to S811.
[0198] S801, in response to obtaining task data, obtain the target memory dataset corresponding to the task data.
[0199] For specific implementation details, please refer to the detailed description in S201, which will not be repeated here.
[0200] S802, Obtain multiple reasoning templates.
[0201] Each inference template is used to define the inference framework and memory organization method for the large language model to reason about task data.
[0202] For specific implementation details, please refer to the detailed description in S202; they will not be repeated here.
[0203] S803. Based on task data and target memory dataset, select the target inference template that matches the task data from multiple inference templates.
[0204] For specific implementation details, please refer to the detailed description in S303; they will not be repeated here.
[0205] S804. Determine the target memory category corresponding to each memory slot.
[0206] For specific implementation details, please refer to the detailed description in S704; they will not be repeated here.
[0207] S805. Filter historical memory data that are consistent with the target memory category from the target memory dataset.
[0208] For specific implementation details, please refer to the detailed description in S705, which will not be repeated here.
[0209] S806. The filtered historical memory data is identified as the target memory data that matches the corresponding predefined memory slot, and then filled into the corresponding memory slot.
[0210] For specific implementation details, please refer to the detailed description in S706, which will not be repeated here.
[0211] S807. Determine the reasoning mode description information based on the reasoning instruction area in the target reasoning template.
[0212] The inference instruction area is a fixed text section in the target inference template. The inference instruction area defines the inference method, analysis steps, and output format requirements that the LLM should adopt.
[0213] The reasoning pattern description information is the result of parsing the content of the reasoning instruction area, which clearly indicates the reasoning paradigm that the current task should follow, such as risk-first, hierarchical, or coach-guided.
[0214] For example, in the S2 risk-priority template, the reasoning instruction area requires a systematic identification of risks before drawing conclusions, which constitutes a risk-priority reasoning pattern description. This reasoning pattern description information serves as a core guiding principle when constructing system prompts, guiding the LLM to handle the current task within a specific mental framework.
[0215] In practical systems, the inference pattern description information is typically extracted from the template by the natural language processing module and transformed into structured instructions for use in subsequent steps. This clarifies the inference direction of the LLM, thereby standardizing the LLM's output logic and ensuring that the generated response closely matches the user's intent and the task type.
[0216] S808. Determine memory context information based on multiple memory slots filled with historical memory data.
[0217] Memory context information refers to a personalized background and situational description of a user, which is composed of specific historical memory data filled into each memory slot.
[0218] Memory context information is a core component of system prompts, apart from inference instructions, conveying key information such as the user's identity, abilities, goals, and relationships to the LLM.
[0219] For example, in the S4 architecture design template, the populated technical background memory slots include proficiency in Python and Java, while the collaboration context memory slots include close relationships with colleague Xiao Li. These populated contents together constitute the memory context information. Memory context information allows LLM to fully consider the user's individual circumstances during inference, rather than performing generalized processing. The system constructs the memory context information by concatenating the historical memory data populated in each memory slot into a coherent text.
[0220] This approach allows for the provision of personalized user contexts, thereby enhancing the LLM's understanding of user needs and enabling the generation of more targeted and practical responses.
[0221] S809. Determine the current task information based on task data.
[0222] Task data typically originates from raw user input, which is then semantically analyzed and categorized into a structured representation. When constructing system prompts, current task information is placed in a designated position within the template, forming a complete input along with inference pattern descriptions and memory context information. Natural language understanding technology is used to expand and rewrite the task data, resulting in more comprehensive and context-friendly retrieval statements or prompt text. This accurately reflects the user's current needs, ensuring that LLM inference focuses on the core issue, thereby improving the relevance and effectiveness of the response.
[0223] S810. Construct system prompt words based on reasoning mode description information, memory context information, and current task information.
[0224] The system prompt is the complete instruction text ultimately input into the LLM. It is an organic combination of three parts: inference mode description information, memory context information, and current task information. The construction process involves piecing together the fixed text in the inference instruction area, the historical memory data of each memory slot after filling, and the user's current task request according to a preset template structure to form a clear and semantically complete system prompt.
[0225] For example, the system prompts constructed using an S2 template might include: You must use a 'risk-first' reasoning approach... [User Profile] Zhang Ming, 32 years old, software engineer... [Current Task] I plan to switch to full-stack development this year. Should I learn React first or prepare for the AWS exam? What are the risks?
[0226] This system prompt not only clarifies the inference rules of LLM but also provides rich user context and specific tasks, enabling the system prompt to generate high-quality responses based on a thorough understanding of the context. This approach allows for the fusion of multi-source information, enabling the construction of highly personalized and context-aware system prompts, thereby significantly improving the overall performance of the agent and the user experience.
[0227] S811. Provide system prompts to the large language model so that the large language model can generate feedback data for the task data based on the system prompts.
[0228] For specific implementation details, please refer to the detailed description in S205, which will not be repeated here.
[0229] In this embodiment, by introducing typified memory slots into the inference template and filtering matching historical memory data from the optimized target memory dataset based on the memory slot type, system prompts are constructed by combining inference pattern description information and current task information. This enables accurate matching and structured integration of historical memory data, thereby improving the quality of system prompt generation and enhancing the accuracy, personalization, and context awareness of the agent's inference.
[0230] In some embodiments, the target memory dataset can also be obtained through semantic evaluation conditions, referring to... Figure 9 The content shown in Embodiment 9 may include, but is not limited to, the following S901 to S907.
[0231] S901. In response to obtaining task data, semantic expansion is performed on the task data to obtain multiple search terms corresponding to the task data.
[0232] Semantic expansion refers to the multi-faceted and multi-layered semantic analysis and rewriting of the original task data to generate a set of search keywords that more comprehensively cover user intent and contextual background. This semantic expansion process is achieved through natural language processing techniques (such as synonym replacement, near-synonym mining, contextual association inference, and concept extension), aiming to overcome the limitations of single query terms and improve the breadth and accuracy of memory recall.
[0233] For example, when a user enters a query about how to plan a full-stack learning path, this semantic expansion process can expand to include multiple search terms such as a full-stack development roadmap, the learning order of front-end and back-end, and the priority of React and AWS exam preparation, thereby covering potential related memories from different dimensions.
[0234] There is a close data logic link between the semantic expansion process and the step of querying multiple search terms in the memory. The multiple search terms generated by the semantic expansion process are used as input and directly used to query these search terms in the memory, ensuring that the memory retrieval system can find memory fragments relevant to the current task from a broader perspective.
[0235] The semantic expansion process can employ either a word vector-based synonym replacement method or a rule-based context rewriting method. The word vector-based synonym replacement method is suitable for general scenarios, while the rule-based context rewriting method is suitable for scenarios with a large number of specialized terms.
[0236] The task data is rewritten in multiple dimensions through a semantic expansion process. This enhances the coverage of queries, thereby improving the comprehensiveness and relevance of memory recall, and ultimately improving the quality of the basis for agent decision-making.
[0237] S902. Query multiple search terms in the memory bank to obtain multiple historical memory data.
[0238] A memory bank is a structured storage system used to preserve historical memory data accumulated by an agent during its interactions. This historical memory data is categorized by type (e.g., user information, professional skills, goals and plans, interpersonal relationships) and accompanied by metadata tags (e.g., timestamps, source, success rate markers) for efficient retrieval and management. The process of querying multiple search terms within the memory bank combines vector similarity matching (based on content semantics), metadata filtering (based on tags and conditions), and importance ranking (based on weights) to achieve precise recall.
[0239] There is a clear data flow relationship between the search memory and the multiple search terms obtained from the semantic expansion process. The multiple search terms obtained from the semantic expansion process are fed into the search memory. The process of querying these search terms in the search memory performs independent or joint query operations based on each search term, returning a set of historical memory data. This historical memory data then enters the next step of the evaluation and filtering process. In actual deployment, the search memory can be built based on a vector database (such as FAISS, Milvus) or a traditional relational database, depending on the data scale and real-time requirements.
[0240] The process of querying multiple search terms in the memory can be carried out using either vector-based similarity retrieval or keyword-based Boolean query. Vector-based similarity retrieval is suitable for semantically complex scenarios, while keyword-based Boolean query is suitable for exact matching scenarios.
[0241] By comprehensively querying multiple search terms in the memory bank, the search scope can be expanded and relevant memories from multiple perspectives can be captured. This improves the accuracy and diversity of memory recall, thereby providing a richer information basis for subsequent decision-making.
[0242] S903. Based on the evaluation criteria, select the target memory data with the highest priority from multiple historical memory data as the target memory dataset.
[0243] Evaluation criteria are a set of rules or standards used to sort and filter multiple historical memory data. The core purpose of evaluation criteria is to select the high-value memory that is most suitable for the current task from a large number of relevant memories.
[0244] Evaluation criteria include, but are not limited to: semantic similarity (the degree of matching with task data), temporal relevance (newer data takes precedence), credibility / success rate (historical memory data with good past performance takes precedence), and contextual fit (consistency with the context of the task data). Based on these evaluation criteria, a screening process weights and scores multiple historical memory data points, and then sorts them according to their scores.
[0245] There is a direct functional dependency between the evaluation criteria and multiple historical memory datasets. Only after a screening process based on the evaluation criteria can the most instructive historical memory datasets be determined, thus forming the final target memory dataset. In practical applications, the screening process based on the above evaluation criteria can be dynamically adjusted in weight by this machine learning model, or fixed rules can be manually set to adapt to the preferences of different task types.
[0246] Evaluation criteria can include time-related priority strategies, credibility / success rate-related priority strategies, and context-related priority strategies. Among them, time-related priority strategies are suitable for time-sensitive tasks, while credibility / success rate-related priority strategies are suitable for risk control scenarios.
[0247] By selecting the highest-priority target memory data from multiple historical memory datasets based on evaluation criteria, the most relevant, reliable, and timely historical memory data can be filtered out, avoiding the influence of invalid memories. This improves the quality and usability of the target memory dataset, thereby significantly enhancing the targeting and effectiveness of the agent's reasoning.
[0248] S904. Obtain multiple inference templates, each of which is used to define the inference framework and memory organization method of the large language model for reasoning on task data.
[0249] For specific implementation details, please refer to the detailed description in S202, which will not be repeated here.
[0250] S905. Based on task data and target memory dataset, select the target reasoning template that matches the task data from multiple reasoning templates.
[0251] For specific implementation details, please refer to the detailed description in S203, which will not be repeated here.
[0252] S906. Construct system prompt words based on target reasoning templates.
[0253] For specific implementation details, please refer to the detailed description in S204, which will not be repeated here.
[0254] S907. Provide system prompts to the large language model so that the large language model can generate feedback data for the task data based on the system prompts.
[0255] For specific implementation details, please refer to the detailed description in S205, which will not be repeated here.
[0256] In this embodiment, the task data is semantically expanded, multiple search terms are queried in the memory bank, and the highest priority target memory data is selected from multiple historical memory data based on evaluation conditions. This enables a precise mapping from the original task to high-quality memory data, thereby improving the agent's ability to reuse experience in long-cycle tasks and enhancing the efficiency and depth of the agent's autonomous decision-making and problem-solving.
[0257] The background and process of memory processing will be explained below through an example.
[0258] There are several shortcomings in the intelligent agent memory system in related technologies.
[0259] First, the context window limitation is significant: most large language models have a limited context length, which prevents the agent from carrying too much historical dialogue or experience data in a single interaction, thus limiting the agent's performance in long-term, multi-round tasks.
[0260] Secondly, the passive and static nature of memory is a prominent issue: existing solutions, such as simple vector database storage, usually only passively store all historical interactions. These memories are static, flat, and undifferentiated, lacking dynamic evaluation of the value, importance, and relevance of memories. Agents cannot actively remember key lessons or actively forget irrelevant information.
[0261] Furthermore, there is a lack of goal relevance: the existing memory system is disconnected from the agent's core goal. The storage and retrieval of memories are not strongly correlated with the task goals that the agent needs to accomplish, which may result in the retrieved memories being uninstructive and unable to effectively assist the agent in making decisions.
[0262] Finally, experience cannot be effectively reused: due to the lack of a memory management mechanism, when the agent encounters similar but not exactly the same situation, it cannot effectively call upon and adapt previously accumulated successful experiences or lessons learned, resulting in each task starting almost from scratch and being inefficient.
[0263] To address the aforementioned technical problems, this embodiment provides a method and system for enabling agents to possess agentic memory capabilities. The core idea of this method is to view memory as a strategic resource actively managed and evolved by the agent to achieve its goals, rather than a passively stored data log. Through this method, the agent can generate one or more query vectors based on the current task description, goal, and context. By combining vector similarity (based on memory content), metadata filtering (based on goal and label), and importance ranking (based on memory weight), the agent can recall the most relevant set of memory units from its memory bank. Subsequently, the recalled memory units are integrated with the current task instructions and contextual information to form an enhanced prompt, which is then input into the agent's core reasoning module (such as LLM), thereby improving the personalization and effectiveness of reasoning.
[0264] In the memory system, the Memory Integration Module, as the sixth step in the memory pipeline, bears the crucial responsibility of feeding the recalled memories to the LLM, ensuring that the LLM truly utilizes the recalled memories during inference. The core design of the Memory Integration Module involves pre-preparing a schema template for each task type, with embedded typed memory slots within the template. Each slot only receives memories of a specific type. After retrieving a memory, the system matches and populates the matching memory content according to the slot type, ultimately generating a complete Prompt which is sent to the LLM.
[0265] refer to Figure 10 The content shown, based on the user's task data processing system, may include, but is not limited to, the memory retrieval engine module 1001, the memory filtering and conflict decision-making module 1002, and the memory reasoning integration module 1003.
[0266] The memory retrieval engine module 1001 is used to: determine whether memory needs to be used based on the task data requested by the user; if so, rewrite the search terms (query) based on the task data to obtain 3-5 rewritten search terms; and then perform memory retrieval based on these 3-5 rewritten search terms, retrieving memories from six types of memories in the memory bank (user information, personal skills, interpersonal relationships, hobbies, professional abilities, and goals and plans) to obtain multiple sets of relevant historical memory data.
[0267] Memory filtering and conflict decision-making module 1002: Used to detect, resolve, memorize and reorder conflicts in multiple sets of related historical memory data, thereby obtaining the target memory dataset.
[0268] Memory Reasoning Integration Module 1003: This module performs reasoning and integration on memories in the target memory dataset. Specifically, it determines the reasoning method of the target reasoning model and the memory data to be filled in, then combines them to obtain the final prompt words, which are then output to the large language model to enable it to provide targeted, personalized responses.
[0269] The memory retrieval engine module 1001 is described below.
[0270] The search engine first activates through intent judgment and query rewriting mechanisms: the system analyzes whether the current user input involves personal information or historical behavior. If so, it semantically expands and rewrites the original query from multiple perspectives to generate more comprehensive search statements to improve recall. Subsequently, the system moves from multi-source recalled memories to conflict resolution and initial screening. The system strictly follows a preset strategy for integration—prioritizing timestamped memories, followed by memories with higher historical success rates or those marked as "valid," while analyzing the sources of differences in contextual details (time, location, purpose, etc.). If conflicts cannot be reconciled, the conflict points and sources are clearly marked, and forced integration is avoided to ensure information transparency.
[0271] The memory filtering and conflict decision-making module 1002 will be described below.
[0272] The core function of this module is to resolve conflicts, remove duplicates, and purify memories retrieved from multiple sources, ensuring high consistency and low noise in the memory data input for subsequent reasoning stages. Its operation follows a strict priority strategy: first, it sorts memories by timestamp, prioritizing the adoption of newer memories to reflect the user's latest state; second, it references historical success rates or validity markers, prioritizing the retention of memories verified as "valid"; simultaneously, it deeply analyzes the contextual details of conflicting memories (such as time, location, participants, and purpose), attempting to reasonably explain the source of disagreement from a contextual perspective; if conflicts cannot be completely reconciled, they are not forcibly merged, but rather the conflict points and their sources are clearly marked in the final output, leaving the decision-making power to subsequent LLM or the user for their own judgment.
[0273] By upgrading the traditional "passive storage + flat retrieval" to an intelligent decision-making mechanism of "active filtering + contextual conflict adjudication," this module effectively filters out outdated, low-quality, or contradictory data noise, significantly reducing the risk of LLM reasoning confusion or hallucinations caused by memory conflicts. At the same time, the deduplication and conflict labeling mechanism ensures that the memories injected into the template slots have clear traceability and logical consistency at the factual level, providing a "clean, reliable, and context-adaptive" memory raw material foundation for the accurate filling of subsequent schema templates and stable LLM reasoning, ultimately ensuring the consistency and reliability of the agent's decision-making in long-cycle, multi-round tasks.
[0274] The memory reasoning integration module 1003 is described below.
[0275] 1. Module positioning.
[0276] The memory integration module is located at step 6 of the memory pipeline. Its core task is to effectively integrate recalled memories into the LLM inference process. Its basic design idea is to pre-build a schema template for each task type, embedding typed memory slots within the template. Each slot only receives memories of a specific type. After retrieving a memory, the system matches and populates it according to the slot type, ultimately generating a complete prompt to be sent to the LLM.
[0277] The transmission chain is as follows: Task type → Select Schema template (with built-in inference mode and memory type slots) → Extract the corresponding type from the recalled memory according to the slot type and fill it in → Generate the final Prompt.
[0278] 2. Template source.
[0279] The schema template is an "experience asset" extracted from historical dialogue data, generated offline through the following three steps: Data mining: Clustering a large number of historical dialogues to summarize the recurring task patterns of users in different contexts (such as "assessing risks", "designing systems", "making plans").
[0280] Results filtering: Mark and extract dialogues that achieve high-quality reasoning results due to the reasonable use of memory, and obtain their common structure—including reasoning ideas and the types of memory used.
[0281] Template solidification: The extracted "inference instructions + memory slot configuration" are written into a fixed template, with each schema corresponding to a task type.
[0282] The templates are empirical results generated offline in a one-time process and remain unchanged after generation. They are not handwritten rules, nor are they dynamically adjusted with each conversation. Instead, they are reusable template assets that preserve dialogue patterns that have been "well-used" in historical data.
[0283] Six schemas have been defined, covering the main task types: Table 1. Example of the correspondence between Schema and task type
[0284] 3. Template Selection Criteria The choice of schema is determined by both the user request (Query) and existing memory signals, and involves a two-level judgment: First layer: Query intent classification (primary basis). The system performs semantic classification on the current query, identifies its core intent, and maps it to the corresponding schema.
[0285] Table 2 Intent and Model Examples
[0286] Second layer: Memory signal-assisted disambiguation (triggered when intent is ambiguous).
[0287] When the query intent is not clear enough and the intent classifier returns multiple candidate schemas with similar confidence levels, the system reads the user's existing memory, performs a weighted score on the candidate schemas according to four dimensions, and selects the one with the highest score as the final choice: Dimension 1: Goal / Plan Memory → S2 / S3 Weighting. Weighting condition: "Goal / Plan" memory is not empty; Weighting objects: S2 Risk Priority, S3 Decision Support; Logic: The presence of a goal / plan memory indicates that the user has clear goals and constraints, and the current query may need to consider these constraints to assess risk or make trade-offs. Both S2 and S3 templates contain a "Goal / Plan" slot, which can be directly utilized.
[0288] Dimension 2: Memorization of professional skill gaps → S5 weighted.
[0289] Weighting criteria: "Professional skills" category memories contain markers of weak mastery (such as "currently learning," "understand but not proficient," "beginner," "no experience"); Weighting object: S5 coaching guidance; Logic: When there are obvious skill gaps, it is better to help users fill in the gaps in their skills than to directly provide solutions. S5 uses guided reasoning, which is more suitable for users' current learning stage.
[0290] Dimension 3: Interpersonal Relationship Memory + Query Containing Collaboration Terms → S4 Weighted Calculation.
[0291] Weighting conditions: The "interpersonal relationships" category memory is not empty, and the query contains collaboration-related words (cooperation / together / with someone / team / division of labor); Weighting object: S4 architecture design; Logic: Collaborator memory alone is not enough—the query must also involve collaboration to indicate that the current task needs to consider the collaboration dimension. Weighting is triggered only when both conditions are met.
[0292] Dimension 4: Historical Schema usage preferences → High-frequency schemas receive lower scores.
[0293] Weighting criteria: In the user's past N conversations, the frequency with which a certain schema was selected exceeds a threshold (e.g., 50%); Weighting object: This high-frequency schema; Logic: Stable historical preferences are a reliable fallback signal. Only frequencies exceeding the threshold are counted as preferences; sporadic usage is not included. The lowest weighted score cannot cover the weighting of the first three dimensions.
[0294] Disambiguation Example: Zhang Ming asks, "How should I plan my full-stack learning?" The query intent is ambiguous; S2 / S3 / S5 could all be hit. Goal / Plan / Memory Not Empty → S2 +0.2, S3 +0.1. Professional Ability Includes Weak Mastery Mark → S5 +0.3. Interpersonal Relationships + Collaboration Conditions Not Met → No Weighting. Historical S2 Frequency Exceeds Threshold → S2 +0.1. Candidate Schema: Intent Base Score, Goal / Plan / Ability, Weakness, Historical Preference, Total Score; S2 Risk Priority 0.5 +0.2 — +0.1 0.8; S5 Coaching Guidance 0.4 — +0.3 — 0.7; S3 Decision Support 0.3 +0.1 — — 0.4; → S2 score is the highest, select S2 risk priority template.
[0295] Choosing the essence: Selecting the schema = selecting "what framework should LLM use to handle this task". Memory signals only intervene as weighted signals when the intent is ambiguous; when the intent is clear, they are directly mapped without triggering the disambiguation process.
[0296] 4. Template usage process.
[0297] Each schema template consists of two parts: Inference Instructions Area: Fixed text describing the specific inference methods, analysis steps, and output format requirements that the LLM should use; Typed Memory Slots: Variable placeholders, where each variable only receives a specific type of memory, and the slot title directly describes its semantic purpose.
[0298] Usage steps: The system selects a schema template based on the task type; it filters the corresponding memory from the memory pool recalled from upstream according to the "memory type" declared for each slot; it fills the filtered memory text into the corresponding slot and replaces the variable placeholders; the completed template after filling is sent to the LLM along with the user's current query as part of the System Prompt.
[0299] 5. Output results.
[0300] After the memory slots are filled, a structured System Prompt fragment carrying personalized memories is obtained, which includes: the reasoning paradigm that the LLM should follow (reasoning instructions from the template); the user's personalized context (from the filled memory content); placeholders for the current task (filling the user's real-time query); and explicit output format requirements.
[0301] This fragment, combined with the user's current query, constitutes the complete input sent to the LLM. The LLM's response will naturally incorporate the user's historical background and preferences, eliminating the need for the user to repeatedly explain their situation.
[0302] 6. Memory Injection Method The memory injection method is embedded in the template slot, and there is no separate "select injection method" step. Each slot precisely controls the injected content through type constraints: the slot declaration only accepts specific memory types (6 in total), and only memories of the matching type can be filled into the corresponding slot.
[0303] Once the schema is selected, it determines "which memories to use"—the slot type determines which memories to filter from the recall pool, and the slot title (such as [User Profile], [Goals and Constraints], etc.) conveys the semantic purpose of the memory to the LLM.
[0304] Table 3 Examples of Definitions for Six Memory Types
[0305] 7. Complete example.
[0306] Example background: Memory data of user "Zhang Ming".
[0307] Table 4 Zhang Ming's memory example
[0308] refer to Figure 11 The content shown explains the processing procedure of the memory integration module.
[0309] S1101. Determine the user task.
[0310] S1102. Classify task types.
[0311] S1103, Schema routing.
[0312] S1104, Read template slot configuration.
[0313] S1105. Select recall memory by type.
[0314] S1106, Fill slot variable.
[0315] S1107. Generate the final prompt word.
[0316] The prompt words are output to a large language model for processing.
[0317] Example 1: S2 Risk Priority Template (Zhang Ming assesses the full-stack transformation path).
[0318] Scenario: Zhang Ming asks, "I plan to switch to full-stack development this year. Should I learn React first or prepare for the AWS exam? What are the risks?" Step 1: Schema selection - The query intent is "scheme evaluation + risk identification". Combined with the clear time constraints (10 hours per week) in the target plan memory, the S2 risk is prioritized.
[0319] Step 2: S2 template structure (fixed, generated offline).
[0320] The S2 template structure includes: [Reasoning Mode] You must use a "risk-first" reasoning approach. Systematically identify risks, uncertainties, and failure paths before drawing conclusions; do not provide solutions before completing risk analysis.
[0321]
User Profile
[0322]
Professional Background
[0323]
Objectives and Constraints
[0324] [Current Task] {{current_task}}.
[0325]
Output Requirements
[0326] Step 3: Fill the System Prompt obtained after filling the memory according to the slot type.
[0327] [Reasoning Mode] You must use a "risk-first" reasoning approach. Systematically identify risks, uncertainties, and failure paths before drawing conclusions; do not provide solutions before completing risk analysis.
[0328] [User Profile] Zhang Ming, 32 years old, software engineer, 5 years of backend development experience.
[0329] [Professional Background] Proficient in Python and Java; understands microservice architecture; currently learning React and TypeScript; preparing for AWS certification; no practical experience with front-end frameworks.
[0330] [Goals and Constraints] Transform into a full-stack engineer by 2024; simultaneously prepare for the AWS Solutions Architect exam; limited time, only 10 hours of study time per week.
[0331] [Current Task] I plan to switch to full-stack development this year. Should I learn React first or prepare for the AWS exam first? What are the risks?
Output Requirements
[0332] LLM inference results (illustrated): Identifies the time risk of "only 10 hours per week × dual-thread parallelism", gives a priority suggestion to learn React first based on "no front-end practical experience", and provides a phased solution that matches the constraints.
[0333] Secondly, embodiments of this application provide a processing apparatus, such as... Figure 12 As shown, the processing device 120 includes: a first obtaining unit 1201, a second obtaining unit 1202, a processing unit 1203, a construction unit 1204, and an output unit 1205.
[0334] Wherein: the first obtaining unit 1201 is used to obtain a target memory dataset corresponding to the task data in response to obtaining task data, the target memory dataset including at least one historical memory data obtained from the memory bank; The second obtaining unit 1202 is used to obtain multiple reasoning templates, each of which is used to define the reasoning framework and memory organization method of the large language model for reasoning on task data. Processing unit 1203 is used to select a target inference template that matches the task data from multiple inference templates based on task data and target memory dataset; the target inference template is used to organize the target memory dataset according to the memory organization method; Construction unit 1204 is used to construct system prompt words based on the target reasoning template; The output unit 1205 is used to provide system prompts to the large language model so that the large language model can generate feedback data for the task data based on the system prompts.
[0335] In some embodiments, the plurality of inference templates correspond to different task processing types.
[0336] In some embodiments, the inference template includes an inference instruction area and a memory filling area; the inference instruction area is used to define the inference order, inference focus, and output format of the large language model for the task data; the memory filling area includes a plurality of memory slots, each of which corresponds to a different memory category. In some embodiments, the processing unit 1203 is further configured to: determine the corresponding target memory data from the target memory dataset based on the memory category corresponding to the memory slot, and fill it into the corresponding memory slot.
[0337] In some embodiments, the processing unit 1203 is further configured to: determine the task intent corresponding to the task data; and determine a target candidate inference template from the plurality of inference templates based on the task intent.
[0338] In some embodiments, the processing unit 1203 is further configured to: if multiple candidate reasoning templates are determined from the multiple reasoning templates based on the task intent, perform matching scoring on the multiple candidate reasoning templates based on the target memory dataset; The candidate inference template with the highest matching score is determined as the target inference template.
[0339] In some embodiments, the processing unit 1203 is further configured to: identify whether the target memory dataset includes memories of the target memory category; if the target memory dataset includes memories of the target memory category, improve the matching score of the candidate inference template corresponding to the target memory category based on the target memory category; wherein, different target categories correspond to different inference templates.
[0340] In some embodiments, the processing unit 1203 is further configured to: determine the target memory category corresponding to each memory slot; filter historical memory data that are consistent with the target memory category from the target memory dataset; and determine the filtered historical memory data as target memory data that matches the corresponding predefined memory slot.
[0341] In some embodiments, the construction unit 1204 is further configured to: determine reasoning mode description information based on the reasoning instruction area in the target reasoning template; determine memory context information based on multiple memory slots filled with the historical memory data; determine current task information based on the task data; and construct the system prompt word based on the reasoning mode description information, the memory context information, and the current task information.
[0342] In some embodiments, the first obtaining unit 1201 is further configured to: semantically expand the task data to obtain multiple search terms corresponding to the task data; query the multiple search terms in the memory bank to obtain multiple historical memory data; and select the target memory data with the highest priority from the multiple historical memory data as the target memory dataset based on evaluation conditions.
[0343] It should be noted that the information processing device provided in this application embodiment includes all the units included, which can be implemented by a processor in an electronic device; of course, it can also be implemented by specific logic circuits; in the implementation process, the processor can be a central processing unit (CPU), a microprocessor (MPU), a digital signal processor (DSP), or a field-programmable gate array (FPGA), etc.
[0344] The descriptions of the above device embodiments are similar to those of the above method embodiments, and have similar beneficial effects. For technical details not disclosed in the device embodiments of this application, please refer to the descriptions of the method embodiments of this application for understanding.
[0345] It should be noted that, in the embodiments of this application, if the above-described vehicle driving control method is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiments of this application, or the part that contributes to the related technology, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), magnetic disks, or optical disks. Thus, the embodiments of this application are not limited to any specific hardware and software combination.
[0346] Thirdly, embodiments of this application provide an electronic device that can implement the processing method provided in the first aspect.
[0347] In one embodiment, an input element is configured to obtain task data; a processor is configured to, in response to obtaining the task data, obtain a target memory dataset corresponding to the task data, the target memory dataset including at least one historical memory data obtained from a memory bank; determine a memory usage pattern matching the task data based on the task data and the target memory dataset, the memory usage pattern being used to define a reasoning framework for a large language model to reason about the task data; process the target memory dataset based on the memory usage pattern to generate a memory usage report, the memory usage report including memory analysis results obtained by analyzing the target memory dataset based on the reasoning framework; construct prompt information based on the task data and the memory usage report for providing to the large language model; the prompt information is used to provide to the large language model so that the large language model generates feedback data for the task data based on the memory usage report; and an output element is configured to output the feedback data.
[0348] Fourthly, embodiments of this application provide a storage medium, namely a computer-readable storage medium, on which a computer program or instructions are stored, which, when executed by a processor, implement the steps of any of the processing methods provided in the first aspect of the above embodiments.
[0349] Fifthly, embodiments of this application provide a computer program product, which includes a computer program or instructions. When the computer program or instructions are executed by a processor, they implement the steps in any of the processing methods provided in the first aspect of the above embodiments.
[0350] It should be noted that the descriptions of the above embodiments of storage media, devices, apparatuses, and program products are similar to the descriptions of the above method embodiments and have similar beneficial effects. For technical details not disclosed in the embodiments of storage media, devices, apparatuses, and program products of this application, please refer to the descriptions of the method embodiments of this application for understanding.
[0351] It should be understood that the phrase "one embodiment" or "an embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this application. Therefore, "in one embodiment" or "in some embodiments" appearing throughout the specification do not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. It should be understood that in the various embodiments of this application, the sequence numbers of the above-described processes do not imply a sequential order of execution; the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application. The sequence numbers of the above-described embodiments are merely descriptive and do not represent the superiority or inferiority of the embodiments.
[0352] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0353] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods, such as: multiple units or components can be combined, or integrated into another electronic device, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed can be through some interfaces, and the indirect coupling or communication connection between devices or units can be electrical, mechanical, or other forms.
[0354] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units. They may be located in one place or distributed across multiple network units. Some or all of the units may be selected to achieve the purpose of this embodiment according to actual needs.
[0355] In addition, each functional unit in the various embodiments of this application can be integrated into one processing unit, or each unit can be a separate unit, or two or more units can be integrated into one unit; the integrated unit can be implemented in hardware or in the form of hardware plus software functional units.
[0356] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media that can store program code, such as mobile storage devices, read-only memory (ROM), magnetic disks, or optical disks.
[0357] Alternatively, if the integrated units described above are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, or the parts that contribute to related technologies, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, ROMs, magnetic disks, or optical disks.
[0358] The above are merely embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.
Claims
1. A processing method, comprising: In response to obtaining task data, a target memory dataset corresponding to the task data is obtained, the target memory dataset including at least one historical memory data obtained from the memory bank; Multiple inference templates are obtained, each of which is used to define the inference framework and memory organization method of the large language model for inference on task data; Based on the task data and the target memory dataset, a target reasoning template that matches the task data is selected from the plurality of reasoning templates; Constructing system prompts based on target reasoning templates; The system prompts are provided to a large language model so that the large language model can generate feedback data for the task data based on the system prompts.
2. The method according to claim 1, wherein the plurality of inference templates correspond to different task processing types.
3. The method according to claim 2, wherein the reasoning template includes a reasoning instruction area and a memory filling area; The inference instruction area is used to define the inference order, inference focus, and output format of the large language model for the task data; The memory filling area includes the plurality of memory slots, each corresponding to a different memory category; Before constructing system prompts based on target reasoning templates, the following is also included: Based on the memory category corresponding to the memory slot, the corresponding target memory data is determined from the target memory dataset and filled into the corresponding memory slot.
4. The method according to claim 1, wherein selecting a target inference template matching the task data from the plurality of inference templates based on the task data and the target memory dataset comprises: Determine the task intent corresponding to the task data; Based on the task intent, a target candidate reasoning template is determined from the plurality of reasoning templates.
5. The method according to claim 4, wherein determining the target candidate reasoning template from the plurality of reasoning templates based on the task intent comprises: If multiple candidate reasoning templates are determined from the multiple reasoning templates based on the task intent, the multiple candidate reasoning templates are matched and scored based on the target memory dataset; The candidate inference template with the highest matching score is determined as the target inference template.
6. The method according to claim 5, wherein matching and scoring of the plurality of candidate reasoning templates based on the target memory dataset includes: Identify whether the target memory dataset includes memories belonging to the target memory category; If the target memory dataset includes memories of the target memory category, the matching score of the candidate inference template corresponding to the target memory category is improved based on the target memory category; Different target categories correspond to different reasoning templates.
7. The method according to claim 3 or 6, wherein determining the corresponding target memory data from the target memory dataset based on the memory category corresponding to the memory slot includes: Determine the target memory category corresponding to each memory slot; Filter historical memory data that matches the target memory category from the target memory dataset; The selected historical memory data is identified as the target memory data that matches the corresponding predefined memory slot.
8. The method according to claim 7, wherein constructing system prompt words based on the target reasoning template includes: Based on the reasoning instruction area in the target reasoning template, determine the reasoning mode description information; Based on multiple memory slots filled with the historical memory data, memory context information is determined; Based on the task data, determine the current task information; The system prompt word is constructed based on the reasoning pattern description information, the memory context information, and the current task information.
9. The method according to any one of claims 1-3, wherein obtaining the target memory dataset corresponding to the task data comprises: The task data is semantically expanded to obtain multiple search terms corresponding to the task data; By querying the multiple search terms in the memory bank, multiple historical memory data are obtained; Based on the evaluation criteria, the target memory data with the highest priority is selected from the multiple historical memory data as the target memory dataset.
10. An electronic device, comprising: Input elements are used to obtain task data; A processor is configured to, in response to acquiring task data, acquire a target memory dataset corresponding to the task data, the target memory dataset including at least one historical memory data obtained from a memory bank; Multiple inference templates are obtained, each of which is used to define the inference framework and memory organization method of the large language model for inference on task data; Based on the task data and the target memory dataset, a target reasoning template that matches the task data is selected from the plurality of reasoning templates; Constructing system prompts based on target reasoning templates; The system prompts are provided to the large language model so that the large language model can generate feedback data for the task data based on the system prompts. An output element is used to output the feedback data.