Structured memory data processing method and system oriented to long time sequence interaction

By constructing a hierarchical attribute pattern and a relevance routing mechanism, the limitations of context windows and privacy security issues in long-term interactions are resolved, achieving high-fidelity structured compression and interpretable memory representation, thus improving the recall accuracy of long-range memory.

CN121901267APending Publication Date: 2026-04-21MEMORY TENSOR (SHANGHAI) TECHNOLOGY CO LTD

Patent Information

Application Number
CN202610015480.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-01-07
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

Existing technologies suffer from limitations such as context window restrictions, information loss, lack of logical coherence, and privacy and security issues in long-term human-computer interaction scenarios, making it difficult to achieve structured expression, temporal consistency, and editability.

Method used

By constructing a hierarchical attribute pattern, the dialogue flow is mapped into a controlled sequence of atomic operations. Timestamp verification and semantically aware summary updates are introduced, a relevance routing mechanism is established, and a structured editing operation sequence is generated, thus realizing the iterative evolution of the tree structure.

Benefits of technology

It achieves high-fidelity structured compression of long-term interactive data, reduces storage overhead, supports readable, editable, and interpretable memory representation, improves the recall accuracy of long-range memory, and ensures privacy and security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121901267A_ABST
    Figure CN121901267A_ABST
Patent Text Reader

Abstract

The invention provides a structured memory data processing method and system oriented to long time sequence interaction, and is applied to the technical field of natural language processing and artificial intelligence memory modeling. The method comprises the following steps: acquiring a real-time interaction data stream, partitioning the real-time interaction data stream into dialogue data blocks, loading a hierarchical attribute mode and a previous time step attribute tree instance, inputting serialized texts of the hierarchical attribute mode and the previous time step attribute tree instance into a generative model, generating a writing, rewriting, deleting or null operation instruction aiming at a leaf node path, analyzing, updating, generating a current attribute tree instance, and storing the current attribute tree instance; by means of the scheme, lossy compression and structured evolution of the infinite long dialogue stream can be achieved, memory forgetting is relieved on the premise that a context window is not expanded, and long-time-sequence information retrieval precision and storage efficiency are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of natural language processing and artificial intelligence data storage technology, and in particular to a method and system for processing structured memory data for long-term interactive data. Background Technology

[0002] With the widespread application of large language models in intelligent agent systems, long-term human-computer interaction scenarios are becoming increasingly common. In such scenarios, the system needs to continuously process the user's dialogue history spanning weeks or even months, which leads to technical bottlenecks such as context window limitations and long-term memory maintenance.

[0003] Existing technologies primarily employ a full context concatenation approach, layering historical dialogues into the model round by round. This results in the input sequence length increasing linearly with each interaction round, rapidly exceeding the model's maximum context capacity and inducing intermediate information loss, thus reducing inference reliability. Another mainstream approach is vector retrieval-enhanced generation, which involves slicing dialogues, embedding them into a vector space, and storing them in a vector database. Retrieval relies on semantic similarity matching to recall fragments. However, this method struggles to guarantee logical coherence and temporal continuity, and lacks the ability to model deep structural features such as the evolution of users' implicit preferences. Furthermore, traditional user profiling is mostly based on offline statistical static tagging systems, unable to respond to dynamic changes in real-time dialogues. While end-to-end neural network memory mechanisms possess temporal modeling capabilities, their internal representations are uninterpretable, making them difficult to support manual verification and compliance auditing. Simultaneously, directly storing raw dialogue data poses a risk of leaking sensitive information such as individuals' names, health status, and biometric features, failing to comply with relevant personal information protection regulations.

[0004] Therefore, there is an urgent need for a memory data processing method that balances structured representation, temporal consistency, editability, and privacy.

[0005] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of the present invention, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention

[0006] In view of this, the present invention provides a structured memory data processing method and system for long-term interactive scenarios, aiming to solve the problems in the prior art, such as the inability to continuously model long-term dialogues due to context window limitations, the difficulty in converting unstructured dialogue streams into readable and editable stable memory representations, the lack of temporal consistency and conflict resolution mechanisms in updating old and new information, and the lack of ability to collaboratively utilize memory structures and original historical data in the retrieval process. This is achieved by constructing a hierarchical attribute pattern as a memory skeleton, mapping the dialogue stream to a controlled atomic operation sequence to achieve iterative evolution of the tree structure, introducing timestamp verification and semantically aware summary updates to ensure the logical integrity of information changes, and establishing a relevance routing mechanism based on attribute tree feature vectors to dynamically select direct or joint enhancement paths. Thus, under limited computing resources and compliance constraints, this invention achieves high-fidelity structured compression of infinitely long dialogue streams, interpretable and interventionizable memory maintenance, and accurate and efficient retrieval enhancement generation.

[0007] This invention provides a method for processing structured memory data for long-term temporal interactions, the method comprising:

[0008] Acquire real-time interactive data streams and convert them into discrete target dialogue data blocks according to preset segmentation rules;

[0009] Load the predefined hierarchical attribute pattern and the attribute tree instance from the previous time step; where the hierarchical attribute pattern limits the fixed data structure branches, the attribute tree instance from the previous time step is a structured compressed representation of historical interaction data, and the attribute tree instance from the previous time step only stores descriptive text data in the leaf nodes.

[0010] The target dialogue data block and the serialized text representation of the attribute tree instance from the previous time step are input together into a pre-configured generative processing model.

[0011] Using a generative processing model, a structured editing operation sequence is generated based on the information increment of the attribute tree instance relative to the previous time step contained in the target dialogue data block. The structured editing operation sequence contains at least one instruction for the target leaf node path in the attribute tree instance of the previous time step, and the instruction is selected from: write instruction, rewrite instruction, delete instruction and no-operation instruction.

[0012] Parse the structured editing operation sequence and perform text data update operations on the target leaf node path of the attribute tree instance in the previous time step to generate the attribute tree instance in the current time step;

[0013] Store the attribute tree instance of the current time step in a computer-readable storage medium, and use the attribute tree instance of the current time step as the attribute tree instance of the previous time step in the interaction processing of the next time step.

[0014] In some optional embodiments, the real-time interactive data stream is converted into discrete target dialogue data blocks according to a preset segmentation rule, including:

[0015] Store the real-time interactive data stream in a data cache area;

[0016] Real-time monitoring of the cumulative data volume metrics in the data cache area, including cumulative rounds or cumulative character count;

[0017] The semantic vectors of the data in the data buffer are computed in parallel, and the drift of the semantic vectors relative to the semantic vectors of the previous block window is monitored.

[0018] When the cumulative data volume reaches the preset cache threshold, or the drift exceeds the preset topic switching threshold, the data in the data cache is truncated to generate the target dialogue data block.

[0019] In some optional embodiments, the instructions in the structured editing operation sequence are constrained to key-value pair operations conforming to JSON syntax, with the specific definitions of the instructions as follows:

[0020] The write command is used to create the target leaf node path and write the text value when the target leaf node path is detected to not exist.

[0021] The rewrite instruction is used to overwrite the original text value with a text value containing new information when the path to the target leaf node is detected to already exist.

[0022] The delete command is used to set the existing text value under the target leaf node path to null or mark it as invalid;

[0023] The no-operation instruction is used to indicate that the generative processing model determines that the target dialogue data block does not contain valid information increments.

[0024] In some optional embodiments, parsing the structured editing operation sequence and performing text data update operations on the target leaf node path of the attribute tree instance in the previous time step also includes a conflict resolution step:

[0025] When the target leaf node path that the structured edit operation sequence attempts to update already has a non-null value in the attribute tree instance of the previous time step, obtain the generation timestamp of the structured edit operation sequence.

[0026] If the generated timestamp is later than the write time of the corresponding non-null value in the attribute tree instance of the previous time step, then the text data update operation is performed.

[0027] If the length of the text data after the text data update operation exceeds the preset length threshold, the summarization algorithm is called to perform semantic compression on the text data. The semantic compression preserves time entities and key event elements.

[0028] In some optional embodiments, the method further includes a data storage optimization step:

[0029] After generating the attribute tree instance for the current time step, compare the attribute tree instance for the current time step with the attribute tree instance for the previous time step.

[0030] Only the target leaf node path where data changes have occurred, the changed text value, and the current version number are written to the incremental log of the non-volatile database;

[0031] Additionally, the attribute tree instance at the current time step is serialized and stored as a full snapshot according to a preset time period.

[0032] In some optional embodiments, the method further includes a dual-path retrieval enhancement step:

[0033] In response to the received final task query request, calculate the correlation metric between the final task query request and the attribute tree instance of the current time step;

[0034] The relevance metric is compared with a preset routing threshold.

[0035] If the relevance metric is higher than or equal to the routing threshold, then a direct enhanced path is executed;

[0036] If the relevance metric is below the routing threshold, then a joint enhanced path is executed.

