A large language model agent long-term memory self-updating management method and system
Patent Information
- Application Number
- CN202611416017.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-14
- Publication Date
- 2026-10-27
AI Technical Summary
[0008]本发明的目的之一在于提供一种大语言模型智能体长期记忆自更新管理方法,以至少解决现有技术中既有记忆无法在用户事实发生变化时沿记忆之间的依赖关系完成一致性修正,且难以在不全量遍历、不销毁历史记录的前提下兼顾修正完整性与计算代价的问题
1、本发明通过在正向巩固将对话轮次写入分层记忆图的同时,于发生结构性改动处显式生成包括源节点与变更内容的变更事件,并以该变更事件反向触发对既有记忆的重新巩固,构建了写入与修正相衔接的闭环;其克服了现有技术中写入仅构成由对话到记忆库的单向流程、缺少由已发生变更向受其影响的既有记忆反向传导一致性修正的机制的缺陷,从而使由被修正事实推出的下游结论能够被一并重估。
Smart Images

Figure CN122986019A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of large model technology, and in particular to a method and system for self-updating the long-term memory of a large language model agent. Background Technology
[0002] When large language models generate answers, they rely solely on the context input for the current inference. Intermediate states are not retained after the conversation ends, making it impossible to maintain knowledge of facts and preferences for the same user across conversations. In scenarios such as personal assistants, intelligent agents increasingly undertake multi-round interactions spanning several days or even months. Whether they can continuously remember user information outside of a single conversation context window has become a key factor affecting their usability.
[0003] To enable agents to possess the aforementioned cross-conversation memory capabilities, the commonly adopted technical approach is to add an external long-term memory module in addition to the large language model. During the dialogue, user information is written into this module. Upon response, several memories are recalled based on semantic similarity, and these are combined with the user's question and prompted before being sent to the large language model to generate the answer. The most widely used approach, represented by Mem0, employs a cumulative memory paradigm: triggered by incremental dialogue, factual statements are extracted and quantified. Similar records are retrieved from the memory bank, and the large language model determines whether to add, modify, delete, or leave the new facts and recalled records unchanged, and then performs the write operation. This type of scheme only constitutes a unidirectional flow from dialogue to the memory bank.
[0004] This type of scheme relies on an implicit premise that information written into the memory remains true throughout its subsequent lifespan. However, users' facts and preferences change over time, and memories are not independent of each other, which leads to the following technical problems: First, updates neither propagate along the dependencies between memories nor cover related memories without explicit association: write operations only target records that are matched by similarity, there are no dependency representations in the memory bank for update signal transmission, and downstream conclusions derived from the corrected facts will not be re-evaluated.
[0005] Secondly, it is difficult to balance the scope of correction and the computational cost. The cost of a full traversal and re-evaluation increases superlinearly with the size of the memory bank; truncation by a fixed number of jumps results in omissions or errors due to the large differences in the radius of influence of changes.
[0006] Third, the binary approach to conflict handling leads to the loss of historical information or the retention of erroneous information. Existing solutions can only choose between in-situ overwriting or deletion and retention: the former makes queries involving the past unanswerable, while the latter allows outdated records to continue to participate in reasoning; moreover, the records do not contain validity indicators, and new and old versions of the same fact are recalled equally; the same fact value often exists in multiple copies in the original trajectory, repeated mentions, and upper-level summaries, and the write operation only applies to the recalled record, while the remaining copies still participate in the retrieval as valid.
[0007] In summary, the aforementioned defects all stem from the fact that the writing process of this type of scheme only constitutes a one-way flow from the dialogue to the memory bank, lacking a mechanism for reverse transmission of consistency correction from the changed to the existing memory affected by it. Summary of the Invention
[0008] One of the objectives of this invention is to provide a long-term memory self-updating management method for large language model intelligent agents, so as to at least solve the problems in the prior art that existing memories cannot complete consistency correction along the dependencies between memories when user facts change, and that it is difficult to balance the integrity of correction and computational cost without full traversal and destruction of historical records.
[0009] This invention is achieved through the following technical solution: A method for self-updating the long-term memory of a large language model agent includes: Acquire dialogue data between the intelligent agent and the user, and divide the dialogue data into dialogue rounds according to the conversation; The semantic content of the dialogue turn is written into a hierarchical memory graph, and a change event is generated when the hierarchical memory graph undergoes structural changes. The change event includes the source node and the changed content. The hierarchical memory graph includes multiple layers of memory nodes and edges connecting the memory nodes. The multiple layers of memory nodes are at least divided into a context trajectory layer and a consolidation knowledge layer. The memory nodes have a validity state. Candidate correction regions are determined using the source node as the seed node. The candidate correction regions include memory nodes selected by propagating activation along the edge based on the association strength determined by historical co-occurrence statistics, and memory nodes obtained by retrieving the hierarchical memory graph based on the changed content. For candidate memory nodes in the candidate correction region, determine the change type of the candidate memory node relative to the change event. The change type includes at least one of time-series update, true contradiction, premise change and implicit deduction. The candidate memory node is non-destructively modified according to the change type, so that the candidate memory node exits the current valid memory state while retaining its original semantic content, or a new memory node is generated. In response to a user's question, candidate memory nodes are retrieved from the hierarchical memory graph. After differentiating the candidate memory nodes according to their validity status, the answer is obtained by inputting the user's question into the large language model.
[0010] Furthermore, the step of writing the semantic content of the dialogue turns into a hierarchical memory graph includes: The dialogue rounds are divided into at least one semantic block, and a memory node for the context trajectory layer is generated for each semantic block. Calculate the semantic correlation degree between the newly generated memory node and the existing scenario trajectory layer memory node, and establish an intra-layer association edge between the two when the semantic correlation degree meets the association condition; The memory nodes of the scenario trajectory layer are classified into semantic clusters according to the entities they involve. For the same semantic cluster, when the newly arrived semantic content is consistent with the facts stated by the existing consolidated knowledge layer memory node, it is merged into the existing consolidated knowledge layer memory node. When they are inconsistent, the existing consolidated knowledge layer memory node is retired and a new consolidated knowledge layer memory node is generated. The change event is generated for the retired memory node, and an inter-layer dependent edge is established between the consolidated knowledge layer memory node and the scenario trajectory layer memory node it is based on. The structural modifications include at least one of adding memory nodes, retiring or rewriting existing memory nodes, adding or deleting edges, and regenerating upper-level memory nodes. However, the refinement and synonym rewriting of the statements of facts presented by memory nodes are not considered structural modifications.
[0011] Furthermore, the candidate correction region is the union of the first candidate set and the second candidate set, wherein: The activation amount is propagated along the edge to adjacent memory nodes. Memory nodes with activation amounts exceeding the propagation threshold are added to the first candidate set, and propagation paths with activation amounts not exceeding the propagation threshold are truncated. Infer at least one target attribute affected by the changes, retrieve the hierarchical memory graph using the target attribute as a search condition with entity scope limitation, and add the matched memory nodes to the second candidate set.
[0012] Further, the propagation of activation along the edge to adjacent memory nodes includes: The association strength from the source memory node to the target memory node is determined based on the co-activation count of the source memory node and the target memory node, the individual activation count of each, and the total activation count in the hierarchical memory graph. The association strength increases with the increase of the co-activation count and decreases with the increase of the individual activation count of each. The availability gain of the target memory node is determined based on the historical activation count of the target memory node and the time interval since its most recent activation. The transmission coefficients are configured according to the type of edge, and the transmission coefficient of the inter-layer dependent edge that represents the upper-layer memory node's dependence on the lower-layer memory node is greater than the transmission coefficient of the intra-layer associated edge that connects the same-layer memory nodes. The activation amount propagated from the source memory node to the target memory node is the product of the activation amount of the source memory node, the association strength, the availability gain, and the conduction coefficient.
[0013] Further, determining the change type of the candidate memory node relative to the change event includes: When the candidate memory node is true before the change event occurs, and the change content represents that the facts it records have changed over time, it is determined to be the time-series update; When the changed content indicates that the facts recorded by the candidate memory node have not been true since its generation, it is determined to be the true contradiction; When the candidate memory node records a precondition that it depends on, and the changed content indicates that the precondition is no longer valid, it is determined to be the precondition change; When the candidate memory node records a triggering condition, and the changed content satisfies the triggering condition, it is determined to be the implicit deduction; When a candidate memory node simultaneously records both a dependent precondition and a triggering condition, it is processed in the order that the precondition change takes precedence over the implicit derivation.
[0014] Furthermore, the memory node includes semantic content, a valid time interval, and a validity state. The validity state includes an active state and an inactive state. The inactive state includes being replaced, having a changed premise, and being withdrawn. The non-destructive modification according to the change type includes: Keeping the semantic content of the candidate memory node and the start time of its effective time interval unchanged, the effective state is migrated from the active state to one of the inactive states corresponding to the change type, and the effective time interval of the candidate memory node is closed with the occurrence time of the change event. The migrated candidate memory node is retained in the hierarchical memory graph and participates in retrieval. When the change type is the implicit inference, the candidate memory node remains unchanged and a new memory node with the validity state of the active state is generated, and the source information of the new memory node is recorded. The source information includes the change event that triggered its generation and the memory node on which it is based. Identify the remaining memory nodes that state the same fact value as the candidate memory node, and write the validity status and the end time of the validity time interval into the remaining memory nodes.
[0015] Furthermore, the multi-layer memory node also includes a graph layer, wherein the memory node of the graph layer is abstracted from at least two consolidation knowledge layer memory nodes, and inter-layer dependent edges are maintained between the memory node of the graph layer and the consolidation knowledge layer memory node that is the source of its abstraction. Retrieving candidate memory nodes in the hierarchical memory graph includes: direct retrieval based on semantic similarity, and navigating along the interlayer subordinate edges to the memory nodes of the consolidation knowledge layer using the memory nodes of the graph layer as navigation; Differentiated processing is performed based on the validity status of the candidate memory nodes, including: Exclude candidate memory nodes whose validity status is withdrawn from the scope of input to the large language model; Mark the candidate memory node whose validity status has been replaced as the historical context; Provide the candidate memory nodes whose validity status has changed along with their updated preconditions.
[0016] This solution also provides a long-term memory self-updating management system for large language model intelligent agents, including: The dialogue access module is used to acquire dialogue data between the agent and the user and divide it into dialogue rounds according to the conversation; A hierarchical memory storage module is used to store a hierarchical memory graph, which includes multiple layers of memory nodes and edges connecting the memory nodes. The multiple layers of memory nodes are at least divided into a scenario trajectory layer and a consolidation knowledge layer. The memory nodes have a validity status. The positive consolidation module is used to write the semantic content of the dialogue turn into the hierarchical memory graph, and generate a change event when the hierarchical memory graph undergoes structural changes. The change event includes the source node and the changed content. The bounded rewrite propagation module is used to determine candidate correction regions with the source node as the seed node. The candidate correction regions include memory nodes selected by propagating the activation amount along the edge according to the association strength determined by historical co-occurrence statistics, and memory nodes obtained by retrieving the hierarchical memory graph according to the changed content. The change adjudication module is used to determine the change type of the candidate memory node in the candidate correction region. The change type includes at least one of the following: time-series update, true contradiction, premise change and implicit deduction. A non-destructive coding module is used to perform non-destructive modification of the candidate memory nodes according to the change type; The validity-aware retrieval module is used to respond to user queries, retrieve candidate memory nodes, and perform differentiated processing based on the validity status of the candidate memory nodes before inputting them into the large language model to obtain the answer.
[0017] On the other hand, this solution also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements a long-term memory self-updating management method for a large language model intelligent agent; and An electronic device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement a long-term memory self-updating management method for a large language model intelligent agent.
[0018] Compared with the prior art, the present invention has the following advantages and beneficial effects: 1. This invention constructs a closed loop that connects writing and correction by explicitly generating change events, including source nodes and changed content, at the point of structural change while writing dialogue turns into a hierarchical memory graph during positive consolidation. This overcomes the shortcomings of existing technologies where writing only constitutes a one-way process from dialogue to memory bank and lacks a mechanism for reverse transmission of consistency correction from changed to affected existing memory. This allows downstream conclusions derived from the corrected facts to be re-evaluated as well.
[0019] 2. This invention determines the association strength by using historical co-occurrence statistics to dynamically determine the association strength and introduces a base rate correction in its denominator. Combined with availability gain determined by the number of historical activations and time intervals, transmission coefficients differentiated by edge type, and threshold truncation of weak association paths, the activation amount adaptively decays along the hierarchical memory graph. This overcomes the shortcomings of existing technologies where the cost of full traversal and re-evaluation increases superlinearly with the size of the memory bank, and where truncation by a fixed number of hops results in omissions or errors due to the large differences in the influence radius of different changes. Thus, the review scale of a single correction is related to the size of the affected subgraph and weakly related to the total size of the memory bank.
[0020] 3. This invention infers the target attribute affected by the changed content, converts the target attribute into an entity-limited query to retrieve the hierarchical memory graph, and takes the union of the memory nodes hit therein with the memory nodes obtained by the aforementioned edge propagation; it overcomes the shortcomings of the prior art which uses semantic similarity as the only candidate localization method and cannot structurally recall memories that have never co-occurred with the modified fact and have low semantic similarity, thus allowing implicitly related memories that do not have explicit connections with the source node to also be included in the review.
[0021] 4. This invention distinguishes the relationship between candidate memory nodes and change events into temporal updates, real contradictions, premise changes, and implicit deductions, and applies corresponding correction operations to different change types. It overcomes the shortcomings of existing technologies, which only have four types of memory operations: adding, in-situ rewriting, deleting, and no processing. The granularity is too coarse to express the situation where the memory itself has not been denied but the premises on which its existence depends have changed. Thus, information that was once valid is preserved as historical context, while information that was never valid from the beginning is completely excluded from reasoning.
[0022] 5. This invention represents memory nodes using a quadruple consisting of semantic content, valid time interval, and valid state. It replaces in-situ overwriting or deletion with appended valid markers and closed valid time intervals, and writes the same valid marker and termination time into all copies stating the same fact value within a highly similar neighborhood. This overcomes the shortcomings of existing technologies where in-situ writing results in only a single current version being stored in the main memory, and only the recalled record is rewritten while the remaining copies still participate in retrieval in a valid state. Thus, it maintains the consistency of the global state while removing outdated information from the current reasoning.
[0023] 6. This invention differentiates memory nodes with a validity status based on their validity status during the retrieval phase. It excludes memory nodes with a validity status of "withdrawn" from the input large language model, marks memory nodes with a validity status of "replaced" as historical context, and provides memory nodes with a validity status of "premise changed" along with their updated premise. This overcomes the shortcomings of existing technologies where old and new versions of the same fact are indexed and recalled equally, and the large language model cannot determine which one is currently valid. Thus, it preserves the ability to answer historical and temporal queries while ensuring the accuracy of the current answer. Attached Figure Description
[0024] The accompanying drawings, which are included to provide a further understanding of embodiments of the invention and form part of this application, do not constitute a limitation thereof. In the drawings: Figure 1 A flowchart illustrating a long-term memory self-updating management method for a large language model intelligent agent, provided in an embodiment of the present invention; Figure 2 This is a schematic diagram of the structure of a layered memory diagram provided in an embodiment of the present invention; Figure 3 A flowchart illustrating the forward consolidation write process provided in an embodiment of the present invention; Figure 4 This is a schematic diagram illustrating the determination of candidate correction regions via dual channels in bounded rewrite propagation, provided in an embodiment of the present invention. Figure 5 A flowchart illustrating the change adjudication process provided in an embodiment of the present invention; Figure 6 A schematic diagram illustrating the transition of the validity state of a memory node provided in an embodiment of the present invention; Figure 7 A flowchart illustrating the validity-aware retrieval question-and-answer process provided in an embodiment of the present invention; Figure 8 This is a schematic diagram of the structure of a long-term memory self-updating management system for a large language model intelligent agent provided in an embodiment of the present invention; Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention.
[0025] In the above figures, the reference numerals are as follows: 100, Dialogue Access Module; 200, Hierarchical Memory Storage Module; 300, Positive Consolidation Module; 400, Bounded Rewrite Propagation Module; 500, Change Adjudication Module; 600, Non-destructive Encoding Module; 700, Validity-Aware Retrieval Module. Detailed Implementation
[0026] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0027] It should be noted that in this application, the terms "first," "second," etc., are used only for distinguishing descriptions and should not be construed as indicating or implying relative importance; the terms "comprising," "having," and any variations thereof are intended to cover non-exclusive inclusion; where there is no conflict, the technical features in the various embodiments of this application can be combined with each other. Furthermore, the specific numerical values, thresholds, vector dimensions, time constants, and specific dialogue content given in the various embodiments of this application are exemplary values and exemplary corpora provided to facilitate understanding and implementation of the present invention by those skilled in the art, and are not intended to limit the scope of protection of the present invention. Those skilled in the art can make corresponding adjustments according to the actual memory scale, dialogue frequency, and response latency requirements.
[0028] Example 1:
[0029] This embodiment discloses a method for self-updating and managing the long-term memory of a large language model intelligent agent, such as... Figure 1 As shown, the method specifically includes the following 6 steps: Step 1: Obtain the dialogue data between the agent and the user, and divide the dialogue data into dialogue rounds according to the conversation.
[0030] In this context, an intelligent agent refers to an application that uses a large language model as its inference kernel, is capable of multi-turn natural language interaction with the user, and can call upon external tools or external storage, such as a personal assistant, customer service assistant, and life planning assistant. Dialogue data refers to the natural language text generated by the intelligent agent during its entire historical interaction with the same user, including user utterances and intelligent agent responses. A conversation refers to a single interaction process between a user and an intelligent agent within a continuous period of time; a conversation consists of several successive messages. A dialogue turn refers to the smallest interactive unit within a conversation, consisting of a user utterance and its corresponding intelligent agent response; this is the smallest processing unit for semantic extraction and memory writing in this invention.
[0031] In this embodiment, to ensure that subsequent memory writing has a defined time base and a defined minimum processing unit, thereby accurately identifying the effective time interval of the memory node and the occurrence time of the change event, step 1 further includes the following sub-steps 1.1 to 1.3: Step 1.1, Collection and Normalization: Collect messages one by one from the agent's conversation service interface, filter out system prompts, tool call logs and format control characters, and retain only the natural language text of user speech and agent replies, and label each message with role identification and generation time; for relative time expressions in speech, parse them into absolute time according to the generation time of the message. For example, "next Wednesday" in a message generated on March 3, 2025 is parsed and rewritten as "March 12, 2025".
[0032] Step 1.2, Session Segmentation: The session is segmented when the difference between the times of two adjacent messages exceeds a silence threshold or when an explicit session end marker appears. The silence threshold is 30 minutes, for example. This segments the continuous message stream into independent sessions and assigns a unique session identifier to each session.
[0033] Step 1.3, Round Structuring: Within each session, a user utterance is paired with its corresponding agent response to form a dialogue round, and the dialogue round is organized into a structured record including a round identifier, the session identifier, the occurrence time, the user utterance text, and the agent response text; where the occurrence time is the time when the user utterance is generated in that dialogue round.
[0034] Understandably, resolving relative time representations to absolute times before writing them is a prerequisite for subsequent steps to distinguish between time-series updates and actual discrepancies. The difference between chronological updates and actual contradictions lies only in the chronological relationship between the time when the recorded fact becomes invalid and the time when the fact was generated. If the memory retains relative expressions such as "next week" or "last month" without a time anchor, then this chronological relationship cannot be determined.
[0035] It should be noted that the session segmentation in step 1 is not merely for ease of storage. Its essential function is to provide the context trajectory layer in the hierarchical memory graph with trajectory division consistent with the actual interaction process, so that the memory nodes generated within the same session naturally have a high co-occurrence relationship, thereby forming a meaningful statistical basis for association strength in the subsequent propagation in step 3. If session segmentation is omitted and all messages are treated as a continuous stream, the historical co-occurrence statistics will degenerate into random co-occurrence according to time windows, and the association strength will lose its ability to distinguish.
[0036] Step 2: Write the semantic content of the dialogue rounds into a hierarchical memory graph, and generate a change event when the hierarchical memory graph undergoes structural changes. The change event includes the source node and the changed content.
[0037] Among them, a hierarchical memory graph refers to a directed graph structure used to store all of a user's long-term memories, such as... Figure 2 As shown, it is denoted as a binary tuple consisting of a set of memory nodes and a set of edges. The memory nodes are divided into three layers from bottom to top according to their level of abstraction: the context trajectory layer, the consolidation knowledge layer, and the schema layer. The memory nodes of the context trajectory layer are memory nodes directly generated from a semantic block in a single dialogue turn. Their semantic content retains the context details of the original interaction and can be traced back to the original text. For example, "The user mentioned in the dialogue on March 3, 2025, that he / she works in Zhongguancun, Beijing". The memory nodes of the consolidation knowledge layer are memory nodes that are summarized from one or more context trajectory layer memory nodes and make a statement about a certain attribute of a certain entity. For example, "The user's workplace is Zhongguancun, Beijing". The memory nodes of the schema layer are stable patterns across attributes that are further abstracted from at least two consolidation knowledge layer memory nodes. For example, "The user is a commuter who lives in Beijing and has a small commuting radius".
[0038] For example, a memory node can be modeled as a quadruple as follows: ; in, It is a memory node; The semantic content of this memory node can be the original contextual trajectory text, the consolidated factual text, or the abstracted schematic text; and These are the start and end times of the valid time interval for the facts recorded by this memory node, respectively. Setting the memory node to null when it is active indicates that this fact still holds true. This represents the validity state of the memory node, taking one of the following values: active, replaced, premise changed, or withdrawn.
[0039] In the specific implementation, the memory node also includes auxiliary fields to support the above steps. A complete memory node includes the following fields: Node identifier, used to uniquely identify the memory node; Layer, used to indicate which layer the memory node belongs to: the context trajectory layer, the consolidated knowledge layer, or the schema layer; Semantic content, the natural language statement carried by the memory node and its embedding vector, with the dimension of the embedding vector exemplarily set to 768; Entity set, the entities involved in the statement, such as the user, location, organization, and item; Attribute name and fact value, the attributes and values corresponding to the statement after structuring, such as the attribute name being the work location and the fact value being Beijing Zhongguancun; Preconditions, other facts upon which the statement depends, which can be empty; Triggering conditions, the facts recorded in the statement that... An agreement that occurs only when a certain condition is met in the future can be empty; the effective time interval is the time range within which the statement is considered to be true, consisting of a start time and an end time, with the end time being infinity when the memory node is active; the validity state can be one of the following: active, replaced, premise changed, or withdrawn; the source set is the lower-level memory node on which the memory node was generated, the original dialogue round identifier, and the change event identifier that triggered its generation; activation statistics include the historical activation count of the memory node being retrieved or propagated, the time of the most recent activation, and the number of times the memory node was co-activated with other memory nodes.
[0040] Among them, the edges include intra-layer associated edges and inter-layer dependent edges; intra-layer associated edges connect two memory nodes in the same layer, indicating that the two are semantically related or repeatedly appear together in interaction; inter-layer dependent edges point from the upper-layer memory node to the lower-layer memory node it is based on, indicating that the establishment of the upper-layer memory node depends on the lower-layer memory node.
[0041] In addition, the hierarchical memory graph also maintains a fact value index, which uses a combination of entity and attribute name as the key and all memory nodes that state the same fact value under that key as the value, and is used to locate the remaining copies of the same fact value in step 5.
[0042] Furthermore, in this embodiment, in order to ensure that newly arriving semantic content can both be precipitated as directly usable facts and, when it is inconsistent with existing facts, send out signals that can be transmitted in reverse, such as... Figure 3 As shown, step 2 also includes the following steps 2.1 to 2.5: Step 2.1, Semantic Blocking and Context Trajectory Layer Memory Node Generation: Divide a dialogue turn into at least one semantic block, with each semantic block representing a relatively independent event.
[0043] In this embodiment, the segmentation rule is as follows: sentences are accumulated sequentially from the beginning of the dialogue round, with sentences as the smallest unit. The current semantic block is closed and a new semantic block is opened when any of the following conditions occur: First, the accumulated length reaches the upper limit, which is exemplarily set to 256 lexical units; second, the cosine similarity of the embedding vectors of the semantic content of two adjacent sentences is lower than the segmentation threshold, indicating a topic switch, which is exemplarily set to 0.45; third, the main entity sets involved in two adjacent sentences do not intersect, indicating a shift in the subject of the statement. A memory node of the context trajectory layer is generated for each semantic block. Its semantic content is taken from the text of the semantic block. The entity set is obtained by named entity recognition or by large language model extraction. The embedding vector is obtained by encoding the semantic content by the embedding model. The start time of the effective time interval is taken as the occurrence time of the dialogue round, the end time is set to empty, the validity state is initialized to the active state, the historical activation count is initialized to 1, and the most recently activated time is initialized to the occurrence time of the dialogue round.
[0044] Step 2.2: Establishment of intra-layer association edges; Calculate the semantic association degree between the newly generated scenario trajectory layer memory nodes and the existing scenario trajectory layer memory nodes. When the semantic association degree is not less than the association threshold, establish an intra-layer association edge between the two and initialize the co-activation count of the edge to 1.
[0045] For example, the expression for the semantic relevance, which is the cosine similarity of the embedding vectors of the semantic content of the two entities, is as follows: ; in, Source memory node With the target memory node The semantic relevance between them; and They are the source memory nodes. With the target memory node The embedding vector of semantic content; The association threshold is set to 0.62 for example. When the above formula is true, it is determined that the association condition is met. In order to avoid the number of edges increasing with the square of the memory size, for each newly generated memory node, only the top few layers of in-layer association edges with the highest semantic association degree are retained. The number of such edges can also be set to 5 for example.
[0046] In another embodiment, the semantic relevance can also be superimposed on the cosine similarity above, with a time proximity term added. That is, the negative exponent of the difference between the occurrence times of the corresponding dialogue rounds is used as an additional term and added according to weight, so that memory nodes generated within the same session are more likely to establish intra-layer association edges.
[0047] Step 2.3: Semantic cluster merging and consolidation of knowledge layer memory nodes; using the combination of entity and attribute name as the key, memory nodes of the context trajectory layer are merged into semantic clusters; for the same semantic cluster, the large language model extracts triplets consisting of entity, attribute name, and fact value from the newly arrived semantic content, and compares them with the facts stated by the existing active knowledge layer memory nodes under that semantic cluster as follows: When the two are consistent, the newly arrived semantic content is incorporated into the existing consolidated knowledge layer memory node, that is, a new scenario trajectory layer memory node is added to its source set and its historical activation count is incremented by one, without changing its fact value and effective time interval. When the two are inconsistent, the existing consolidated knowledge layer memory node is retired. That is, its effective time interval is closed with the occurrence time of the current dialogue round and its validity state is set to be replaced. At the same time, a consolidated knowledge layer memory node with an active validity state is regenerated with the new fact value, and a change event is generated for the retired memory node. Whether it is merged or regenerated, an inter-layer subordinate edge is established between the consolidated knowledge layer memory node and the context trajectory layer memory node on which it is based.
[0048] Step 2.4, Abstraction of Graph Layer Memory Nodes: When there are at least two active consolidation knowledge layer memory nodes under the same entity, and the facts stated by these memory nodes present a consistent pattern, the large language model abstracts it into a graph layer memory node, and establishes inter-layer dependent edges between this graph layer memory node and each consolidation knowledge layer memory node that serves as its abstraction source; the start time of the effective time interval of the graph layer memory node is taken as the latest start time among its abstraction sources.
[0049] Step 2.5, Determination of structural modifications and generation of change events; the structural modifications include at least one of adding memory nodes, retiring or rewriting existing memory nodes, adding or deleting edges, and regenerating upper-level memory nodes; the refinement of the description of facts stated by memory nodes and the synonym rewriting are not considered structural modifications. The determination condition is that the newly arrived semantic content is exactly the same as the triple of the existing memory node, and the cosine similarity of the embedding vectors of the two is not less than the rewriting threshold, which is exemplarily taken as 0.95.
[0050] For example, the determination of the refinement of the expression and the paraphrase can be made according to the following conditional formula: ; in, , and These are the entity, attribute name, and fact value corresponding to the newly arrived semantic content, respectively; , and These are the entity, attribute name, and fact value corresponding to the existing memory node, respectively; and These are the embedding vectors of the semantic content of the two entities, respectively. The threshold for rewriting is set. When the above formula is true, it is determined to be a refinement of the expression or a synonymous rewriting. Only the semantic content expression and activation statistics of the existing memory nodes are updated, and no change event is generated.
[0051] When the structural modification conditions are met, a change event is generated. The change event includes an event identifier, a source node, and change content. The source node is the memory node that was decommissioned, rewritten, or regenerated. The change content includes the entity involved, attribute name, old fact value, new fact value, and the effective time of the change. The change event itself records its occurrence time, which is the time of occurrence of the dialogue round that triggered the structural modification.
[0052] Understandably, dividing memory into three layers—the contextual trajectory layer, the consolidation knowledge layer, and the schema layer—is technically significant in that it allows for the separation of the traceability and usability of memory: the contextual trajectory layer retains the original context to support tracing and evidence collection, the consolidation knowledge layer carries facts that can be directly involved in reasoning and serves as the starting point for changes in events, and the schema layer provides a top-down navigation entry point for retrieval; at the same time, the inter-layer subordination edges explicitly record the dependence of upper-layer memories on lower-layer memories, enabling a change in a fact to propagate down to its downstream conclusions along the dependency relationship, which is precisely the representation that is missing in existing cumulative memory schemes.
[0053] It is also understandable that limiting the generation conditions of change events to structural changes, while excluding elaboration and paraphrasing, is the key to making the triggering of backpropagation selective: it is extremely common for users to repeat the same fact in different words in different conversations. If each repetition generates a change event, then each repetition will trigger a round of candidate area determination and adjudication, and the computational cost will accumulate linearly with the number of conversation rounds without corresponding benefits.
[0054] It should be noted that in step 2, when the knowledge layer memory node is inconsistent, it is retired and regenerated, rather than its fact value is rewritten in place. If it is rewritten in place, the historical fact value of the memory node will be overwritten, and it will be impossible to recover even if the subsequent step 5 is performed. Questions involving past time points will be unanswerable, and there will be a mismatch between the lower-level basis pointed to by the original inter-layer subordinate edge on the memory node and the new fact value.
[0055] Step 3: Determine candidate correction regions using the source node as the seed node. The candidate correction regions include memory nodes selected by propagating activation along the edges based on the association strength determined by historical co-occurrence statistics, and memory nodes obtained by retrieving the hierarchical memory graph based on the changed content.
[0056] Among them, the candidate correction region refers to the set of existing memory nodes that need to be examined one by one to see if they are still valid after a change event occurs; the activation amount is a non-negative real number assigned to each memory node during the propagation process, representing the degree to which it is affected by the change event; the association strength is a coefficient that represents the closeness of the association between two memory nodes, determined by the number of times they are both hit in historical retrieval and historical propagation.
[0057] In this embodiment, in order to cover both the effects propagating downstream along the dependency relationship and memory nodes that are not explicitly associated with the source node but are affected by the same change, without traversing all memory nodes, such as Figure 4 As shown, step 3 also includes the following sub-steps, specifically: Step 3.1, Propagation Initialization: Take the source node of the change event as the seed node, set its activation value to the initial activation value, which is exemplarily set to 1; establish a queue to be expanded in descending order of activation value, and enqueue the seed node.
[0058] Step 3.2, the first channel, i.e., event-driven association propagation: Take the memory node with the largest activation value from the queue to be expanded as the source memory node, and propagate the activation value to each adjacent target memory node along the edge it is connected to. Add the target memory nodes with activation values exceeding the propagation threshold to the first candidate set and enqueue them. Discard the target memory nodes with activation values not exceeding the propagation threshold and cut off the propagation path through the target memory node. Repeat this step until the queue to be expanded is empty or the number of hops that has been expanded reaches the maximum number of hops. The maximum number of hops is 6 for example. Its function is to prevent long chain propagation in extreme cases in dense hierarchical memory graphs. Under normal circumstances, the propagation will stop automatically before reaching this number of hops because the activation value is lower than the propagation threshold.
[0059] For example, the propagation of the activation amount can be calculated as follows: First, based on the co-activation count of the source memory node and the target memory node, the individual activation counts of each, and the total activation count in the hierarchical memory graph, the association strength from the source memory node to the target memory node is determined, and the formula satisfies: ; To prevent the activation value from amplifying and diverging during multi-hop propagation, the association strength is normalized according to the proportion of each outgoing edge of the source memory node as follows: ; Secondly, based on the historical activation count of the target memory node and the time interval since its most recent activation, the availability gain of the target memory node is determined, and the calculation process satisfies:
[0060] ; Simultaneously, the propagation coefficients are configured according to the edge type, and the propagation coefficient of inter-layer dependent edges, which characterize the dependence of upper-layer memory nodes on lower-layer memory nodes, is greater than the propagation coefficient of intra-layer associated edges connecting memory nodes in the same layer. ; Finally, the product of the activation level of the source memory node, the association strength, the availability gain, and the propagation coefficient is used as the activation level propagated from the source memory node to the target memory node. Whether this activation level exceeds the propagation threshold is used as the criterion for whether the target memory node should be added to the first candidate set. The expression is as follows:
[0061] ; For ease of description, in each hop of the propagation process, vi represents the source memory node of the hop and vj represents the target memory node of the hop. The subscripts i and j refer to the source memory node and the target memory node, respectively, throughout this application. The source memory node of the first hop is the source node of the change event.
[0062] in, Source memory node To the target memory node The strength of the association; Source memory node With the target memory node The number of times they are jointly activated is the cumulative number of times they are both hit in the same search or the same propagation. and They are the source memory nodes. With the target memory node Each has its own number of activations; The total number of activations in the hierarchical memory graph; As a smoothing constant, it is exemplarily set to 0.5, which serves to prevent the logarithm from diverging when the number of co-activations is zero; It should be noted that the above formula is in the form of a logarithmic ratio of point mutual information, and its denominator introduces a base rate correction, which makes the ratio change with the number of co-activations. Increases with the increase of, and Each increases and decreases, meaning that frequently activated memory nodes will not generate strong propagation simply because of their high frequency, unless they are specifically associated with the current change event. When the value of the above expression is negative, it is treated as zero, meaning that no propagation occurs in that direction. Source memory node The set of neighbors; The normalized correlation strength, due to its... The sum of all outgoing edges is 1, therefore The total amount of activation propagating outward is constrained and will not diverge.
[0063] For target memory node The basic activation level; For target memory node Historical activation count; The time interval, in days, between the current moment and the most recent activation of the target memory node; This is the forgetting decay coefficient. For gain amplitude, For smoothing scales; The availability gain of the target memory node is determined by the boundedness of the hyperbolic tangent function, which restricts its value to between 1-a and 1+a, thus preventing the propagation from getting out of control due to the extremely frequent activation of a certain memory node. The edges connecting the source memory node and the target memory node The conductivity coefficient; and These are the sets of inter-layer dependent edges and the sets of intra-layer associated edges, respectively. and These are the transmission coefficients of inter-layer dependent edges and intra-layer associated edges, respectively, and are 1.0 and 0.6 for example. Source memory node The initial activation value of the seed node is set to 1. The propagation threshold is set to 0.15 for example. The first candidate set is the target memory node that is added to the set and becomes the source memory node for the next hop when it continues to propagate outward.
[0064] Step 3.3, the second channel, namely the knowledge-guided candidate extension, infers at least one target attribute affected by the changed content; Specifically, the system first queries a pre-configured attribute dependency table to obtain attribute names that are dependent on the attribute names in the changed content. Then, the large language model supplements the inference if the attribute dependency table is not covered. The union of the two results in the target attribute set. Subsequently, each target attribute is converted into an entity-scoped query, that is, the query text is the attribute name and its synonym extensions, and the retrieval scope is limited by the main entity involved in the changed content. This limitation applies to the entity set field of the memory node, thereby avoiding recalling memory nodes that are irrelevant to the user. Hit memory nodes with semantic similarity not less than the retrieval threshold are added to the second candidate set, and the retrieval threshold can be 0.55.
[0065] For example, when the change is that a user’s permanent city changes from the first city to the second city, the attribute dependency table can be used to obtain target attributes such as commuting mode, frequently visited places, dining preferences and local service providers. Then, memory nodes that record “commuting by shared bicycle every day” and “frequently visiting a certain restaurant” can be retrieved, even if there is no explicit edge between these memory nodes and the source node.
[0066] Step 3.4: Merging candidate correction regions. The union of the first candidate set and the second candidate set is combined and duplicates are removed to obtain the candidate correction region, expressed as: ; in, Candidate correction region; This forms the second candidate set; after merging, they are sorted in descending order of activation amount of each memory node, and memory nodes with the same activation amount or only hit by the second channel are sorted in descending order of semantic similarity, which serves as the order for subsequent adjudication.
[0067] In one embodiment, an upper limit can be set on the size of the candidate correction region. When the upper limit is exceeded, only the memory nodes that are ranked first are retained, so as to constrain the adjudication overhead caused by a single change event.
[0068] The first and second channels cover two different types of affected memories. For example, the first channel spreads along established inter-layer subordinate edges and intra-layer related edges, covering downstream conclusions derived from the corrected facts. These memories may not be semantically similar to the source node and cannot be recalled by semantic retrieval alone. The second channel performs entity-limited retrieval based on attribute dependencies, covering memories that have not yet established edges with the source node but whose validity depends on the same attribute. These memories cannot be reached by propagation along edges alone. By taking the union of the two channels, the candidate correction region can be covered in both orthogonal dimensions.
[0069] Understandably, using whether the activation amount exceeds the propagation threshold as the criterion for whether to continue propagating essentially makes the depth of propagation adaptively expand and contract with the scope of influence of the change event itself. That is, when the source node is in a densely connected region, the activation amount decays slowly, and the propagation can go deep into multiple hops; while when the source node is in an isolated region, the activation amount drops below the threshold within one or two hops and stops on its own.
[0070] Therefore, compared to a full traversal, the scope of its review will be reduced from the total size of the memory bank to a local size that is equivalent to the radius of influence of the change; and compared to truncation by a fixed number of jumps, it will not miss changes in dense areas, nor will it include a large number of irrelevant memories in the ruling in sparse areas.
[0071] It should also be noted that the first and second channels are not interchangeable, nor can one be omitted: if only the first channel is retained, memory nodes such as "frequently visited a certain restaurant" that have no edge to the source node will not be examined and will still participate in subsequent retrieval as active nodes; if only the second channel is retained, downstream conclusions obtained through multiple steps of reasoning from the corrected facts, whose attribute names do not appear in the attribute dependency table, will be missed; if a fixed number of hops is used instead of threshold truncation, the impact radius of different change events varies greatly. If the number of hops is small, it will miss the changes, and if it is large, the computational cost will increase rapidly and a large number of irrelevant candidates will be introduced, which will increase the risk of erroneous changes.
[0072] Step 4: For the candidate memory nodes in the candidate correction region, determine the change type of the candidate memory node relative to the change event. The change type includes at least one of the following: time-series update, true contradiction, premise change, and implicit deduction.
[0073] Among them, temporal update refers to the fact recorded in the candidate memory node being true before the change event, and then changing over time, such as the user's work location changing from location one to location two; true contradiction refers to the fact recorded in the candidate memory node being invalid since the memory node was generated, such as the user previously misreporting the building where their workstation is located and later clarifying it; premise change refers to the fact recorded in the candidate memory node not being directly denied, but the premise on which its validity depends no longer being valid.
[0074] For example, the statement "commuting by shared bike takes only 20 minutes" depends on the premise that "the workplace is near the residence"; while implicit inference means that the candidate memory node records the triggering condition, and the changed content just happens to satisfy the triggering condition. For example, the user previously agreed that "after moving into the house with a balcony, I will start raising cats", and the changed content indicates that he has moved into the house with a balcony.
[0075] In this embodiment, to ensure that the same candidate memory node receives different treatments under different property changes, thereby avoiding handling all conflicts with a single overwrite or delete operation, such as... Figure 5 As shown, step 4 further includes the following steps.
[0076] For example, in step 4.1, constructing the adjudication input: For each candidate memory node in the candidate correction region, take its semantic content, attribute name, fact value, precondition, triggering condition, effective time interval and its layer, along with the change content of the change event and the time of its occurrence, to construct an adjudication input.
[0077] Step 4.2, rule pre-screening: When the attribute name of a candidate memory node is the same as the attribute name in the changed content and the fact value is the same, it is determined that the candidate memory node is not affected by the change event, does not enter the subsequent judgment, and maintains its original validity status; when the end time of the valid time interval of the candidate memory node is earlier than the occurrence time of the change event, it means that the candidate memory node is already in an inactive state, and it will also not enter the subsequent judgment.
[0078] Step 4.3, Determining the Change Type; For candidate memory nodes that have passed the preliminary screening, their change type is determined according to the following conditions: When the candidate memory node is true before the change event occurs, and the change content indicates that the facts it records have changed over time, that is, when the effective time stated in the change content is later than the start time of the effective time interval of the candidate memory node, it is determined to be a time-series update; when the change content indicates that the facts recorded by the candidate memory node have not been true since its generation, that is, when the effective time stated in the change content is not later than the start time of the effective time interval of the candidate memory node, or when the change content contains a correction to the previous statement, it is determined to be a true contradiction. When a candidate memory node records a dependent precondition and the changed content indicates that the precondition is no longer valid, it is determined to be a precondition change; when a candidate memory node records a trigger condition and the changed content satisfies the trigger condition, it is determined to be an implicit deduction; when a candidate memory node records both a dependent precondition and a trigger condition, it is processed in the order of precondition change taking precedence over implicit deduction, that is, the candidate memory node is first modified according to the precondition change, and then it is determined whether its trigger condition is still satisfied after the precondition has changed. Only when it is still satisfied is a new memory node generated according to implicit deduction.
[0079] In this embodiment, the above determination is based on Figure 5 The steps are performed sequentially: first, determine the true contradiction; then, determine the premise change; next, determine the implicit deduction; and finally, determine the temporal update. If none of the steps are true, the candidate memory node is determined not to belong to any of the four change types mentioned above, and no modification is made to it.
[0080] Step 4.4: Determining the confidence level and handling low confidence levels; wherein, the determination of the change type is jointly given by rule determination and large language model determination. The rule determination gives candidate types and their rule scores based on the consistency of attribute names, the order of the effective time interval and the time when the change takes effect, and whether the precondition and trigger condition fields are empty. The large language model determination gives candidate types and their model scores using the aforementioned adjudication input as prompt words and a restricted set of type labels as the output space.
[0081] For example, the decision confidence of a candidate memory node can be calculated as follows: ; in, For candidate target memory nodes The confidence level of the ruling; and These are the scores given by rule-based judgment and large language model judgment, respectively, with both ranging from 0 to 1; The weight for rule determination (generally 0.5 is acceptable); when If the value is not less than the adjudication threshold, step 5 is performed to correct the change according to the determined change type. The adjudication threshold can be preset according to the reliability requirements of change type adjudication in different application scenarios. If the value is less than the adjudication threshold, no modification is made to the candidate memory node. Instead, a check mark is recorded in its source set so that it can be re-examined when the next change event involving the same attribute occurs.
[0082] Understandably, classifying conflicts into the four categories mentioned above has the technical significance of changing conflict handling from a binary choice to a treatment that matches the nature of the conflict. The old facts corresponding to the chronological update were true within their valid time interval, so they should be retained as history; the records corresponding to the real contradictions were never valid from the beginning, so they should be completely excluded from reasoning; the records corresponding to the premise change were not negated themselves, and their truth value depends on the new premise, so they should be re-evaluated by the large language model along with the new premise; the implied deductions do not correspond to conflicts but to the generation of new facts, so new memory nodes should be added without changing the original memory nodes.
[0083] It should be noted that the provision in step 4 that the premise change takes precedence over the implicit deduction is to avoid deriving a new memory from an invalid convention when the premise has already changed: if the implicit deduction is executed first, a new memory node with an active validity state may be generated based on a convention whose premise is no longer valid. This new memory node will carry the incorrect content in the correct form, and since its tracing points to a memory node that still exists in form, such errors are difficult to detect in subsequent searches.
[0084] Step 5: Perform non-destructive modification on the candidate memory node according to the change type, so that the candidate memory node retains its original semantic content while exiting the current effective memory state, or generates a new memory node.
[0085] Non-destructive modification refers to a modification method that does not delete memory nodes, nor overwrite their semantic content and factual values, but only rewrites their validity state and closes their validity time interval to make them exit the current valid memory state; the validity state includes active state and inactive state, and the inactive state includes three values: replaced, premise changed, and withdrawn.
[0086] In this embodiment, in order to ensure that the revised memory no longer participates in reasoning as current fact, yet can still be queried and used as historical evidence, further steps are taken as follows: Figure 6 As shown, step 5 includes steps 5.1 to 5.5; Step 5.1, mapping of state transitions; it is understandable that when the change type is a time-series update, the validity state of the candidate memory node is transitioned from the active state to the replaced state; when the change type is a true contradiction, it is transitioned to the withdrawn state; when the change type is a premise change, it is transitioned to the premise changed state; when the change type is an implicit deduction, the validity state of the candidate memory node is not transitioned.
[0087] Step 5.2: Closing the effective time interval and writing the source; When a state transition occurs, the semantic content, attribute name, fact value and the start time of the effective time interval of the candidate memory node remain unchanged. The effective time interval of the candidate memory node is closed only with the occurrence time of the change event, that is, its end time is rewritten from infinity to the occurrence time of the change event. At the same time, the change event identifier that triggered this transition, the change type on which this transition is based and the decision confidence level are added to its source set. The candidate memory node after the transition is still retained in the hierarchical memory graph and participates in the retrieval, and is only differentiated in step 6.
[0088] Step 5.3: Generation of new memory nodes under implicit inference; When the change type is implicit inference, the candidate memory node remains unchanged, and the large language model generates a new memory node based on the conventions recorded in the candidate memory node and the change content. The new memory node is located in the knowledge consolidation layer, its validity state is active, the start time of its validity time interval is taken as the occurrence time of the change event, and the change event that triggered its generation and the memory node on which it is based are recorded in its source information. At the same time, an inter-layer subordinate edge is established between the new memory node and the candidate memory node.
[0089] Step 5.4: Global state alignment of copies of the same fact value; determine the remaining memory nodes that state the same fact value as the candidate memory node, including the context trajectory layer memory node on which the candidate memory node was generated, the context trajectory layer memory node generated by repeatedly mentioning the same fact in other sessions, and the schema layer memory node that is the abstract source of the candidate memory node; write the validity state obtained from this migration and the end time of the validity time interval into the remaining memory nodes.
[0090] In this embodiment, the remaining memory nodes are determined by retrieving repeated representations of retired fact values in the highly similar neighborhood of the candidate memory node, that is, by performing an approximate nearest neighbor search using the embedding vector of the candidate memory node and comparing its fact value in the hit results.
[0091] As an alternative implementation, an explicit copy index can be maintained for the same fact value during writing. This is an inverted index with the combination of entity and attribute name as the key and all memory nodes that state the same fact value under that key as the value. During correction, all copies can be located directly by the index, thereby replacing vector retrieval with constant-level location overhead. Alternatively, a normalized entity identifier can be used as the alignment key to include all memory nodes under the same entity and attribute in the alignment range.
[0092] Step 5.5: Recalculation of upper-level memory nodes; When a candidate memory node to be migrated is a lower-level memory node upon which an upper-level memory node is based via an inter-layer dependent edge, the upper-level memory node is added to the recalculation list for this change event; If all lower-level dependencies of an upper-level memory node in the recalculation list have been migrated to an inactive state, the upper-level memory node is also migrated to the same inactive state; If some of its lower-level dependencies are still active, a new upper-level memory node is regenerated based on the still active lower-level dependencies, and the original upper-level memory node is migrated to the replaced state. The recalculation is performed from bottom to top along the inter-layer dependent edges and only within the candidate correction region.
[0093] Understandably, non-destructive correction and global state alignment together ensure that the representation of the same fact in the hierarchical memory graph is consistent: after a fact is written, it usually leaves multiple copies in the original trajectory of the context trajectory layer, the context trajectory layer memory nodes generated by subsequent repeated mentions, and the generalized memory nodes of the schema layer. If only the memory node that is determined to be hit is state-transferred, the remaining copies still exist in the hierarchical memory graph in an active state and are recalled as current facts in the semantic retrieval in step 6, with the same effect as no correction.
[0094] It should be noted that using state migration instead of deletion or in-situ overwriting is a necessary condition for making questions involving past time points still answerable. At the same time, since the migrated memory nodes retain complete semantic content, valid time intervals and source information, when the user later changes a fact back to its original value, the system can also restore the complete change trajectory of that fact based on these historical records, without having to rely on re-parsing the original dialogue data.
[0095] Step 6: In response to the user's question, retrieve candidate memory nodes from the hierarchical memory graph, differentiate the candidate memory nodes according to their validity status, and input the user's question into the large language model to obtain the answer.
[0096] Differential processing refers to the process of determining whether a candidate memory node is excluded, marked as historical context, or provided to the large language model along with its updated preconditions, based on the validity status of the candidate memory node.
[0097] In this embodiment, to ensure that memories in different states of validity play different roles in the generation process, so that outdated facts are not used as current facts, and historical information is not absent from questions involving the past, such as... Figure 7 As shown, step 6 also includes the following steps, specifically: Step 6.1: Perform query parsing; The large language model parses the user's query to obtain the entity and attribute names involved in the query, and determines whether the query contains time constraints; If it contains time constraints, the time constraint is parsed into an absolute query time or query time interval, for example, "when I was in Beijing last year" is parsed into a specific time interval.
[0098] Step 6.2: Perform a dual-path retrieval. The first path is determined as a direct retrieval based on semantic similarity, that is, performing an approximate nearest neighbor retrieval on all memory nodes using the embedding vector of the user's question, and selecting the top k1 memory nodes with the highest similarity, for example, k1 can be 20. The second path is determined as a retrieval using the memory nodes of the graph layer as navigation, that is, first retrieving the graph layer memory nodes most relevant to the user's question within the graph layer, and then descending along the inter-layer edges to the consolidation knowledge layer memory nodes that serve as the source of its abstraction, selecting the top k2, where k2 can be 10 for example. Finally, the results of the two retrieval paths are combined and deduplicated to obtain the candidate memory nodes.
[0099] Step 6.3: Time Constraint Filtering and Validity Differentiation Processing; When the query contains a time constraint, only candidate memory nodes whose valid time interval intersects with the query time or query time interval are retained; then, differentiation processing is performed according to the validity status: candidate memory nodes whose validity status is withdrawn are excluded from the input range of the large language model; candidate memory nodes whose validity status is replaced are marked as historical context, and their valid time interval and the current fact value stated by the memory node that replaced them are appended after their statement; candidate memory nodes whose validity status is changed are provided together with their updated premises, that is, the original value and the current value of the premise are appended after their statement; candidate memory nodes whose validity status is active are provided directly as current facts.
[0100] Step 6.4, Sorting and Truncation: Calculate the comprehensive score of the candidate memory nodes retained after differentiation processing and sort them in descending order. Take the first m nodes and assemble them into the prompt words. M is exemplarily taken as 8.
[0101] Furthermore, the overall score can be calculated as follows: ; in, Candidate memory nodes The overall score; Asking questions for users Embedding vectors and candidate memory nodes The cosine similarity between the embedded vectors; Candidate memory nodes The validity status; The validity state weight function is 1.0 when the validity state is active, 0.6 when the premise has changed, 0.3 when it has been replaced, and the candidate memory node has been excluded from the sorting when it has been withdrawn. The weight for the state item is, for example, 0.15; The time interval, in days, between the current time and the start time of the effective time interval of the candidate memory node; To retrieve the forgetting coefficient, we exemplarily use 0.002 days to the power of negative one; The weight for the recentity item is 0.1, for example.
[0102] It should be noted that when a user's question contains a time constraint pointing to the past, The value of the replaced state is increased to 1.0 so that historical memory is not overwhelmed by recent current facts in such questions.
[0103] Step 6.5: Prompt word assembly and answer generation; The first m candidate memory nodes are assembled in segments according to the current facts, historical context and changed premises, and input into the large language model along with the user's question to obtain the answer; The node identifier and source information of each candidate memory node referenced are output along with the answer to support the tracing of the memory on which the answer is based.
[0104] Understandably, the differentiation process in step 6 and the state transition in step 5 are a pair of complementary measures. Specifically, step 5 preserves the modified memory in the hierarchical memory graph in the form of a state identifier, while step 6 determines how it participates in the generation based on this identifier. If there is only a state transition and no distinction is made during retrieval, then memories in an inactive state will still enter the prompt words in the same way as current facts. The large language model will see both old and new fact values on the same attribute of the same entity and will be unable to choose between them.
[0105] It should be noted that this solution excludes withdrawn memory nodes from the input large language model, which is different from deleting them from the hierarchical memory graph. The former only prevents them from participating in the current generation, but the memory node and its traceability information are still retained and can be used for manual review and user-initiated query of its correction history; while the latter makes the correction behavior itself untraceable, and when the same erroneous statement reappears in subsequent dialogues, the system has no way of knowing that it has been corrected.
[0106] It should be further noted that the number of layers of memory nodes in this embodiment is not limited to three layers, but can also be N layers with no less than two layers.
[0107] For example, the consolidation knowledge layer and the schema layer can be merged into a single abstract layer. In this case, the hierarchical memory graph is only divided into the context trajectory layer and the consolidation knowledge layer. The retrieval in step 6.2, which uses the schema layer memory nodes as navigation, is then changed to be performed within this abstract layer. Another example is to insert a domain summary layer above the consolidation knowledge layer to form a four-layer structure, with the connection method of the subordinate edges between the layers being the same as described above.
[0108] Furthermore, when an upper-level memory node is supported by multiple lower-level memory nodes, the inter-layer dependent edge can also be represented by a hyperedge to indicate the one-to-many dependency relationship. In this case, the recalculation of the upper-level memory node in step 5.5 is based on the validity status of all lower-level dependencies connected by the hyperedge.
[0109] Example 2:
[0110] Based on the above embodiments, to facilitate understanding of this technical solution, this embodiment specifically uses changes in health status and residence in a personal assistant agent as examples to illustrate the process of this method for hierarchically writing dialogue content, generating change events, determining candidate correction areas, performing change adjudication and non-destructive correction, and responding to current and historical queries based on the validity status of memory nodes. Specifically, as follows: Scenario 1: Changes in health status cause an update in fitness memories.
[0111] In an early conversation, the user states, "If my health condition changes, I will go to Pyravar CrossFit," and also states that their current fitness habit is swimming twice a week, a habit determined by their tendinitis condition. Following steps 1 and 2, the system divides the conversation into dialogue turns and semantic blocks, generating memory nodes at the contextual trajectory layer that record the corresponding semantic content; and at the knowledge consolidation layer, it generates a health status memory node H1 "The user has tendinitis," a fitness habit memory node M1 "The user currently swims twice a week," and a conditional agreement memory node M2 "If the user's health condition changes, they will go to Pyravar CrossFit."
[0112] Among them, the precondition field of M1 records "the user has tendinitis", and the trigger condition field of M2 records "the user's health condition has changed". Each knowledge consolidation layer memory node establishes an inter-layer subordinate edge with the context trajectory layer memory node on which it is based; when the semantic correlation between M1 and M2 meets the correlation condition, an intra-layer correlation edge is established between the two.
[0113] In a subsequent session, the user states "My tendinitis has been cured." The system writes this semantic content into the context trajectory layer and compares the new fact value "tendinitis has been cured" with the fact value "tendinitis exists" in H1 within the semantic cluster corresponding to the health status. Since the two are inconsistent, the system decommissions H1 and generates an active health status memory node H2 "The user's tendinitis has been cured," while generating a change event Δ1. The source node of Δ1 is H1, and the change content includes the entity being the user, the attribute name being health status, the old fact value being the existence of tendinitis, the new fact value being the cured tendinitis, and the effective time determined by the subsequent session.
[0114] When performing step 3 on Δ1, the event-driven association propagation channel uses H1 as the seed node. Based on the historical co-occurrence statistics, historical activation counts, and the activation amount propagated along the edges at the most recent activation time recorded in the hierarchical memory graph, memory nodes such as M1 and M2 whose activation amounts exceed the propagation threshold are added to the first candidate set. The knowledge-guided candidate expansion channel infers affected attributes such as exercise methods and fitness arrangements based on the changes in Δ1, and searches for relevant memory nodes with the user as the entity scope, adding the matched memory nodes to the second candidate set. The union of the two candidate sets and the deduplication result constitute the candidate correction region for Δ1. The statistics, time intervals, and thresholds used in the above calculations are all taken from the node fields of the hierarchical memory graph and the system configuration, without assuming fixed statistical results.
[0115] Steps 4 and 5 are executed for the candidate correction regions. Specifically, for M1, since the premise on which it depends, "the user has tendinitis," is no longer true, it is determined to be a premise change. The validity state of M1 is migrated to the premise changed state, and its validity time interval is closed with the occurrence time of Δ1. For M2, its triggering condition, "the user's health condition has changed," has been satisfied by Δ1, so it is determined to be an implicit deduction. The system keeps the semantic content and validity state of M2 unchanged, generates a new consolidation knowledge layer memory node M3, "the user is currently going to Pyravar CrossFit for fitness," sets M3 to an active state, and records Δ1 and M2 in the traceability information of M3.
[0116] Subsequently, the system identifies other memory nodes that state the same fitness fact value as M1, and writes the changed premise state of M1 and the end time of its effective time interval into the aforementioned memory nodes. If there is an upper-level memory node based on M1, the upper-level memory node is recalculated based on the lower-level basis that is still active, so that the validity state of the same fitness fact remains consistent in the context trajectory layer, the consolidation knowledge layer, and the schema layer.
[0117] For example, when a user asks "Where am I working out now?", the system performs direct retrieval and graph navigation retrieval in step 6, and performs validity differentiation processing on the obtained candidate memory nodes. Since M1 is in the premise changed state, it is provided together with the updated premise "tendinitis has been cured"; while M3 is in the active state and is provided as the current fact. Therefore, the large language model can answer that the user is currently working out at Pyravar CrossFit, and can determine from the source information of M3 that the conclusion is jointly generated by the change in health status and the existing condition agreement.
[0118] Scenario 2: Changes in residence trigger updates to related memories.
[0119] In an early conversation, the user states "I live in New York". Based on this, the system saves the original semantic content in the context trajectory layer and generates an active residence memory node A1 "User lives in New York" in the consolidation knowledge layer. Subsequently, in a new conversation, the user states "I just moved to London". The system compares the new fact value "London" with the fact value "New York" of A1 in the semantic cluster corresponding to the residence.
[0120] Because the two are inconsistent, the system retires A1, generates a new residence memory node A2 "User lives in London" which is now active, and generates a change event Δ2. The source node of Δ2 is A1, and the changes include the entity being user, the attribute name being residence, the old fact value being New York, the new fact value being London, and the effective time determined by the session.
[0121] When performing step 3 on Δ2, the event-driven association propagation channel recalls memory nodes that are directly connected to A1 and whose activation exceeds the propagation threshold along the edges in the hierarchical memory graph; the knowledge-guided candidate expansion channel infers affected attributes such as commuting methods, frequently visited places, and local service providers from changes in residence, and performs retrieval with users as the entity scope, thereby recalling relevant memory nodes such as commuting routes, frequently visited restaurants, or family doctors that were formed in other sessions and have not yet established explicit edges with A1. The results of the two channels are combined and deduplicated to form the candidate correction region of Δ2.
[0122] Steps 4 and 5 are executed for the candidate correction region; the residence fact recorded in A1 was true before the relocation, therefore its retirement and migration to the replaced state corresponds to a time-series update; if the premise of a commuting suggestion is that the user lives in New York, then the premise no longer holds due to the change of residence, and the commuting suggestion is identified as a premise change and migrated to the premise changed state. For memory nodes such as frequently visited restaurants and family doctors recalled by the second channel, the system makes a determination one by one based on their semantic content, premise, effective time interval, and the changed content of Δ2; if it can be determined that its establishment depends on the New York residence, it is processed as a premise change; if the existing information is insufficient to determine whether it is still applicable, its original state is maintained and a check mark is recorded. Subsequently, the system writes the replaced state of A1 and the end time of the effective time interval into the remaining memory nodes that state the same New York residence fact value.
[0123] For example, when a user asks "Where do I live?", A2 is provided as the current fact with the active state, while A1 is only marked as historical context, so the large language model answers "London". However, when a user asks "Where did I live before?", the system identifies the time constraint pointing to the past, retains A1 whose effective time interval intersects with the time constraint, and increases the ranking weight of the replaced state in the historical query, so the large language model answers "New York", which can also explain that the residence was later replaced by the current fact of London.
[0124] Therefore, when health status and residence change, the system triggers the change event, limits the candidate correction area through two complementary channels, and then migrates the validity status of existing memory nodes or generates new memory nodes according to the nature of the conflict. Outdated memories no longer participate in the answer as current facts, but still retain the original semantic content, valid time interval and traceability information, which can be used for historical query and subsequent review.
[0125] Example 3:
[0126] This embodiment further discloses a long-term memory self-updating management system for a large language model intelligent agent, used to execute the long-term memory self-updating management method for a large language model intelligent agent described in Embodiment 1, such as... Figure 8 As shown, the system includes a dialogue access module 100, a hierarchical memory storage module 200, a positive consolidation module 300, a bounded rewrite propagation module 400, a change adjudication module 500, a non-destructive coding module 600, and a validity perception retrieval module 700.
[0127] The dialogue access module 100 is used to acquire dialogue data between the agent and the user and divide it into dialogue rounds according to the conversation. The dialogue access module 100 is connected to the conversation service interface of the agent to perform the acquisition and normalization, conversation segmentation and round structuring described in step 1 of embodiment 1, and output the structured dialogue rounds to the positive consolidation module 300.
[0128] The hierarchical memory storage module 200 is used to store a hierarchical memory graph, which includes multiple layers of memory nodes and edges connecting the memory nodes. The multiple layers of memory nodes are at least divided into a scenario trajectory layer and a consolidation knowledge layer, and the memory nodes have a validity status.
[0129] In one embodiment, the hierarchical memory storage module 200 is implemented by a combination of a relational database and a vector index: the relational database sets up a memory node table, an edge table, and a change event table, which respectively store the fields of the aforementioned memory nodes, the fields of the edges, and the fields of the change events; the vector index stores the embedding vector of the semantic content of the memory nodes with the node identifier as the primary key, and supports approximate nearest neighbor retrieval based on cosine similarity; in order to support the global state alignment in step 5.4 and the entity range-limited retrieval in step 3.3, the memory node table also establishes indexes on the fact value key, the entity set, and the validity state.
[0130] In another embodiment, the hierarchical memory storage module 200 can also be implemented by combining a graph database and a vector index. The graph database carries the storage of memory nodes and edges and adjacency queries. The hierarchical memory storage module 200 provides interfaces for node reading and writing, edge reading and writing, conditional retrieval by entity and attribute name, and retrieval by vector similarity, which can be called by the positive consolidation module 300, the bounded rewrite propagation module 400, the non-destructive encoding module 600, and the validity-aware retrieval module 700.
[0131] The positive consolidation module 300 is used to write the semantic content of the dialogue turn into the hierarchical memory graph, and generate a change event when the hierarchical memory graph undergoes structural changes. The change event includes the source node and the changed content. The positive consolidation module 300 performs the semantic segmentation and context trajectory layer memory node generation, intra-layer association edge establishment, semantic clustering and consolidation of knowledge layer memory nodes, abstraction of graph layer memory nodes, and determination of structural changes described in step 2 of embodiment 1, and outputs the generated change event to the bounded rewrite propagation module 400.
[0132] The bounded rewrite propagation module 400 is used to determine candidate correction regions with the source node as the seed node. The candidate correction regions include memory nodes selected by propagating the activation amount along the edge according to the association strength determined by historical co-occurrence statistics, and memory nodes obtained by retrieving the hierarchical memory graph according to the changed content.
[0133] Furthermore, the bounded rewrite propagation module 400 includes an event-driven correlation propagation unit and a knowledge-guided candidate expansion unit that are structurally parallel and can be executed in parallel in terms of timing, as well as a boundary synthesis unit with two input ends respectively connected to the output ends of the two units; the event-driven correlation propagation unit performs the correlation propagation described in step 3.2 of embodiment 1 and outputs a first candidate set, and the knowledge-guided candidate expansion unit performs the candidate expansion described in step 3.3 and outputs a second candidate set, and the two do not depend on each other's output; the boundary synthesis unit takes the union of the two and outputs the candidate correction region to the change adjudication module 500 after deduplication.
[0134] The change adjudication module 500 is used to determine the change type of the candidate memory nodes in the candidate correction region. The change type includes at least one of time-series update, true contradiction, premise change and implicit deduction. The change adjudication module 500 performs the adjudication input construction, rule pre-screening, change type determination and confidence determination described in step 4 of embodiment 1, and outputs each candidate memory node and its change type to the non-destructive encoding module 600.
[0135] The non-destructive encoding module 600 is used to non-destructively correct the candidate memory nodes according to the change type. Understandably, the non-destructive encoding module 600 includes a connected append-type validity marking unit and a global state alignment unit. The former is used to migrate the validity state of the candidate memory node to the corresponding inactive state while maintaining the original record, or to generate a new memory node in the active state. The latter is used to propagate the same validity mark to all copies of the same fact value. The non-destructive encoding module 600 performs the state transition mapping, validity time interval closure and tracing writing, generation of new memory nodes under implicit deduction, global state alignment of copies of the same fact value, and recalculation of upper-level memory nodes as described in step 5 of Embodiment 1, and writes the correction results back to the hierarchical memory storage module 200.
[0136] The validity-aware retrieval module 700 is used to respond to user queries, retrieve candidate memory nodes, and perform differential processing based on the validity status of the candidate memory nodes before inputting them into the large language model to obtain an answer. The validity-aware retrieval module 700 performs the query parsing, dual-path retrieval, time-constrained filtering and validity differential processing, sorting and truncation, and prompt word assembly and answer generation described in step 6 of embodiment 1.
[0137] In one embodiment, the system further includes a change event bus located between the forward consolidation module 300 and the bounded rewrite propagation module 400. This bus caches and distributes change events, with its input connected to the event output of the forward consolidation module 300 and its output connected to the input of the bounded rewrite propagation module 400. This change event bus serves as a connection hub between the forward consolidation side and the reverse consolidation side, decoupling them in timing; that is, the forward consolidation write does not need to wait for the reverse correction to complete. The system may also include a large language model interface for submitting prompt words to the large language model and receiving generated results. This interface can be either an application programming interface call to a remote large language model service or a local call to a locally deployed model. The writing path consisting of the dialogue access module 100 and the forward consolidation module 300 is called the forward consolidation path, and the correction path consisting of the bounded rewrite propagation module 400, the change adjudication module 500 and the non-destructive encoding module 600 is called the reverse consolidation path. The two share the same hierarchical memory map stored in the hierarchical memory storage module 200 and are connected through change events, thereby forming a bidirectional consolidation process.
[0138] In terms of deployment, the above system can be implemented as an independent long-term memory service for intelligent agents, which can be called by one or more intelligent agents through an application programming interface; it can also be implemented as a functional module embedded inside an intelligent agent; or it can be implemented as a service that conforms to the model context protocol, which can be accessed by intelligent agents through tool calls.
[0139] It should be noted that the division between the above modules is a logical division based on function. In specific implementation, each module can be deployed on the same physical device or on different physical devices and communicate via a network; the hierarchical memory storage module 200 can also be implemented by multiple storage components. In addition, the parts of the above modules that involve calling the large language model can either call the same large language model as the agent's inference kernel or call a dedicated model with a smaller parameter scale. This embodiment does not limit this.
[0140] Example 4:
[0141] This embodiment discloses an electronic device and a computer-readable storage medium.
[0142] As Figure 9 As shown, the electronic device described in this embodiment includes a processor, a memory, a communication bus, and a communication interface. The processor and the memory are interconnected via the communication bus and communicate with each other. The processor communicates with external devices via the communication interface.
[0143] The memory is used to store computer programs, as well as hierarchical memory maps, fact value indexes, and change events generated during the execution of the method described in Embodiment 1; the processor is used to execute the computer programs stored in the memory to implement steps 1 to 6 of the long-term memory self-updating management method for a large language model intelligent agent described in Embodiment 1.
[0144] The processor can be a central processing unit, or other general-purpose processors, digital signal processors, application-specific integrated circuits, field-programmable gate arrays, or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components; the memory can include read-only memory and random access memory, or non-volatile memory, such as at least one disk storage or flash memory device; the communication interface can be a wired communication interface or a wireless communication interface, used to receive dialogue data and user questions and output answers.
[0145] This embodiment also discloses a computer-readable storage medium storing a computer program thereon. When the computer program is executed by a processor, it implements the long-term memory self-updating management method for a large language model intelligent agent described in Embodiment 1. The computer-readable storage medium can be a read-only memory, random access memory, magnetic disk, optical disk, or USB flash drive, or other media capable of storing program code.
[0146] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media containing computer-usable program code. The execution order of the steps described in the above embodiments, except for those that must be performed sequentially according to their inherent logic, does not constitute a limitation on the present invention.
[0147] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for self-updating and managing the long-term memory of a large language model intelligent agent, characterized in that, include: Acquire dialogue data between the intelligent agent and the user, and divide the dialogue data into dialogue rounds according to the conversation; The semantic content of the dialogue turn is written into a hierarchical memory graph, and a change event is generated when the hierarchical memory graph undergoes structural changes. The change event includes the source node and the changed content. The hierarchical memory graph includes multiple layers of memory nodes and edges connecting the memory nodes. The multiple layers of memory nodes are at least divided into a context trajectory layer and a consolidation knowledge layer. The memory nodes have a validity state. Candidate correction regions are determined using the source node as the seed node. The candidate correction regions include memory nodes selected by propagating activation along the edge based on the association strength determined by historical co-occurrence statistics, and memory nodes obtained by retrieving the hierarchical memory graph based on the changed content. For candidate memory nodes in the candidate correction region, determine the change type of the candidate memory node relative to the change event. The change type includes at least one of time-series update, true contradiction, premise change and implicit deduction. The candidate memory node is non-destructively modified according to the change type, so that the candidate memory node exits the current valid memory state while retaining its original semantic content, or a new memory node is generated. In response to a user's question, candidate memory nodes are retrieved from the hierarchical memory graph. After differentiating the candidate memory nodes according to their validity status, the user's question is input into the large language model to obtain an answer.
2. The long-term memory self-updating management method for a large language model intelligent agent as described in claim 1, characterized in that, The step of writing the semantic content of the dialogue turn into a hierarchical memory graph includes: The dialogue rounds are divided into at least one semantic block, and a memory node for the context trajectory layer is generated for each semantic block. Calculate the semantic correlation degree between the newly generated memory node and the existing scenario trajectory layer memory node, and establish an intra-layer association edge between the two when the semantic correlation degree meets the association condition; The memory nodes of the scenario trajectory layer are classified into semantic clusters according to the entities they involve. For the same semantic cluster, when the newly arrived semantic content is consistent with the facts stated by the existing consolidated knowledge layer memory node, it is merged into the existing consolidated knowledge layer memory node. When they are inconsistent, the existing consolidated knowledge layer memory node is retired and a new consolidated knowledge layer memory node is generated. The change event is generated for the retired memory node, and an inter-layer dependent edge is established between the consolidated knowledge layer memory node and the scenario trajectory layer memory node it is based on. The structural modifications include at least one of adding memory nodes, retiring or rewriting existing memory nodes, adding or deleting edges, and regenerating upper-level memory nodes. However, the refinement and paraphrasing of the facts stated by the memory nodes are not considered structural modifications.
3. The long-term memory self-updating management method for a large language model intelligent agent as described in claim 1, characterized in that, The candidate correction region is the union of the first candidate set and the second candidate set, where: The activation amount is propagated along the edge to adjacent memory nodes. Memory nodes with activation amounts exceeding the propagation threshold are added to the first candidate set, and propagation paths with activation amounts not exceeding the propagation threshold are truncated. Infer at least one target attribute affected by the changes, retrieve the hierarchical memory graph using the target attribute as a search condition with entity scope limitation, and add the matched memory nodes to the second candidate set.
4. The long-term memory self-updating management method for a large language model intelligent agent as described in claim 3, characterized in that, The propagation of activation along the edge to adjacent memory nodes includes: The association strength from the source memory node to the target memory node is determined based on the co-activation count of the source memory node and the target memory node, the individual activation count of each, and the total activation count in the hierarchical memory graph. The association strength increases with the increase of the co-activation count and decreases with the increase of the individual activation count of each. The availability gain of the target memory node is determined based on the historical activation count of the target memory node and the time interval since its most recent activation. The transmission coefficients are configured according to the type of edge, and the transmission coefficient of the inter-layer dependent edge that represents the upper-layer memory node's dependence on the lower-layer memory node is greater than the transmission coefficient of the intra-layer associated edge that connects the same-layer memory nodes. The activation amount propagated from the source memory node to the target memory node is the product of the activation amount of the source memory node, the association strength, the availability gain, and the conduction coefficient.
5. The long-term memory self-updating management method for a large language model intelligent agent as described in claim 1, characterized in that, Determining the change type of the candidate memory node relative to the change event includes: When the candidate memory node is true before the change event occurs, and the change content represents that the facts it records have changed over time, it is determined to be the time-series update; When the changed content indicates that the facts recorded by the candidate memory node have not been true since its generation, it is determined to be the true contradiction; When the candidate memory node records a precondition that it depends on, and the changed content indicates that the precondition is no longer valid, it is determined to be the precondition change; When the candidate memory node records a triggering condition, and the changed content satisfies the triggering condition, it is determined to be the implicit deduction; When a candidate memory node simultaneously records both a dependent precondition and a triggering condition, it is processed in the order that the precondition change takes precedence over the implicit derivation.
6. The long-term memory self-updating management method for a large language model intelligent agent as described in claim 1, characterized in that, The memory node includes semantic content, valid time interval and validity status. The validity status includes active status and inactive status. The inactive status includes being replaced, premise changed and withdrawn. The non-destructive modification according to the change type includes: Keeping the semantic content of the candidate memory node and the start time of its effective time interval unchanged, the effective state is migrated from the active state to one of the inactive states corresponding to the change type, and the effective time interval of the candidate memory node is closed with the occurrence time of the change event. The migrated candidate memory node is retained in the hierarchical memory graph and participates in retrieval. When the change type is the implicit inference, the candidate memory node remains unchanged and a new memory node with the validity state of the active state is generated, and the source information of the new memory node is recorded. The source information includes the change event that triggered its generation and the memory node on which it is based. Identify the remaining memory nodes that state the same fact value as the candidate memory node, and write the validity status and the end time of the validity time interval into the remaining memory nodes.
7. The long-term memory self-updating management method for a large language model intelligent agent as described in claim 1, characterized in that, The multi-layer memory node also includes a graph layer, wherein the memory node of the graph layer is abstracted from at least two consolidation knowledge layer memory nodes, and inter-layer dependent edges are maintained between the memory node of the graph layer and the consolidation knowledge layer memory node that is the source of its abstraction. Retrieving candidate memory nodes in the hierarchical memory graph includes: direct retrieval based on semantic similarity, and navigating along the interlayer subordinate edges to the memory nodes of the consolidation knowledge layer using the memory nodes of the graph layer as navigation; Differentiated processing is performed based on the validity status of the candidate memory nodes, including: Exclude candidate memory nodes whose validity status is withdrawn from the scope of input to the large language model; Mark the candidate memory node whose validity status has been replaced as the historical context; Provide the candidate memory nodes whose validity status has changed along with their updated preconditions.
8. A long-term memory self-updating management system for a large language model intelligent agent, characterized in that, include: The dialogue access module is used to acquire dialogue data between the agent and the user and divide it into dialogue rounds according to the conversation; A hierarchical memory storage module is used to store a hierarchical memory graph, which includes multiple layers of memory nodes and edges connecting the memory nodes. The multiple layers of memory nodes are at least divided into a scenario trajectory layer and a consolidation knowledge layer. The memory nodes have a validity status. The positive consolidation module is used to write the semantic content of the dialogue turn into the hierarchical memory graph, and generate a change event when the hierarchical memory graph undergoes structural changes. The change event includes the source node and the changed content. The bounded rewrite propagation module is used to determine candidate correction regions with the source node as the seed node. The candidate correction regions include memory nodes selected by propagating the activation amount along the edge according to the association strength determined by historical co-occurrence statistics, and memory nodes obtained by retrieving the hierarchical memory graph according to the changed content. The change adjudication module is used to determine the change type of the candidate memory node in the candidate correction region. The change type includes at least one of the following: time-series update, real contradiction, premise change and implicit deduction. A non-destructive coding module is used to perform non-destructive modification of the candidate memory nodes according to the change type; The validity-aware retrieval module is used to respond to user queries, retrieve candidate memory nodes, and perform differentiated processing based on the validity status of the candidate memory nodes before inputting them into the large language model to obtain the answer.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements a long-term memory self-updating management method for a large language model intelligent agent as described in any one of claims 1 to 7.
10. An electronic device, characterized in that, It includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement a long-term memory self-updating management method for a large language model intelligent agent as described in any one of claims 1 to 7.