A memory management method, device and equipment of an intelligent agent
By constructing a windowed memory annotation mechanism and a semantic matching algorithm, the agent can filter out relevant memory text entries when managing dialogue history information, which solves the problems of noise interference and broken association of key information, improves the accuracy and consistency of the response, and enhances the robustness and fault tolerance of the system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD
- Filing Date
- 2026-05-08
- Publication Date
- 2026-06-05
AI Technical Summary
When managing dialogue history, intelligent agents suffer from noise interference and broken connections between key information, leading to response errors and inconsistent context, which reduces task execution efficiency and user experience.
By constructing a windowed memory annotation mechanism based on semantic continuity and a two-dimensional semantic matching algorithm, relevant memory text entries are filtered out, and in abnormal situations, the system switches to memory sorting mode to ensure the accuracy and consistency of the response.
It significantly improves the response accuracy and consistency of the agent, avoids contextual noise interference and key information disconnection caused by memory management defects, enhances system robustness and fault tolerance, and ensures response continuity.
Smart Images

Figure CN122154744A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a method, apparatus and device for memory management of an intelligent agent. Background Technology
[0002] An intelligent agent is an artificial intelligence entity designed for a specific industry. It perceives environmental information, autonomously decides actions based on these perceptions, and executes those actions to achieve pre-defined goals. Intelligent agents can be implemented as software programs or hardware. They are deeply integrated with industry-specific expertise and tools, providing customized problem-solving capabilities. Intelligent agents are widely used in industries such as transportation and customer service, processing user queries through integrated professional knowledge, such as customer service dialogues or data analysis tasks.
[0003] However, intelligent agents exhibit significant shortcomings in managing dialogue history. For instance, the failure to effectively filter and utilize dialogue history results in the input context to the large language model containing substantial noise interference (such as irrelevant historical statements or redundant data), leading to broken connections between key information (such as ambiguous referents caused by topic jumps in multi-turn interactions). This causes biases in the large language model's understanding of user intent, manifesting as incorrect responses or incoherent context, thereby reducing task execution efficiency and user experience. Summary of the Invention
[0004] This application provides a memory management method for an intelligent agent, the method comprising: Retrieve the original text question and multiple memory text entries already stored in the cache; Based on the semantic matching degree between the original text question and each memory text entry, memory text entries are selected as candidate memory text entries from the plurality of memory text entries; wherein, when the memory filtering mode is enabled, based on the target semantic value of each memory text entry, memory text entries with a target semantic value greater than a benchmark threshold are selected as candidate memory text entries; wherein, the target semantic value of a memory text entry is determined based on the semantic matching degree corresponding to that memory text entry. Based on the sequence number of the candidate memory text entry, the memory text entry with the sequence number is selected from the cache; the original text question and the memory text entry with the sequence number are input into the agent, and the agent processes the original text question and the memory text entry to obtain the answer to the question; In the case of enabling the memory filtering mode, if the agent returns a memory omission exception after inputting the original text question and the memory text entry with the sequence number, then the memory sorting mode is enabled; wherein, the memory omission exception indicates that there is a missing memory text entry, and the agent cannot answer the question based on the memory text entry.
[0005] This application provides a memory management device for an intelligent agent, the device comprising: The acquisition module is used to acquire the original text question and multiple memory text entries already stored in the cache. The selection module is used to select memory text entries as candidate memory text entries from the plurality of memory text entries based on the semantic matching degree between the original text question and each memory text entry; and to select memory text entries with the sequence number of the candidate memory text entries from the cache area; wherein, when the memory filtering mode is enabled, memory text entries with a target semantic value greater than a benchmark threshold are selected as candidate memory text entries based on the target semantic value of each memory text entry; wherein, the target semantic value of a memory text entry is determined based on the semantic matching degree corresponding to that memory text entry; The processing module is used to input the original text question and the memory text entry of the sequence number into the agent, and the agent processes the original text question and the memory text entry to obtain the answer to the question; wherein, when the memory filtering mode is enabled, if the agent returns a memory omission exception after the original text question and the memory text entry of the sequence number are input, the memory sorting mode is enabled; wherein, the memory omission exception indicates that there is a missing memory text entry, and the agent cannot answer the question based on the memory text entry.
[0006] This application provides an electronic device, including: a processor and a machine-readable storage medium, the machine-readable storage medium storing machine-executable instructions that can be executed by the processor; the processor is used to execute the machine-executable instructions to implement the memory management method of the intelligent agent described in the above example of this application.
[0007] This application provides a computer program product, which includes a computer program that, when executed by a processor, implements the memory management method of the intelligent agent described above in this application.
[0008] This application provides a machine-readable storage medium storing machine-executable instructions that can be executed by a processor; wherein the processor is used to execute the machine-executable instructions to implement the memory management method of the intelligent agent described in the above example of this application.
[0009] As can be seen from the above technical solutions, in this embodiment, after obtaining the original text question and multiple memory text entries, the original text question and multiple memory text entries are not directly input into the intelligent agent. Instead, based on the semantic matching degree between the original text question and each memory text entry, candidate memory text entries are selected from the multiple memory text entries. Based on the sequence number of the candidate memory text entries, the memory text entry with that sequence number is selected from the cache. The original text question and the memory text entry with that sequence number are then input into the intelligent agent, and the answer to the question is obtained through the intelligent agent. Based on this, it is possible to filter out the relevant memories of the original text question (i.e., the memory text entry with that sequence number) and input them into the intelligent agent to generate accurate and contextually coherent answers, ensuring that the response matches the deeper needs of the user's query. This paper proposes an optimized memory filtering method. By constructing a windowed memory annotation mechanism based on semantic continuity and a two-dimensional semantic matching algorithm, it achieves accurate filtering and context reconstruction of historical memories, significantly improving the accuracy and coherence of agent responses, enhancing the purity and consistency of contextual information, and avoiding contextual noise interference (such as irrelevant historical statements or redundant data) and key information connection breaks (such as lost cross-references and semantic gaps caused by topic jumps) due to memory management defects. It can effectively solve the memory omission problem caused by weak relevance in special scenarios (such as no nouns before pronouns), improve the robustness and fault tolerance of the system, prevent the agent from interrupting service due to memory filtering failure, and ensure response continuity. The introduction of a windowed annotation mechanism based on semantic continuity integrates continuous and related historical memories into window units (such as the same topic or intent chain) through unified sequence numbers, solving the semantic gaps and context fragmentation problems caused by focusing on a single memory (such as memory breaks caused by topic jumps). Through unified window management, it ensures the natural flow of context, avoids intent loss caused by mechanical truncation, and significantly enhances response coherence. Overcoming the blind spots in weakly related scenarios (such as no keyword overlap), this method accurately captures semantic associations, significantly improving the accuracy and semantic coherence of the agent's response. A dynamic mode-switching mechanism is proposed: a memory-filtering mode is activated during initial processing; when a memory omission anomaly is detected in historical processing records (such as missing associations due to referential risk), the system automatically switches to memory-sorting mode, ensuring seamless degradation under abnormal conditions. Based on this, the system effectively solves the memory omission problem caused by weak relevance in special scenarios such as referentiality (e.g., no noun before a pronoun), improving system robustness and fault tolerance. In practical applications, it prevents the agent from interrupting service due to memory-filtering failure, ensuring continuous response. Attached Figure Description
[0010] Figure 1 This is a flowchart illustrating the memory management method of an intelligent agent in one embodiment of this application; Figure 2 This is a flowchart illustrating the memory management method of an intelligent agent in one embodiment of this application; Figure 3A , Figure 3B and Figure 3C This is a schematic diagram of memory-based intelligent annotation in one embodiment of this application; Figure 4 This is a schematic diagram of the structure of an intelligent agent memory management system in one embodiment of this application; Figure 5 This is a schematic diagram of the memory filtering optimization algorithm in one embodiment of this application; Figure 6 This is a schematic diagram of the memory management device of an intelligent agent in one embodiment of this application; Figure 7 This is a hardware structure diagram of an electronic device according to one embodiment of this application. Detailed Implementation
[0011] This application proposes a memory management method for intelligent agents, which can be applied to electronic devices. See [link to relevant documentation]. Figure 1 The diagram shown is a flowchart of a memory management method for intelligent agents, which may include: Step 101: Obtain the original text question and multiple memory text entries already stored in the cache.
[0012] Step 102: Based on the semantic matching degree between the original text question and each memory text entry, select memory text entries as candidate memory text entries from multiple memory text entries; based on the sequence number of the candidate memory text entries, select memory text entries with the corresponding sequence number from the cache. Wherein, when the memory filtering mode is enabled, based on the target semantic value of each memory text entry, memory text entries with a target semantic value greater than a benchmark threshold can be selected as candidate memory text entries; wherein, the target semantic value of a memory text entry can be determined based on the semantic matching degree corresponding to that memory text entry.
[0013] Step 103: Input the original text question and the memory text entry of the sequence number into the agent. The agent processes the original text question and the memory text entry to obtain the answer to the question.
[0014] For example, if, when the memory filtering mode is enabled, the agent returns a memory omission exception after inputting the original text question and the memory text entry with the sequence number, then the memory sorting mode can be enabled (switching from memory filtering mode to memory sorting mode). A memory omission exception indicates that there is a missing memory text entry, and the agent cannot answer the question based on that memory text entry.
[0015] For example, semantic matching degree may include semantic continuity and / or semantic similarity. If semantic matching degree includes semantic continuity and semantic similarity, then the process of determining the target semantic value of a memory text entry based on the semantic matching degree corresponding to the memory text entry may include, but is not limited to: for each memory text entry, determining the semantic similarity between the original text question and the memory text entry, determining the semantic continuity between the original text question and the memory text entry, and weighting the semantic similarity and the semantic continuity to obtain the target semantic value of the memory text entry.
[0016] Based on this, based on the target semantic value of each memory text entry, memory text entries with target semantic values greater than the baseline threshold can be selected as candidate memory text entries; or, based on the target semantic value of each memory text entry, multiple memory text entries can be sorted, and based on the sorting results, the K memory text entries with the largest target semantic values can be selected as candidate memory text entries, where K can be a positive integer.
[0017] If semantic matching degree includes semantic continuity, then the process of determining the target semantic value of a memory text entry based on the semantic matching degree corresponding to the memory text entry may include, but is not limited to: for each memory text entry, determining the semantic continuity between the original text question and the memory text entry, and determining the semantic continuity as the target semantic value of the memory text entry.
[0018] If semantic matching degree includes semantic similarity, then the process of determining the target semantic value of a memory text entry based on the semantic matching degree corresponding to the memory text entry may include, but is not limited to: for each memory text entry, determining the semantic similarity between the original text question and the memory text entry, and determining the semantic similarity as the target semantic value of the memory text entry.
[0019] For example, when the memory sorting mode is enabled, multiple memory text entries can be sorted based on the target semantic value of each memory text entry, and the K memory text entries with the largest target semantic values can be selected as candidate memory text entries based on the sorting results. For instance, for the first processing request of the original text problem, the memory filtering mode can be enabled for the first processing request; for subsequent processing requests of the original text problem, the memory sorting mode can be enabled for the subsequent processing requests.
[0020] In the case of enabling the memory filtering mode, if the agent returns a memory omission exception after inputting the original text question and the memory text entry with the sequence number, then a non-first-time processing request for the original text question can be executed, that is, the memory sorting mode can be enabled.
[0021] For example, determining the semantic similarity between the original text question and the remembered text entry may include, but is not limited to: extracting features from the original text question to obtain a question feature vector; extracting features from the remembered text entry to obtain a memory feature vector; and obtaining M sliding windows, where M can be greater than 1; for each sliding window, smoothing the question feature vector to obtain smoothed question features; generating high-frequency detail question features based on the smoothed question features and the question feature vector; and fusing the high-frequency detail question features corresponding to each sliding window to obtain fused question features; furthermore, for each sliding window, smoothing the memory feature vector to obtain smoothed memory features; generating high-frequency detail memory features based on the smoothed memory features and the memory feature vector; and fusing the high-frequency detail memory features corresponding to each sliding window to obtain fused memory features. Based on this, semantic similarity can be determined based on the fused question features and the fused memory features.
[0022] For example, determining the semantic continuity between the original text question and the remembered text entry may include, but is not limited to: extracting features from the original text question to obtain a question feature vector; extracting features from the remembered text entry to obtain a memory feature vector; and determining semantic continuity based on the question feature vector, the memory feature vector, and the acquired bandwidth parameter; wherein the bandwidth parameter is a parameter used to control the degree of smoothness. Semantic continuity can be determined using the following formula: In the above formula, V q It can be used to represent the feature vector of a problem. V m γ can be used to represent memory feature vectors, and γ can be used to represent bandwidth parameters. It can be used to represent semantic continuity.
[0023] For example, before selecting memory text entries with target semantic values greater than a benchmark threshold as candidate memory text entries, the process of obtaining the benchmark threshold may include, but is not limited to: if the original text question is a high-probability-of-reference question, the configured initial threshold can be reduced to obtain the benchmark threshold; if the original text question is not a high-probability-of-reference question, the initial threshold can be determined as the benchmark threshold; or, if the original text question is not a high-probability-of-reference question, the initial threshold can be increased to obtain the benchmark threshold. Wherein, if multiple keywords in the original text question contain pronouns, and there is no noun preceding the pronouns, then the original text question can be considered a high-probability-of-reference question.
[0024] For example, the original text question and its sequence number are input into the agent. The agent processes the original text question and the sequence number to obtain the answer. Afterward, the original text question and its answer are stored in a cache, serving as the sequence number for subsequent original text questions. The sequence number of the original text question is the same as the sequence number of the answer. If the semantics of the original text question are consistent with the first sequence number in the cache, then the sequence number of the original text question and the sequence number of the first sequence number are the same. If the semantics of the original text question are inconsistent with any of the sequence numbers in the cache, then the sequence number of the original text question is a newly assigned sequence number, meaning the original text question needs to be reassigned.
[0025] As can be seen from the above technical solutions, in this embodiment, after obtaining the original text question and multiple memory text entries, the original text question and multiple memory text entries are not directly input into the intelligent agent. Instead, based on the semantic matching degree between the original text question and each memory text entry, candidate memory text entries are selected from the multiple memory text entries. Based on the sequence number of the candidate memory text entries, the memory text entry with that sequence number is selected from the cache. The original text question and the memory text entry with that sequence number are then input into the intelligent agent, and the answer to the question is obtained through the intelligent agent. Based on this, it is possible to filter out the relevant memories of the original text question (i.e., the memory text entry with that sequence number) and input them into the intelligent agent to generate accurate and contextually coherent answers, ensuring that the response matches the deeper needs of the user's query. This paper proposes an optimized memory filtering method. By constructing a windowed memory annotation mechanism based on semantic continuity and a two-dimensional semantic matching algorithm, it achieves accurate filtering and context reconstruction of historical memories, significantly improving the accuracy and coherence of agent responses, enhancing the purity and consistency of contextual information, and avoiding contextual noise interference (such as irrelevant historical statements or redundant data) and key information connection breaks (such as lost cross-references and semantic gaps caused by topic jumps) due to memory management defects. It can effectively solve the memory omission problem caused by weak relevance in special scenarios (such as no nouns before pronouns), improve the robustness and fault tolerance of the system, prevent the agent from interrupting service due to memory filtering failure, and ensure response continuity. The introduction of a windowed annotation mechanism based on semantic continuity integrates continuous and related historical memories into window units (such as the same topic or intent chain) through unified sequence numbers, solving the semantic gaps and context fragmentation problems caused by focusing on a single memory (such as memory breaks caused by topic jumps). Through unified window management, it ensures the natural flow of context, avoids intent loss caused by mechanical truncation, and significantly enhances response coherence. Overcoming the blind spots in weakly related scenarios (such as no keyword overlap), this method accurately captures semantic associations, significantly improving the accuracy and semantic coherence of the agent's response. A dynamic mode-switching mechanism is proposed: a memory-filtering mode is activated during initial processing; when a memory omission anomaly is detected in historical processing records (such as missing associations due to referential risk), the system automatically switches to memory-sorting mode, ensuring seamless degradation under abnormal conditions. Based on this, the system effectively solves the memory omission problem caused by weak relevance in special scenarios such as referentiality (e.g., no noun before a pronoun), improving system robustness and fault tolerance. In practical applications, it prevents the agent from interrupting service due to memory-filtering failure, ensuring continuous response.
[0026] The technical solutions described above in the embodiments of this application will be explained below in conjunction with specific application scenarios.
[0027] An intelligent agent is an AI entity designed for a specific industry. It perceives environmental information, autonomously decides actions based on these perceptions, and executes those actions to achieve predefined goals. However, intelligent agents have significant shortcomings in managing dialogue history. For example, the failure to effectively filter and utilize dialogue history leads to a large amount of noise interference (such as irrelevant historical statements or redundant data) in the context information input to the large language model, resulting in broken connections between key information (such as unclear referents due to topic jumps in multi-turn interactions). This causes the large language model to misunderstand user intent, manifesting as incorrect responses or incoherent context, thereby reducing task execution efficiency and user experience. Dialogue history includes information stored across sessions in long-term memory and temporary data within the task cycle in short-term memory. Long-term memory refers to the agent's ability to persistently store and retrieve information across sessions and tasks, relying on external storage systems (such as databases and knowledge graphs) to achieve long-term retention and reuse of information. Short-term memory refers to the information cache temporarily maintained by the agent within a single task cycle, storing intermediate results generated by the current task, sub-task breaks, and real-time perception data, maintaining the continuity of multi-turn interactions in dialogue scenarios and avoiding context breaks.
[0028] To address the above findings, this embodiment proposes a dynamic agent short-term memory management method that enables dynamic long and short-term memory management and memory filtering optimization. By constructing a windowed memory annotation mechanism based on semantic continuity and a two-dimensional semantic matching algorithm, it achieves accurate filtering of historical memories and context reconstruction, significantly improving the accuracy and coherence of agent responses, enhancing the purity and consistency of contextual information, and avoiding contextual noise interference (such as irrelevant historical statements and redundant function words) and key information connection breaks (such as loss of cross-wheel reference and semantic breaks caused by topic jumps) due to memory management defects.
[0029] This application proposes a memory management method for intelligent agents. This method can be applied to electronic devices, which are any devices that support intelligent agents, such as personal computers, laptops, smartphones, IoT devices, cloud devices, servers, etc. There is no limitation on the type of electronic device. See also Figure 2 The diagram shown is a flowchart of a memory management method for intelligent agents, which may include: Step 201: Obtain the original text question and multiple memory text entries already stored in the cache.
[0030] For example, when a user inputs a question, the question can be in text format, and this input can be recorded as the original text question. Alternatively, the question can be in speech format, which can be converted to text format and recorded as the original text question. Or, the question can be in image format, which can be converted to text format and recorded as the original text question. Of course, these are just a few examples; the goal is simply to obtain the original text question based on the user input.
[0031] For example, the cache of an electronic device (also known as an information cache, such as memory, disk, or other storage media) can store a large number of memory text entries (memory text entries are the original text questions and answers from previous rounds; the original text questions and answers can be the same memory text entry, or the original text question can be one memory text entry, and the answer can be another memory text entry). Based on this, multiple memory text entries can be retrieved from the cache. For example, the number P to be retrieved can be predetermined, where P can be a positive integer, such as 5, 8, 10, 20, etc. Thus, P memory text entries can be retrieved from the cache. For example, when retrieving P memory text entries from the cache, the P memory text entries with the most recent storage time (closest to the current time interval) can be retrieved according to the storage time of each memory text entry (indicating that the memory text entry was stored at that storage time).
[0032] Step 202: For each memory text entry (i.e., each memory text entry within P memory text entries), determine the semantic continuity between the original text question and the memory text entry.
[0033] For example, feature extraction can be performed on the original text question to obtain a question feature vector, and feature extraction can be performed on the remembered text entry to obtain a memory feature vector. For instance, the original text question can be input into a feature extraction network, which will extract features from the original text question to obtain a question feature vector. Similarly, the remembered text entry can be input into a feature extraction network, which will extract features from the remembered text entry to obtain a memory feature vector. The feature extraction network can be a Sentence_BERT network model or any other network model that can perform feature extraction.
[0034] For example, the Sentence_bert network model is an improved model based on the BERT (Bidirectional Encoder Representations from Transformers) architecture, specifically designed to generate high-quality sentence-level embedding vectors (Sentence Embeddings).
[0035] For example, when extracting the problem feature vector from the original text problem, the original text problem can be preprocessed first to obtain the preprocessed text problem, and then the problem feature vector can be obtained by extracting features from the preprocessed text problem. For example, when preprocessing the original text problem, meaningless stop words (i.e., function words, such as "le", "ne", etc.) in the original text problem can be removed to simplify the problem structure. For example, the original text problem can be tokenized to obtain multiple tokens in the original text problem. For each token, if the词性 of the token belongs to the stop word category (such as auxiliary words, interjections), then the token is removed from the original text problem. For example, a stop word list can be predefined, and for each token, if the词性 of the token is in the stop word list, then the词性 of the token belongs to the stop word category.
[0036] Exemplarily, after obtaining the problem feature vector and the memory feature vector, the semantic continuity between the original text problem and the memory text entry can be determined based on the problem feature vector, the memory feature vector, and the obtained bandwidth parameter. Among them, the bandwidth parameter can be a parameter used to control the smoothness degree.
[0037] For example, although the cosine similarity can effectively measure the consistency of vector directions, the cosine similarity assumes that the semantic space is a linear structure and it is difficult to capture local proximities and non-linear continuous relationships in complex semantic manifolds. Therefore, in this embodiment, the Radial Basis Function Kernel (RBF kernel) is introduced as a measurement tool for semantic continuity. The RBF kernel maps the original vector into a high-dimensional Hilbert space through an implicit mapping, thereby measuring the proximity of the original vector in the semantic manifold. The RBF kernel can effectively map vectors to a high-dimensional space and measure the proximity characteristics, which is suitable for capturing non-linear relationships in the semantic space, so as to more accurately quantify the semantic continuity between the problem and the memory. The continuity score value calculated by the RBF kernel reflects the local consistency between the problem and the memory in the deep semantic space and is applicable to metaphorical expressions such as anaphora.
[0038] Based on this, in this embodiment, the semantic continuity between the original text problem and the memory text entry is determined based on the RBF kernel. For example, the following formula can be used to determine the semantic continuity: It should be noted that there seems to be some incorrect "词性" in the translation of item , which may need to be adjusted according to the correct content in the original Chinese.; In the above formula, V q represents the problem feature vector, V m represents the memory feature vector, and γ represents the bandwidth parameter, represents semantic continuity. It can be seen from the above formula that the semantic continuity between the original text problem and this memory text entry can be determined based on the problem feature vector, the memory feature vector, and the bandwidth parameter. For the bandwidth parameter, it is used to control the smoothness of the RBF kernel.
[0039] The above formula is only an example for determining semantic continuity, and there is no limitation to this. The semantic continuity between the original text problem and this memory text entry can be determined based on the problem feature vector and the memory feature vector.
[0040] Step 203: For each memory text entry (that is, each memory text entry within the P memory text entries), determine the semantic similarity between the original text problem and this memory text entry.
[0041] Exemplarily, feature extraction can be performed on the original text problem to obtain the problem feature vector, and feature extraction can be performed on this memory text entry to obtain the memory feature vector. For example, the original text problem can be input into the feature extraction network, and the feature extraction network can perform feature extraction on the original text problem to obtain the problem feature vector. This memory text entry can be input into the feature extraction network, and the feature extraction network can perform feature extraction on this memory text entry to obtain the memory feature vector. The feature extraction network can be the Sentence_bert network model or other network models, as long as it can implement the feature extraction function.
[0042] For example, when performing feature extraction on the original text problem to obtain the problem feature vector, the original text problem can also be preprocessed first to obtain the preprocessed text problem, and then feature extraction is performed on the preprocessed text problem to obtain the problem feature vector. For example, when preprocessing the original text problem, meaningless stop words (i.e., function words, such as "le", "ne", etc.) in the original text problem can be removed.
[0043] For example, after obtaining the problem feature vector and the memory feature vector, a multi-scale iterative smoothing mechanism can be used to denoise the feature vector. This mechanism optimizes the representation quality of the semantic vector through progressive residual fusion. The multi-scale iterative smoothing mechanism employs a hierarchical processing flow: multi-level sliding weighted averaging is performed on the input vector (e.g., a 1024-dimensional problem feature vector or memory feature vector), with each level using a dynamically expanding sliding window (e.g., a Gaussian window). For instance, level 1 has a sliding window of 3 (3×3), level 2 has a sliding window of 5 (5×5), and level 3 has a sliding window of 7 (7×7). By performing multi-level sliding weighted averaging, features are progressively extracted from local to global levels. Then, in each level, the residual (high-frequency details) between the current smoothing result and the input vector is weighted and fused using an adjustable intensity coefficient α (0.2~0.5). Finally, cosine similarity is calculated between the weighted fused problem feature vector and the weighted fused memory feature vector.
[0044] By employing a multi-scale iterative smoothing mechanism, the stable semantic structure of the baseline is preserved while key detailed features are enhanced. This effectively suppresses noise interference and significantly improves the accuracy of semantic relevance.
[0045] For the multi-scale iterative smoothing mechanism, M sliding windows can be obtained. M can be greater than 1, such as 3, 4, 5, 6, etc. Taking 3 sliding windows as an example, sliding window 1 is a 3×3 sliding window, sliding window 2 is a 5×5 sliding window, and sliding window 3 is a 7×7 sliding window.
[0046] For each sliding window, a smoothing operation can be performed on the problem feature vector to obtain smoothed problem features. Taking a Gaussian window as an example, a Gaussian window can be a window function based on a Gaussian function. For each feature point (e.g., feature point A) within the problem feature vector, the center of the Gaussian window is aligned with feature point A. Using feature point A as the center, a feature region matching the Gaussian window is extracted from the problem feature vector, with the size of the feature region being the same as the size of the Gaussian window. Then, operations (such as convolution, weighted operations, etc.) are performed based on the feature values of each feature point within the feature region and the values of each point within the Gaussian window to obtain the optimized feature value of feature point A. Clearly, the smoothed problem features can be obtained by combining the optimized feature values of each feature point within the problem feature vector.
[0047] High-frequency detail problem features are generated based on the smoothed problem features and the problem feature vector. For example, the residual features between the smoothed problem features and the problem feature vector are calculated, and this residual feature is used as the high-frequency detail problem features, thereby obtaining the high-frequency detail problem features of each sliding window, such as the high-frequency detail problem features of sliding window 1, sliding window 2, and sliding window 3.
[0048] The high-frequency detail features corresponding to each sliding window are fused to obtain the fused problem features. For example, the high-frequency detail features corresponding to each sliding window are weighted and fused to obtain the fused problem features. For instance, the weighted coefficients and high-frequency detail features of sliding window 1, sliding window 2, and sliding window 3 are weighted and calculated to obtain the fused problem features.
[0049] The weighting coefficients of sliding window 1, sliding window 2, and sliding window 3 can be configured according to actual needs. For example, the weighting coefficients can be between 0.2 and 0.5, such as 0.2 for sliding window 1, 0.3 for sliding window 2, and 0.4 for sliding window 3.
[0050] For each sliding window, the memory feature vector is smoothed using that window to obtain smoothed memory features. High-frequency detail memory features are then generated based on these smoothed memory features and the memory feature vector (e.g., calculating the residual between the smoothed memory features and the memory feature vector, and using this residual as the high-frequency detail memory feature). The high-frequency detail memory features corresponding to each sliding window are then fused to obtain the fused memory features. The method for obtaining the fused memory features is the same as that for obtaining the fused problem features, and will not be elaborated further here.
[0051] For example, after obtaining the fused question features and fused memory features, semantic similarity can be determined based on these features. For instance, the cosine similarity between the fused question features and the fused memory features can be calculated, and this cosine similarity can be used as the semantic similarity between the original text question and the remembered text entry. For example, the cosine similarity can be calculated using the following formula: ; In the above formula, V q Indicates the characteristics of the problem after fusion. V m Indicates the characteristics of memory after fusion. Cosine similarity represents the semantic similarity between the original text question and the memorized text entry.
[0052] The above method is just an example of determining semantic similarity and is not a limitation. The semantic similarity between the original text question and the memory text entry can be determined based on the question feature vector and the memory feature vector.
[0053] Step 204: For each memory text entry, the semantic similarity and semantic continuity corresponding to the memory text entry are weighted to obtain the target semantic value of the memory text entry.
[0054] For example, a weighted operation is performed based on semantic similarity and its weighted coefficient, as well as semantic continuity and its weighted coefficient, to obtain the target semantic value. The weighted coefficients for semantic similarity and semantic continuity can be configured empirically. The weighted coefficient for semantic similarity can be greater than the weighted coefficient for semantic continuity, and vice versa.
[0055] Step 205: Determine whether the current working mode is memory filtering mode. If yes, i.e., memory filtering mode is enabled, proceed to step 206; if no, i.e., memory sorting mode is enabled, proceed to step 207.
[0056] For example, for the first processing request of the original text problem, the memory filtering mode can be enabled, that is, the current working mode can be the memory filtering mode; for subsequent processing requests of the original text problem, the memory sorting mode can be enabled, that is, the current working mode can be the memory sorting mode.
[0057] For example, upon receiving the original text question, it's necessary to filter candidate memory text entries. Since this is the first time filtering candidate memory text entries, it's the first processing request for the original text question, and the memory filtering mode is enabled. With memory filtering mode enabled, the original text question and the memory text entry for the target sequence number can be input into the agent (see subsequent steps for details), and the agent will answer the original text question. After inputting the original text question and the memory text entry for the target sequence number into the agent, if the agent returns the answer corresponding to the original text question, it indicates a successful answer. If the agent returns a memory omission exception, it means that candidate memory text entries need to be filtered again for the original text question. Since this is a re-filtering of candidate memory text entries, not the first filtering, it's a non-first processing request for the original text question, and the memory sorting mode is enabled. With memory sorting mode enabled, the original text question and the memory text entry for the target sequence number can be input into the agent, and the agent will answer the original text question.
[0058] Regarding memory omission anomalies, these indicate that some entered memory text entries are missing, making it impossible to answer the question based on those entries. For example, after inputting the original text question and the memory text entry for the target number into the agent, if the agent determines that the memory text entry for the target number is missing and cannot be used to answer the question, the agent outputs a memory omission anomaly, triggering the activation of the memory sorting mode, and then reselecting the memory text entry for the target number. This ensures that encountering anomalies in the memory filtering function does not affect the agent's functionality.
[0059] Step 206: Based on the target semantic value of each memory text entry, memory text entries with target semantic values greater than the baseline threshold are selected as candidate memory text entries. Then, step 208 can be executed.
[0060] For example, for each of the P memory text entries, if the target semantic value of the memory text entry is greater than a benchmark threshold, then the memory text entry can be considered a candidate memory text entry; if the target semantic value of the memory text entry is not greater than the benchmark threshold, then the memory text entry is not considered a candidate memory text entry. In this way, candidate memory text entries can be selected from the P memory text entries, and the target semantic value of the candidate memory text entry can be greater than the benchmark threshold.
[0061] For example, the baseline threshold can be a value configured according to actual needs, or it can be a value obtained using a certain algorithm; there are no restrictions on this. For instance, the baseline threshold can be determined as follows: if the original text problem is a high-probability-of-reference problem, the configured initial threshold can be reduced to obtain the baseline threshold. If the original text problem is not a high-probability-of-reference problem, the initial threshold can be set as the baseline threshold; or, if the original text problem is not a high-probability-of-reference problem, the initial threshold can be increased to obtain the baseline threshold.
[0062] For example, an initial threshold can be configured according to actual needs, such as 0.5. If the original text problem is a high-probability-risk problem, the initial threshold is reduced to obtain a baseline threshold, such as 0.4. If the original text problem is not a high-probability-risk problem, the initial threshold is set as the baseline threshold, or the initial threshold is increased to obtain a baseline threshold, such as 0.5 or 0.6.
[0063] Based on the above method, the baseline threshold can be dynamically adjusted, meaning the baseline threshold is related to the original text question. By calculating semantic continuity and semantic similarity and comparing them with the baseline threshold, memory text entries that exceed the baseline threshold are selected as candidate memory text entries, thus completing the screening of memory text entries.
[0064] For example, the original text question can be segmented to obtain multiple keywords. If there are pronouns among the keywords of the original text question, and there is no noun preceding the pronoun, then the original text question can be considered a high-risk question for reference. Otherwise, the original text question may not be considered a high-risk question for reference.
[0065] For example, the original text can be segmented into words using the maximum matching algorithm, without any restrictions. For each keyword (word), part-of-speech tagging can be performed based on a standard part-of-speech tag set (such as nouns, pronouns, verbs, etc.), also without restrictions.
[0066] Based on this, the part-of-speech tag for each keyword in the original text question can be obtained. If multiple keywords in the original text question contain pronouns (such as "he" or "it"), and these pronouns are not preceded by a noun, then the original text question can be labeled as a high-risk referencing problem. For example, if the original text question is "How does it work?", and the pronoun "it" is not preceded by a noun, then the original text question is considered a high-risk referencing problem, and the corresponding baseline threshold for the original text question is lowered.
[0067] Step 207: Based on the target semantic value of each memory text entry, sort the multiple memory text entries. Based on the sorting result, select the K memory text entries with the largest target semantic values as candidate memory text entries, where K can be a positive integer. After step 207, step 208 can be executed.
[0068] For example, based on the target semantic values of P memory text entries, the P memory text entries can be sorted in descending order of their target semantic values, and the top K memory text entries can be selected as candidate memory text entries based on the sorting result. Alternatively, based on the target semantic values of P memory text entries, the P memory text entries can be sorted in ascending order of their target semantic values, and the bottom K memory text entries can be selected as candidate memory text entries based on the sorting result.
[0069] Step 208: Based on the target sequence number of the candidate memory text entry, select the memory text entry with the target sequence number from the cache. The memory text entry with the target sequence number can be used as a context memory entry.
[0070] For example, each memory text entry has a sequence number, which represents the identifier of the memory text entry, such as 1, 2, 3, 4, etc. After obtaining candidate memory text entries, the sequence number of the candidate memory text entry can be obtained and recorded as the target sequence number. Based on this, all memory text entries with the target sequence number can be selected from the cache. For example, if the target sequence number is 4, then all memory text entries with sequence number 4 will be selected from the cache.
[0071] Step 209: Input the original text question and the memory text entry of the target sequence number into the agent. The agent processes the original text question and the memory text entry to obtain the answer to the question.
[0072] For example, the agent can use a multimodal large model to process the original text question. Therefore, the original text question and the memorized text entry for the target sequence number can be input into the multimodal large model. The multimodal large model processes the original text question and the memorized text entry for the target sequence number to obtain the answer. The multimodal large model can then output the answer, thus completing the response to the original text question.
[0073] Furthermore, after inputting the original text question and the memory text entry for the target sequence number into the multimodal large-scale model, if the multimodal large-scale model returns the answer corresponding to the original text question, it indicates a successful answer. If the multimodal large-scale model returns a memory omission exception, it is necessary to re-select candidate memory text entries for the original text question and repeat the above steps. For example, after inputting the original text question and the memory text entry for the target sequence number into the multimodal large-scale model, if the multimodal large-scale model determines that the memory text entry for the target sequence number is missing and cannot answer the question based on the memory text entry for the target sequence number, it returns a memory omission exception, triggers the activation of the memory sorting mode, and then re-selects the memory text entry for the target sequence number.
[0074] Step 210: Store the original text question and its answer in the cache. The original text question and its answer can serve as memory text entries for subsequent original text questions. The original text question and its answer can be the same memory text entry, or they can be different memory text entries; that is, the original text question is one memory text entry, and the answer is another. For example, when the original text question and its answer are different memory text entries, the sequence number of the original text question and the sequence number of the answer can be the same.
[0075] For example, when storing the original text question and its answer in the cache, if the original text question is semantically consistent with the first memory text entry in the cache, then the sequence number of the original text question and the sequence number of the first memory text entry are the same; if the original text question is semantically inconsistent with each memory text entry in the cache, then the sequence number of the original text question is a newly assigned sequence number, that is, a reassigned sequence number.
[0076] For example, referring to the above embodiment, the target semantic values of the original text question and P memory text entries have been obtained. The maximum target semantic value is selected from these target semantic values. If the maximum target semantic value is greater than a reference threshold, which can be a threshold configured according to actual needs and can be greater than a baseline threshold, such as 0.9, then the memory text entry corresponding to the maximum target semantic value can be taken as the first memory text entry. The semantics of the original text question and the first memory text entry are consistent. Based on this, the sequence number of the first memory text entry can be taken as the sequence number of the original text question, and the sequence number of the first memory text entry can be taken as the sequence number of the question answer of the original text question. That is, the sequence number of the original text question and the sequence number of the first memory text entry are the same, and the sequence number of the original text question and the sequence number of the question answer can be the same.
[0077] If the maximum target semantic value is not greater than the reference threshold, it indicates that the semantics of the original text question are inconsistent with the semantics of the various memorized text entries in the cache. A new sequence number needs to be assigned. For example, determine the maximum sequence number already assigned in the cache, and add 1 to the maximum sequence number as the newly assigned sequence number. Based on this, this newly assigned sequence number can be used as the sequence number of the original text question and the sequence number of the answer to the original text question.
[0078] For example, after obtaining the original text question and its answer, if the original text question is continuously related to existing memories (first memory text entries), it is consistently numbered. Finally, the marked original text question and its answer are written to a cache for later retrieval. For instance, when the original text question is related to historical context, it is marked as semantically consistent, i.e., assigned the same number. In this way, related and continuous numbered content is treated as a single window for synchronous processing, ensuring a natural flow of context without breaks. This effectively solves the semantic fragmentation problem that may occur when processing continuous dialogue, especially avoiding the risk of missing information caused by mechanically truncating context when switching intentions.
[0079] For example, if the semantics of the original text question are consistent with the first memory text entry, then the sequence number of the original text question and the sequence number of the first memory text entry are the same. In this way, the continuity and integrity of the dialogue are maintained through an intelligent annotation mechanism, solving the problem of semantic fragmentation of memory that may occur during memory screening. By marking continuous and related dialogue content with a unified sequence number and managing it as a "window," the natural flow of context is ensured, avoiding memory loss caused by mechanical truncation during memory screening.
[0080] For example, see Figure 3A , Figure 3B and Figure 3C The diagram illustrates the intelligent annotation process using memory. When a user poses a new question (the original text question), a relevance filtering process is performed: deep semantic analysis is used to retrieve historical content highly relevant to the original text question from memory storage. This process considers not only similarity matching but also semantic continuity. If the filtering results contain a memory within a specific window (such as record number 1, which can also be called an index), all memories within that window (i.e., all memories with the target index) are automatically considered relevant. The filtered relevant memories are then input into the agent to generate accurate and context-coherent answers, ensuring the response matches the user's deeper query needs.
[0081] After generating the answer to the question, the process enters the memory management phase, where intelligent annotation is performed. For example, if the original text question has a continuous correlation with historical memories (e.g., belonging to the same topic or intent chain), the original text question will be annotated with the same sequence number (e.g., 1) and integrated into the same window for collaborative processing. This means the entire window is treated as a single unit, facilitating subsequent unified retrieval and updates. Conversely, if the original text question represents a completely new intent, a new window with a new sequence number will be created. After annotation is complete, the optimized content (including the question and related memories) is written to a long-term repository, awaiting future retrieval.
[0082] This application proposes an intelligent agent memory management system, see [link to relevant documentation]. Figure 4 The diagram shows the structure of the intelligent agent memory management system. The system adopts a three-layer collaborative architecture, including a decision-making and planning module, a dynamic perception module, and a memory management module. Through modular design, the system achieves a pipelined operation for memory processing. The decision-making and planning module selects solutions, the dynamic perception module undertakes the core function of memory filtering, and the memory management module is responsible for persistent data storage.
[0083] When a user enters a question, the original text question is input into the decision planning module. A specified number of memory text entries (denoted as short-term memory) are retrieved from the memory management module and input into the decision planning module. For example, if the memory management module supports memory retrieval, it can read a specified number of memory text entries and input them into the decision planning module.
[0084] The decision-making and planning module determines whether the current operating mode is memory filtering mode. For the first processing request of the original text question, the decision-making and planning module activates memory filtering mode, meaning the current operating mode is memory filtering mode; for subsequent processing requests of the original text question, the decision-making and planning module activates memory sorting mode, meaning the current operating mode is memory sorting mode. For example, if the agent returns a memory omission exception when memory filtering mode is enabled, it indicates that candidate memory text entries need to be re-filtered for the original text question, automatically switching to memory sorting mode to ensure that the agent's functionality is not affected.
[0085] After determining the current working mode, the original text question and the memory text entries are input into the dynamic perception module. The dynamic perception module executes a memory filtering network based on dynamic perception, outputting the filtered relevant memories. For example, the original text question undergoes multi-level preprocessing through semantic enhancement, including: high-frequency referential risk identification; invalid word meaning filtering (stop word removal based on TF-IDF weights). The preprocessed question text and memory text entries are respectively represented by a Sentence_bert network for high-dimensional vectorization, generating semantic vectors. Subsequently, semantic continuity and semantic similarity values are calculated in parallel, and finally matched with a benchmark threshold to filter out memories relevant to the original text question. The window memory containing the relevant memory is selected as the context memory.
[0086] After filtering out the relevant memories of the original text question, the original text question and the memory are input into the agent to respond, and the answer to the original text question is obtained and output.
[0087] The original text question and its answer are written to the memory management module, which then performs memory annotation and storage. For example, if the original text question is consecutively related to existing memories, it is assigned a consistent sequence number, and the annotated memory is written to a cache for later retrieval. When the original text question is related to historical context, it is marked as semantically consistent, i.e., assigned the same sequence number; related and consecutive sequence numbers are treated as a single window for synchronous processing, ensuring a natural flow of context without breaks. This effectively solves the semantic fragmentation problem that may occur when processing continuous dialogues.
[0088] This application proposes a memory intelligent annotation algorithm. This algorithm maintains the continuity and integrity of dialogue through an intelligent annotation mechanism, effectively solving the problem of semantic fragmentation that may occur during memory filtering. The core of the algorithm lies in marking continuous and related dialogue content with a unified sequence number, treating it as a "window" for unified management. This ensures a natural flow of context and avoids memory loss caused by mechanical truncation during memory filtering. For example, when a user asks a new question, relevance filtering is first performed: using deep semantic analysis technology, historical content highly relevant to the current question is retrieved from memory storage. This process considers not only similarity matching but also semantic continuity. If the filtering result contains a memory in a specific window (such as a record labeled "1"), all memories in that window are automatically considered relevant. The filtered relevant memories are then input into the agent to generate accurate and context-coherent answers, ensuring the response matches the user's deeper query needs.
[0089] After the answer is generated, the process enters the memory management phase. The current question and the selected related memories are sent to the memory management module, where intelligent annotation is performed: if a new question has a continuous correlation with a historical memory (such as belonging to the same topic or intent chain), it will be annotated with the same sequence number (e.g., 1) and integrated into the same window for collaborative processing. The entire window is treated as a single unit, facilitating subsequent unified retrieval and updates. If the question represents a completely new intent, a new window with a new sequence number will be created. After annotation is complete, the memory management module writes the optimized content (including the question and related memories) into a long-term repository, awaiting future retrieval.
[0090] This application proposes a memory filtering optimization algorithm, which is a core component of the dynamic perception module. It comprises three sub-modules: a semantic enhancement module, a semantic similarity-based filtering module, and a semantic continuity-based filtering module. These three sub-modules work together to complete the high-precision memory filtering task. For example, see... Figure 5 The diagram shown is a schematic of the memory filtering optimization algorithm.
[0091] For the original text problem, the semantic enhancement module is used to preprocess the original text problem. The semantic enhancement module includes a word - nature judgment sub - module and a word - nature filtering sub - module. The word - nature judgment sub - module performs word segmentation and word - nature tagging based on a predefined dictionary and rule set. The word segmentation uses the maximum matching algorithm, and the word - nature tagging is based on a standard word - nature tag set (such as nouns, pronouns, verbs, etc.). Based on the results of word segmentation and word - nature tagging, the semantic enhancement module can perform a reference risk assessment: when a pronoun (such as "he", "it") appears in the original text problem and there is no noun before the pronoun, the original text problem is marked as a high - reference - risk problem. For example, for the original text problem "How does it work?", if there is no noun before the pronoun "it", the original text problem is considered a high - reference - risk problem, and the baseline threshold for its screening is reduced, such as reducing the configured initial threshold to obtain the baseline threshold.
[0092] The word - nature filtering sub - module removes meaningless stop words (i.e., function words, such as "le", "ne") from the original text problem, based on a predefined stop - word list. The algorithm implementation is as follows: traverse the word - nature sequence, and if the word - nature belongs to the stop - word category (such as auxiliary words, interjections), the word - nature filtering sub - module removes the word to simplify the problem structure.
[0093] The screening module based on semantic similarity can also be called a semantic - enhanced similarity evaluation module. The semantic - enhanced similarity evaluation module uses a deep - learning model to extract the vector features of the question and the memory, and performs noise reduction processing on the vectors through a multi - scale iterative smoothing mechanism. The multi - scale iterative smoothing mechanism optimizes the representation quality of the semantic vectors through progressive residual fusion. This mechanism adopts a hierarchical processing flow: first, perform a multi - level sliding weighted average on the input vector (such as a 1024 - dimensional text embedding), and each level uses a dynamically expanding Gaussian window (level 1 window = 3, level 2 window = 5, level 3 window = 7) to gradually extract the feature patterns from local to global. In each level of processing, the residual (high - frequency details) of the current smoothed result and the original vector is weighted and fused according to an adjustable intensity coefficient α (0.2 - 0.5). This design not only retains the stable semantic structure of the baseline but also strengthens the key detail features, effectively suppressing noise interference while significantly enhancing semantic relevance. Finally, calculate the cosine similarity between the smoothed question and memory vectors as the semantic similarity (semantic likeness).
[0094] The screening module based on semantic continuity can also be called a semantic - continuity perception module. The semantic - continuity perception module introduces the RBF kernel as a semantic - continuity measurement tool. The RBF kernel implicitly maps the original vector into a high - dimensional Hilbert space to measure its proximity in the semantic manifold.
[0095] After obtaining the semantic similarity and semantic continuity, candidate memory text entries can be screened based on the semantic similarity and semantic continuity. The screening process of the candidate memory text entries can be referred to the above - mentioned embodiments.
[0096] As can be seen from the above technical solutions, this application proposes a three-layer collaborative architecture (decision planning module, dynamic perception module, and memory management module) and a dynamic mode switching mechanism. The decision planning module determines the processing status in real time: the memory filtering mode is enabled during the first processing; when a memory omission anomaly is detected in the historical processing records (such as the lack of association due to pronoun reference risk), it automatically switches to the memory sorting mode to ensure seamless degradation of the system under abnormal conditions. Based on this, the memory omission problem caused by weak relevance in special scenarios such as pronoun reference (such as when there is no noun before the pronoun) is effectively solved, improving the robustness and fault tolerance of the system. In practical applications, it avoids service interruption due to memory filtering failure of the agent, ensuring the continuity of response.
[0097] A windowing annotation mechanism based on semantic continuity is introduced, integrating continuous and related historical memories into window units (such as the same topic or intent chain) through a unified sequence number. When a new question is input, if it is related to a historical window, it inherits the same sequence number and is processed synchronously; otherwise, a new window is created. Based on this, the semantic fragmentation and contextual disconnect caused by focusing on a single memory (such as memory breaks caused by topic jumps) are solved. Unified window management ensures natural context flow. In actual dialogue, intent loss caused by mechanical truncation is avoided, significantly enhancing response coherence. A two-dimensional semantic matching algorithm is developed, combining semantic similarity and semantic continuity for filtering. The semantic enhancement module preprocesses problems (such as reference risk assessment and stop word filtering); the similarity module uses the Sentence_bert network and a multi-scale iterative smoothing mechanism to calculate cosine similarity; the continuity module uses radial RBF kernel quantization of semantic proximity. Related memories are comprehensively determined through dynamic thresholds. Based on this, the filtering blind spot in weakly related scenarios (such as no keyword overlap) is overcome, and semantic associations are accurately captured through two-dimensional analysis, significantly improving the accuracy and semantic coherence of the agent's response.
[0098] Based on the same concept as the above method, this application proposes a memory management device for an intelligent agent, see [link to relevant documentation]. Figure 6 The diagram shown is a structural schematic of the device, which includes: The acquisition module 61 is used to acquire the original text question and multiple memory text entries already stored in the cache area; The selection module 62 is used to select memory text entries as candidate memory text entries from multiple memory text entries based on the semantic matching degree between the original text question and each memory text entry; and to select memory text entries with the specified numbers from the cache based on the sequence numbers of the candidate memory text entries; wherein, when the memory filtering mode is enabled, memory text entries with target semantic values greater than a benchmark threshold are selected as candidate memory text entries based on the target semantic values of each memory text entry; wherein, the target semantic value of a memory text entry is determined based on the semantic matching degree corresponding to that memory text entry; Processing module 63 is used to input the original text question and the memory text entry of the sequence number into the agent, and to obtain the answer to the question by the agent processing the original text question and the memory text entry; wherein, when the memory filtering mode is enabled, if the agent returns a memory omission exception after inputting the original text question and the memory text entry of the sequence number, then the memory sorting mode is enabled; wherein, the memory omission exception indicates that there is a missing memory text entry, and the agent cannot answer the question based on the memory text entry.
[0099] For example, the semantic matching degree includes semantic continuity and / or semantic similarity. If the semantic matching degree includes semantic continuity and semantic similarity, the selection module 62, when determining the target semantic value of the memory text entry based on the semantic matching degree corresponding to the memory text entry, specifically performs the following: for each memory text entry, determine the semantic similarity between the original text question and the memory text entry, determine the semantic continuity between the original text question and the memory text entry, and weight the semantic similarity and the semantic continuity to obtain the target semantic value of the memory text entry.
[0100] For example, the selection module 62 is used to sort the plurality of memory text entries based on the target semantic value of each memory text entry when the memory sorting mode is enabled, and select the K memory text entries with the largest target semantic values as the candidate memory text entries based on the sorting results, where K is a positive integer; wherein, for the first processing request of the original text problem, the memory filtering mode is enabled for the first processing request; for the non-first processing requests of the original text problem, the memory sorting mode is enabled for the non-first processing requests.
[0101] For example, when the selection module 62 determines the semantic similarity between the original text question and the remembered text entry, it specifically performs the following steps: extracting features from the original text question to obtain a question feature vector; extracting features from the remembered text entry to obtain a memory feature vector; and obtaining M sliding windows, where M is greater than 1; for each sliding window, smoothing the question feature vector using the sliding window to obtain smoothed question features; generating high-frequency detail question features based on the smoothed question features and the question feature vector; fusing the high-frequency detail question features corresponding to each sliding window to obtain fused question features; for each sliding window, smoothing the memory feature vector using the sliding window to obtain smoothed memory features; generating high-frequency detail memory features based on the smoothed memory features and the memory feature vector; fusing the high-frequency detail memory features corresponding to each sliding window to obtain fused memory features; and determining the semantic similarity based on the fused question features and the fused memory features.
[0102] For example, when determining the semantic continuity between the original text question and the remembered text entry, the selection module 62 specifically performs the following steps: extracting features from the original text question to obtain a question feature vector; extracting features from the remembered text entry to obtain a memory feature vector; and determining the semantic continuity based on the question feature vector, the memory feature vector, and the acquired bandwidth parameter; wherein the bandwidth parameter is a parameter used to control the smoothness: the selection module 62 uses the following formula to determine the semantic continuity: ; V q This represents the feature vector of the problem. V m Let γ represent the memory feature vector, and let γ represent the bandwidth parameter. This indicates the semantic continuity.
[0103] For example, when the selection module 62 obtains the benchmark threshold, it is specifically used to: if the original text problem is a high-probability-of-reference problem, then the configured initial threshold is reduced to obtain the benchmark threshold; if the original text problem is not a high-probability-of-reference problem, then the initial threshold is determined as the benchmark threshold; wherein, if there are pronouns among the multiple keywords of the original text problem, and there is no noun before the pronouns, then the original text problem is a high-probability-of-reference problem.
[0104] For example, the processing module 63 is further configured to store the original text question and the question answer in the cache area, wherein the original text question and the question answer serve as memory text entries for subsequent original text questions; wherein the sequence number of the original text question and the sequence number of the question answer are the same; wherein if the semantics of the original text question are consistent with the first memory text entry in the cache area, then the sequence number of the original text question and the sequence number of the first memory text entry are the same; If the semantics of the original text question are inconsistent with the semantics of the various memory text entries in the cache, then the sequence number of the original text question is a newly assigned sequence number.
[0105] Based on the same concept as the above method, this application proposes an electronic device, see [link to previous application]. Figure 7 As shown, the electronic device includes a processor 71 and a machine-readable storage medium 72, the machine-readable storage medium 72 storing machine-executable instructions that can be executed by the processor 71; the processor 71 is used to execute the machine-executable instructions to implement the memory management method of the intelligent agent disclosed in the above example of this application.
[0106] Based on the same concept as the above method, this application also provides a machine-readable storage medium storing a plurality of computer instructions, which, when executed by a processor, can implement the memory management method of the intelligent agent disclosed in the above examples of this application.
[0107] The aforementioned machine-readable storage medium can be any electronic, magnetic, optical, or other physical storage device that can contain or store information, such as executable instructions, data, etc. For example, machine-readable storage media can be: RAM (Random Access Memory), volatile memory, non-volatile memory, flash memory, storage drives (such as hard disk drives), solid-state drives, any type of storage disk (such as optical discs, DVDs, etc.), or similar storage media, or combinations thereof.
[0108] Based on the same concept as the methods described above, this application also provides a computer program product, which may include a computer program. When executed by a processor, the computer program implements the memory management method for an intelligent agent disclosed in the examples above.
[0109] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, embodiments of this application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0110] The above description is merely an embodiment of this application and is not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. A memory management method for an intelligent agent, characterized in that, The method includes: Retrieve the original text question and multiple memory text entries already stored in the cache; Based on the semantic matching degree between the original text question and each memory text entry, memory text entries are selected as candidate memory text entries from the plurality of memory text entries; wherein, when the memory filtering mode is enabled, based on the target semantic value of each memory text entry, memory text entries with a target semantic value greater than a benchmark threshold are selected as candidate memory text entries; wherein, the target semantic value of a memory text entry is determined based on the semantic matching degree corresponding to that memory text entry. Based on the sequence number of the candidate memory text entry, the memory text entry with the sequence number is selected from the cache; the original text question and the memory text entry with the sequence number are input into the agent, and the agent processes the original text question and the memory text entry to obtain the answer to the question; In the case of enabling the memory filtering mode, if the agent returns a memory omission exception after inputting the original text question and the memory text entry with the sequence number, then the memory sorting mode is enabled; wherein, the memory omission exception indicates that there is a missing memory text entry, and the agent cannot answer the question based on the memory text entry.
2. The method according to claim 1, characterized in that, Before selecting memory text entries with target semantic values greater than a benchmark threshold as candidate memory text entries, the process of obtaining the benchmark threshold includes: if the original text problem is a high-probability-of-reference problem, then the configured initial threshold is reduced to obtain the benchmark threshold; if the original text problem is not a high-probability-of-reference problem, then the initial threshold is determined as the benchmark threshold. If a pronoun is present among the multiple keywords of the original text problem, and there is no noun preceding the pronoun, then the original text problem is a high-reference-risk problem.
3. The method according to claim 1, characterized in that, The semantic matching degree includes semantic continuity and / or semantic similarity. If the semantic matching degree includes semantic continuity and semantic similarity, the process of determining the target semantic value of the memorized text entry based on the semantic matching degree corresponding to the memorized text entry includes: For each memory text entry, determine the semantic similarity between the original text question and the memory text entry, determine the semantic continuity between the original text question and the memory text entry, and weight the semantic similarity and the semantic continuity to obtain the target semantic value of the memory text entry.
4. The method according to claim 1 or 3, characterized in that, When the memory sorting mode is enabled, the multiple memory text entries are sorted based on the target semantic value of each memory text entry. Based on the sorting result, the K memory text entries with the largest target semantic values are selected as the candidate memory text entries, where K is a positive integer. Specifically, for the first processing request of the original text problem, the memory filtering mode is enabled for the first processing request; for subsequent processing requests of the original text problem, the memory sorting mode is enabled for the subsequent processing requests.
5. The method according to claim 3, characterized in that, Determining the semantic similarity between the original text question and the memorized text entry includes: Feature extraction is performed on the original text question to obtain a question feature vector; feature extraction is performed on the memorized text entry to obtain a memory feature vector; and M sliding windows are obtained, where M is greater than 1; For each sliding window, the problem feature vector is smoothed using the sliding window to obtain smoothed problem features. High-frequency detail problem features are generated based on the smoothed problem features and the problem feature vector. The high-frequency detail problem features corresponding to each sliding window are fused to obtain fused problem features. For each sliding window, the memory feature vector is smoothed using the sliding window to obtain smoothed memory features. High-frequency detail memory features are generated based on the smoothed memory features and the memory feature vector. The high-frequency detail memory features corresponding to each sliding window are fused to obtain fused memory features. The semantic similarity is determined based on the fused problem features and the fused memory features.
6. The method according to claim 3, characterized in that, Determining the semantic continuity between the original text question and the memorized text entry includes: Feature extraction is performed on the original text question to obtain the question feature vector; The memory feature vector is obtained by extracting features from the memory text entry. The semantic continuity is determined based on the problem feature vector, the memory feature vector, and the acquired bandwidth parameter; wherein, the bandwidth parameter is a parameter used to control the degree of smoothness. The semantic continuity is determined using the following formula: ; in, V q Used to represent the feature vector of the problem. V m γ is used to represent the memory feature vector, and γ is used to represent the bandwidth parameter. Used to represent the semantic continuity.
7. The method according to claim 1, characterized in that, After inputting the original text question and the memorized text entry of the sequence number into the agent, and having the agent process the original text question and the memorized text entry to obtain the answer, the method further includes: The original text question and the answer are stored in the cache area, and the original text question and the answer are used as memory text entries for subsequent original text questions; Wherein, the sequence number of the original text question and the sequence number of the question answer are the same; Wherein, if the original text question is semantically consistent with the first memory text entry in the cache, then the sequence number of the original text question is the same as the sequence number of the first memory text entry; If the semantics of the original text question are inconsistent with the semantics of the various memory text entries in the cache, then the sequence number of the original text question is a newly assigned sequence number.
8. A memory management device for an intelligent agent, characterized in that, The device includes: The acquisition module is used to acquire the original text question and multiple memory text entries already stored in the cache. The selection module is used to select memory text entries as candidate memory text entries from the plurality of memory text entries based on the semantic matching degree between the original text question and each memory text entry; and to select memory text entries with the sequence number of the candidate memory text entries from the cache area; wherein, when the memory filtering mode is enabled, memory text entries with a target semantic value greater than a benchmark threshold are selected as candidate memory text entries based on the target semantic value of each memory text entry; wherein, the target semantic value of a memory text entry is determined based on the semantic matching degree corresponding to that memory text entry; The processing module is used to input the original text question and the memory text entry of the sequence number into the agent, and the agent processes the original text question and the memory text entry to obtain the answer to the question; wherein, when the memory filtering mode is enabled, if the agent returns a memory omission exception after the original text question and the memory text entry of the sequence number are input, the memory sorting mode is enabled; wherein, the memory omission exception indicates that there is a missing memory text entry, and the agent cannot answer the question based on the memory text entry.
9. The apparatus according to claim 8, characterized in that, The selection module obtains the baseline threshold by: if the original text problem is a high-probability-of-reference problem, then reducing the configured initial threshold to obtain the baseline threshold; if the original text problem is not a high-probability-of-reference problem, then determining the initial threshold as the baseline threshold; wherein, if there are pronouns among the multiple keywords of the original text problem, and there is no noun before the pronouns, then the original text problem is a high-probability-of-reference problem. Alternatively, the semantic matching degree includes semantic continuity and / or semantic similarity. If the semantic matching degree includes semantic continuity and semantic similarity, the selection module, when determining the target semantic value of the memory text entry based on the semantic matching degree corresponding to the memory text entry, specifically performs the following: for each memory text entry, determine the semantic similarity between the original text question and the memory text entry, determine the semantic continuity between the original text question and the memory text entry, and weight the semantic similarity and the semantic continuity to obtain the target semantic value of the memory text entry; Alternatively, the selection module is configured to, when the memory sorting mode is enabled, sort the plurality of memory text entries based on the target semantic value of each memory text entry, and select the K memory text entries with the largest target semantic values as the candidate memory text entries based on the sorting result, where K is a positive integer; wherein, for the first processing request of the original text problem, the memory filtering mode is enabled for the first processing request; for non-first processing requests of the original text problem, the memory sorting mode is enabled for the non-first processing requests; Alternatively, when determining the semantic similarity between the original text question and the remembered text entry, the selection module specifically performs the following steps: extracting features from the original text question to obtain a question feature vector; extracting features from the remembered text entry to obtain a memory feature vector; and obtaining M sliding windows, where M is greater than 1; for each sliding window, smoothing the question feature vector using the sliding window to obtain smoothed question features; generating high-frequency detail question features based on the smoothed question features and the question feature vector; fusing the high-frequency detail question features corresponding to each sliding window to obtain fused question features; for each sliding window, smoothing the memory feature vector using the sliding window to obtain smoothed memory features; generating high-frequency detail memory features based on the smoothed memory features and the memory feature vector; fusing the high-frequency detail memory features corresponding to each sliding window to obtain fused memory features; and determining the semantic similarity based on the fused question features and the fused memory features. Alternatively, when determining the semantic continuity between the original text question and the remembered text entry, the selection module specifically performs the following steps: extracting features from the original text question to obtain a question feature vector; extracting features from the remembered text entry to obtain a memory feature vector; and determining the semantic continuity based on the question feature vector, the memory feature vector, and the acquired bandwidth parameter; wherein the bandwidth parameter is a parameter used to control the smoothness; and wherein the selection module determines the semantic continuity using the following formula: ; V q This represents the feature vector of the problem. V m Let γ represent the memory feature vector, and let γ represent the bandwidth parameter. This indicates the semantic continuity; Alternatively, the processing module is further configured to store the original text question and the answer in the cache area, wherein the original text question and the answer serve as memory text entries for subsequent original text questions; wherein the sequence number of the original text question and the sequence number of the answer are the same; Wherein, if the original text question is semantically consistent with the first memory text entry in the cache, then the sequence number of the original text question is the same as the sequence number of the first memory text entry; If the semantics of the original text question are inconsistent with the semantics of the various memory text entries in the cache, then the sequence number of the original text question is a newly assigned sequence number.
10. An electronic device, characterized in that, include: A processor and a machine-readable storage medium, the machine-readable storage medium storing machine-executable instructions that can be executed by the processor; The processor is configured to execute machine-executable instructions to implement the method of any one of claims 1-7.