[0037] In some optional embodiments, calculating a relevance metric between the final task query request and the attribute tree instance at the current time step includes:

[0038] Map the final task query request to a query vector;

[0039] Obtain the feature vectors of each non-empty leaf node in the attribute tree instance at the current time step;

[0040] Calculate the cosine similarity between the query vector and each feature vector, and select the largest cosine similarity value as the relevance measure.

[0041] In some alternative embodiments, performing the direct enhancement path includes:

[0042] Extract the leaf node text whose cosine similarity satisfies the retrieval criteria directly from the attribute tree instance at the current time step;

[0043] Use the leaf node text as the context for generating the response.

[0044] In some alternative embodiments, performing the joint enhancement path includes:

[0045] Using the leaf node text in the attribute tree instance of the current time step, semantically complete the pronouns or default entities in the final task query request to generate an explicit rewritten query statement.

[0046] Retrieve relevant original dialogue fragments from the historical dialogue database by rewriting the query statement;

[0047] The leaf node text and the original dialogue fragment are used together as the context for generating the response.

[0048] In some optional embodiments, the pre-configured generative processing model is pre-trained through the following supervised fine-tuning steps:

[0049] Obtain a historical long dialogue sample set and divide it into multiple consecutive training dialogue blocks according to a preset block division rule.

[0050] Obtain the sequence of truth-editing operations for each training dialogue block, either manually annotated or generated by the teacher model;

[0051] By using training dialogue blocks as input and truth-valued edit operation sequences as supervision labels, the parameters of the initial model are adjusted by minimizing the loss function, enabling the initial model to generate grammatically correct structured edit operation sequences, thus obtaining a generative processing model.

[0052] In some optional embodiments, the generative processing model is further optimized through reinforcement learning steps, which include:

[0053] Generative processing models are used as policy networks to generate predicted editing operation sequences from dialogue blocks during training on the input.

[0054] The reward value for predicting the sequence of editing operations is calculated using a process reward mechanism;

[0055] The parameters of the policy network are updated based on the reward value.

[0056] In some optional embodiments, the process reward mechanism calculates the reward value according to the following rules:

[0057] Compare the atomic operation instructions in the predicted editing operation sequence with the corresponding instructions in the truth value editing operation sequence;

[0058] If an atomic operation instruction perfectly matches the corresponding instruction in terms of operation type, target path, and text content, it is assigned a positive first score.

[0059] If an atomic operation instruction matches the corresponding instruction in terms of operation type and target path, and the semantic similarity of the text content exceeds the preset similarity threshold, a positive second score is assigned, where the second score is less than the first score.

[0060] If an atomic operation instruction contains a missing or incorrect operation relative to the truth-editing operation sequence, a negative penalty score is assigned.

[0061] In some optional embodiments, the method further includes a dynamic graph expansion step:

[0062] When the information increment identified by the generative processing model cannot be mapped to the existing leaf nodes of the hierarchical attribute pattern, the semantic vector centroid of the information increment is calculated.

[0063] Determine whether the centroid of a semantic vector belongs to a pre-defined extended category cluster based on a clustering algorithm;

[0064] If so, then dynamically create the corresponding new leaf node path in the attribute tree instance of the previous time step, and write the information increment to the new leaf node path.

[0065] In some optional embodiments, the attribute tree instance is stored in JSON format, and the structured edit operation sequence generated by the generative processing model is constrained to a function call format containing only the keywords ADD, UPDATE, DELETE, and NO_OP.

[0066] In some optional embodiments, the method further includes a privacy data desensitization step:

[0067] Before inputting the target dialogue data block into the generative processing model, the target dialogue data block is scanned using a named entity recognition model.

[0068] Identify sensitive entities in the target dialogue data block that involve natural person biometric features or specific identity identifiers;

[0069] Sensitive entities are replaced using preset mask symbols or generalized labels to generate desensitized target dialogue data blocks as input to the generative processing model.

[0070] This invention provides a structured memory data processing system for long-term temporal interactions, comprising:

[0071] The segmentation module is used to acquire real-time interactive data streams and convert them into discrete target dialogue data blocks according to preset segmentation rules.

[0072] The state loading module is used to load predefined hierarchical attribute patterns and attribute tree instances from the previous time step. The hierarchical attribute patterns define fixed data structure branches, and the attribute tree instances from the previous time step are structured compressed representations of historical interaction data. The attribute tree instances from the previous time step only store descriptive text data in the leaf nodes.

[0073] The inference module is used to input the serialized text representation of the target dialogue data block and the attribute tree instance of the previous time step into a pre-configured generative processing model. Using the generative processing model, based on the information increment of the attribute tree instance relative to the previous time step contained in the target dialogue data block, a structured editing operation sequence is generated. The structured editing operation sequence contains at least one instruction for the target leaf node path in the attribute tree instance of the previous time step. The instruction is selected from: write instruction, rewrite instruction, delete instruction, and no-operation instruction.

[0074] The execution module is used to parse the structured editing operation sequence and perform text data update operations on the target leaf node path of the attribute tree instance in the previous time step to generate the attribute tree instance in the current time step.

[0075] The storage module is used to store the attribute tree instance of the current time step into a non-volatile storage medium and use the attribute tree instance of the current time step as the attribute tree instance of the previous time step in the interaction processing of the next time step.

[0076] The structured memory data processing method and system for long-term temporal interaction of the present invention has the following beneficial effects:

[0077] This invention incrementally updates the attribute tree through a structured editing operation sequence, achieving high-fidelity lossy compression of long-term interactive data and significantly reducing storage overhead. The hierarchical attribute pattern supports readable, editable, and interpretable memory representation, overcoming the semantic fragmentation and static user profile defects of traditional vector retrieval. The dual-path retrieval mechanism dynamically routes based on the relevance between the query and the attribute tree, improving the long-range memory recall accuracy. Privacy-desensitization preprocessing ensures compliance of sensitive information. The overall system effectively alleviates the limitations of the context window and memory forgetting problems of large language models while maintaining low latency response. Attached Figure Description

[0078] Other features, objects, and advantages of the invention will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings.

[0079] Figure 1 This is a flowchart of a structured memory data processing method for long-term time-series interactions according to an embodiment of the present invention;

[0080] Figure 2 This is a schematic diagram of a dual-path memory enhancement generation system architecture based on a user attribute tree according to an embodiment of the present invention;

[0081] Figure 3 This is a schematic diagram of a structured memory data processing system for long-term time-series interaction according to an embodiment of the present invention. Detailed Implementation

[0082] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, they are provided so that the invention will be more comprehensive and complete, and will fully convey the concept of the exemplary embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

[0083] Furthermore, the accompanying drawings are merely illustrative of the invention and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.

[0084] The flowchart shown in the attached diagram is merely an illustrative example and does not necessarily include all steps. For example, some steps may be broken down, while others may be combined or partially combined. Therefore, the actual execution order may change depending on the specific circumstances.

[0085] In long-term interactive scenarios, memory modeling needs to balance information fidelity and representational compactness. Essentially, it maps the infinitely growing original dialogue flow into a structured symbol system in a finite state space. This mapping process follows the information theory constraint of lossy compression, that is, while maintaining semantic recoverability, it strips away redundant surface forms through hierarchical abstraction, retaining only semantic invariants that are comparable and evolvable across time steps. The resulting structured state has deterministic update capabilities, allowing the differences between new observation data and historical states to be decomposed into discrete, verifiable operational units, thereby avoiding memory confusion caused by semantic drift in continuous vector space. This state evolution mechanism supports conflict determination based on timestamps and semantic similarity, maintaining the integrity of event elements while ensuring temporal consistency. Furthermore, the explicit semantic paths carried by the structured state constitute an interpretable index skeleton, enabling retrieval behavior to shift from fuzzy vector approximation matching to precise path positioning and logical association reasoning, ultimately achieving sublinear growth in storage overhead, a significant improvement in long-range information retrieval accuracy, and a substantial reduction in generation latency.

[0086] like Figure 1 As shown, this embodiment of the invention provides a method for processing structured memory data oriented towards long-term temporal interactions. The method includes the following steps:

[0087] Step S100: Acquire the real-time interactive data stream and convert it into discrete target dialogue data blocks according to a preset segmentation rule; wherein, the segmentation rule is dynamically determined based on the temporal continuity, content capacity, and semantic consistency of the data stream to ensure that each target dialogue data block achieves a balance between information density and topic integrity; in one embodiment, the segmentation rule is implemented by monitoring at least one of the following indicators in the buffer: dialogue rounds, number of characters, and semantic vector drift; in some other optional implementations, the segmentation rule can also be adjusted based on explicit user instructions, system resource levels, or external event trigger signals.

