Method and device for constructing prompt information of agent based on multi-level memory processing, and storage medium
By employing a multi-level memory processing method, the problems of redundant prompts and inefficient management in intelligent agent systems are solved, thereby optimizing computing resources and improving output stability, and meeting the security requirements of high compliance scenarios.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING FANGCUN WUYOU TECH DEV CO LTD
- Filing Date
- 2026-03-03
- Publication Date
- 2026-06-05
AI Technical Summary
Existing intelligent agent systems suffer from problems such as redundancy and expansion, lack of memory value assessment, flat and chaotic memory structure, insufficient adaptive update capability, and insufficient security and controllability in the management of prompt information, resulting in high consumption of computing resources, unstable output, and insufficient security.
A multi-level memory processing method is adopted to construct structured memory data units by collecting, classifying, evaluating and updating intelligent agent interaction data. A multi-dimensional evaluation model is used to dynamically manage memory data, accurately retrieve and construct high-value prompt information, and combine with a security module to ensure data security.
It effectively reduces computing resource consumption, improves the accuracy and stability of intelligent agent output, meets the security requirements of highly compliant scenarios, and achieves personalized and consistent task execution.
Smart Images

Figure CN122152942A_ABST
Abstract
Description
Technical Field
[0001] The embodiments disclosed herein relate to the fields of artificial intelligence and natural language processing technology, and particularly to the application of large language models, intelligent agent memory management and prompting engineering technology, specifically to a method, apparatus and storage medium for constructing intelligent agent prompting information based on multi-level memory processing. Background Technology
[0002] With the rapid development of large language model capabilities, intelligent agent systems built upon such models have been widely applied in scenarios requiring complex, multi-turn interactive tasks, such as government consultation, official document drafting, customer service, and educational tutoring. The core working mode of intelligent agent systems is to construct specific prompts as input to the model to guide it in generating expected task outputs.
[0003] To improve the accuracy and personalization of agent output, existing technologies typically incorporate the following elements into prompts: system-defined settings, agent role descriptions, user dialogue history, or preset preference information. Common implementation schemes currently include: Static configuration-based prompts use system commands and agent role settings as fixed text templates, which are directly used each time a task is executed. This approach is simple to implement but lacks flexibility, failing to dynamically adjust based on the specific task context and the user's real-time status.
[0004] The context-based approach directly appends the user's recent dialogue history with the agent, presented as raw text, to the prompt for the current task. While this approach introduces historical context, the length of the prompt increases linearly with each interaction round, leading to a sharp increase in computational resources required for model inference and greater response latency. More importantly, this method lacks the ability to discern the value and validity of historical information, allowing irrelevant or outdated information to easily interfere with current inference.
[0005] A simple preference recording scheme records user preferences through manual presets or simple rules, and inserts them as fixed prompts. This method has a certain degree of personalization capability, but the update and maintenance costs are high, and it cannot adaptively adjust to long-term, dynamic changes in user behavior.
[0006] The existing technical solutions generally have the following technical problems: (1) Redundancy and expansion of prompt information: The indiscriminate splicing of historical context leads to excessively long input sequences, which significantly increases the computational overhead and time cost of model reasoning. (2) Lack of memory value assessment: There is a lack of quantitative assessment and dynamic management mechanism for the importance, timeliness and credibility of historical information. Low-value or contradictory information participates in reasoning, affecting the output quality. (3) Flat and chaotic memory structure: Memory information from different sources and of different natures is mixed and stored. There is a lack of hierarchical and structured organization, making it difficult to achieve accurate and efficient memory retrieval in complex tasks. (4) Insufficient adaptive update capability: The system is unable to dynamically optimize and decay the memory bank according to user interaction feedback, task execution effect and external knowledge updates, resulting in rigid behavior patterns of the intelligent agent. (5) Lack of security and controllability considerations: In scenarios with high requirements for data security and privacy, such as government affairs and finance, there is a lack of mechanisms for sensitive information filtering, access control and operation auditing of memory content. Summary of the Invention
[0007] The summary portion of this disclosure is intended to provide a brief overview of the concepts, which will be described in detail in the detailed description portion. This summary portion is not intended to identify key or essential features of the claimed technical solutions, nor is it intended to limit the scope of the claimed technical solutions.
[0008] Some embodiments of this disclosure propose a method, apparatus, and storage medium for constructing intelligent agent prompt information based on multi-level memory processing, in order to solve the problems mentioned in the background art, such as redundancy of prompt information, inefficient memory management, poor system adaptability, and weak security control.
[0009] In a first aspect, some embodiments of this disclosure provide a method for constructing intelligent agent prompt information based on multi-level memory processing, the method comprising: Memory data acquisition steps: Collect interaction data during the execution of user tasks by the intelligent agent and generate task logs; Memory classification and structuring steps: The collected data is parsed into memory data units and divided into explicit memory data units and implicit memory data units. The explicit memory data units include configuration data at the system level, agent level and user level. Memory evaluation and update steps: Assign initial confidence parameter values to implicit memory data units; evaluate memory data units based on a multi-dimensional evaluation model, using their current confidence parameter values as confidence scores in the calculation; and dynamically update the confidence parameter values of each memory data unit according to task feedback and time decay mechanisms. Memory retrieval steps: Based on the characteristics of the current task, retrieve matching memory data units from the memory bank; The prompt information construction steps are as follows: Based on the retrieved memory data units, prompt input containing control information is dynamically constructed to drive the agent to perform tasks.
[0010] Secondly, some embodiments of this disclosure provide an intelligent agent prompting information construction device based on multi-level memory processing, the device comprising: The memory acquisition module is configured to collect interaction data during the execution of user tasks by the intelligent agent and generate task logs. The memory classification module is configured to parse the collected data into memory data units and divide them into explicit memory data units and implicit memory data units. The memory assessment module is configured to assign reliability parameters to implicit memory data units and evaluate memory data units based on a multi-dimensional assessment model. The memory update module is configured to dynamically update the memory bank based on the confidence parameter and the time decay mechanism; The memory retrieval module is configured to retrieve matching memory data units from the memory bank based on the characteristics of the current task. The prompt construction module is configured to dynamically construct prompt inputs containing control information based on retrieved memory data units.
[0011] Thirdly, some embodiments of this disclosure provide an electronic device, including: one or more processors; and a storage device having one or more programs stored thereon, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any implementation of the first aspect above.
[0012] Fourthly, some embodiments of this disclosure provide a computer-readable storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the method described in any of the implementations of the first aspect above.
[0013] The various embodiments disclosed above have the following beneficial effects: The intelligent agent prompt information construction method based on multi-level memory processing in some embodiments of this disclosure can effectively reduce the computational resource consumption of the intelligent agent system and improve the consistency and stability of task output. Here, the reason for high resource consumption and unstable output is that existing technologies use indiscriminate long context splicing and lack effective management of memory information. Based on this, the method in some embodiments of this disclosure first collects and logs the intelligent agent interaction data. Then, the raw data is parsed and classified into structured memory data units of different levels, realizing refined organization of memory information. Afterwards, confidence parameters and multi-dimensional evaluation models are introduced to evaluate the value of memory data units, especially implicit memory data units, and dynamically update them, automatically eliminating low-value or outdated memories through mechanisms such as time decay. Then, when a new task is received, precise retrieval is performed from the structured memory bank based on task characteristics, rather than full loading. Finally, based on the retrieved high-value memory data units, concise and relevant prompt information is dynamically constructed. Thus, on the one hand, the amount of irrelevant information input into large models is significantly reduced, lowering computational overhead; on the other hand, by ensuring that the memory information involved in reasoning possesses high relevance, high confidence, and timeliness, the accuracy of the agent's output and its consistency when performing similar tasks at different times are improved. Furthermore, through structured memory management, the maintenance complexity of long-term system operation is reduced, and the integration of a security module can meet the needs of highly compliant scenarios. Attached Figure Description
[0014] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and elements are not necessarily drawn to scale.
[0015] Figure 1 This is a flowchart of some embodiments of the intelligent agent prompting information construction method based on multi-level memory processing according to the present disclosure; Figure 2 This is a schematic diagram of the multi-level classification system of memory disclosed herein; Figure 3 This is a schematic diagram of the multi-dimensional memory assessment and dynamic update process disclosed herein; Figure 4 This is a schematic diagram illustrating the process of constructing memory retrieval and prompting information based on this disclosure; Figure 5 This is a schematic diagram of the structure of some embodiments of the intelligent agent prompting information construction device based on multi-level memory processing according to the present disclosure. Detailed Implementation
[0016] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0017] It should also be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings. Unless otherwise specified, the embodiments and features described in this disclosure can be combined with each other.
[0018] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.
[0019] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0020] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0021] This disclosure will now be described in detail with reference to the accompanying drawings and embodiments.
[0022] refer to Figure 1 The document illustrates a flow 100 of some embodiments of a method for constructing intelligent agent prompt information based on multi-level memory processing according to the present disclosure. The flow 100 includes the following steps: Step 101, memorize the data acquisition steps.
[0023] In some embodiments, the executor of the agent prompt information construction method based on multi-level memory processing (e.g., a server or computing cluster deploying the agent system) can collect multimodal interaction data of the agent during the execution of user tasks in real time via wired or wireless connection, and generate structured task logs. The data to be collected includes at least: (1) User-inputted task request data: including original task descriptions, questions, instructions or uploaded document content submitted by users through text, voice, images, etc.
[0024] (2) Multi-round interaction process data: Completely record all dialogue rounds between the agent and the user around the current task, including each question, supplement, and clarification from the user, and each corresponding answer, confirmation, and request from the agent.
[0025] (3) User feedback data on output results: Collect explicit feedback (such as five-star rating, likes / dislikes, text evaluation) and implicit feedback (such as directly adopting the output results, modifying the results and using them, completely abandoning the results and asking questions again, no follow-up operations for a long time, etc.) from users on the final or intermediate output results of the agent.
[0026] Task logs can be stored in structured formats such as JSON or Protocol Buffers. Each log entry includes, but is not limited to, the following fields: unique session ID, user ID, timestamp, task type, raw input, raw output, parsed structured input / output, feedback type and content, and computational resources consumed by the task (such as token count and inference time). The system can be configured with log rolling and archiving strategies to ensure data manageability and long-term traceability.
[0027] Step 102, memory classification and structuring steps.
[0028] In some embodiments, the execution entity parses the task log generated in step 101, transforms the raw, unstructured interaction data into structured memory data units, and organizes them according to a preset classification system.
[0029] Specifically, refer to Figure 2 The memory multi-level classification system shown can divide memory data units into the following four levels: (1) System-level memory data unit: Stores global information that is independent of specific users or tasks. For example, descriptions of the system's core functions, general compliance terms (such as privacy policies), basic fact knowledge base, and general behavioral guidelines and security constraints that apply to all intelligent agents.
[0030] (2) Agent-level memory data unit: Stores proprietary information of a specific agent role. For example, in government affairs scenarios, the role setting of the "policy consultant" agent, the scope of policy areas it is good at (such as finance and taxation, education), the required dialogue style (such as rigorous and friendly), and the response templates or scripts specific to this role.
[0031] (3) User-level memory data unit: stores personalized information related to a specific user. This includes explicit configurations (such as user-filled preferences: preferring concise answers, using Chinese as the most common language) and implicitly learned features (such as the areas that frequently appear in the user's historical questions, their typical focus on a certain type of question, and their usually active interaction time periods).
[0032] (4) Task-level memory data unit: Stores patterns, experiences and knowledge related to specific types of tasks. For example, successful case templates, common mistakes, and format differences for different issuing authorities for tasks such as "drafting official notices"; or commonly used analysis dimensions and visualization suggestions for tasks such as "data report analysis".
[0033] Each memory data unit is a structured object that contains at least the following metadata attributes: Memory ID: A globally unique identifier.
[0034] Content: The specific information being remembered, which can be text, key-value pairs, lists, or embedded vectors.
[0035] Source level: Identifies which level of the system, agent, user, or task it belongs to.
[0036] Memory type (Type): Identified as "explicit memory data unit" (such as manually configured rules) or "implicit memory data unit" (such as characteristics statistically inferred from behavior).
[0037] Creation time and last update time.
[0038] Context Tags: A set of tags describing the applicable scenario of the memory. These tags can be automatically generated by a lightweight classification model or partially manually labeled. Typical tags include: Task type: official document drafting; Interaction stage: needs clarification; Emotional tendency: neutral / positive / negative; Urgency level: routine; Professional field: agriculture and rural areas, etc.
[0039] Related Memories: Identifiers that record other memories that are semantically related, logically dependent on, or frequently invoked together with this memory, used to construct a memory network graph.
[0040] By continuously recording the 'associative memory' field, the system dynamically constructs a memory network graph. Nodes represent memory data units, and edges represent semantic or logical associations between units. Associations are automatically established in the following ways: a) If two memory data units are frequently retrieved together in the same task (co-occurrence exceeding a threshold θ1), an edge is established between them; b) If the semantic similarity (e.g., cosine similarity) of the content vectors of two memory data units exceeds a threshold θ2, an edge is established between them. Here, θ1 and θ2 are preset system parameters. This graph can be used to enhance retrieval; for example, when a node is retrieved, its first-order neighbor nodes can also be included in the candidate set for comprehensive scoring and ranking.
[0041] Step 103, Memory Assessment and Update Steps.
[0042] In some embodiments, the aforementioned execution entity is a memory data unit, particularly an implicit memory data unit, and a dynamic evaluation and update mechanism is established to ensure the timeliness, effectiveness, and simplicity of the memory bank.
[0043] Specifically, refer to Figure 3 This step introduces a multi-dimensional evaluation model to quantify the "overall value score" of each memory data unit. This model primarily considers the following four core dimensions: (1) Confidence Dimension: Assessing the reliability of the memory content. For explicit memory data units, the base confidence value is high (e.g., the confidence value of a rule configured by the system administrator is 0.95). For implicit memory data units, the initial confidence value is low and is updated Bayesianly based on the number of times it is verified or reinforced. For example, an inferred user preference (such as "users often pay attention to subsidy policies") will have its confidence increased if it is confirmed in subsequent similar tasks (users do indeed inquire about subsidies multiple times); if there is a counterexample (users explicitly state that they do not care about subsidies), the confidence will decrease.
[0044] (2) Timeliness dimension: Assessing the freshness of memory content. Different types of memories have different "half-lives". For example, a user's real-time location information has a very short timeliness, while the basic rules of the system have a very long timeliness. It can be quantified by a time-based decay function, where freshness decays exponentially with the time since the last update or the last verification.
[0045] (3) Frequency of recall dimension: assess the usefulness and activity of the memory. Count the number of times the memory was successfully retrieved and used to construct cues within a recent time window (such as the past week). Memory that is recalled frequently is generally more valuable.
[0046] (4) Task relevance dimension: assess the relevance of memory to specific task types. By analyzing historical data, calculate the "contribution" of a memory when it is recalled in various tasks (which can be inferred through attribution analysis or post-event effects), and establish a matrix of the correlation strength between memory and task type.
[0047] The overall value score (S) can be calculated using the following weighted formula:
[0048] in: C represents the confidence score (0-1), which is the confidence parameter value of the memory data unit at the current time.
[0049] F(t) represents the timeliness score, which is a decay function with respect to the decay time t, for example... λ is the decay coefficient, which can be preset according to the memory type (e.g., λ is 0.5 for real-time user preferences, and λ is 0.01 for system basic rules); t is the decay time, defined as the difference between the current time and the timestamp of the last successful call or verification of the memory data unit, in days. The output value F(t) of this function is the timeliness score.
[0050] U represents the normalized recent call frequency.
[0051] R represents the score indicating the relevance to the core task type being assessed.
[0052] α, β, γ, δ are the weight coefficients for each dimension, which can be adjusted according to the application scenario, and satisfy α+β+γ+δ=1.
[0053] The multi-dimensional evaluation model calculates the scores for each dimension as follows: Confidence Score (C): For explicit memory data units, the initial confidence parameter value is set to a fixed high value (e.g., above 0.95). For implicit memory data units, the initial confidence parameter value is set to a lower value (e.g., 0.5-0.7). This confidence score C is dynamically updated using Bayesian methods based on feedback after task execution. For example, when an implicit memory data unit is validated, its confidence parameter value is adjusted accordingly. Update, where η is the learning rate (e.g., 0.05); when proof by contradiction occurs, press The decay is calculated using μ as the decay factor (e.g., 0.8). The current confidence parameter value is used directly as the score C during evaluation.
[0054] Recall frequency (U): The count of the number of times a memory data unit has been successfully retrieved and used within a preset time window (e.g., the past 7 days). Normalization is applied to this count. , where max_count_all is the maximum number of times all memory data units are called within the same time window.
[0055] Task Relevance (R): A weighted matrix of associations between a memory data unit i and task type j, obtained through learning from historical data. The relevance score R is the weight corresponding to the current task type j. Weight The success rate of task completion after unit i is called in task type j can be obtained by performing a smoothing process.
[0056] Based on the evaluation results, the system performs dynamic updates: Confidence update: Based on user feedback and effect evaluation after task execution, the confidence of the memory data units participating in this task is fine-tuned.
[0057] Time decay: Run the decay function periodically (e.g., hourly) to reduce the confidence and timeliness scores of memories that have not been called or verified for a long time.
[0058] Retirement Mechanism: When the overall value score S of a memory data unit falls below a preset retirement threshold (e.g., 0.2), the system automatically marks it as "low-value." For low-value memories, they can be migrated to a low-frequency storage area to reduce the load on the main retrieval database; if they remain low-value for several consecutive periods, they will be safely deleted or deeply archived. For explicit memory data units, an administrator confirmation process can be triggered before retirement.
[0059] Step 104, memory retrieval steps.
[0060] When an agent receives a new user task, the system performs a memory retrieval step, efficiently and accurately selecting the memory data units most relevant to the current task from a structured memory bank, rather than loading the entire history.
[0061] Specifically, refer to Figure 4 The retrieval process on the left includes the following sub-steps: (1) Task feature extraction: Use pre-trained language models (such as BERT, Sentence-BERT) to convert the current task description text into high-dimensional feature vectors. For complex tasks, task type tags, user IDs, and other supplementary features can be used.
[0062] (2) Semantic similarity calculation: Calculate the task feature vector With the content vector of each memory data unit in the memory bank cosine similarity This yields a preliminary measure of correlation.
[0063] (3) Context matching degree calculation: Parse the context of the current task (which can be extracted from the task description or specified by the user) and match it with the context labels of the memory data units. Matching degree This can be achieved by calculating the overlap and weight score of the tag set.
[0064] (4) Comprehensive scoring and ranking: Combining semantic similarity, the confidence score C of the memory data unit (i.e., its current confidence parameter value), context matching degree, and timeliness score F(t), the final retrieval score of each memory data unit for the current task is calculated. The following weighted formula can be used:
[0065] Among them, the weighting coefficient , , , It can be dynamically configured according to task type or system policy.
[0066] (5) Top-K result return: Sort all memory data units in descending order of Score_retrieval, and select the top K units as the result set for this retrieval. The value of K can be dynamically determined according to the task complexity and the context window limit of the large model.
[0067] Step 105, prompt message construction steps.
[0068] Based on the high-value memory result set retrieved in step 104, the system constructs the prompt information that is finally input to the large language model.
[0069] Specifically, refer to Figure 4 The construction process on the right includes the following sub-steps: (1) Template Selection: The system maintains a configurable prompt template library. Based on the current task type and characteristics, the most suitable prompt template is automatically selected. The templates adopt a modular design, for example: [System Instructions] section: Defines the basic roles and behavioral boundaries of the intelligent agent.
[0070] [Task Description] section: Clearly state the user's specific needs for this task.
[0071] The [Related Background] section contains several predefined "slots," such as {System Constraints}, {User Preferences}, {Historical References}, and {Task Experience}, for embedding dynamically retrieved memory content.
[0072] [Output Requirements] section: Specify the desired output format, length, style, etc.
[0073] (2) Memory Slot Filling: Each predefined memory slot (e.g., {User Preferences}) in the prompt template is associated with one or more mapping rules. The rules are composed of the source level (system, agent, user, task) and / or memory type (explicit, implicit) of the memory data unit. The system automatically fills the content of the retrieved memory data unit into all slots that match the mapping rules based on its metadata attributes. For example, if the mapping rule for the {User Preferences} slot is "source level attribute is 'user'", then the content of all user-level explicit and implicit memory data units will be filled into this slot.
[0074] (3) Content optimization and length control: Check the total length of the filled prompts. If it exceeds the maximum context limit of the large model, intelligent compression is performed on the filled content. For example, for longer text memories, an extraction-based summarization algorithm (such as TextRank) is used to generate key sentence summaries; list-type memories are truncated or summarized. The goal is to retain the core semantics while strictly controlling the total number of tokens.
[0075] (4) Final prompt generation: The optimized, structured prompt information that incorporates dynamic memory is sent to the large language model to drive the agent to generate the final task output.
[0076] Example: Application in the Scenario of Drafting Government Documents To enable those skilled in the art to better understand the present invention, the following describes in detail how each step is implemented, using a specific scenario of drafting government documents.
[0077] Scenario Description: "Zheng Xiaozhu," the intelligent office assistant at a municipal government service center, needs to draft a "Notice on Organizing and Carrying Out the Annual Flood and Drought Prevention Inspection" for its user (Director Zhang, an office staff member of a bureau). Director Zhang has a history of multiple interactions with "Zheng Xiaozhu."
[0078] The specific implementation of step S101 (memory data acquisition): The "Zheng Xiaozhu" system continuously collects interaction logs with Director Zhang. When this task was triggered, the system collected: Current task request data: User voice input: "Please help me draft a notice for flood and drought prevention inspection work."
[0079] Historical interaction data: It was found that within the past month, Director Zhang requested the drafting of "notice" type documents three times, twice involving "work safety" and once involving "energy conservation publicity".
[0080] Historical feedback data: Director Zhang commented on the initial draft of the "Safety Production Notice," stating that "the content structure is good, but some wording could be stronger," and ultimately adopted the revised version. The system recorded this task as "successful" and recorded the modifications.
[0081] Specific implementation of step S102 (memory classification and structuring): The system parses the collected data into structured memory data units: System-level memory data unit (explicit): The content is "The drafting of official documents must follow the national standard of 'Format of Official Documents of Party and Government Organs'", the source level is "system", the type is "explicit", the confidence level is 0.99, and the context label task type is: drafting official documents.
[0082] Intelligent agent-level memory data unit (explicit): The content is "role: official document drafting assistant; style: rigorous, formal, and standardized language", the source level is "intelligent agent", the type is "explicit", and the confidence level is 0.98.
[0083] User-level memory data units (partially explicit, partially implicit): Explicit: User configuration "Preference title: Director Zhang; Affiliation: XX Bureau".
[0084] Implicitly: Based on historical behavior statistics, the system found that "users frequently process 'notice' type documents; have a high level of attention to the 'safety production' field; and tend to use 'severe' wording." The system assigned an initial confidence level of 0.7 to this implicit memory data unit and added the following labels: Task Type: Document Drafting, Field: Safety Production, Style: Severe.
[0085] Task-level memory data unit (implicit): Extracts the general structural template "title, addressee, body (introduction, matters, requirements), signature, date" from historically successfully drafted "notice" cases, as well as successful excerpts with "strong wording". Confidence level 0.8, labeled task type: official document drafting, document style: notice.
[0086] Based on the fact that the memories of "general notification structure" and "strong wording" are often used together in the "official document drafting" task in historical tasks, the system automatically established logical connection edges between them, enriching the memory network graph.
[0087] Specific implementation of step S103 (memory assessment and update): Prior to this task, the system was regularly evaluated.
[0088] For the user's implicit memory data unit "tends to use harsh language," its confidence parameter value was updated from 0.7 to 0.85 because it was verified in the most recent "Safety Production Notification" task (user feedback was positive). Therefore, its confidence score C will be 0.85 in subsequent searches.
[0089] For an old user implicit memory data unit "likes to use blue titles" (originating from an accidental operation six months ago), due to long-term inactivity, its timeliness score F(t) has decayed to a very low level, and its comprehensive score S is below the threshold, so it is automatically migrated to the low-frequency zone by the system.
[0090] The specific implementation of step S104 (memory retrieval): After receiving the task of "drafting a flood and drought prevention inspection notice": Extract the task feature vector V_task (containing semantics such as "drafting", "notification", "flood control and drought relief", "inspection" etc.).
[0091] Calculate the similarity between the data and the memory unit. It shows high similarity to "Task-level Memory Data Unit: Notification Template" and "User-level Memory Data Unit: Frequently Processed Notifications"; it has some correlation with "User-level Memory Data Unit: Focus on Safe Production" (both belong to special inspections); and it is related to the style of "User-level Memory Data Unit: Tends to Use Stern Wording".
[0092] Context matching: The current task label, Task Type: Official Document Drafting, Domain: Flood Control and Drought Relief, highly matches the labels of the above memory data units.
[0093] Overall score: Combining high confidence, high similarity, and high contextual matching, the above memory data units achieve a high Score_retrieval.
[0094] Returning Top-K results: includes memory data units such as "notification templates", "frequently processed notifications", and "preferentially harsh wording".
[0095] Specific implementation of step S105 (construction of prompt information): Select the dedicated prompt template for "Official Document Drafting - Notice".
[0096] Fill slots: {System Constraints}: Enter “Follow the national standard for the format of official documents of Party and government organs”.
[0097] {User Preference}: Enter "Title: Director Zhang; Affiliation: XX Bureau; Prefers a strong wording style".
[0098] {Task Experience}: Enter "General Notification Structure: Title, Addressee, Body (Introduction, Matters, Requirements), Closing, Date".
[0099] Length control: All padding content is concise, and the total length is far below the model's limit, so no compression is required.
[0100] The final prompt is generated and sent to the large model: "You are a rigorous and formal document drafting assistant. Please draft a 'Notice on Organizing and Carrying Out the Annual Flood and Drought Prevention Inspection Work' for Director Zhang (XX Bureau) in accordance with the national standard 'Format of Official Documents for Party and Government Organs.' Users prefer a strong wording style. You can refer to the general structure of the notice: title, addressee, body (introduction, matters, requirements), signature, date. Please directly generate the complete draft notice." During the retrieval in step S104 or the filling in step S105, conflicting memories may be encountered. For example, a task-level memory suggests "the beginning of a flood prevention notice should emphasize urgency," while a user-level memory (from an earlier feedback) records "Director Zhang believes that the beginning of a certain notice was too rushed." In this case, the system activates the conflict resolution submodule: Conflict detection: Semantic analysis identifies two memories that contradict each other regarding the "opening tone" suggestion.
[0101] Conflict assessment: Analyze the confidence level (task-level 0.8 vs user-level 0.6), timeliness (task-level updated this week vs user-level updated two months ago), and source authority (task-level based on multiple successful patterns vs user-level based on a single specific feedback).
[0102] Resolution Strategy: Weighted voting is employed. Task-level memories are given higher weight due to their high confidence, timeliness, and multiple successful summaries. The system may prioritize suggestions that emphasize urgency, but softening statements can be added to the prompts, such as "Please pay attention to the tone at the beginning, balancing urgency and stability." Resolution results and reasons are recorded for subsequent optimization.
[0103] To enhance the document drafting capabilities of "Zheng Xiaozhu" for all users, while strictly protecting user privacy, the system employs a federated learning mechanism to update task-level memory (public knowledge): Each user's local terminal extracts anonymized and desensitized document drafting pattern features (such as "the 'matter' section in a notification often contains 3-5 key points") from its own interaction data and encrypts them locally.
[0104] The encrypted data is uploaded to the central server.
[0105] The server aggregates the encryption features of all users and trains a global "document drafting optimization model" in ciphertext state.
[0106] The server securely distributes model updates to each terminal to optimize their local task-level memory (such as updating details of the "notification general structure"), so that all users can benefit from the collective experience and no individual user's raw data is leaked.
[0107] The implementation of steps S106 (memory security and privacy protection) and S107 (feedback learning and optimization) in the embodiment is as follows: Security protection: In step S102, when structuring user memory, the system automatically detects and desensitizes sensitive information such as the names and phone numbers of internal personnel that may be involved in the log, and replaces them with placeholders such as [name] and [phone number].
[0108] Feedback Learning: Director Zhang revised and adopted the initial draft of the flood prevention notice generated this time. The system collected this positive feedback and analysis revealed that the "task-level memory data unit: notice template" and "user-level memory data unit: tendency towards harsh wording" contributed highly to this task. Therefore, according to the feedback rules, the confidence parameter values of these two memory data units were increased (for example, by increasing the original value by 0.05), and their correlation with the "flood prevention and drought relief" domain was strengthened. Conversely, if the user feedback was negative, the confidence of the relevant memory was lowered accordingly.
[0109] Based on "Director Zhang's" user role (clerk) and task security level (ordinary notification), the system set access permissions for his user-level memories, restricting access only to the "Zheng Xiaozhu" intelligent agent and its direct superior administrator account. All memory retrieval operations were recorded in the audit log. Through the operation of the above complete embodiments, this method realizes a closed loop of the entire process from memory acquisition, classification, evaluation, retrieval to prompt construction in a specific scenario. It effectively utilizes high-value memories, generates accurate and personalized prompts, and ultimately assists in outputting draft documents that better meet user needs.
[0110] Further reference Figure 5 As an implementation of the methods shown in the above figures, this disclosure provides some embodiments of an intelligent agent prompting information construction device based on multi-level memory processing. These device embodiments are similar to... Figure 1 Corresponding to the method embodiments shown, the device can be specifically applied to various electronic devices.
[0111] like Figure 5As shown, an intelligent agent prompt information construction device 500 based on multi-level memory processing in some embodiments includes: a memory acquisition module 501, a memory classification module 502, a memory evaluation module 503, a memory update module 504, a memory retrieval module 505, and a prompt construction module 506. Specifically, the memory acquisition module 501 is configured to acquire interaction data during the intelligent agent's execution of user tasks and generate task logs; the memory classification module 502 is configured to parse the acquired data into memory data units and divide them into explicit memory data units and implicit memory data units; the memory evaluation module 503 is configured to configure confidence parameters for implicit memory data units and evaluate the memory data units based on a multi-dimensional evaluation model; the memory update module 504 is configured to dynamically update the memory bank according to the confidence parameters and a time decay mechanism; the memory retrieval module 505 is configured to retrieve matching memory data units from the memory bank according to the current task characteristics; and the prompt construction module 506 is configured to dynamically construct prompt input containing control information based on the retrieved memory data units.
[0112] Optionally, the device 500 may further include: a context labeling module (not shown in the figure), configured to automatically add context labels to memory data units; a conflict resolution module (not shown in the figure), configured to detect and handle content contradictions between retrieved memory data units; a security filtering module (not shown in the figure), configured to perform sensitive information detection and desensitization on memory data units; an access control module (not shown in the figure), configured to manage access permissions for memory data units; a feedback learning module (not shown in the figure), configured to optimize memory evaluation and retrieval parameters based on task execution feedback; and a federated learning client module (not shown in the figure), configured to participate in cross-user federated learning to securely update public task memories.
[0113] It is understandable that the modules described in the device 500 are similar to those in the reference. Figure 1 The steps in the described method correspond accordingly. Therefore, the operations, features, and beneficial effects described above for the method also apply to device 500 and the modules contained therein, and will not be repeated here.
[0114] Embodiments of this disclosure also provide an electronic device, including: one or more processors; and a storage device having one or more programs stored thereon, which, when executed by one or more processors, cause the one or more processors to implement the method described in any of the above method embodiments.
[0115] Embodiments of this disclosure also provide a computer-readable storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the method described in any of the above method embodiments.
[0116] 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 system 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 system. 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 system that includes that element.
[0117] The above description is merely a selection of preferred embodiments of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of the invention involved in the embodiments of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described inventive concept. For example, technical solutions formed by substituting the above-described features with (but not limited to) technical features with similar functions disclosed in the embodiments of this disclosure.
Claims
1. A method for constructing intelligent agent prompt information based on multi-level memory processing, characterized in that, include: Memory data acquisition steps: Collect interaction data during the execution of user tasks by the intelligent agent and generate task logs; Memory classification and structuring steps: The collected data is parsed into memory data units and divided into explicit memory data units and implicit memory data units. The explicit memory data units include configuration data at the system level, agent level and user level. Memory evaluation and update steps: Assign confidence parameters to implicit memory data units, evaluate memory data units based on a multi-dimensional evaluation model, and dynamically update the memory bank according to confidence parameters and time decay mechanism; Memory retrieval steps: Based on the characteristics of the current task, retrieve matching memory data units from the memory bank; The prompt information construction steps are as follows: Based on the retrieved memory data units, prompt input containing control information is dynamically constructed to drive the agent to perform tasks.
2. The method according to claim 1, characterized in that, The memory classification and structuring steps specifically include: The memory data unit is further subdivided into system-level memory data unit, agent-level memory data unit, user-level memory data unit, and task-level memory data unit; Add a context label to each memory data unit, the context label including at least the task type, interaction stage and user emotional tendency; Establish semantic or logical relationships between the memory data units to form a memory network graph.
3. The method according to claim 1, characterized in that, The memory assessment and updating steps specifically include: The comprehensive value score of each memory data unit is calculated using the multi-dimensional evaluation model, which considers at least the confidence dimension, timeliness dimension, call frequency dimension, and task relevance dimension. Establish a time decay function to decay the confidence of memory data units that have not been called for more than a preset time window; A memory eviction threshold is set. When the overall value score of a memory data unit is lower than the memory eviction threshold, it is marked as invalid or migrated to a low-frequency storage area.
4. The method according to claim 1, characterized in that, The memory retrieval steps specifically include: Extract the feature vector of the current task; Calculate the semantic similarity between the feature vector and the content of each memory data unit in the memory bank; The semantic similarity, the confidence score of each memory data unit, and the contextual label matching degree are combined to perform a weighted comprehensive ranking. Return at least one memory data unit that appears at the top of the sort order as the retrieval result.
5. The method according to claim 1, characterized in that, The steps for constructing the prompt information specifically include: Based on the characteristics of the current task, a matching prompt template is selected from a preset prompt template library, wherein the prompt template has at least one preset memory slot; The contents of the retrieved memory data units are filled into the corresponding memory slots; For prompt messages whose length exceeds a preset threshold after filling, content compression or summary generation is performed to control the final length of the prompt message.
6. The method according to claim 1, characterized in that, It also includes steps for memory security and privacy protection: Sensitive information detection and automatic desensitization processing are performed on the memory data units; Differentiated access and retrieval permissions are set for the memory data unit based on user roles and task security levels; The creation, modification, retrieval, and deletion operations of the memory data units are recorded to form an audit traceability record.
7. The method according to claim 1, characterized in that, It also includes feedback learning and optimization steps: Collect user feedback data and task completion performance indicators after the intelligent agent performs the task; Analyze the contribution of each memory data unit in this task execution; Based on the user feedback data, the task completion performance indicators, and the contribution level, the confidence parameters of the relevant memory data units and the weight coefficients in the memory retrieval step are dynamically adjusted.
8. A device for constructing intelligent agent prompting information based on multi-level memory processing, characterized in that, include: The memory acquisition module is configured to collect interaction data during the execution of user tasks by the intelligent agent and generate task logs. The memory classification module is configured to parse the collected data into memory data units and divide them into explicit memory data units and implicit memory data units. The memory assessment module is configured to assign reliability parameters to implicit memory data units and evaluate memory data units based on a multi-dimensional assessment model. The memory update module is configured to dynamically update the memory bank based on the confidence parameter and the time decay mechanism; The memory retrieval module is configured to retrieve matching memory data units from the memory bank based on the characteristics of the current task. The prompt construction module is configured to dynamically construct prompt inputs containing control information based on retrieved memory data units.
9. An electronic device, characterized in that, include: One or more processors; A storage device on which one or more programs are stored; When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, It stores a computer program thereon, wherein the program, when executed by a processor, implements the method as described in any one of claims 1 to 7.