Intelligent memory dynamic evolution method and system based on metadata and double channels
By using metadata and a dual-channel intelligent memory dynamic evolution method, the problems of incompleteness, update delay and noise accumulation in agent memory management are solved, realizing refined, efficient and dynamic management of agent memory and improving the interactive response capability of large language model agents.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHENGDU POTENTIAL ARTIFICIAL INTELLIGENCE TECH CO LTD
- Filing Date
- 2026-03-30
- Publication Date
- 2026-07-03
Smart Images

Figure CN121935293B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of natural language processing, and specifically discloses an intelligent memory dynamic evolution method and system based on metadata and dual channels. Background Art
[0002] With the rapid development of artificial intelligence and natural language processing technologies, large language model-based agents (LLM-based Agents) have become a research and application hotspot in this field. The Retrieval-Augmented Generation (RAG) architecture, which can effectively integrate external knowledge retrieval and large model generation capabilities, has been widely used in the memory construction, knowledge invocation, and interaction response processes of agents, providing core technical support for agents to achieve dialogue coherence and knowledge output accuracy in long-term and complex human-computer interaction scenarios, and has been widely applied in scenarios such as intelligent customer service, personal intelligent assistants, and industry-specific large models. However, when existing RAG-based agent architectures actually handle long-term and complex interaction tasks, there are still many core technical defects in their memory management, making it difficult to meet the requirements of the integrity of agent memory management, the timeliness of dynamic updates, and the effectiveness of memory data invocation, which has become a key problem restricting their implementation and application in complex scenarios. The specific technical defects include:
[0003] There is a problem of cognitive blind spots lacking integrity verification. Before the existing RAG agent system performs a knowledge retrieval operation, it lacks a pre-judgment mechanism for the "known / unknown" status of entities involved in the input instruction and does not establish a corresponding entity status recognition and verification system. When encountering a target entity that does not exist in the knowledge base, the model cannot accurately identify such a knowledge gap, but instead will force content generation, which may lead to the "hallucination" problem of the large model. At the same time, the system does not have the ability to actively initiate clarification or questioning for knowledge gaps and cannot achieve active knowledge supplementation, seriously affecting the accuracy of human-computer interaction responses.
[0004] There is a problem of delayed update of memory data. The memory update link of existing agents usually relies on a timed background batch processing method, such as completing the update and iteration of memory data through vector database reconstruction. This update mode has obvious timeliness drawbacks. When a user issues a key instruction involving security attributes or strong personal preferences, such as correcting personal allergy history, changing permanent residence, or adjusting core usage preferences, the system cannot immediately take effect the memory update in the subsequent next round of dialogue, resulting in the "single learning" failure of the agent and being unable to respond to the core needs of the user in a timely and accurate manner.
[0005] There are issues with contextual noise accumulation and logical conflicts between old and new facts. On the one hand, existing systems lack a dynamic pruning mechanism based on the memory lifecycle, failing to effectively distinguish the value of historical dialogue data. A large number of low-value historical dialogue fragments cannot be filtered and cleaned up in a timely manner, continuously crowding out the agent's context window. This not only reduces the efficiency of knowledge retrieval but also easily introduces invalid interference information. On the other hand, the system lacks a fine-grained version control strategy for managing memory data. When conflicts between old and new facts occur, such as changes in a user's occupation, contact information, or residential address, semantic conflicts easily arise between related old and new memory data during retrieval. Furthermore, the system lacks the ability to automatically resolve such conflicts, further reducing the effectiveness and accuracy of the agent's memory retrieval.
[0006] The aforementioned technical deficiencies, when combined, result in significant shortcomings in the existing RAG-based agent architecture regarding the completeness of memory management, the timeliness of dynamic updates, and the effectiveness of memory data. These deficiencies severely restrict the application experience and implementation effectiveness of large language model agents in long-term, complex interactive scenarios. Therefore, there is an urgent need for a method for the dynamic evolution and management of agent memory that can solve the above problems.
[0007] In view of this, this invention proposes a dynamic evolution method and system for intelligent memory based on metadata and dual channels. It focuses on the core technical directions of long-term memory management, dynamic updating, integrity verification, and knowledge graph construction of large language model agents. Through the integrated design of pre-emptive integrity verification, dual-channel processing for intent diversion, lifecycle-based dynamic evolution algorithm, and multi-database collaborative hybrid storage architecture, it optimizes the entire link of agent memory verification, updating, evolution, storage, and retrieval. It precisely solves the core defects of existing RAG-based agent architectures, such as cognitive blind spots, update delays, noise accumulation, and logical conflicts. It realizes refined, efficient, and dynamic management of agent memory, and significantly improves the interactive response capability and engineering implementation effect of large language model agents in long-cycle and complex interactive scenarios. Summary of the Invention
[0008] The purpose of this invention is to provide a method and system for the dynamic evolution of intelligent memory based on metadata and dual channels. The problem addressed is how to technically optimize the memory of intelligent agents to achieve refined, efficient, and dynamic management of their memory, thereby improving the interactive response capabilities and engineering implementation effects of large language model agents in long-cycle, complex interactive scenarios. The specific solution is as follows:
[0009] A dynamic evolution method for intelligent memory based on metadata and dual-channel processing includes: S1: Extracting entities from user input commands using natural language processing to obtain command entities; S2: Querying the metadata index based on the command entities to obtain entity states; entity states include known states, pending completion states, and unentered states; the metadata index is used to implement a dynamic schema-less GAP registration mechanism, a retrieval blocking mechanism, an anti-harassment state mechanism, and a reverse state degradation mechanism; S3: When the entity state is a known state or an unentered state, updating the relational vector database and graph database based on the user input commands through a dual-channel mechanism to obtain new relational vector databases and new graph databases; S4: Matching the user input commands to the new relational vector database and the new graph database for mixed retrieval to obtain preference relations and hard constraint relations; S5: Constructing context vectors based on the user's core profile, preference relations, and hard constraint relations; S6: Processing the user input commands and context vectors through large-scale model generation to obtain generated content, and outputting feedback based on the generated content.
[0010] Furthermore, it also includes: when the entity status is in the pending completion state, generating query content based on the user input command; and outputting feedback based on the query content; the query content includes clarification commands or counter-question commands.
[0011] Furthermore, S3 includes: scoring the urgency of user input commands to obtain a command urgency score; when the command urgency score is higher than or equal to the urgency score threshold, updating the relational vector database and graph database in real time through an instant response channel based on the user input command to obtain a new relational vector database and a new graph database; when the command urgency score is lower than the urgency score threshold, updating the relational vector database and graph database asynchronously through an asynchronous maintenance channel based on the user input command to obtain a new relational vector database and a new graph database.
[0012] Furthermore, the urgency score for the instruction is:
[0013] ;
[0014] in, This represents the urgency score of the instruction; min represents the minimum value. For business area weighting coefficients; Risk factors for business areas; These are the state transition weight coefficients; For state transition intention factors; Emotional activation weighting coefficient; It is an emotional activation factor.
[0015] Furthermore, based on user input commands, the relational vector database and graph database are updated in real time through an instant response channel to obtain a new relational vector database and a new graph database. This includes: querying data related to the command entity in the relational vector database and updating the query results based on user input commands to obtain a new relational vector database; and calling the graph data interface to perform graph data updates based on user input commands, updating the structured relationships of the graph data to obtain a new graph database.
[0016] Furthermore, based on user input commands, the relational vector database and graph database are asynchronously updated through an asynchronous maintenance channel to obtain a new relational vector database and a new graph database. This includes: clustering historical input commands in the buffer queue database based on user input commands to obtain multiple related input commands; performing multi-dimensional scoring on the user input commands based on the multiple related input commands to obtain command update scores; deleting user input commands when the command update score is lower than a first update score threshold; storing user input commands in the buffer queue database when the command update score is higher than or equal to the first update score threshold and lower than a second update score threshold; and updating the semantic knowledge buckets in the relational vector database and the graph database based on the user input commands when the command update score is higher than or equal to the second update score threshold to obtain a new relational vector database and a new graph database.
[0017] Furthermore, the instruction update score is:
[0018] ;
[0019] in, Update the score for the instruction; This is the adjustment coefficient for the first dimension; Foundational importance; This is the adjustment coefficient for the second dimension; Logarithmic operations to base 10; To increase visitor popularity; This is the adjustment coefficient for the third dimension; It is a natural constant; This is a preset forgetting rate constant; For time difference.
[0020] Furthermore, based on user input commands, the semantic knowledge buckets and graph database in the relational vector database are updated to obtain a new relational vector database and a new graph database. This includes: extracting entity relations based on user input commands and updating the graph database according to the entity relations; generating vector indexes based on user input commands and updating the data in the semantic knowledge buckets based on the vector indexes; performing long-term inaccessible decay processing on the data in the semantic knowledge buckets and deleting long-term inaccessible data; long-term inaccessibility refers to data that has not been accessed within a preset access time interval.
[0021] Furthermore, the relational vector database includes a user core profile bucket, a semantic knowledge bucket, and a contextual flow log bucket; the user core profile bucket is used to store the core profile of the user; the semantic knowledge bucket is used to store the data extracted from the asynchronous maintenance channel in the dual-channel mechanism; and the contextual flow log bucket is used to store the data in the buffer queue database.
[0022] This invention also provides a dynamic evolution system for intelligent memory based on metadata and dual channels, used to implement the dynamic evolution method for intelligent memory based on metadata and dual channels as described above. It includes an entity extraction layer, an integrity verification layer, an intent routing layer, a context generation layer, a hybrid retrieval layer, a large model generation layer, and an output feedback layer. The entity extraction layer extracts entities from user input commands through natural language processing to obtain command entities. The integrity verification layer queries the metadata index based on the command entities to obtain entity states. Entity states include known states, states to be completed, and states not entered. The metadata index implements a dynamic schema-less GAP registration mechanism, a retrieval blocking mechanism, and anti-harassment mechanisms. The system includes a state mechanism and a reverse state degradation mechanism; the intent routing layer updates the relational vector database and graph database through a dual-channel mechanism based on user input commands when the entity state is a known state or an unentered state, resulting in a new relational vector database and a new graph database; the hybrid retrieval layer matches user input commands to the new relational vector database and the new graph database for hybrid retrieval, resulting in preference relations and hard constraint relations; and constructs context vectors based on the user's core profile, preference relations, and hard constraint relations; the large model generation layer processes user input commands and context vectors through large model generation to obtain generated content; and the output feedback layer outputs feedback based on the generated content.
[0023] The present invention has the following advantages and beneficial effects:
[0024] This invention improves the integrity verification system for intelligent agent memory, eliminating cognitive blind spots at the source and effectively solving the model "illusion" problem. By introducing a metadata index library into the retrieval pre-layer, it achieves accurate prediction of the "known / unknown" state of entities in user input commands, enabling rapid identification of knowledge gaps and proactively triggering clarification and follow-up questioning processes. This replaces the forced generation of unknown entities by the model in existing technologies, significantly improving the accuracy of intelligent agent interaction responses. At the same time, standardized entity state verification provides an accurate and reliable entity foundation for knowledge graph construction, ensuring the effectiveness of knowledge graph entity and relation construction.
[0025] This invention achieves differentiated dynamic updates of agent memory, balancing update timeliness and system processing efficiency, and completely solves the problems of data update delays and "single-learning" failures. Through a dual-channel mechanism of immediate response and asynchronous maintenance based on urgency scoring, for high-risk, strongly preferred critical commands, a fast channel using atomic writing to a graph database and version lock updates to a relational database achieves millisecond-level memory activation, ensuring that core memory updates can be immediately applied in the next round of dialogue, perfectly realizing "single-learning." For ordinary interaction commands, a slow channel writes to the log buffer and is asynchronously processed by a background process, avoiding the occupation of core system resources by high-frequency ordinary interactions and achieving reasonable allocation of system resources. Simultaneously, the semantic clustering and knowledge extraction of the slow channel provide an efficient and low-cost technical path for the continuous supplementation of the knowledge graph and the iterative updating of long-term memory.
[0026] This invention constructs a lifecycle-based dynamic memory evolution system, effectively solving the problems of contextual noise accumulation and logical conflicts between old and new facts, and achieving refined management of long-term memory. By integrating a multi-dimensional scoring formula that considers importance, popularity, and time decay, it realizes automatic promotion, archiving, and physical forgetting of memory data. It can accurately filter and clean up low-value historical dialogue data, free up context window resources, and improve the efficiency and accuracy of knowledge retrieval. At the same time, a fine-grained version control mechanism enables orderly iteration between old and new memories. By archiving old records and inserting new versions, it automatically resolves semantic conflicts between old and new facts, ensuring that the agent's long-term memory data always maintains logical consistency. Furthermore, the entity relationships extracted during the evolution process continuously enrich the content of the knowledge graph, promoting the dynamic iteration and improvement of the knowledge graph.
[0027] This invention optimizes the storage and retrieval architecture of an agent's long-term memory, adapting to the management needs of various types of memory data and providing stable memory support for long-term interactions. Relying on a hybrid storage module composed of graph databases, relational databases, and vector databases, it achieves categorized storage of memory data: the graph database stores structured entity relationships, the relational database implements versioned memory management, and the vector database stores unstructured text, perfectly matching the storage characteristics of different types of data in the agent's long-term memory. Meanwhile, the hybrid retrieval module can integrate multi-source stored data for precise retrieval, making long-term memory retrieval more efficient and effectively supporting the agent's dialogue coherence and knowledge output accuracy in long-term, complex interaction scenarios.
[0028] This invention achieves a deep integration of metacognitive monitoring, dual-channel processing, dynamic evolution, and knowledge graph construction, comprehensively enhancing the interactive capabilities and engineering application value of large language model agents. By starting from the entire lifecycle of agent memory management, it organically combines integrity verification, dynamic updates, evolutionary pruning, and knowledge graph construction technologies to form a closed-loop dynamic memory management system for agents. This effectively reduces the model illusion rate, improves the timeliness of memory updates, and optimizes the effectiveness of memory retrieval. It makes the agent's memory management capabilities more aligned with the needs of long-cycle, complex interactions in practical applications, providing reliable technical support for the engineering implementation and scenario-based applications of various large language model agents, such as intelligent customer service, personal intelligent assistants, and industry-specific large models, thus expanding the application boundaries of large language model agents. Attached Figure Description
[0029] Figure 1 An exemplary flowchart of an intelligent memory dynamic evolution method based on metadata and dual channels provided by the present invention;
[0030] Figure 2 This is an exemplary flowchart of the present invention for real-time updates via an instant response channel;
[0031] Figure 3 This is an exemplary flowchart for asynchronous updates via an asynchronous maintenance channel provided by the present invention. Detailed Implementation
[0032] 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.
[0033] The core technical solutions of this invention include an integrity verification mechanism, intent triage and dual-channel processing, and a dynamic evolution algorithm. The integrity verification mechanism involves introducing a metadata index at the retrieval front-end layer to perform status queries on entities in the input command, intercepting "known unknowns" and triggering an active completion process. Intent triage and dual-channel processing divide the data processing path into an immediate response channel (fast channel) and an asynchronous maintenance channel (slow channel) based on the command's urgency score. The immediate response channel, for high-risk / strong-preference commands, directly executes atomic writes to the graph database and version lock updates to the relational database, achieving millisecond-level effectiveness. The asynchronous maintenance channel, for ordinary interactive commands, writes to a log buffer and performs semantic clustering and knowledge extraction through periodic background processes. The dynamic evolution algorithm, based on a multi-dimensional scoring formula considering importance, popularity, and time decay, achieves automatic promotion, archiving, and pruning of memory.
[0034] Figure 1 An exemplary flowchart illustrating a dynamic evolution method for intelligent memory based on metadata and dual channels, provided by this invention, demonstrates the end-to-end data flow from user input to integrity verification, and then to dual-channel routing and hybrid storage. Figure 1 As shown, the intelligent memory dynamic evolution method based on metadata and dual channels provided by this invention includes the following:
[0035] S1: Extract entities from user input instructions using Natural Language Processing (NPL) to obtain instruction entities. User input instructions refer to natural language text data sent by the user to the intelligent agent system through a terminal interface (such as a text box or voice input), including ordinary instructions, constraint instructions (including strong preference instructions and high-risk instructions), and query instructions. After receiving user input instructions, the system parses them into data packets with timestamps and determines their instruction type based on business logic. Ordinary instructions are declarative instructions. For example, conveying everyday facts or casual conversation, specifically, "I went hiking today." Strong preference / high-risk instructions are constraint instructions. For example, explicitly expressing a user's long-term habit change, health restrictions, or safety constraints, specifically, "I will never eat cilantro again" or "I am allergic to penicillin." Query instructions are question-and-answer instructions. For example, requesting the system to retrieve information and answer, specifically, "What is the deadline for the project I mentioned last week?". Instruction entities refer to nouns or noun phrases with independent business meaning extracted from "input instructions" through natural language processing modules (such as the Named Entity Recognition (NER) algorithm), representing the subject, object, or core concept in a knowledge triple. For example, in the instruction "I will not eat beef anymore," "beef" is the extracted core entity; in "Please check the progress of that project for me," "project" is the extracted entity.
[0036] S2: Query the metadata index based on the instruction entity to obtain the entity status. Entity status includes known status (KNOWN), pending completion status (GAP), and unentered status (NEW). The metadata index is implemented through a metadata index table (KnowledgeMeta) to solve the problem of "the system not knowing what it doesn't know." "The system not knowing what it doesn't know" means that the system, through analyzing historical context, has clearly recorded a user mentioning a specific thing, but the system itself lacks the awareness of that thing's key detailed attributes. For example, a user said last week, "I'm busy with that new project." The system extracts the entity "project," but the user did not specify the name. At this time, the system generates a record in the index: {topic:"project name",status:"GAP",gap_context:"user mentioned being busy with a project but did not name it"}. When the user asks today, "What other materials are needed for that project?", the system looks up the table and finds the GAP status. The metadata index includes the entity name (topic(String)), the entity's status identifier (status(Enum)), and metadata (meta_data(JSON)). The entity status can be obtained by querying the entity's status identifier. The system uses the extracted "entity" name as the search key to perform precise string traversal matching in the entity field of the "metadata index". A known status means the traversal matches the entity record, and the associated specific attribute values are complete (e.g., entity "occupation", value "doctor"). A pending status means the traversal matches the entity record, but the specific key attribute values are empty. An unentered status means the traversal does not match the entity record, representing the first time the system has encountered this new concept. Metadata can include storage confidence, first mention time, number of follow-up attempts, etc. Storage confidence is a quantitative evaluation value (a floating-point number ranging from 0.0 to 1.0) stored in the metadata index's meta_data field, used to characterize the system's degree of confidence in the extracted entity facts. Storage confidence can be dynamically calculated based on information source rules and time decay algorithms, including direct declarations, implicit inferences, and time decay verification. For example, if the information comes from an explicit statement by the user (e.g., "I am a doctor"), the initial confidence level is assigned a very high value (e.g., 0.95). As another example, if the information is derived by the system through contextual inference (e.g., "I work the night shift at the hospital every day," the system infers that the occupation is likely a medical professional), the initial confidence level is assigned a moderate value (e.g., 0.60). Furthermore, the confidence level may decay over time. When the confidence level falls below a preset threshold (e.g., 0.4), the system forcibly downgrades the entity's state from Known to Gap, triggering proactive verification upon the next encounter.
[0037] The Metadata Index Database is a lightweight key-value database or relational table deployed in the retrieval front-end layer. For example, it can be implemented using JSONB fields in PostgreSQL. The Metadata Index Database does not store the actual long-text dialogue or core memory content; it only stores the system's current "cognitive state mapping map" (including entity name, state identifier, and metadata for auxiliary verification) for each extracted entity. The retrieval front-end layer is a lightweight logic interception and verification module deployed between the Natural Language Processing module and the underlying Large Model Vector Retrieval (RAG) module. The retrieval front-end layer extracts entities from the input command before triggering high-computing-power, high-latency conventional vector retrieval and performs state pre-checks in the Metadata Index Database. Its purpose is to intercept missing information upfront, preventing the system from forcibly retrieving based on incomplete conditions and thus creating "hallucinations." The Metadata Index Database is used to implement a dynamic schema-less GAP registration mechanism, a retrieval blocking mechanism, an anti-harassment state mechanism, and a reverse state degradation mechanism. The dynamic, schema-less GAP registration mechanism emphasizes that the system is based on natural language log analysis, dynamically discovering and creating unknown entity topics, rather than hard-coding static slots during system initialization. The retrieval blocking mechanism and anti-harassment state mechanism emphasize that a state must be executed before performing large-scale vector retrieval. The system involves complex state lookup operations; and before triggering follow-up questions by hitting a gap, it must read the `query_attempts` and `user_refused` parameters to perform anti-loop / anti-harassment computer checks. The reverse state degradation mechanism emphasizes that the known state is not permanently fixed, but rather automatically degenerates into a gap state by combining a timestamp with a confidence decay algorithm, thereby triggering a new round of active learning and verification loops for the agent regarding "outdated facts".
[0038] For example, in the application scenario of dynamic discovery and silent registration of cognitive gaps in the metadata index table, the trigger scenario is when a user mentions something in a daily conversation but does not assign specific attribute values to that thing. For example, a user might casually complain, "The new project I mentioned last week is stuck now, it's so annoying," only mentioning the project without specifying its name. The corresponding underlying execution action consists of three steps. First, the backend NLP model parses the user's instruction and extracts the entity slot, where the topic is the project name and the corresponding attribute value is empty. Next, the system detects that the attribute value is empty and no record related to "project name" is found in the KnowledgeMeta metadata index table, thus determining that there is missing information. Finally, the system automatically performs a silent insertion operation in the index table to complete the registration of the "ignorance" metacognition, recording the corresponding entity topic, the state to be filled, and marking the gap context, the initial number of follow-up questions being 0, and the user not refusing to answer in the metadata. The technical effect of this application is that the system can accurately capture and record its own cognitive blind spots without interrupting the user's current emotional state, achieving imperceptible registration of cognitive gaps.
[0039] For example, in the application scenario of pre-retrieval interception and anti-harassment pre-detection of metadata index table, the trigger scenario is that the user mentions the above-mentioned entity with unclear attributes again. For example, three days later, the user sends an instruction to the system to "help me sort out the plan of that project". The corresponding underlying execution actions are as follows: First, a high-speed, precise query with constant-level complexity is performed to extract the query entity "project name" from the user's command. Before initiating the underlying large-scale model vector retrieval, the system forcibly prioritizes querying the entity's status and metadata in the KnowledgeMeta table. If the query result shows that the entity's status is pending completion, the system will immediately suspend the subsequent large-scale model vector library retrieval thread to fundamentally prevent the large model from generating illusions due to missing information. Then, the critical anti-harassment verification step is executed. The system reads the control parameters in the metadata to conduct logical judgments. If any of the following three situations are detected—the user has explicitly refused to answer, the system has cumulatively asked about the entity 3 times, or the system has just initiated a follow-up question to the user within a short period of 24 hours—the follow-up question is abandoned, the retrieval thread is unsuspended, and the system is downgraded to a full-database fuzzy search. If all anti-harassment checks are passed, the system will extract the gap context from the metadata, generate and output a precise clarification question command, and simultaneously perform an update operation in the KnowledgeMeta table to increment the cumulative number of follow-up questions for the entity by 1.
[0040] For example, in the application scenario of filling gaps in the metadata index table and dual-write at the underlying level, the trigger scenario is when the user provides an effective answer to the system's clarification question, clearly supplementing the specific attribute value of the entity, such as the user informing the system that the project is an "AI reconstruction project". The corresponding underlying execution actions are as follows: First, the system performs entity alignment on the user's answer, identifying the specific attribute value corresponding to "project name" as "AI reconstruction project"; then, it performs a state flipping operation in the KnowledgeMeta table, updating the entity's state from pending completion to known, while setting the confidence level to 0.95 in the metadata and resetting the cumulative number of follow-up questions to 0; subsequently, the system synchronously triggers the underlying knowledge accumulation operation, transforming this definite factual information into a high-dimensional vector and inserting it into the semantic knowledge bucket L2 of the Memories table in the master relational database, completing the long-term accumulation of this knowledge; finally, the system resumes the previously suspended retrieval process, inputting the explicit "AI reconstruction project" as the search keyword into the underlying hybrid retrieval module, generating accurate project plan-related information for the user.
[0041] For example, in the application scenario of time-decay-based reverse degradation in the metadata index table, the trigger scenario is to deal with the situation where the user's objective facts drift over time, such as changes in information such as the user's place of residence or occupation. The corresponding underlying execution action consists of three steps. First, the background asynchronous process will periodically perform a full scan of the records in the KnowledgeMeta table whose status is known. Then, the system calculates the confidence of each record using an exponential decay formula. If the confidence of a record falls below the system's preset safety threshold, for example, a record that indicates the user's place of residence is Beijing, has an initial confidence of 0.95, and was last updated on January 1, 2023, and whose confidence drops below 0.4 by 2026, then decay processing is triggered. Finally, the system forcibly performs a reverse status degradation operation on the record, reverting its status from known to pending completion in the KnowledgeMeta table, and modifying the gap context in the metadata to indicate "Previously in Beijing, current status needs to be confirmed". The technical effect of this application is that it reverts outdated knowledge to a state of needing to be supplemented. When the user mentions the entity again later, the system will not respond based on the outdated information, but will trigger a pre-retrieval interception and anti-harassment pre-inspection process to proactively verify the current situation with the user, thus realizing the cautious cognitive characteristics of the bionic human brain.
[0042] S3: When an entity's state is either known or unentered, the relational vector database and graph database are updated via a dual-channel mechanism based on user input, resulting in a new relational vector database and a new graph database. The relational vector database uses Memories-Enhanced for version control and lifecycle management, including text content, hierarchical buckets, version, validity period (valid_until), and urgency flags for writes. The hierarchical buckets include the user core profile bucket L1, the semantic knowledge bucket L2, and the contextual flow log bucket L3. The user core profile bucket stores the user's core profile; the semantic knowledge bucket stores data extracted from the asynchronous maintenance channel in the dual-channel mechanism; and the contextual flow log bucket stores data in the buffer queue database. The version includes a version number (Integer). The validity period includes the validity expiration time (Timestamp). If the validity period is not empty, it indicates that the memory has been archived and becomes a historical version. Memories-Enhanced is a version-controlled table in a relational database that supports vector extensions. After being processed by an immediate response channel or an asynchronous maintenance channel, it packages natural language and its feature vectors into structured data rows and writes them using SQL INSERT statements.
[0043] After the pre-layer verification and approval, the system classifies the original natural language instructions through the "intent routing layer". In some embodiments, S3 includes the following:
[0044] The urgency of user input commands is scored to obtain a command urgency score. The urgency score characterizes the timeliness requirement for the user input command to alter the "system's core cognitive architecture (user profile)." A higher score indicates a higher timeliness requirement, meaning the system must ensure its effectiveness in the next interaction round. The system extracts three-dimensional features of user input commands using a lightweight Natural Language Processing (NLP) classifier and calculates the command urgency score using a linear weighted summation method. The specific calculation formula is as follows:
[0045] ;
[0046] in, This represents the urgency score of the instruction; min represents the minimum value. For business area weighting coefficients; Risk factors for business domains are obtained through string matching using a pre-defined high-risk entity dictionary. For example, if a match is found in a high-risk category library such as "medical," "legal," or "life and property safety" (e.g., "penicillin" or "alarm"), a high value is directly assigned (e.g., ...). If the target matches long-term attributes such as "dietary preferences" or "place of residence", assign a median value (e.g., If the match is not found (casual conversation), assign a low value (e.g., ); These are the state transition weight coefficients; The state transition intention factor can be obtained by extracting verbs and adverbs using dependency parsing algorithms. For example, if there are strong state change words (such as "absolutely not," "change to," "must"), they are assigned as... If it is a simple declarative sentence (such as "I feel", "maybe"), assign it as ; Emotional activation weighting coefficient; The emotional activation factor can be obtained by calculating arousal using a text sentiment analysis model. For example, text with high arousal features such as extreme anger, emphasis, or fear is mapped to a high score range. Stable emotions are The weighting coefficients are preset hyperparameters of the system, satisfying... To ensure secure isolation, the domain risk weight composite is typically set to the highest level (e.g., The outermost layer The function is used to ensure that the final total score boundary is safe and does not exceed [the specified threshold]. .
[0047] When the urgency score of an instruction is higher than or equal to the urgency rating threshold, the relational vector database and graph database are updated in real-time through the instant response channel based on the user input instruction, resulting in a new relational vector database and a new graph database. The urgency rating threshold refers to the urgency threshold preset by the system (e.g., ...). Based on the scoring results, instructions can be categorized into critical instructions, strong preference instructions, and normal instructions. Critical instructions may involve bottom-line issues such as user health, property safety, and system compliance, with objective constraints that have zero tolerance for error. Text matching is then used to find critical entity dictionaries (urgency score). For example, a high-risk instruction could be "I am severely allergic to penicillin, please don't prescribe it to me." Strong preference instructions can involve explicit changes to long-standing user habits, or direct overturning and correction of known historical memories of the system. These may include state transition words (urgency scores are in...). (Between). For example, "I've officially been transferred to work in Shanghai"; "I will absolutely never eat beef again." Ordinary instructions can involve everyday observations, casual conversation, or emotional expressions that do not contain high-risk entities or strong restrictive tones. Their timeliness requirements are lower, and they are mainly used as material for extracting long-term characteristics (urgency score). For example, "It's really hot today. I had a salad for lunch, and it was pretty good."
[0048] Figure 2 This demonstrates how data can be directly written to graphs and version locked in the fast lane, solving the problem of unclear data flow, such as... Figure 2 As shown, the process of real-time updates via the real-time response channel includes the following: querying data related to the instruction entity in the relational vector database, updating the query results based on user input instructions, and obtaining a new relational vector database; calling the graph data interface, executing graph data updates based on user input instructions, updating the structured relationships of the graph data, and obtaining a new graph database.
[0049] When the urgency score of an instruction is lower than the urgency rating threshold, the relational vector database and the graph database are updated asynchronously through an asynchronous maintenance channel based on the user input instruction, resulting in a new relational vector database and a new graph database. Figure 3 This demonstrates how slow-channel data is clustered, scored, and ultimately promoted or forgotten in the background, such as... Figure 3 As shown, the process of asynchronous updates via the asynchronous maintenance channel includes the following:
[0050] Based on user input commands, historical input commands in the buffer queue database are clustered to obtain multiple related input commands. These related input commands, as the clustering result, include JSON or structured data of topic tags and source log ID sequences.
[0051] The user input commands are scored using multiple related input commands to obtain a command update score. The command update score is as follows:
[0052] ;
[0053] in, The instruction update score, also known as the multidimensional retention score, is a calculation model in which the background maintenance process evaluates the lifecycle value of each physical data record in the "scenario stream log buffer" in the asynchronous maintenance channel. This is the adjustment coefficient for the first dimension; Based on fundamental importance, the inherent static value of the memory is characterized after being removed from the time dimension. During memory generation or background clustering, zero-shot scoring is performed using a Large Language Model (LLM) based on a pre-defined quantized prompt; for example, "The user got married" is automatically scored. "Users drank water" ; This is the adjustment coefficient for the second dimension; Logarithmic operations to base 10; Access popularity represents the cumulative frequency with which the record has been hit and adopted in historical searches; This is the adjustment coefficient for the third dimension; It is a natural constant; The preset forgetting rate constant (e.g., ); The time difference represents the freshness of the memory; it is the current timestamp when the system performs the calculation. The time difference is obtained by subtracting the creation timestamp (created_at) or last access timestamp (last_accessed_at) from the database field of the record. This is a time decay factor used to simulate the natural forgetting mechanism of the biological brain over time, employing a natural constant. A negative exponential function. With time difference... As the exponential term increases, its value decreases exponentially, approaching a certain level. If a memory is of extremely low importance and has not been accessed for a long time, its total score will rapidly drop below the elimination threshold as that item decays. Updating the score via instructions can resolve the contradiction between "limited context window and unlimited memory growth". The higher the score, the more worthy the record is of being extracted and solidified (triggering promotion to L2 semantic knowledge bucket); records with scores below the threshold will be deleted at the underlying level by the system generating a DELETESQL statement (triggering physical forgetting).
[0054] When the instruction update score is lower than the first update score threshold, the user input instruction is deleted. When the instruction update score is higher than or equal to the first update score threshold but lower than the second update score threshold, the user input instruction is stored in the buffer queue database. When the instruction update score is higher than or equal to the second update score threshold, the semantic knowledge buckets and graph database in the relational vector database are updated based on the user input instruction, resulting in a new relational vector database and a new graph database. This includes: extracting entity relations based on the user input instruction and updating the graph database based on the entity relations; generating vector indexes based on the user input instruction and updating the data in the semantic knowledge buckets based on the vector indexes. For example, by extracting knowledge from the user input instruction, abstract summary text including the output of the large model and INSERT actions are obtained, and the extracted content is stored in the semantic knowledge bucket L2.
[0055] Perform long-term inaccessible decay processing on the data in the semantic knowledge bucket and delete long-term inaccessible data; long-term inaccessible means that the data has not been accessed within a preset access time interval.
[0056] In some embodiments, when the entity status is in a state of pending completion, a query is generated based on the user input command; and feedback is output based on the query; the query includes clarification commands or counter-question commands. For example, when the status query returns GAP, an interception is triggered, immediately suspending subsequent large-scale model regular retrieval tasks, and initiating a verification mechanism to read the query_attempts (historical number of follow-up queries) of the GAP record in the index. If the number of... If a preset threshold (e.g., 3 times) is set, indicating the user is unwilling to answer, follow-up questions are canceled, and the search is downgraded to a fuzzy search; if After three attempts, proceed to the next step; extract the source context of the GAP and construct a clarifying question; output the question instruction to the user (e.g., "Are you referring to the large project you mentioned last time? What is its specific name?"); after receiving the user's supplementary answer (e.g., "It's called the AI Reconstruction Project"), perform a closed-loop update, re-extract the entity, update the entity's status in the index from GAP to KNOWN, and write the attribute value.
[0057] S4: Match the user input command to the new relational vector database and the new graph database respectively for mixed retrieval to obtain preference relations and hard constraint relations.
[0058] S5: Construct context vectors based on core user profiles, preference relationships, and hard constraint relationships.
[0059] S6: Process user input commands and context vectors through a large model to obtain generated content, and output feedback based on the generated content.
[0060] This invention also provides an intelligent memory dynamic evolution system based on metadata and dual channels, including an entity extraction layer, an integrity verification layer, an intent routing layer, a context generation layer, a hybrid retrieval layer, a large model generation layer, and an output feedback layer. This system overcomes the limitations of single vector databases in handling complex logic by adopting a Hybrid Neuro-Symbolic Architecture, which strictly isolates "hard logic" from "soft semantics" at the physical level. The entity extraction layer extracts entities from user input commands through natural language processing to obtain command entities. The integrity verification layer queries the metadata index based on the command entities to obtain entity states; entity states include known states, states to be completed, and states not entered. The metadata index table is physically independent of the memory table used to store massive amounts of text and high-dimensional vectors. This table is deployed in a high-speed cache or a lightweight relational data table, enabling precise key-value lookup with constant-time complexity. Before the time-consuming vector similarity calculation process begins, it quickly determines the system's cognitive boundaries, providing crucial pre-verification for subsequent retrieval and response operations. The metadata index table has a dedicated physical table structure containing six core fields. Each field corresponds to a different data type and has a clear core physical meaning and function: the `id` field is of type UUID and serves as the globally unique primary key for the index record, ensuring a unique identifier for each index record; the `user_id` field is of type UUID and is a foreign key associated with a user, enabling physical isolation of entity states between multiple users and ensuring that the cognitive state data of different users is independent; the `topic` field is an indexed string type and serves as the core entity identifier and index key, used to store abstract concepts extracted from user input commands. The system can use either factual topics, such as the name of the project being promoted, the spouse's name, or allergies; the status field is an enumeration type and is the core hub of the system's state machine, containing only two fixed values: KNOWN represents the known state, meaning the system has a firm grasp of the factual values of the entity, and GAP represents the state to be completed, meaning the system has captured the entity concept but is missing key attribute information; the meta_data field is of type JSONB and serves as a metadata control dictionary, dynamically storing the auxiliary traceability information, factual confidence level, and anti-interference control parameters corresponding to the cognitive state in a structured JSON format; the updated_at field is of type timestamp and is specifically used to record the time when the index record last underwent a state change or when the system actively verified it, enabling time-based traceability of entity cognitive state changes.
[0061] When an entity is in a GAP (Gap) state in the metadata index table, its corresponding `meta_data` field has a dedicated internal JSON structure. This structure not only includes key state machine tracking and tracing mechanisms but also integrates core anti-harassment control parameters, specifically five core components: `confidence` (numeric type) represents the current system's confidence in the entity's facts; this value is set to 0.0 by default when the entity is in a GAP state; `gap_context` (string type) stores the tracing context of this cognitive gap, allowing the system to generate natural counter-questions tailored to the conversational scenario; `query_attempts` (numeric type) is a core anti-harassment parameter, recording the cumulative number of times the system has proactively attempted to ask the user for information related to the entity; `last_asked_at` (timestamp type) precisely marks the absolute time when the system last initiated a follow-up inquiry about the entity; and `user_refused` (boolean type) is another core anti-harassment parameter, used to indicate whether the user has explicitly refused to answer questions related to the entity or actively ignored the system's follow-up inquiries. The metadata index table is not a static database table. It will evolve dynamically as users continue to interact with the system and as time goes by, strictly following the system's preset state machine control flow. This ensures that the cognitive states of each entity recorded in the table are always highly consistent with the actual human-computer interaction.
[0062] The intent routing layer updates the relational vector database and graph database through a dual-channel mechanism based on user input commands when the entity state is either known or unentered. This results in new relational vector databases and graph databases. The graph database, typified by Neo4j, acts as the system's "logical cortex," specifically storing highly confident structured entity relation triples extracted from large models. It does not store long text-like information and primarily handles multi-hop logical reasoning and attribute filtering, eliminating the possibility of illusions generated by large models from the ground up. The database's stored content is mainly divided into two categories: nodes and edges. Nodes are core entities extracted from user commands, such as users, food, and locations; edges represent explicit directional constraints between entities, such as residency, allergies, and dietary restrictions. Taking a user's input of "I absolutely will not eat cilantro" via an instant response channel as an example, the graph database does not store the original text of this sentence. Instead, it immediately generates a strongly binding hard link relationship, establishing an "absolutely forbidden" relationship between the user node and the food node representing cilantro. This relationship is then labeled with key information such as high urgency and a corresponding timestamp. Relational vector databases, often implemented using PostgreSQL with PGVector, serve as the system's "massive memory base." They are primarily responsible for storing unstructured raw text with timestamps, high-dimensional semantic feature vectors, and complex relational metadata fields used for metacognitive monitoring and version control. Again using the instruction "I absolutely will not eat cilantro" as an example, the relational vector database will fully store the original text of the instruction, such as "The user clearly stated an extreme aversion to cilantro before ordering lunch and requested an absolute aversion." This text will be converted into a 768-dimensional floating-point semantic feature vector for storage. The database will also attach SQL fields for lifecycle management, such as version number 1 and effective expiration time not set. In a relational vector database built with PostgreSQL, the core data table Memories implements a three-level hierarchical design that mimics human memory patterns through the bucket field. At the same time, the table has a standardized core physical structure and sets up differentiated storage and retrieval mechanisms for each level.
[0063] The complete core structure of the Memories table comprises nine fields, each with its own data type and distinct physical meaning and function: `memory_id` is a UUID type, serving as the globally unique primary key for a single memory record, providing a unique identifier; `content` is a text type, used to store the original memory text in natural language or related abstract summary text generated by the large model; `embedding` is a 768-dimensional vector type, acting as a multi-dimensional floating-point feature vector, used in conjunction with the HNSW index to perform high-speed similarity calculations; `bucket` is an enumeration type, the core field for implementing memory layering, with only three possible values: core profile bucket, semantic knowledge bucket, and contextual log bucket; `importance` is a floating-point type, representing the data assigned to the memory by the large model. The inherent importance score of the record serves as a crucial parameter in the dynamic evolution calculation formula for memory; access_count, an integer, records the cumulative frequency of successful retrieval of the record, and is also a key parameter in the evolution calculation; root_id, a UUID, acts as a tracking key for fact changes, and when the same fact undergoes version overwrite, the old and new version records will share this identifier; version, an integer, serves as the fact version number, and works monotonically with root_id to clearly present the iterative process of the fact; valid_until, a timestamp, is the core version lock field. When this field is NULL, it means that the record is currently absolutely valid; if it has a specific timestamp, it means that the record has become a historical archive and is no longer used as the default retrieval content.
[0064] The hybrid retrieval layer is used to match user input commands to a new relational vector database and a new graph database for hybrid retrieval, thereby obtaining preference relations and hard constraint relations; and to construct context vectors based on the user's core profile, preference relations, and hard constraint relations.
[0065] The large model generation layer processes user input commands and context vectors to generate content using a large model. The output feedback layer provides feedback based on the generated content.
[0066] Example 1
[0067] Suppose a user inputs the command: "I will no longer eat beef" (involving strong preference correction), then the dynamic evolution of intelligent memory based on metadata and dual channels is as follows:
[0068] S1, Integrity Check:
[0069] Input: Natural language text;
[0070] Processing: The NLP module extracts the entity "beef";
[0071] Query: Query the metadata index. If the returned status is GAP, the process is interrupted and a reverse query is performed. In this example, the status is KNOWN, so a release signal is output.
[0072] S2, Intent Routing:
[0073] Scoring: The model identified the negative word "no longer" and the object "beef," determining it to be a change in the user's core profile;
[0074] Decision: Calculate the urgency score of the instruction to 0.95 (> the urgency score threshold of 0.8), and route it to the immediate response channel (fast channel).
[0075] S3 performs real-time processing through the real-time response channel, in which the system performs the following operations in parallel within an atomic transaction:
[0076] Direct graph writing: Call the graph database interface and execute the Cypher command: MERGE(u:User)-[:DISLIKES]->(f:Food {name:'beef'}) to ensure that the structured relationship is established immediately;
[0077] Version Lock for Relational Vector Databases:
[0078] Query all old records in a relational vector database with Tag='Favorite Beef' and Valid_Until IS NULL;
[0079] Lock: Update the Valid_Until of the old record to the current time (archiving);
[0080] Write: Insert a new record {Content:"Avoid Beef",Version: N+1,Bucket:L1};
[0081] Effect: In the next second of the search, the system will automatically ignore old memories because it filters Valid_Until IS NULL by default, thus achieving "single learning takes effect immediately".
[0082] S4, Asynchronous Evolution and Physical Forgetting: If the user inputs casual conversation (such as "I'm a little tired today"), the data will enter the slow-channel buffer. This is triggered by a background process during idle time.
[0083] Clustering: Aggregating multiple fragmented conversations about "fatigue";
[0084] Scoring: The updated score of the instruction is obtained by performing multi-dimensional scoring on the user's input instruction.
[0085] Pruning: If the instruction update score is lower than the threshold, the record is physically deleted directly from the database to prevent low-value information from polluting the context.
[0086] Example 2
[0087] When the agent receives a user query (e.g., "Please book a restaurant for me, according to my previous preferences"), the system's read operation (retrieval) strictly follows the "pre-detection" principle. Dual-path concurrency The integration process is implemented in three steps:
[0088] S1, Metacognitive Pre-Check:
[0089] Extract the intent entity [taste preference] and query the KnowledgeMeta index table in the relational database;
[0090] If the status is GAP, immediately suspend the underlying search and output the question: "Do you have any dietary restrictions?"; if it is KNOWN, allow the process.
[0091] S2, Dual-Query Execution:
[0092] Path A (Vector Retrieval - Query Postgres (Relational Vector Database)): Converts user commands into embeddings (performs high-speed similarity calculation), performs cosine similarity calculation in the SEMANTIC bucket of the Memories table, and forcibly applies the SQL filter condition WHERE valid_until IS NULL (only retrieves the latest valid version). Recalls soft semantics (e.g., "The user mentioned liking mildly spicy food", Score: 0.85);
[0093] Path B (Graph Retrieval - Neo4j (Graph Database)): Execute Cypher path traversal query: MATCH (u:User)-[r:DISLIKES]->(f:Food)RETURN f.name (related graph data relationships, including nodes and edges). Instantly recalls hard constraint relationships (e.g., "Avoid beef").
[0094] S3, Reciprocal Rank Fusion (RRF):
[0095] The system merges the two results. Because the graph database represents "absolute hard logic," the system assigns it a very high confidence weight; the "soft preference" of vector recall is assigned a regular weight.
[0096] The final synthesized context is: [L1 forced injection (user core profile bucket, including dietary restrictions, etc.)] + [Graph hard constraint: don't eat beef] + [Vector soft preference: like spicy food] The model ultimately provided a perfect recommendation for "Sichuan restaurants without beef".
[0097] Example 3
[0098] The update (write operation) mechanism of this invention perfectly avoids the context fragmentation and data loss problems caused by direct UPDATE / DELETE operations in traditional databases. The specific underlying CRUD primitives are as follows:
[0099] 1. Resolving Conflicts of Fact (Version Control) – Addressing User Changes:
[0100] Scenario: The old record (V1) is "I work in Beijing". Today, the user enters a strong preference command through the fast track: "I have officially transferred to work in Shanghai".
[0101] Underlying execution steps (atomic transactions):
[0102] Lock Archive: In Postgres (a relational database), precisely locate (and update) the old record V1, executing `UPDATE memories SET valid_until = NOW() WHERE root_id = 'X' AND valid_until IS NULL`. V1 is then archived from history.
[0103] Add the following new version: Execute INSERT INTO memories (content, version, valid_until) VALUES ('User works in Shanghai', 2, NULL);
[0104] Graph Coverage (Merge): Perform MERGE to update edges in Neo4j (graph database), switching the original work location association to (Loc: Shanghai).
[0105] The above processing ensures that the regular retrieval in the next second, with the addition of WHERE valid_until IS NULL, automatically masks V1, perfectly resolving cognitive conflicts while preserving the trajectory of factual changes.
[0106] 2. Addressing Cognitive Gap Filling – Responding to Active Learning:
[0107] Scenario: The system previously recorded {topic: "spouse's name", status: "GAP"}. One day, a user casually chatted in the slow lane, saying, "My wife Alice and I are going on a trip this weekend."
[0108] Underlying execution steps:
[0109] The background NLP process scanned the entity "Alice" and its identity during nighttime clustering;
[0110] State reversal: Execute UPDATE knowledge_meta SET status = 'KNOWN', meta_data ='{"value": "Alice"}' WHERE topic = 'spouse's name';
[0111] Knowledge Accumulation: Simultaneously perform INSERT on the L2 SEMANTIC (semantic knowledge) bucket to generate a new long-term memory entry: "User's spouse's name is Alice".
[0112] 3. Solving Noise and Forgetting (Pruning) – Addressing Storage Explosion:
[0113] Scenario: The L3 context flow log bucket buffer is filled with a large amount of valueless chat logs (such as "It rained a little today" or "I received the package").
[0114] Underlying execution steps:
[0115] A scheduled task starts every day at midnight, iterating through records in the scenario stream log bucket L3 that have exceeded a certain number of days (e.g., 30 days).
[0116] The multidimensional scoring formula is called to calculate the score, and the updated score is obtained.
[0117] Because "I received the package" is of extremely low importance. ), never been searched and hit ( (and it decays exponentially over time);
[0118] When the instruction update score falls below the first update score threshold (elimination threshold), the system executes DELETE FROM memories WHERE memory_id = 'Y'.
[0119] The above methods can permanently eliminate junk data and accurately simulate the synaptic pruning mechanism of the biological brain, ensuring the ultimate retrieval speed of the underlying vector database.
[0120] Example 4
[0121] This channel is used to handle high-risk and strongly preferred commands. To clearly demonstrate the "Input" option... A B The logical chain of the "result" is broken down into its entirety, taking "updating the work location" as an example:
[0122] Enter the natural language command: "I have officially been transferred to work in Shanghai."
[0123] The NLP module extracts the entities [User, Workplace, Shanghai], and the intent routing module calculates the urgency score. Generate a fast channel trigger signal.
[0124] Upon receiving the trigger signal, the system executes the following two steps in parallel within a database-level atomic transaction to ensure strong data consistency:
[0125] S1, Atomic Write to Graph Database: Bypassing the conventional text vectorization buffer queue, directly call the underlying graph database (e.g., Neo4j) API; execute graph query merge statement (e.g., Cypher:MERGE (u:User)-[r:WORKS_IN{timestamp: NOW()}]->(loc:Location {name:'Shanghai'})); immediately generate a hard link edge representing a strong constraint relationship in the knowledge graph.
[0126] S2, Version Lock Update in Relational Databases: In relational databases (e.g., PostgreSQL), version updates are performed in the "memory table." Direct physical deletion of old data is strictly prohibited to prevent data loss. A SELECT statement is executed to find the old record for the entity (work location) where `valid_until` IS NULL (representing absolute validity at present) (assuming the V1 version record is found: "Work location is in Beijing"). An UPDATE statement is executed to update the `valid_until` field of the V1 record to the current precise timestamp. This record is no longer used as the default search term and becomes a historical archive. An INSERT statement is executed to insert a new record V2 (content: "Work location is in Shanghai", version=2, valid_until=NULL, stored in the L1 core profile bucket). The relational database completes a safe iteration of the fact state.
[0127] Once the transaction is successfully committed, the system immediately refreshes the working memory context. The next second, when a user asks "Can you recommend a restaurant near my company?", the system's underlying search forcibly adds the filter condition WHERE valid_until IS NULL, ensuring 100% accuracy in matching the new version "Shanghai" and completely discarding the old version "Beijing," perfectly achieving immediate effect from a single learning iteration.
[0128] Example 5
[0129] This channel is used to process ordinary commands. For example, consider the user's casual chat input over several consecutive days: "I ate a light salad on Monday," "I ate boiled chicken breast on Wednesday," "I didn't like the weight-loss meal on Friday."
[0130] Multiple ordinary instruction texts scattered across the timeline are not subjected to high-computing-power deep analysis by the system. Instead, their feature vectors and original texts are used as raw materials and appended to the Episodic Log buffer of the relational database.
[0131] The process of automatically grouping massive discrete logs according to topic similarity using unsupervised learning algorithms.
[0132] A periodic background process (such as one triggered at midnight every day) reads the newly added log vectors in the buffer, uses a similarity clustering algorithm (such as DBSCAN) to calculate the high-dimensional spatial distance, and groups logs that are close in distance into the same cluster.
[0133] The result is a structured JSON data packet containing topic tags and a list of source log IDs (formatted as: {"Cluster_ID":"C01","Topic":"Recent Dietary Records","Source_Logs":[log_1,log_2,log_3]}).
[0134] The original text contained in the above "clustering result JSON" is concatenated into a context input model, with a Prompt instruction: "Based on the provided logs, summarize a long-term user preference state and output a concise summary."
[0135] The large model outputs a highly abstract conclusion string and action instruction (format: {"action":"INSERT","content":"The user is currently trying to lose weight through light meals, but there is some resistance"}).
[0136] The extracted summary text is revectorized and INSERTed into the L2 Semantic Bucket, a high-level layer of the memory table.
[0137] The three fragmented chat logs in the original buffer will be physically deleted using DELETE after they have completed their mission to free up storage space.
[0138] In the future, when a user asks "How am I doing lately?", the system will directly access the condensed memory in the L2 semantic knowledge bucket through regular vector retrieval (RAG), which will significantly reduce the computation of tokens and filter out redundant contextual noise.
[0139] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Various modifications and variations can be made to the present invention by those skilled in the art. 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 intelligent memory dynamic evolution based on metadata and dual channels, characterized in that, include: S1: Extract entities from user input commands using natural language processing to obtain command entities; S2: Query the metadata index based on the instruction entity to obtain the entity status; the entity status includes known status, pending completion status, and unentered status; the metadata index is used to implement the dynamic schema-less GAP registration mechanism, retrieval blocking mechanism, anti-harassment status mechanism, and reverse status degradation mechanism; S3: When the entity status is known or unentered, the relational vector database and graph database are updated through a dual-channel mechanism based on user input commands, resulting in a new relational vector database and a new graph database, including: The urgency of user input commands is scored to obtain an urgency score; When the urgency score of an instruction is higher than or equal to the urgency score threshold, the relational vector database and graph database are updated in real time through an instant response channel based on the user input instruction, resulting in a new relational vector database and a new graph database, including: The system queries data related to instruction entities in a relational vector database and updates the query results based on user input instructions to obtain a new relational vector database. Call the graph data interface to perform graph data updates based on user input commands, update the structured relationships of the graph data, and obtain a new graph database; When the urgency score of an instruction falls below the urgency rating threshold, the relational vector database and graph database are asynchronously updated via an asynchronous maintenance channel based on the user-input instruction, resulting in a new relational vector database and a new graph database, including: Based on user input commands, historical input commands in the buffer queue database are clustered to obtain multiple related input commands; The user input command is scored in multiple dimensions based on multiple related input commands to obtain the command update score; When the updated score of an instruction falls below the first updated score threshold, the user-input instruction is deleted. When the instruction update score is higher than or equal to the first update score threshold and lower than the second update score threshold, the user input instruction is stored in the buffer queue database. When the instruction update score is higher than or equal to the second update score threshold, the semantic knowledge bucket and graph database in the relational vector database are updated based on the user input instruction to obtain a new relational vector database and a new graph database. S4: Match the user input commands to the new relational vector database and the new graph database respectively for mixed retrieval to obtain preference relations and hard constraint relations; S5: Construct context vectors based on core user profiles, preference relationships, and hard constraint relationships; S6: Process user input commands and context vectors through a large model to obtain generated content, and output feedback based on the generated content.
2. The intelligent memory dynamic evolution method based on metadata and dual channels according to claim 1, characterized in that, Also includes: When the entity status is "to be completed", generate a query based on the user input command; And output feedback based on the content of the inquiry; The questions may include clarification instructions or counter-questions.
3. The intelligent memory dynamic evolution method based on metadata and dual channels according to claim 1, characterized in that, The urgency score for the instruction is: ; in, This represents the urgency score of the instruction; min represents the minimum value. For business area weighting coefficients; Risk factors for business areas; These are the state transition weight coefficients; State transition intention factor; Emotional activation weighting coefficient; It is an emotional activation factor.
4. The intelligent memory dynamic evolution method based on metadata and dual channels according to claim 1, characterized in that, The instruction update score is: ; in, Update the score for the instruction; This is the adjustment coefficient for the first dimension; Foundational importance; This is the adjustment coefficient for the second dimension; Logarithmic operations to base 10; To increase visitor popularity; This is the adjustment coefficient for the third dimension; It is a natural constant; This is a preset forgetting rate constant; For time difference.
5. The intelligent memory dynamic evolution method based on metadata and dual channels according to claim 4, characterized in that, Based on user input commands, the semantic knowledge buckets and graph database in the relational vector database are updated to obtain a new relational vector database and a new graph database, including: Extract entity relationships based on user input commands, and update the graph database based on entity relationships; A vector index is generated based on user input commands, and the data in the semantic knowledge bucket is updated based on the vector index. Perform long-term inaccessible decay processing on the data in the semantic knowledge bucket and delete long-term inaccessible data; long-term inaccessible means that the data has not been accessed within a preset access time interval.
6. The intelligent memory dynamic evolution method based on metadata and dual channels according to claim 1, characterized in that, The relational vector database includes a user core profile bucket, a semantic knowledge bucket, and a contextual flow log bucket. The user core profile bucket stores the core profile of the user; the semantic knowledge bucket stores the data extracted from the asynchronous maintenance channel in the dual-channel mechanism; and the contextual flow log bucket stores the data in the buffer queue database.
7. A dynamic evolution system for intelligent memory based on metadata and dual channels, characterized in that, The method for implementing the intelligent memory dynamic evolution method based on metadata and dual channels as described in any one of claims 1-6 includes an entity extraction layer, an integrity verification layer, an intent routing layer, a context generation layer, a hybrid retrieval layer, a large model generation layer, and an output feedback layer. The entity extraction layer is used to extract entities from user input commands through natural language processing to obtain command entities; The integrity verification layer is used to query the metadata index based on the instruction entity to obtain the entity status; the entity status includes known status, pending completion status, and unentered status; The metadata index is used to implement a dynamic schema-less GAP registration mechanism, a retrieval blocking mechanism, an anti-harassment state mechanism, and a reverse state degradation mechanism; The intent routing layer is used to update the relational vector database and graph database through a dual-channel mechanism based on user input commands when the entity status is a known state or an unentered state, resulting in a new relational vector database and a new graph database. The hybrid retrieval layer is used to match user input commands to a new relational vector database and a new graph database for hybrid retrieval, thereby obtaining preference relations and hard constraint relations. And based on the core user profile, preference relationships, and hard constraint relationships, a context vector is constructed; The large model generation layer is used to process user input commands and context vectors through large model generation to obtain generated content; The output feedback layer is used to output feedback based on the generated content.