[0088] Step S200: Load the predefined hierarchical attribute pattern and the attribute tree instance from the previous time step; wherein, the hierarchical attribute pattern defines a set of immutable trunk and branch structures for organizing logical categories of memory information; the attribute tree instance from the previous time step is a structured compressed representation generated based on historical interaction data, and its data structure stores descriptive text data only at the leaf nodes, while the internal non-leaf nodes do not carry specific semantic content; in one embodiment, the hierarchical attribute pattern is defined in the form of a tree-shaped JSON Schema, containing two fixed classification levels and expandable leaf node slots; in some other optional implementations, the hierarchical attribute pattern can also be expressed using XML Schema, YAML Schema, or graph structure Schema, and the number of its branch levels can be configured to two or more levels according to application requirements.

[0089] Step S300: Input the target dialogue data block and the serialized text representation of the attribute tree instance from the previous time step into a pre-configured generative processing model; wherein, the generative processing model is typically a Large Language Model (LLM) or a neural network model based on the Transformer architecture. The generative processing model is trained to receive joint prompts from structured context and unstructured incremental input, and output a sequence of operation instructions that conforms to predetermined grammatical constraints; in one embodiment, the serialized text representation is generated by performing standard JSON serialization on the attribute tree instance and appending a path prefix identifier; in some other optional implementations, the serialized text representation may also take the form of plain text expansion with indentation, a path-flattened key-value pair list, or an embedded vector summary.

[0090] Step S400: Using a generative processing model, a structured editing operation sequence is generated based on the information increment of the attribute tree instance relative to the previous time step contained in the target dialogue data block. The structured editing operation sequence contains at least one instruction for the target leaf node path in the attribute tree instance of the previous time step. The instruction is selected from: write instruction, rewrite instruction, delete instruction, and no-operation instruction. The write instruction is used to add an uncovered attribute path and its corresponding text value, the rewrite instruction is used to update the text content under the existing path, the delete instruction is used to clear invalid or outdated attribute entries, and the no-operation instruction is used to indicate that there is no valid information increment. In one embodiment, the generative processing model is constrained to output only function call style structured instructions, and each instruction explicitly specifies the target path and operation type. In some other optional embodiments, the structured editing operation sequence may also be represented as a version-marked changeset, a diffpatch format, or a set of state transition predicates.

[0091] Step S500: Parse the structured editing operation sequence and perform text data update operations on the target leaf node path of the attribute tree instance in the previous time step to generate the attribute tree instance in the current time step; wherein, the parsing process includes instruction syntax verification, path validity verification, and operation semantic compatibility check; the update operation performs path creation, content overwriting, node clearing, or state preservation according to the instruction type; in one embodiment, the parsing and execution process is completed by a deterministic rule engine, without relying on probability sampling or random decoding; in some other optional implementations, the parsing and execution process can also be integrated into the model inference post-processing module, or implemented through a lightweight script interpreter.

[0092] Step S600: Store the attribute tree instance of the current time step into a computer-readable storage medium, and use the attribute tree instance of the current time step as the attribute tree instance of the previous time step in the interaction processing of the next time step; wherein, the storage operation supports both incremental write and full snapshot modes, and ensures that the attribute tree instance maintains structural consistency and data integrity during the transfer across time steps; in one embodiment, the computer-readable storage medium is a local SSD or a distributed key-value storage system; in some other optional embodiments, the storage medium may also be a memory-mapped file, an embedded database, or an object storage service.

[0093] The above steps work together to form a closed-loop memory evolution mechanism: Step S100 uses a semantically aware segmentation strategy to divide the infinitely long dialogue flow into segments with independent information units, alleviating context window pressure and suppressing semantic fragmentation; Step S200 introduces a predefined hierarchical attribute pattern, providing a stable, interpretable, and interventionist structural framework for memory, overcoming the problem of traditional vector memory lacking logical organization ability; Steps S300 and S400 jointly construct an abstract layer of "input-reasoning-instruction generation", enabling the generative processing model to no longer directly manipulate the original text, but to focus on identifying information increments and generating precise structured actions, thereby improving the controllability and traceability of memory updates; Step S500, through deterministic parsing and execution, ensures the temporal consistency and logical rigor of attribute tree state evolution, avoiding memory conflicts caused by model illusions or ambiguities; Step S600 realizes the persistence and iterative reuse of memory states, enabling the entire system to continuously accumulate, compress, and evolve long-term user interaction features without relying on infinite context. This multi-stage coupled design collectively solves problems such as insufficient memory compression, weak structural expression ability, uncontrollable update logic, and inaccurate retrieval and positioning in long-term interaction scenarios.

[0094] Through the above scheme, this embodiment can maintain a high-fidelity structured representation of ultra-long dialogue history with limited storage overhead, supporting fine-grained editing of memory content, human readability verification, and consistency maintenance across time steps. At the same time, the scheme avoids the linear growth bottleneck and "lost in the middle" effect caused by full context splicing, and also overcomes the inherent defects of pure vector retrieval in logical relevance and temporal coherence, providing a robust, compliant, and evolvable memory infrastructure for large language models in real-world long-cycle intelligent agent applications.

[0095] In one specific implementation, the real-time interactive data stream is continuously written to a circular buffer structured data cache. This cache maintains two synchronously updated metadata pointers: a round counter and a character accumulation counter. The round counter increments by 1 each time a new round of dialogue message is received from the user or the system, while the character accumulation counter dynamically accumulates all text content in the current cache based on the number of UTF-8 encoded bytes. Simultaneously, a lightweight semantic vectorization submodule is launched in parallel. This submodule uses a domain-adapted Sentence-BERT variant model to generate a 768-dimensional normalized vector for all current text in the cache every 500 milliseconds. And compare it with the reference vector saved at the end of the previous block window. Perform cosine similarity calculation to obtain the drift degree. When the round counter reaches the preset threshold Or the character cumulative counter exceeds ,or When any one of the three conditions is met, the system immediately triggers a truncation operation: locking the current buffer boundary, serializing all its contents into a target dialogue data block, and matching the end timestamp of the block with the corresponding... Write the chunked metadata log together, then clear the cache and use it as... Initialize new The physical capacity of the circular buffer is configured to support a maximum of 15 rounds of dialogue or 3000 characters to prevent sudden long messages from causing memory overflow. In some other optional implementations, the semantic vectorization submodule is replaced with a RoFormer-Sim-based dual-tower structure model; drift monitoring can be switched to sliding window mean drift detection, i.e., based on the most recent 3... Construct local principal component directions, and determine topic switching when the projection change rate of a new vector in this direction exceeds a threshold; the character cumulative counter can also be replaced by token-level statistics, and its mapping is based on the word segmentation results of LLaMA tokenizer or Qwentokenizer.

[0096] Through the above scheme, this embodiment can achieve multi-dimensional adaptive segmentation of long-term interactive streams, taking into account the triple constraints of dialogue rhythm, information density and semantic coherence, avoiding context breakage caused by fixed-length segmentation, and also avoiding the over-segmentation phenomenon caused by pure vector drift detection in low-information-entropy dialogues (such as greetings and confirmation sentences); at the same time, the collaborative design of the circular buffer and metadata pointer ensures low-latency and deterministic segmented response, which is suitable for high-concurrency real-time dialogue scenarios.

[0097] In one specific implementation, the instructions in the structured editing operation sequence are constrained to key-value pair operations conforming to JSON syntax, and this constraint is implemented through a predefined function call format and syntax validation mechanism. Specifically, the output layer of the generative processing model is configured by default to support four atomic operation words: ADD, UPDATE, DELETE, and NO_OP, each corresponding to a strictly defined parameter signature and semantic behavior. Among them, the path parameter of the ADD(path, value) instruction is a JSON path string separated by dots (e.g., "1_basic attributes.demographic characteristics.age stage"), and the value parameter is a UTF-8 encoded plain text string whose length, after front-end truncation, does not exceed 50 Chinese characters. When the parser detects that the path does not have any ancestor node in the current attribute tree instance, it automatically creates the missing intermediate level object level by level and writes the value to the final leaf node. The `UPDATE(path, value)` instruction requires that `path` already exists in the current attribute tree instance. Before execution, the parser first verifies whether the path points to a leaf node (i.e., does not contain nested objects or arrays). If the verification is successful, its text value is updated by overwriting. If `value` contains newline characters or control characters, they are uniformly replaced with full-width spaces before writing. The `DELETE(path)` instruction only accepts complete paths pointing to leaf nodes. When executed, the text value of the corresponding node is set to an empty string, and the node's metadata is marked with `deleted: true` and the current timestamp to support subsequent auditing and reversible rollback. The `NO_OP()` instruction does not take any parameters. Its existence itself indicates that the model determines that the current dialogue block has not introduced any effective incremental information that can be incorporated into structured memory. In this case, the parser skips all update logic and directly returns to the original attribute tree instance. In some other alternative implementations, the semantics of ADD and UPDATE can be merged into a single SET operation, whose behavior dynamically switches depending on whether the path exists; or DELETE can be replaced with ARCHIVE(path), which migrates the original value to the archive area and retains the associated timestamp and context hash; or NO_OP can be extended to NO_OP(reason="redundant" | "irrelevant" | "conflicting") with a reason code for downstream log analysis and model diagnosis.

[0098] Through the above scheme, this embodiment can ensure that all editing operations have deterministic execution semantics and verifiable syntactic structure, avoiding JSON parsing failures, path out-of-bounds errors, or illegal nesting caused by free text generation; at the same time, the orthogonal design of the four instructions makes the operation intention clear and traceable, providing a formal basis for subsequent conflict resolution, incremental synchronization, and process reward modeling.

[0099] In one specific implementation, when the structured editing operation sequence contains an UPDATE instruction for a target leaf node path that already has a non-null value, the system first extracts the generation timestamp attached to the UPDATE instruction. This timestamp is written by the inference module at the same time as generating the operation instruction, and its format is an ISO 8601 standard UTC time string, which is serialized together with the instruction text as part of the structured output. Next, the system reads the metadata field "_write_ts" stored under the corresponding path in the attribute tree instance of the previous time step. This field is written synchronously each time a write or update operation is performed, and its value is also an ISO 8601 format UTC time string. Then, the system performs a lexicographical comparison of the two timestamps—since the ISO 8601 format guarantees strict consistency between lexicographical order and time order, this comparison can be completed without parsing to a time object. If the lexicographical order of the generated timestamp is greater than the value of the "_write_ts" field, it is determined to be a valid time-sensitive update, and subsequent processing continues; otherwise, the UPDATE instruction is ignored. Specifically, after confirming the update, the system concatenates the new value text with the old value text and inserts a separator "[BUTRECENTLYCHANGEDTO]" to form a joint text string. Then, a lightweight summarization model is called to compress the joint text string. This summarization model is a finely tuned TinyBERT-Base (768 hidden layer dimensions, 14M parameters), with a maximum input length of 128 tokens and a maximum output length limit of Llimit=50 Unicode characters. During the summarization process, the model is forced by constrained decoding to retain all explicit time expressions (such as "last week", "since March 2024", "since the physical examination") and logical transition words (such as "but", "however", "because... changed to...", "from... to..."). After the summarization is completed, the system writes the compressed text to the target path and synchronously updates the "_write_ts" field under that path to the current system timestamp. In some other alternative implementations, timestamp comparison can be performed by parsing the timestamps to Unix milliseconds before numerical comparison; the summary model can be replaced by a rule-based template filler, which matches words and applies corresponding sentence templates based on a predefined change pattern library (e.g., 12 patterns such as "preference change", "status update", "medical order adjustment"); Llimit can be configured to dynamically adjust according to language type, for example, 50 characters for Chinese scenarios and 80 tokens for English scenarios.

[0100] Through the above scheme, this embodiment can ensure that the evolution of information in the same semantic dimension in the attribute tree has strict temporal causal consistency, avoiding the overwriting of new information by old information due to network latency, historical backfilling, or asynchronous processing. At the same time, when information undergoes substantial changes, the summary mechanism that retains time anchors and logical connectors maintains the traceability and interpretability of the event development, preventing both catastrophic forgetting and unrestrained text expansion. Compared with the prior art, this embodiment simultaneously completes the three logics of timeliness verification, semantic fusion, and length truncation in a single UPDATE operation, without relying on external clock synchronization services. Moreover, the summary results stably control the average leaf node length within the range of 42-48 characters while maintaining the elements, reducing storage overhead by more than 67% compared to the uncompressed scenario.

[0101] In one specific implementation, after generating the attribute tree instance for the current time step, the system first performs a structured difference comparison between the attribute tree instance for the current time step and the attribute tree instance for the previous time step. This comparison is performed at the granularity of JSON paths, traversing all leaf node paths layer by layer, comparing the string hash value and timestamp field of the text value under the corresponding path. If a path exists in both versions and the text hash value is the same, it is determined that there has been no change. If the path exists but the hash value is different, or the path only exists in the current version, it is determined that data has been changed. Then, the system stores all leaf node paths determined to have been changed, the corresponding changed text values, and the current globally monotonically increasing version number (Version). The ID and change operation type (ADD / UPDATE / DELETE) are packaged into an incremental log entry and written to a dedicated incremental log table in a non-volatile database. This incremental log table uses a columnar storage format, where the path field has a B+ tree index, the version number field supports range queries, and the text value field is compressed using the LZ4 algorithm. Next, the system starts a background scheduled task to trigger a full snapshot operation at a preset time period—e.g., every 24 hours or every 100 attribute tree updates. This operation serializes the attribute tree instance at the current time step into standard JSON text, appends a checksum (SHA-256) and a generation timestamp, stores it in a separate namespace of the object storage service, and records the snapshot's version number, generation time, size, and storage URI in the metadata index. In some other optional implementations, the incremental log can use WAL (Write-Ahead Log). The Logging mechanism persists the data to a local SSD log file and then asynchronously batch-synchronizes it to a distributed database. The full snapshot period can be dynamically adjusted based on the frequency of attribute tree changes. For example, when the average number of change paths is less than 3 in 5 consecutive update cycles, the snapshot interval will be automatically extended to 72 hours. The version number can also be replaced with a distributed unique identifier generated based on a combination of logical clock (such as LamportTimestamp) and node ID.

[0102] Through the above solution, this embodiment can significantly reduce the storage bandwidth and disk I / O pressure of the memory system under long-term operation, and stabilize the write latency of incremental updates at the millisecond level. At the same time, it supports arbitrary historical state backtracking and differential debugging based on version number, and when data anomalies occur, it can complete state recovery accurate to the leaf node level through incremental logs and the most recent full snapshot. Compared with the prior art, this embodiment avoids the redundant I / O overhead caused by serializing the entire tree for each update, and while ensuring data traceability, it converges the cumulative storage growth under long-term operation from linear to approximately logarithmic level.

[0103] In one specific implementation, in response to a received final task query request, the system performs a dual-path retrieval enhancement operation. First, based on the semantic association between the final task query request and the attribute tree instance at the current time step, a scalar relevance metric is calculated. Then, this relevance metric is compared with a preset routing threshold. If the relevance metric is higher than or equal to the routing threshold, a direct enhancement path is triggered, where the context for response generation is generated solely based on the internal structured information of the attribute tree instance. If the relevance metric is lower than the routing threshold, a joint enhancement path is triggered, where the context is constructed by comprehensively invoking the attribute tree instance and externally stored historical dialogue data. Specifically, the relevance metric is obtained by matching the query request with the semantic representation of readable nodes in the attribute tree. Its calculation process does not rely on full-text comparison of the original dialogue text but is based on the spatial projection relationship of node-level feature vectors. The routing threshold is a configurable real-valued parameter with a value between 0.5 and 0.9, and can be dynamically adjusted according to the precision-recall tradeoff requirements of the application scenario. In other alternative implementations, the relevance metric can also be generated by graph neural network embedding, sparse word matching weighting, or hierarchical attention score aggregation; the routing threshold can also be implemented as a conditional function output that adapts to the frequency of user interaction, the stage of the session lifecycle, or the type of task.

[0104] In the specific implementation process, such as Figure 2As shown, when the system receives a final task query request initiated by the user, it enters the retrieval enhancement generation process. This process uses routing policy logic to dynamically select between path A - direct enhancement path and path B - complex enhancement path. Specifically, the routing policy logic first calculates the relevance metric between the final task query request and the currently loaded attribute tree instance. If the relevance metric meets a preset condition (e.g., higher than a routing threshold), the system determines that the current query mainly involves macroscopic attributes or explicit memory, and thus activates path A; conversely, if the relevance metric is lower than the preset condition, the system determines that the current query involves detailed backtracking or implicit reference, and thus activates path B.

[0105] In path A – the direct enhancement path – the system invokes the attribute tree retriever logic. This retriever directly accesses the attribute tree instance and extracts the leaf node text relevant to the query semantics. The extracted node text is directly used as context and input into the final answer generation logic. In this path, the system relies solely on the structured information of the attribute tree for a fast response, avoiding invalid scanning of the entire historical data.

[0106] In path B - the joint enhancement path, the data flow passes through three logical processing units in sequence:

[0107] Tree-Guided Rewriter: This rewriter uses attribute tree instances as a background knowledge base to perform semantic completion or disambiguation on the final query request. For example, it maps pronouns in the query to specific entity names recorded in the attribute tree, generating explicit rewritten queries.

[0108] History Retriever: Retrieves external history dialogue databases (History DB) using rewritten queries. This database stores uncompressed original dialogue fragments, providing fine-grained context not included in the attribute tree.

[0109] Fusion Generator: It splices and weights the structured node information extracted by the attribute tree retriever with the unstructured original fragments recalled by the history backtracker to construct a joint context that takes into account both macro logic and micro details.

[0110] Ultimately, both the structured context from path A and the joint context from path B are fed into the final answer generation logic. At this point, the inference module generates the final response for the user based on this enhanced context.

[0111] Through the above Figure 2 The architecture shown in this embodiment, without introducing additional hardware modules, utilizes the computing power of the inference module and the hierarchical storage structure (attribute tree + history database) of the storage module to achieve on-demand scheduling of "structured memory" and "unstructured history". This design ensures low-latency response for common problems (following path A) and solves the pain point of losing details in complex long-tail problems (following path B), thereby significantly improving the accuracy of answers and system performance in long-term interaction scenarios.

[0112] Through the above scheme, this embodiment can realize fine-grained dynamic decision-making on retrieval strategies, avoiding the problems of insufficient information coverage or redundant loading caused by using a fixed single memory access mode. Compared with the prior art, this embodiment maintains the lightweight advantage of attribute trees while taking into account the complementarity between structured memory and unstructured history, so that the system can select the appropriate combination of information sources when facing task queries at different abstraction levels, thereby improving the accuracy, timeliness and contextual consistency of response content in long-term interaction scenarios.

[0113] In one specific implementation, the relevance metric between the final task query request and the attribute tree instance at the current time step is calculated. First, the final task query request is mapped into a fixed-dimensional query vector using a pre-trained text encoder. The text encoder is a Sentence-BERT model, and the output vector is L2 normalized. Then, it iterates through all non-empty leaf nodes in the attribute tree instance at the current time step, and performs the same encoding process on the descriptive text data stored in each leaf node to obtain the corresponding feature vector set. ,in This represents the total number of non-empty leaf nodes in the current attribute tree; then, one by one... With each Calculate cosine similarity, i.e.

[0114]

[0115] The maximum value in the similarity sequence is taken as the correlation measure. Cosine similarity calculations are performed under floating-point precision no less than IEEE 754 single precision, and all vector dimensions are considered. The standard number is 768.

[0116] In some alternative implementations, the text encoder can be replaced with E5-Mistral-7B or BGE-large-zh-v1.5, whose output vector is still normalized before participating in the cosine similarity calculation; the feature vectors of non-empty leaf nodes can also be generated by jointly encoding the node path string and the text content, instead of encoding only the text content; the selection process for the maximum similarity can further introduce a weighting strategy, such as weighting each leaf node based on its level depth or update timestamp. Apply a decay factor, then take the maximum value after weighting.

[0117] Through the above scheme, this embodiment can quantify the semantic association strength between the final task query request and the structured memory in a deterministic and reproducible manner, avoiding reliance on heuristic word matching or fuzzy rule judgment, thereby providing stable, continuous and well-discriminative numerical input for subsequent dual-path routing decisions.

[0118] In one specific implementation, when the routing decision determines to execute the direct enhancement path, the system first traverses all non-empty leaf nodes in the attribute tree instance at the current time step, extracts their text content, and generates a corresponding feature vector for each leaf node. Specifically, a lightweight sentence vector model is used to encode the text of each leaf node, resulting in a dense vector representation with a dimension of 768. Then, the final task query request is mapped to a query vector using the same sentence vector model. Next, the cosine similarity between the query vector and the feature vectors of all leaf nodes is calculated to form a similarity set. Subsequently, based on preset retrieval conditions—that is, selecting the top 3 leaf nodes with a similarity value greater than or equal to 0.65—the corresponding text content is extracted from them. Finally, the extracted text content is concatenated in descending order of similarity and used as a structured context input to the downstream language generation module to generate a user-oriented response.

[0119] In other alternative implementations, the search criteria can be configured as: a fixed number threshold (such as Top-1, Top-3, or Top-5), a dynamic number threshold (adaptively truncated based on the standard deviation of the similarity distribution), or a composite threshold (simultaneously satisfying the minimum similarity lower limit and the maximum number upper limit); the feature vector generation method can be replaced with a sparse vector based on term frequency-inverse document frequency (TF-IDF) weighting, or a context-aware vector output by a small-scale fine-tuned BERT variant; the concatenation method can be replaced with weighted fusion according to the attribute tree hierarchy weights, or by introducing an attention mechanism to assign dynamic scores to the text of each leaf node before concatenation.

[0120] Through the above scheme, this embodiment can quickly locate highly relevant semantic units from structured memory in a deterministic manner, avoiding semantic fragmentation and noise interference common in vector retrieval, and improving the accuracy of context relevance while maintaining low latency. Compared with the prior art, in strong memory relevance scenarios, this embodiment only needs to load less than 1KB of structured text on average to complete the effective context supply, reducing token consumption by more than 98% compared to full historical splicing, and avoiding inaccurate reasoning caused by the "lost in the middle" effect.

[0121] In one specific implementation, when the routing decision result is to execute the joint enhanced path, the final task query request is first subjected to referential resolution and entity completion: the system traverses all non-empty leaf node texts in the attribute tree instance at the current time step, extracting field values ​​with entity determinism, including but not limited to explicitly stored structured attributes such as "shopping preferences.recently followed brands", "dietary preferences", "frequently used travel methods", and "device model"; then, the final task query request is input into a lightweight semantic rewriting model, which takes the query text as input and the matching leaf node text in the attribute tree as in-context prompts, and identifies and replaces ambiguous referential components; specifically, if the query contains phrases without explicit referents such as "the brand last time", "the store I mentioned before", or "that app", the model performs explicit mapping based on the latest value of the corresponding path in the attribute tree to generate a rewritten query statement; for example, if the original query is "I want to buy the shoes of the brand I bought last time", and the attribute tree contains the path "shopping preferences.recently followed brands" with the value "Nike", then the rewritten query statement is "I want to buy Nike". The system then encodes the rewritten query into a vector and performs an approximate nearest neighbor (ANN) search in the historical dialogue vector database to recall the top K (K=3) original dialogue fragments with the cosine similarity to the vector. Finally, the system concatenates the extracted leaf node text set with the recalled original dialogue fragments according to preset weights into a unified context block, and uses it as the input context for the generative response model.

[0122] In other alternative implementations, the semantic rewriting process can use rule-based template matching instead of a lightweight model: the system pre-sets a set of regular expressions and mapping templates, such as "last time.?brand" → "{shopping_preference.brand}", and completes the rewriting at runtime through string matching and variable injection; or, the rewriting process can be implemented by a multi-hop inference module: first, locate the entity type to be completed in the query (such as brand, location, time), and then perform cross-path association retrieval based on the corresponding classification level in the attribute tree (such as "2_interaction behavior pattern.decision preference" or "1_basic attribute.residence"), thereby supporting more complex contextual dependencies; in addition, the recalled original dialogue fragments can be further filtered for noise reduction, retaining only sentences containing user-initiated statements, confirmatory statements, or action instructions, and removing system replies, duplicate confirmations, and irrelevant small talk.

[0123] Through the above scheme, this embodiment can dynamically align structured memory and unstructured historical data at the semantic level, enabling referential queries that were originally unable to be effectively captured by vector retrieval due to ambiguity to obtain accurate responses. At the same time, through attribute tree-driven query rewriting, the retrieval noise of the original dialogue database is significantly reduced, and the relevance of the recalled fragments to the user's true intent is improved. Compared with the prior art, this embodiment maintains the lightweight advantage of attribute trees while making up for the deficiency of pure structured memory in covering detailed context, and realizes the dual capability of "macro-features manageable and micro-facts traceable" in long-term interaction.

[0124] In one specific implementation, the generative processing model is trained through a supervised fine-tuning step. This step first acquires a long dialogue sample set formed by interactions between real users and the agent. The sample set covers a continuous interaction period of no less than six months and includes dialogue sequences from different domains, with different topic densities and different information update frequencies. Then, according to the preset segmentation rules defined in the above embodiments, each long dialogue sample is segmented using a sliding window to obtain multiple consecutive training dialogue blocks. Each training dialogue block satisfies at least one of the following triggering conditions: round threshold, character threshold, or semantic drift threshold. Next, for each training dialogue block, a corresponding truth-editing operation sequence is generated by a human annotator or a calibrated teacher model. The operation sequence is a function call sequence conforming to the JSON syntax specification, and its atomic operation types, target path structure, and text content are all validated for consistency. Subsequently, the serialized text representation of the training dialog block and the serialized text representation of the attribute tree instance corresponding to the previous time step are jointly constructed as the model input. The truth value editing operation sequence is used as the supervision label. The autoregressive language modeling objective is adopted, and the parameters of the initial large language model are updated by minimizing the cross-entropy loss function. During training, the model output is constrained to generate only legal function call formats with words such as ADD, UPDATE, DELETE, and NO_OP, and all path expressions strictly follow the first and second layer fixed branch structure defined by the hierarchical attribute pattern.

[0125] In other alternative implementations, the teacher model can be a large language model with different parameter scales, including but not limited to open-source base models of 7B, 13B, or 70B scale; the generation method of the truth editing operation sequence can be replaced by the consistency fusion result after multi-person collaborative annotation, or confidence-weighted annotation based on multiple rounds of iterative verification; the loss function used in supervised fine-tuning can be replaced by a hierarchical loss function with path weights, in which higher gradient weights are given to the path matching term to enhance the model's ability to perceive structured patterns.

[0126] Through the above scheme, this embodiment enables the generative processing model to stably learn the ability to identify information increments, locate target nodes, and generate grammatically compliant and semantically coherent editing instructions under a given structured memory framework, thereby ensuring the accuracy and interpretability of the attribute tree's continuous evolution in long-term interactions. Compared with existing methods that directly generate responses end-to-end or use implicit memory encoding, the supervision signal constructed in this embodiment has clear operational granularity and structural boundaries, significantly reducing the illusion rate and path misalignment rate of the model in memory update tasks.

[0127] In one specific implementation, the generative processing model is configured as a policy network and integrated with a reinforcement learning framework during the training phase. This framework first feeds the input training dialogue blocks into the policy network, which then outputs a sequence of predicted edit operations. Subsequently, a process reward model independent of the policy network receives the predicted edit operation sequence and the corresponding manually labeled ground truth edit operation sequence. It evaluates each atomic operation in the predicted sequence according to a pre-defined multi-dimensional matching logic, generating a scalar reward value. This reward value is fed back to the policy network to calculate the policy gradient and update its parameters. The multi-dimensional matching logic covers three levels: operation type consistency, target path structure consistency, and text content semantic consistency, and applies differentiated weight adjustments to inconsistencies. In other optional implementations, the process reward model is implemented using a neural network-based regressor, with input being a joint embedding representation of predicted and ground truth operations and outputting a continuous reward score; or it is implemented using a rule-driven deterministic scorer, which integrates segmented scoring functions for different types of inconsistencies.

[0128] Through the above scheme, this embodiment enables the generative processing model to not only focus on whether the final output conforms to the grammatical and structural constraints during the training process, but also to continuously optimize its joint decision-making ability in operation intent recognition, path localization accuracy and semantic expression fidelity, thereby improving the stability and robustness of attribute tree updates in long-term interaction scenarios.

[0129] In one specific implementation, the process reward mechanism performs a step-by-step comparison between each atomic operation instruction in the predicted edit operation sequence and the corresponding instruction in the true edit operation sequence, and calculates a weighted sum of individual scores according to the following rules:

[0130] First, regarding the first One prediction instruction The instruction to determine its corresponding position in the truth sequence. If the length of the truth sequence is less than If the predicted sequence length is less than 1, it is considered a missed operation; And the truth sequence exists in the first... If an item is omitted, it is considered a missed operation; if the predicted sequence contains the first item... If a term does not have a corresponding term in the truth sequence, it is considered an erroneous operation.

[0131] Specifically, for each pair of alignable instructions, the following determination is performed sequentially:

[0132] like Operation types (ADD / UPDATE / DELETE / NO_OP) and They are completely identical, with identical target path strings, and their text values ​​have the same F1 score calculated by BERTScore. If the score is positive, then a first positive score of 1.0 is assigned.

[0133] If the operation type and target path both match, but the BERTScore F1 score of the text value is between If so, a positive second score is assigned, which is 0.7.

[0134] If either the operation type or the target path does not match, or the semantic similarity of the text value is less than 0.8, then the score for this item is 0;

[0135] For each missed or incorrect operation, an additional 1.0 point will be deducted. This penalty is independent of the above item-by-item scoring and is not included in normalization.

[0136] Then, all of them The final reward value is obtained by summing the individual scores for each alignment position and then subtracting the total penalty points for missed and incorrect operations. The reward value was normalized to an interval. The input strategy gradient update module is then used to adjust the parameters of the generative processing model.

[0137] Next, during training, the process reward model uses a sliding window to jointly verify three consecutive groups of adjacent operation instructions: when an UPDATE instruction appears in a group and its path is consistent with the path of the preceding ADD instruction, the timestamp order is reasonable, and the text content shows a logical evolution relationship, an additional 0.1 points of structural consistency reward is added. This reward does not change the main score weight allocation and is only used as an auxiliary guiding signal.

[0138] In some other alternative implementations, semantic similarity can be achieved by using the cosine similarity of the Sentence-BERT embedding vectors instead of BERT Score F1; the logic for determining operation type and path matching can be extended to support fuzzy path matching, such as allowing regular expression wildcards or hierarchical wildcards (e.g., "basic attribute."); the penalty strength for missed operations and erroneous operations can be dynamically adjusted according to the training phase, initially set to 0.5, and increased to 1.0 in the later convergence phase.

[0139] Through the above scheme, this embodiment can achieve fine-grained behavioral modeling of generative processing models in the editing operation generation process, so that the model not only focuses on whether the final output is "usable", but also on whether its reasoning chain conforms to the inherent logical constraints of structured memory evolution, thereby significantly reducing the occurrence rate of hallucination operations and improving the stability and interpretability of cross-round information inheritance.

[0140] In one specific implementation, when the information increment output by the generative processing model after parsing the target dialogue data block cannot match the semantic category of any existing leaf node in the hierarchical attribute pattern, the system first inputs the information increment text into a pre-trained sentence embedding model to generate its corresponding high-dimensional semantic vector. Then, the semantic vector is normalized, and its centroid distance as a single sample point in a preset extended category cluster space is calculated. The extended category cluster space is defined by an offline-constructed K-means clustering model, which performs unsupervised clustering based on frequently occurring new attribute description texts (such as "prefers to order at night", "prefers voice interaction", "frequently uses dialect expressions") in millions of user interaction logs. A total of 12 initial clusters are formed, and the cluster center vector and corresponding cluster radius δexpand of each cluster are persistently stored in the local configuration database. Then, the system traverses all cluster centers and calculates the Euclidean distance between the semantic vector of the information increment and each cluster center. If there is a cluster whose distance is less than the corresponding cluster radius δexpand, the information increment is determined to belong to the extended category cluster. Finally, in the attribute tree instance of the previous time step, the system dynamically generates a new key name under the parent node with the closest semantics. The naming rule is to add the prefix "X_" plus the semantic label of the cluster (for example, if the cluster label is "interaction time period preference", then the new key name is "X_interaction time period preference"), and writes the information increment text into the leaf node path corresponding to the new key.

[0141] Specifically, semantic tags are extracted by TF-IDF weighted sum of high-frequency words within the cluster and then solidified after manual verification; the cluster radius δexpand is set to 0.45 during deployment (measured by L2 distance in unit spherical space), and the clustering model is updated monthly during runtime to adapt to language evolution. In some other optional implementations, the clustering algorithm is replaced with DBSCAN to support the identification of non-spherical cluster structures; the semantic vector generation model is replaced with a domain-adapted, finely tuned version of Sentence-BERT; and the new key name generation method is replaced with template-based controllable generation, with the template format being "X_{cluster ID}_{last four digits of timestamp}" to ensure cross-instance uniqueness and traceability.

[0142] Through the above scheme, this embodiment can achieve autonomous, controllable and interpretable topological growth of the attribute tree structure, avoid information loss due to pattern rigidity, and ensure that newly added nodes have clear contextual belonging in the semantic space, so that subsequent retrieval and reasoning operations can still use the unified path addressing mechanism without modifying the underlying logic of the dual-path routing or editing operation parsing module.

[0143] In one specific implementation, attribute tree instances are serialized and stored in standard JSON format. Their keys strictly adhere to the naming conventions for predefined Chinese category labels and dynamically generated paths in the hierarchical attribute schema. Values ​​are limited to UTF-8 encoded strings, and all nested levels satisfy the JSON syntax constraints defined in RFC 8259. The generative processing model is configured to output only a structured sequence of edit operations conforming to a specific function call syntax. This sequence consists of several independent statements, each strictly matching one of the following four formats: ADD("path.to.leaf", "value_text"), UPDATE("path.to.leaf", "value_text"), DELETE("path.to.leaf"), or NO_OP(), where the path string uses dot separators. The notation indicates a JSON hierarchical path. Double quotes are used, the string content is JSON escaped, and the entire instruction does not contain any extra spaces, comments, control characters, or non-ASCII delimiters. The model output layer uses a two-level filtering process: a regular expression validator and a syntax parser. First, it matches the pattern ^(ADD|UPDATE|DELETE|NO_OP)\s\([^)]\)\s$. Then, it recursively verifies the number of parameters within the parentheses, the matching of quotes, and the validity of the path. Only when all verifications pass is the instruction included in the final operation sequence.

[0144] Specifically, the `value_text` field in the `ADD` and `UPDATE` instructions has had sensitive entities replaced by the desensitization module before being input into the model, and its content does not contain identifiable information such as the original name, address, or ID number. When the `DELETE` instruction is executed, it only sets the value of the corresponding path to an empty string "" and appends the metadata flag "status": "invalid", rather than physically deleting the node, in order to maintain the stability of the tree structure. The `NO_OP()` instruction is on a separate line in the sequence and is not merged with other instructions. The model is trained to prioritize outputting this instruction rather than an empty response or an invalid placeholder when there is no information increment. In some other optional implementations, the path representation can be replaced with JSON Pointer format (e.g., / 1_basic attributes / demographic characteristics / age stage), or a URI-style path with a namespace prefix (e.g., schema: / / user / attribute / age_stage). Instruction words can also be mapped to lowercase form (e.g., add, update) or ISO standardized verbs (e.g., INSERT, MODIFY), as long as their semantics correspond one-to-one with the aforementioned four atomic operations and there are deterministic parsing rules in the execution module.

[0145] Through the above solution, this embodiment can ensure that the structured editing operation sequence has strong syntactic consistency and machine parsability, avoiding the risks of JSON parsing failure, path ambiguity or illegal character injection caused by free text generation; at the same time, it makes the storage format of the attribute tree and the operation interface form a strict contract, supporting reliable deployment and long-term evolution compatibility in cross-platform and multi-language environments.

[0146] In one specific implementation, the privacy data desensitization step includes the following operations: First, the target dialogue data blocks generated by segmentation are input into a Named Entity Recognition (NER) model. This NER model is configured to recognize sensitive fields that identify individuals, including but not limited to: natural person names, ID card numbers, mobile phone numbers, email addresses, specific home addresses, dates of birth, biometric descriptions (including but not limited to terms such as "fingerprint," "iris," "voiceprint," and "facial features"), and medical and health information. Specifically, the NER model uses a fine-tuned model based on the BERT-BiLSTM-CRF architecture. Its training corpus includes a desensitized and annotated Chinese dialogue dataset, with a labeling system covering categories such as PER (person), LOC (location), ORG (organization), IDCARD (identification number), PHONE (telephone), and HEALTH_CONDITION (health status). Then, for each identified sensitive entity, a replacement is performed according to a preset mapping table: natural person names are uniformly replaced with the general label "...".<USER_NAME> Replace the ID number with "<ID_NUMBER> The biometric feature description is replaced with the corresponding generalized label.<BIOMETRIC_TYPE_A> "to"<BIOMETRIC_TYPE_Z> The subscript letters are ordered sequentially according to the recognition order; for medical and health information, a hierarchical generalization strategy is adopted—symptom-level descriptions (such as "gastric ulcer") are replaced with "".<HEALTH_CONDITION_B> Replace disease categories (such as "digestive system diseases") with "<HEALTH_CATEGORY_1> Next, all replacement operations preserve the syntactic structure and punctuation of the original text, ensuring that the anonymized text still meets the LLM input format requirements and does not introduce syntactic errors or semantic breaks. In some other optional implementations, the NER model can be replaced with a lightweight rule engine (such as a combination system based on regular expressions and dictionary matching) for deployment on resource-constrained terminals; the generalized tags of sensitive entities can also be generated as fixed-length strings using hash anonymization (such as truncating the first 8 bits of the SHA-256 hash value) to support cross-session consistent tracking without exposing the original identity.

[0147] Through the above solution, this embodiment can ensure that the generative processing model only comes into contact with dialogue content that has undergone semantic generalization and identity stripping, blocking the entry of original sensitive information into the memory modeling process from the source of input. Thus, without impairing the attribute tree structured reasoning ability, it meets the requirements of Article 17 of the Personal Information Protection Law regarding de-identification processing and avoids compliance risks caused by the storage of original data.

[0148] This invention provides a structured memory data processing system for long-term temporal interactions, such as... Figure 3 As shown, the system includes:

[0149] The segmentation module M100 is used to acquire real-time interactive data streams and convert them into discrete target dialogue data blocks according to preset segmentation rules. In one embodiment, the segmentation module M100 maintains a sliding buffer to continuously receive multi-turn dialogue text between the user and the large language model. When the cumulative dialogue turns in the buffer reach 10 turns, or the cumulative number of characters reaches 2000 tokens, or the cosine similarity between the current sentence vector and the average vector of the previous block is less than 0.6, a truncation operation is triggered to generate target dialogue data blocks. In some other optional embodiments, the cumulative turn threshold is set to 5–20 turns, the character count threshold is set to 1000–5000 tokens, the semantic drift threshold is set to 0.4–0.7, and the semantic vectors are generated using Sentence-BERT or E5-Mistral embedding models.

[0150] The state loading module M200 is used to load a predefined hierarchical attribute pattern and the attribute tree instance from the previous time step. The hierarchical attribute pattern defines fixed data structure branches, and the attribute tree instance from the previous time step is a structured compressed representation of historical interaction data, storing descriptive text data only in its leaf nodes. In one embodiment, the hierarchical attribute pattern is defined in JSON Schema format, containing two fixed main branches: "1_Basic Attributes" and "2_Interaction Behavior Patterns," each with immutable second-level key names such as "Demographic Characteristics," "Physiological State Parameters," "Communication Style," and "Decision Preferences." All leaf nodes are string type fields, without nested sub-objects or arrays. In other optional implementations, the first-level classification of the hierarchical attribute pattern can be expanded to 3–5 preset categories, and the second-level key names can be dynamically registered via configuration files, but their namespace and path hierarchy remain static.

[0151] The inference module M300 is used to input the target dialogue data block and the serialized text representation of the attribute tree instance from the previous time step into a pre-configured generative processing model. Using the generative processing model, based on the information increment of the attribute tree instance relative to the previous time step contained in the target dialogue data block, a structured editing operation sequence is generated. The structured editing operation sequence contains at least one instruction targeting the target leaf node path in the attribute tree instance from the previous time step. The instruction is selected from: write instruction, rewrite instruction, delete instruction, and no-operation instruction. In one embodiment, the generative processing model is a Llama-3-8B model jointly optimized by supervised fine-tuning and reinforcement learning. Its output is constrained to a function call format containing only four words: ADD, UPDATE, DELETE, and NO_OP, for example, "UPDATE("basic attributes.demographic characteristics.language ability", "Proficient in Cantonese and English"; the serialized text representation uses a compact JSON string format, omitting null values ​​and empty objects, and uniformly uses the English period "." as the path separator; in some other optional implementations, the generative processing model can be replaced with Qwen2-7B, Phi-3-mini, or DeepSeek-V2-7B, and its output format can also be adapted to the JSON Patch document format defined by the RFC6902 standard, or mapped to SQL UPDATE / INSERT statements.

[0152] The execution module M400 is used to parse the structured editing operation sequence and perform text data update operations on the target leaf node path of the attribute tree instance of the previous time step to generate the attribute tree instance of the current time step. In one embodiment, the execution module M400 has a built-in deterministic conflict resolution engine: when an UPDATE instruction is received and the target path already has a non-empty value, it first checks whether the timestamp attached to the instruction is later than the writing timestamp of the existing value of the path; if so, it further calculates the BERTScore F1 value of the old and new text; when F1 < 0.8, it calls a lightweight summarization model (such as TinyLlama-Summary) to perform fusion summarization, with the upper limit of the summarization length set to 50 Chinese characters, and forcibly retains all explicit time expressions (such as "last week", "just diagnosed", "from 2024 onwards") and logical transition words (such as "but", "however", "changed to"). In some other optional implementations, the summarization model can be replaced with an extractive summarizer based on T5-small fine-tuning, or a rule template filling method can be used, such as "[old value]; but [BUTRECENTLYCHANGEDTO] [new value]".

[0153] The storage module M500 is used to store the attribute tree instance of the current time step in a non-volatile storage medium and use the attribute tree instance of the current time step as the attribute tree instance of the previous time step in the interaction processing of the next time step. In one embodiment, the storage module M500 adopts a dual-modal persistence strategy: after each update, only the changed leaf node paths, the changed text values, and the current logical version number are written to the incremental log table of the SQLite database; at the same time, a full snapshot is triggered every 24 hours or every 100 updates, serializing the current attribute tree into a GZIP compressed JSON file and storing it in the object storage service. In some other optional implementations, the incremental log can be built into a streaming change log based on Apache Kafka, and the full snapshot can be stored in a distributed file system in Parquet columnar format and partitioned by time.

[0154] The modules described above work together in a coordinated manner: the chunking module M100 uses a multi-dimensional triggering mechanism to segment the infinitely flowing dialogue into semantically coherent and size-controllable data units, providing a stable input granularity for subsequent structured processing; the state loading module M200 ensures that each inference is based on the latest and consistent structured memory state, avoiding path misalignment caused by state drift; the inference module M300 relies on a generative processing model to accurately identify information increments and generate verifiable atomic operations under fixed schema constraints, transforming unstructured language understanding into deterministic data operations; the execution module M400 performs conflict resolution and summary compression based on a dual criterion of timestamp and semantic similarity, ensuring the temporal consistency and content fidelity of memory evolution; and the storage module M500 uses an incremental + snapshot hybrid strategy to suppress storage expansion while ensuring historical traceability. This closed-loop feedback chain, strictly following "input → state → reasoning → execution → storage → re-input" between modules, enables the system to perform lossy but high-fidelity structured compression on dialogue streams that last for months or even years without relying on an infinite context window. It continuously maps unstructured natural language into a readable, editable, and interpretable hierarchical attribute tree, and solves the problems of conflict between old and new information and catastrophic forgetting through a time-sensitive update mechanism and a bimodal storage strategy. Thus, it systematically addresses multiple technical challenges in long-term interaction scenarios, such as context window limitations, semantic fragmentation, static memory, and privacy compliance.

[0155] Through the above scheme, this embodiment can achieve efficient structured modeling and dynamic evolution of long-term dialogue data, keeping the attribute tree size stable at the level of 500-800 tokens, reducing storage overhead by about 96% compared to full storage; achieving a Recall@5 accuracy rate of 89% in long-range memory retrieval tasks spanning more than 50 rounds; and controlling the first character generation delay to within 0.3 seconds; in addition, all original sensitive entities undergo generalized label replacement before entering the inference module M300, meeting the requirements of GDPR, Personal Information Protection Law and other regulations for fine-grained desensitization.

Claims

1. A method for processing structured memory data oriented towards long-term temporal interaction, characterized in that, The method includes: Acquire real-time interactive data streams and convert them into discrete target dialogue data blocks according to preset segmentation rules; Load a predefined hierarchical attribute pattern and the attribute tree instance from the previous time step; wherein the hierarchical attribute pattern defines a fixed data structure branch, the attribute tree instance from the previous time step is a structured compressed representation of historical interaction data, and the attribute tree instance from the previous time step stores descriptive text data only in the leaf nodes. The target dialogue data block and the serialized text representation of the attribute tree instance from the previous time step are input together into a pre-configured generative processing model. Using the generative processing model, a structured editing operation sequence is generated based on the information increment of the attribute tree instance relative to the previous time step contained in the target dialogue data block; the structured editing operation sequence contains at least one instruction for the target leaf node path in the attribute tree instance of the previous time step, the instruction being selected from: write instruction, rewrite instruction, delete instruction, and no-operation instruction. The structured editing operation sequence is parsed, and a text data update operation is performed on the target leaf node path of the attribute tree instance in the previous time step to generate the attribute tree instance in the current time step; and The attribute tree instance of the current time step is stored in a computer-readable storage medium, and the attribute tree instance of the current time step is used as the attribute tree instance of the previous time step in the interaction processing of the next time step.

2. The method according to claim 1, characterized in that, The step of converting the real-time interactive data stream into discrete target dialogue data blocks according to a preset segmentation rule includes: The real-time interactive data stream is stored in a data cache area; Real-time monitoring of the cumulative data volume index in the data cache area, the cumulative data volume index including the cumulative number of rounds or the cumulative number of characters; The semantic vectors of the data in the data buffer are computed in parallel, and the drift of the semantic vectors relative to the semantic vectors of the previous block window is monitored. When the cumulative data volume reaches a preset cache threshold, or the drift exceeds a preset topic switching threshold, the data in the data cache is truncated to generate the target dialogue data block.

3. The method according to claim 1, characterized in that, The instructions in the structured editing operation sequence are constrained to key-value pair operations conforming to JSON syntax, and the specific definitions of the instructions are as follows: The write instruction is used to create the target leaf node path and write the text value when the target leaf node path is detected to not exist. The rewrite instruction is used to overwrite the original text value with a text value containing new information when it is detected that the target leaf node path already exists. The deletion instruction is used to set the original text value under the target leaf node path to empty or mark it as invalid; The no-operation instruction is used to indicate that the generative processing model determines that the target dialogue data block does not contain the valid information increment.

4. The method according to claim 1, characterized in that, The process of parsing the structured editing operation sequence and performing a text data update operation on the target leaf node path of the attribute tree instance in the previous time step also includes a conflict resolution step: When the target leaf node path that the structured editing operation sequence attempts to update already has a non-null value in the attribute tree instance of the previous time step, obtain the generation timestamp of the structured editing operation sequence. If the generated timestamp is later than the write time of the corresponding non-empty value in the attribute tree instance of the previous time step, then the text data update operation is performed. If the length of the text data after the text data update operation exceeds a preset length threshold, then the summarization algorithm is invoked to perform semantic compression on the text data, and the semantic compression preserves time entities and key event elements.

5. The method according to claim 1, characterized in that, The method also includes a data storage optimization step: After generating the attribute tree instance of the current time step, the attribute tree instance of the current time step is compared with the attribute tree instance of the previous time step. Only the path of the target leaf node where the data has changed, the changed text value, and the current version number are written to the incremental log of the non-volatile database; In addition, the attribute tree instance at the current time step is fully snapshotted and serialized according to a preset time period.

6. The method according to claim 1, characterized in that, The method also includes a dual-path retrieval enhancement step: In response to a received final task query request, calculate a correlation metric between the final task query request and the attribute tree instance of the current time step; The correlation metric is compared with a preset routing threshold. If the relevance metric is higher than or equal to the routing threshold, then a direct enhanced path is executed; If the relevance metric is lower than the routing threshold, then a joint enhanced path is executed.

7. The method according to claim 1, characterized in that, The pre-configured generative processing model is pre-trained through the following supervised fine-tuning steps: Obtain a historical long dialogue sample set, and divide the historical long dialogue sample set into multiple continuous training dialogue blocks according to the preset block division rules; Obtain the sequence of truth-editing operations for each of the training dialogue blocks, either manually annotated or generated by the teacher model; Using the training dialogue block as input and the truth edit operation sequence as supervision label, the parameters of the initial model are adjusted by minimizing the loss function, so that the initial model has the ability to generate the grammatically correct structured edit operation sequence, thereby obtaining the generative processing model.

8. The method according to claim 1, characterized in that, The method also includes a dynamic graph expansion step: When the information increment identified by the generative processing model cannot be mapped to the existing leaf node of the hierarchical attribute pattern, the semantic vector centroid of the information increment is calculated. The semantic vector centroid is determined based on a clustering algorithm to determine whether it belongs to a preset extended category cluster; If so, a new leaf node path is dynamically created in the attribute tree instance of the previous time step, and the information increment is written into the new leaf node path.

9. The method according to claim 1, characterized in that, The method also includes a privacy data desensitization step: Before inputting the target dialogue data block into the generative processing model, the target dialogue data block is scanned using a named entity recognition model; Identify sensitive entities in the target dialogue data block that involve natural person biometric features or specific identity identifiers; The sensitive entities are replaced with preset mask symbols or generalized labels to generate desensitized target dialogue data blocks as input to the generative processing model.

10. A structured memory data processing system for long-term temporal interaction, characterized in that, include: The segmentation module is used to acquire real-time interactive data streams and convert the real-time interactive data streams into discrete target dialogue data blocks according to preset segmentation rules. The state loading module is used to load a predefined hierarchical attribute pattern and the attribute tree instance of the previous time step; wherein, the hierarchical attribute pattern defines a fixed data structure branch, the attribute tree instance of the previous time step is a structured compressed representation of historical interaction data, and the attribute tree instance of the previous time step stores descriptive text data only in the leaf nodes. The inference module is used to input the target dialogue data block and the serialized text representation of the attribute tree instance of the previous time step into a pre-configured generative processing model. Using the generative processing model, based on the information increment of the attribute tree instance relative to the previous time step contained in the target dialogue data block, a structured editing operation sequence is generated. The structured editing operation sequence includes at least one instruction for the target leaf node path in the attribute tree instance of the previous time step, and the instruction is selected from: write instruction, rewrite instruction, delete instruction, and no-operation instruction. The execution module is used to parse the structured editing operation sequence and perform a text data update operation on the target leaf node path of the attribute tree instance of the previous time step to generate the attribute tree instance of the current time step. The storage module is used to store the attribute tree instance of the current time step into a non-volatile storage medium, and to use the attribute tree instance of the current time step as the attribute tree instance of the previous time step in the interaction processing of the next time step.

Citation Information

Patent Citations

  • Multi-level modular personal memory large model and construction method thereof

    CN121031669A

  • Method and system for analyzing and editing view in real time based on streaming data

    CN121233121A

  • Search indexing using discourse trees

    US20190095522A1

  • Supporting Combinations of Intents in a Conversation

    US20190377790A1

  • Hybrid dialog tree generation and access

    US20250269284A1

Cited By

  • Agent long-term task consistency maintenance method based on long-term memory

    CN122174867A

  • A Consistency Maintenance Method for Long-Term Tasks by Intelligent Agents Based on Long-Term Memory

    CN122174867B