State tracking and context management method for high-concurrency real-time dialog

By combining unified semantic representation and event-driven state management with long context modeling and optimistic concurrency control, the problems of response latency, context breakage and state conflict in high-concurrency real-time dialogue systems are solved, improving the system's concurrent processing capability and context coherence, and achieving efficient state management and consistency.

CN121614646BActive Publication Date: 2026-05-05GUANGDONG CHAOTENG INFORMATION TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
GUANGDONG CHAOTENG INFORMATION TECHNOLOGY CO LTD
Filing Date
2026-02-02
Publication Date
2026-05-05

AI Technical Summary

Technical Problem

Existing dialogue state tracking and context management methods suffer from problems such as response latency, synchronization difficulties, context breaks, lack of unified semantic representation of multimodal inputs, and state conflicts in high-concurrency, real-time interaction, and multi-turn complex dialogue scenarios, making it difficult to meet the performance and user experience requirements of intelligent dialogue systems.

Method used

By employing unified semantic representation, event-driven state management, long context modeling, and optimistic concurrency control, a closed-loop collaborative system is constructed, including multimodal user input preprocessing, semantic parsing and slot filling, state change event generation and publication, global session state update, multi-level caching and efficient state access, streaming modeling and maintenance of long contexts, and lifecycle management of state objects.

Benefits of technology

It significantly improves the concurrent processing capability, contextual coherence, and response robustness of the dialogue system, realizes the standardization and decoupling fusion of multimodal input, enhances state read/write performance and system scalability, and ensures state update consistency in a distributed environment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121614646B_ABST
    Figure CN121614646B_ABST
Patent Text Reader

Abstract

This invention relates to a method for state tracking and context management in high-concurrency real-time dialogue, belonging to the fields of natural language processing and human-computer interaction. The method includes: firstly, unifying multimodal input into a standardized semantic representation; then, performing semantic parsing by fusing historical context and external knowledge; encapsulating the parsed state changes as events and publishing them to a distributed log; independently consuming events asynchronously, and atomically updating the global state through version control and optimistic locking mechanisms; improving read / write performance using multi-level caching and incremental compression; and simultaneously, maintaining a graph-based long context in a streaming manner and optimizing resources through lifecycle management. This invention, through unified semantic representation, event-driven state management, long context modeling, and optimistic concurrency control, constructs a closed-loop collaborative system, significantly improving the concurrency processing capability, contextual coherence, and response robustness of dialogue systems.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of natural language processing and human-computer interaction technology, specifically relating to a method for state tracking and context management in high-concurrency real-time dialogue. Background Technology

[0002] With the widespread application of intelligent dialogue systems, existing dialogue state tracking and context management methods face significant bottlenecks in high-concurrency, real-time interaction, multi-turn complex dialogues, and cross-modal scenarios. In high-concurrency scenarios, traditional centralized state management suffers from response latency and synchronization difficulties; in long, multi-turn dialogues, key historical information is easily lost due to window truncation, leading to context fragmentation; to meet real-time requirements, systems often face a difficult trade-off between context integrity and resource efficiency; multimodal inputs such as voice and gestures lack unified semantic representation, causing context fragmentation; and the parallel processing of the same conversation across multiple nodes easily leads to state conflicts and inconsistencies. Existing solutions struggle to systematically address these challenges, hindering the performance and user experience of intelligent dialogue systems. Summary of the Invention

[0003] To address the aforementioned problems in existing technologies, this invention provides a method for state tracking and context management in high-concurrency real-time dialogue. By employing unified semantic representation, event-driven state management, long context modeling, and optimistic concurrency control, a closed-loop collaborative system is constructed, significantly improving the concurrent processing capability, context coherence, and response robustness of the dialogue system.

[0004] The objective of this invention can be achieved through the following technical solutions:

[0005] This disclosure provides a method for state tracking and context management in high-concurrency real-time dialogue, including the following steps:

[0006] S1. Multimodal user input preprocessing: Receive raw user input from different interaction channels, perform preliminary identification of the raw input through the corresponding modality perception module, and convert the identification results of all modalities into intermediate semantic representation objects;

[0007] S2. Semantic parsing and slot filling: Dynamically fuse intermediate semantic representation objects, active context packages extracted and maintained from historical dialogues, and external knowledge graphs, and output an enhanced dialogue state update fragment through a context-aware slot filling algorithm; wherein, the active context package is generated and maintained in the previous round or multiple rounds of dialogue in step S6.

[0008] S3. Generation and Publication of State Change Events: Determine the state change of the session based on the enhanced dialogue state update fragment, generate a state change event object based on the change encapsulation, and publish it to the specified partition of the distributed event log system for persistence.

[0009] S4. Global Session State Update: Read events sequentially from the distributed event log system and update the session state in the global state store based on an optimistic concurrency control strategy.

[0010] S5, Multi-level caching and efficient state access: Build and manage a collaborative multi-level storage system, respond to state queries and synchronization requests, and execute state access services;

[0011] S6. Streaming Modeling and Maintenance of Long Contexts: Extract key information through long sequence encoding, dynamically update the session graph and intent chain, and perform hierarchical management and refinement of context based on importance weights and sliding windows to output active context packets.

[0012] S7. Lifecycle Management of State Objects: By collecting and maintaining session state lifecycle metadata in real time, periodically scanning and generating resource scheduling instructions based on policies, driving the execution of cache cleanup, data archiving and priority adjustment, the system resources achieve automated lifecycle management.

[0013] Furthermore, the intermediate semantic representation object adopts the JSON-based Intent Object format, including the original recognition result, intent classification result, slot field, and metadata; the modality perception module includes an automatic speech recognition module, a computer vision module, and a gesture recognition module.

[0014] Furthermore, the output of the enhanced dialogue state update fragment includes the following steps:

[0015] S21. Multi-source information input and feature extraction: Feature representation of three types of data, including current input features, historical context features, and external knowledge features;

[0016] S22. Attention-based multi-source information fusion: Dynamically fuse current input features, historical context features, and external knowledge features through a multi-source information fusion network, calculate the correlation weights between current input features, historical context features, and external knowledge features, and generate context-enhanced joint features.

[0017] S23, Intent Classification and Slot Filling: Input the joint features into the classifier, output the intent category and confidence level of the current user input, and use a sequence labeling model to label the current input sequence with the joint features as context conditions to extract the slot type and value;

[0018] S24. Output Generation: Output a structured data object to build an enhanced dialogue state update fragment, including the confirmed intent, the set of slots to be filled, and the updated context pointer.

[0019] Furthermore, the generation and publication of the state change event includes the following steps:

[0020] S31. Change Detection and Event Encapsulation: Based on the enhanced dialogue state update fragment, a change is determined through an event generator. If the session state is determined to have changed, an event is generated.

[0021] The event generation includes: creating a state change event object for each independent changed field. The state change event object follows a predefined pattern and includes fields such as: event identifier, session identifier, operation type, changed field path, old value snapshot, new value snapshot, timestamp, version stamp, and source service identifier.

[0022] S32. Event Persistence and Publication: Persist the encapsulated event objects to a distributed event log system, including partitioned routing, reliable delivery, and local cache updates after publication.

[0023] Furthermore, the optimistic concurrency control strategy includes the following steps:

[0024] S41. Event Acquisition and Parsing: Acquire the state change event object and parse it to extract key fields, including event identifier, session identifier, operation type, changed field path, new value snapshot, current version stamp, and expected version stamp;

[0025] S42. State reading and version comparison: Based on the extracted session identifier, query the current complete state object and metadata of the session from the second-level cache, obtain the current global version stamp of the session state, and compare whether the current version stamp extracted from the state change event object is equal to the global version stamp.

[0026] S43. Conflict Resolution and Path Selection: Based on the version stamp comparison results, different processing paths are selected. When the comparison results are equal, there is no conflict and the process proceeds to the conflict-free state update. When the comparison results are different, a conflict occurs and the process proceeds to conflict resolution and state merging.

[0027] S44, Conflict-free state update: Based on the operation type of the event and the path of the changed field, apply the new value snapshot to the corresponding field of the state object read from the global storage; write the updated complete state object along with the new version number as an atomic operation back to the global state storage;

[0028] S45. Conflict Resolution and State Merging: Based on preset business rules, determine whether the current conflict can be automatically merged. If it can be merged, logically merge the change of the current event with the latest state corresponding to the global version stamp to generate a new merged state. Then, generate a new merged event based on the global version stamp, and jump to state reading and version comparison to apply the new merged event. If it cannot be merged, abandon the application of the current event and mark it as a conflict event.

[0029] Furthermore, the multi-level caching and efficient state access include the following steps:

[0030] S51, Collaborative Query of Response Status Read Request: Initiate a session status query based on the response status read request, and execute it in sequence:

[0031] Query the first-level cache: Search in the thread-local cache of the local service instance that handled the request. If a match is found, the status is returned directly to the requester.

[0032] Query the second-level cache: If the first-level cache is not hit, a query is sent to the second-level cache cluster; if it is hit, the returned status data is provided to the requester and asynchronously copied to the first-level cache of the local service instance.

[0033] Load persistent storage: If the second-level cache is not hit, the complete state is asynchronously loaded from the third-level persistent storage, backfilled by the second-level cache, and then provided to the requester.

[0034] S52. Cache synchronization after execution state update: Cache synchronization is triggered based on the updated session state, including:

[0035] Update the global authoritative copy: Atomically write the updated session state to the second-level cache, making it the new authoritative state copy;

[0036] Maintain cache consistency: Broadcast cache invalidation notifications to all service instances to invalidate the corresponding old state entries in the first-level cache of each instance;

[0037] Proactive preheating optimization: Based on a prediction strategy, the latest status of high-frequency sessions is proactively pushed to the first-level cache of the specified service instance;

[0038] S53, Incremental Compression and Lazy Loading Optimization: When writing state to the second-level cache or persistent storage, the session state is differentially compared with the previous version, and only incremental patches of changed fields and version identifiers are stored; when reading state, if incremental storage is hit, the complete state is reconstructed in real time by applying patches.

[0039] S54, Dynamic scheduling of cached resources: Dynamically optimizing resources based on access patterns.

[0040] Cold and hot data migration: Based on access frequency and last access time metrics, cold data in the second-level cache is asynchronously archived to persistent storage, and reactivated hot data is preloaded back into the second-level cache;

[0041] Local cache eviction: Each service instance actively evicts inactive entries from its local first-level cache based on capacity and LRU policy.

[0042] Furthermore, the streaming modeling and maintenance of the long context includes the following steps:

[0043] S61. Historical Dialogue Encoding and Key Information Extraction: Taking the enhanced dialogue state update fragment as input, perform long sequence encoding and information extraction, and output a set of structured information units.

[0044] S62. Construction and updating of session entity graph and intent chain: Receive a set of structured information units and update the context model accordingly, including operations on graph nodes and edges and operations on intent chains, and update the session entity graph and intent chain.

[0045] S63. Dynamic context management based on sliding window and importance weight: Dynamically calculate the importance weight for each entity node in the session entity graph and each node in the intent chain, set a sliding window based on the most recent round or duration, classify information inside and outside the window by setting a weight threshold, and trigger storage degradation and information removal operations when the weight is lower than the threshold.

[0046] Furthermore, the long sequence encoding includes: concatenating the newly added dialogue content of the current round with recent historical text and inputting it into the long sequence encoding model for processing;

[0047] The information extraction includes: using an information extraction unit integrated in the encoding model or as a post-processing module to identify and extract key entities, user intents, and slot relationships from the encoded representation;

[0048] The operations on the graph nodes and edges include: adding the extracted key entities as nodes to the session entity graph; if the entity already exists, updating its attributes or active timestamp; and establishing directed edges between entity nodes and between entities and intent nodes based on the extracted semantic relationships.

[0049] The operation of the intent chain includes: adding the identified current user intent as a node to the intent chain sequence, and establishing a logical relationship edge between the new intent node and the previous intent node according to the dialogue logic.

[0050] Furthermore, the lifecycle management of the state object includes the following steps:

[0051] S71. Lifecycle Metadata Collection and Maintenance: Attach and maintain a lifecycle metadata record for each session state object. The record update driver includes:

[0052] Creation time: Recorded during session initialization;

[0053] Last access time: Updated synchronously when reading or writing session state during semantic parsing or session state updates;

[0054] Activity weight: The weight is dynamically calculated based on access frequency, dialogue round depth and task criticality, and is recalculated after each access;

[0055] Session phase labels: Drive conversion through intent recognition results and business rules;

[0056] S72. Periodic scanning and scheduling decisions based on metadata: Periodically scan the metadata of all session state objects and make decisions based on preset strategies to trigger corresponding scheduling instructions;

[0057] S73. Execution of scheduling instructions and resource operations: Based on the generated scheduling instructions, return to the multi-level storage system for execution to complete resource scheduling.

[0058] Furthermore, the preset strategy includes:

[0059] Expiration determination and removal decision: Compare the last access time of the object with the preset lifespan threshold. If the object has expired, a removal instruction is generated.

[0060] Phase-driven archiving decisions: Check the session phase tag of the object. If the tag is completed or terminated, generate an archive migration instruction, targeting Tier 3 persistent storage.

[0061] Popularity-driven priority adjustment decision: Sort all objects according to activity weight, generate downgrade instructions for low-frequency objects with lower ranking, and generate upgrade / lock instructions for high-frequency objects with higher ranking;

[0062] The resource scheduling includes:

[0063] For the clear command, the corresponding state data is deleted from the first-level cache and the second-level cache, and selectively cleaned from persistent storage;

[0064] For archive commands, initiate an asynchronous migration task to write the state data completely from the second-level cache to the third-level persistent storage and remove it from the cache;

[0065] For downgrade / upgrade instructions, data objects are moved between different cache levels.

[0066] The beneficial effects of this invention are as follows:

[0067] This invention standardizes and decouples multimodal input by introducing a unified intermediate semantic representation object, providing a unified interface for context understanding. By employing event sourcing and distributed logging to asynchronously handle state changes, combined with multi-level caching and incremental compression mechanisms, it significantly improves state read / write performance and system scalability under high concurrency. Through long sequence encoding and conversation graph construction, it achieves accurate structured memorization of long dialogue histories and dynamically manages context based on streaming windows and importance weights, balancing resource consumption and information integrity. Utilizing version stamp comparison, optimistic locking, and idempotency design, it effectively detects and resolves concurrent conflicts, ensuring eventual consistency of state updates in a distributed environment. Overall, this invention forms a closed-loop collaborative system from input, understanding, state synchronization to resource management, significantly improving the concurrent processing capabilities, contextual coherence, real-time response speed, and overall robustness of dialogue systems in complex interaction scenarios. Attached Figure Description

[0068] To facilitate understanding by those skilled in the art, the present invention will be further described below with reference to the accompanying drawings.

[0069] Figure 1 A schematic diagram illustrating the steps of a high-concurrency real-time dialogue state tracking and context management method provided in an embodiment of the present invention;

[0070] Figure 2 This is a schematic diagram illustrating the steps of an enhanced dialogue state update segment provided in an embodiment of the present invention;

[0071] Figure 3 This is a schematic diagram illustrating the steps of generating and publishing state change events according to an embodiment of the present invention;

[0072] Figure 4 A schematic diagram illustrating the steps of streaming modeling and maintenance of long contexts provided in an embodiment of the present invention;

[0073] Figure 5 A schematic diagram illustrating the steps of lifecycle management for state objects provided in an embodiment of the present invention. Detailed Implementation

[0074] To further illustrate the technical means and effects of the present invention in achieving its intended purpose, the following detailed description of the specific implementation methods, structures, features, and effects of the present invention, in conjunction with the accompanying drawings and preferred embodiments, is provided.

[0075] This embodiment provides a method for state tracking and context management in high-concurrency real-time dialogue, such as... Figure 1 As shown, it includes the following steps:

[0076] S1. Multimodal User Input Preprocessing: The system receives raw user input from different interaction channels, including at least one of text, speech, gestures, and images. The raw input is initially identified using corresponding modality perception modules (such as ASR and CV models), and the recognition results of all modalities are converted into a unified, standardized intermediate semantic representation object. This intermediate semantic representation object is in JSON-based Intent Object format and includes the raw recognition results, intent classification results, slot fields, and metadata. The modality perception module includes an automatic speech recognition module, a computer vision module, and a gesture recognition module.

[0077] Understandably, the intermediate semantic representation object serves as a unified data interface for all subsequent processing steps, ensuring the operability of data from different sources at the semantic layer and laying the foundation for subsequent context fusion.

[0078] It should be noted that the JSON-based Intent Object structure has the ability to decompose semantic hierarchy and contains at least the following core fields: General metadata: timestamp (timestamp of input occurrence), source_modality (source modality type, such as "voice", "gesture", "text", "image"), confidence (confidence score of the recognition result of this modality), channel_id (interaction channel ID); Original recognition results: text_transcript (text transcription output by the ASR module), gesture_command (predefined action command output by the gesture recognition module), image_tags (list of image tags or recognized entity information output by the image recognition module); Semantic layer parsing fields: intent.name (user intent classification result), intent.confidence (intent recognition confidence), slots (key-value pair dictionary, containing extracted structured slot fields); Context association fields: reference_to_session_id (record its ID when this input refers to other sessions), reference_to_entity_id (record its ID when this input refers to an entity in the session graph). By using a unified input of intermediate semantic representation objects, heterogeneous modal data can be abstracted into a unified semantic representation, which greatly simplifies the complexity of downstream dialogue management modules and effectively overcomes the complexity and fragmentation of traditional systems when processing heterogeneous modal data, thus providing a foundation for achieving true multimodal fusion.

[0079] S2. Semantic Parsing and Slot Filling: Dynamically fuse the intermediate semantic representation object of the current input, the active context package extracted and maintained from historical dialogues (such as the conversation entity graph and intent chain), and the external knowledge graph (such as the business rule base), and output an enhanced dialogue state update fragment through a context-aware slot filling algorithm. The active context package is generated and maintained in the previous round or multiple rounds of dialogue in step S6.

[0080] Understandably, semantic parsing and slot filling rely on the standardized input provided in step S1, closely call the conversation entity graph and intent chain maintained in step S6 as the core context source, actively query external knowledge graphs for constraints and verification, and its output enhanced dialogue state update fragments accurately depict the latest progress of the dialogue, directly triggering the generation of state change events in the subsequent step S3.

[0081] The output enhanced dialogue state update fragment, such as Figure 2 As shown, it includes the following steps:

[0082] S21. Multi-source information input and feature extraction: Feature representation of three types of data, including current input features, historical context features, and external knowledge features.

[0083] Among them, the current input features include converting intermediate semantic representation objects into dense vector representations; the historical context features include obtaining entity subgraphs and their vectors related to the current input based on the historical context, as well as the preceding intent vectors and states of the current dialogue stage; and the external knowledge features include feature vectors obtained based on external knowledge graphs.

[0084] Specifically, the intermediate semantic representation object is transcribed into a dense vector representation by an embedding layer, converting the intent category, slot key-value pairs, and original text. The entity subgraph and its vectors related to the current input are extracted from the conversation entity graph, which stores entities (such as people, places, and times) and their relationships (such as attributes and associations) extracted from historical dialogues in a graph structure. The algorithm obtains these through a graph neural network (GNN) or a query interface. The preceding intent vector and state of the current dialogue stage are extracted from the intent chain, which records multi-turn intent sequences and logical relationships. The algorithm obtains these through a sequence model or attention mechanism. External knowledge features are queried from external knowledge graphs or business rule bases. For example, when a user mentions a product, attributes, specifications, and associations are queried from the product knowledge base and encoded as feature vectors.

[0085] S22. Multi-source information fusion based on attention mechanism: Dynamically fuse current input features, historical context features and external knowledge features through a multi-source information fusion network (such as a neural network based on attention mechanism), calculate the correlation weight between current input features and historical context features and external knowledge features, and generate context-enhanced joint features.

[0086] S23. Intent Classification and Slot Filling: Input the joint features into a classifier (such as a Softmax layer) to output the intent category and confidence level of the current user input. At the same time, use a sequence labeling model (such as BiLSTM-CRF or a pointer network based on Transformer) to label the current input sequence with the joint features as context conditions and extract the slot type and value.

[0087] Understandably, the above process is a key manifestation of "context awareness":

[0088] Dynamic slot constraints: Based on historically filled slots and external knowledge (such as business rules), dynamically limit the set of valid values ​​for the current slot to be filled. For example, if the "Trip Type" has been historically determined to be "Domestic Flight", then the "Departure Point" slot will be automatically constrained to a list of domestic cities.

[0089] Cross-wheel referential disambiguation: When the current input contains pronouns (such as "it" or "that") or is omitted, the algorithm queries the session entity graph to link the referential expression to the exact entity node that already exists in the graph, thereby resolving the correct slot value.

[0090] Polysemous word disambiguation and value verification: For ambiguous slot values ​​(such as "apple"), the algorithm combines the currently identified intent (such as "buy a mobile phone" vs. "buy fruit") with the entity classification in the external knowledge graph to perform semantic disambiguation. At the same time, it verifies the format, range, and other rules defined in the external knowledge base (such as date format and price range).

[0091] S24. Output Generation: Output a structured data object to build an enhanced dialogue state update fragment, including the confirmed intent, the set of slots to be filled, and the updated context pointer.

[0092] Specifically, the confirmed intent includes the classification result and confidence level; the filled slot set includes all slots, and each slot contains a slot name, extracted value, confidence level, and meta-labels indicating whether the value comes from the current input, historical reference, or external knowledge verification; the updated context pointers include nodes and edges associated with new or updated nodes in the session entity graph, providing input for subsequent steps to update the context model.

[0093] S3. State Change Event Generation and Publication: Based on the enhanced dialogue state update fragment, determine the session state change, encapsulate the change to generate a state change event object, and publish it to a designated partition of the distributed event log system for persistence. Figure 3 As shown, it includes the following steps:

[0094] S31. Change Detection and Event Encapsulation: Based on the enhanced dialogue state update fragment, change detection is performed through an event generator. If the session state is determined to have changed, an event is generated.

[0095] The change determination process involves checking the intent and slot information in the enhanced dialogue state update fragment field by field. If a new intent is found, a slot value change is detected, or an old value is cleared, the change is considered valid. Understandably, if no actual change is detected, the process terminates and no event is generated.

[0096] The event generation includes: creating a state change event object for each independent changed field (or a group of atomic changes). The state change event object follows a predefined pattern and includes fields such as: event identifier, session identifier, operation type, changed field path, old value snapshot, new value snapshot, timestamp, version stamp, and source service identifier.

[0097] S32. Event Persistence and Publication: Persist the encapsulated event objects to a distributed event logging system (such as an Apache Kafka cluster), including partition routing, reliable delivery, and local cache updates after publication.

[0098] Specifically, partitioned routing ensures the order of events within a session by using a consistent hashing algorithm to calculate the target partition based on the session identifier in the event. Reliable delivery ensures the one-time and complete persistence of events; the event producer (the service that generates the event) employs a highly reliable configuration, such as a high-availability acknowledgment mechanism, idempotent production, and transactional support. After publication, the local cache is updated immediately after the event is successfully persisted by Kafka and acknowledged. The local service that generated the event can then immediately update its own in-memory thread-local cache of the session state.

[0099] S4. Global Session State Update: Read events sequentially from the distributed event log system and update the session state in the global state store based on an optimistic concurrency control strategy, which includes the following steps:

[0100] S41. Event Acquisition and Parsing: Acquire the state change event object and parse it to extract key fields, including event identifier, session identifier, operation type, changed field path, new value snapshot, current version stamp, and expected version stamp.

[0101] Understandably, the current version stamp refers to the version number of the session state read by the event generator when the event is generated in step S3; it represents the known state snapshot on which the event is calculated and modified. The expected version stamp refers to the new version number that the session state should become after the event is successfully applied. In a normal single update, it is usually the current version stamp + 1.

[0102] S42. State Reading and Version Comparison: Based on the extracted session identifier, query the current complete state object and metadata of the session from the global state storage (i.e., the second-level cache, such as Redis Cluster), obtain the current global version stamp of the state, and compare whether the current version stamp extracted from the state change event object is equal to the global version stamp.

[0103] It should be noted that the cache hierarchy in this embodiment includes: Level 1 cache resides in the application process's memory, with extremely fast access (nanoseconds / microseconds), but the data is only visible to the current process instance, resulting in weak consistency (eventual consistency). Level 2 cache (i.e., "global state storage") resides in an independent distributed in-memory database, with relatively fast access (milliseconds), and the data is globally visible, ensuring strong consistency or eventual consistency through distributed protocols. Level 3 storage: a persistent database (such as MongoDB), serving as a backup and cold data storage for the final data persistence.

[0104] S43. Conflict resolution and path selection: Based on the version stamp comparison results, select different processing paths. If the comparison results are equal, there is no conflict and proceed to step S44; if the comparison results are different, a conflict occurs and proceed to step S45.

[0105] Understandably, if the version stamps match, it indicates that the session state has not been modified by other concurrent operations since the event was generated, and the event can be safely applied. If the version stamps do not match, it indicates that concurrent modifications have occurred, and the state on which the event is based has expired.

[0106] S44. Conflict-Free State Update: Based on the event's operation type and the path of the changed fields, a snapshot of the new value is applied to the corresponding fields of the state object read from global storage. The updated complete state object, along with the new version number (i.e., updating the global version stamp to the desired version stamp), is written back to global state storage as an atomic operation. This operation is typically implemented using CAS commands or database operations that support atomic comparisons and settings, ensuring that the version remains unchanged at the moment of writing. After a successful state update, the service asynchronously sends a notification or directly updates the second-level cache (the source of reads for this operation), and decides whether to broadcast an invalidation command to clear the first-level thread-local cache of the relevant service instance based on a strategy.

[0107] Understandably, the "second-level cache" mentioned in the description of S44 is the same entity as the "global state store" queried in S42. In S42, the second-level cache is read to obtain the current state and version stamp; in S44, after successfully applying the changes, the updated state and version stamp are written to the same store.

[0108] S45. Conflict Resolution and State Merging: Based on preset business rules, determine whether the current conflict can be automatically merged. If it can be merged, logically merge the change of the current event with the latest state corresponding to the global version stamp to generate a merged new state. Then, generate a new merged event based on the global version stamp (its expected version stamp is the global version stamp + 1). Then, proceed to step S42 to apply the merged new event. If it cannot be merged, abandon the application of the current event and mark it as a conflict event.

[0109] It should be noted that the business rules include:

[0110] The type of the conflicting field: whether it is an overriding of a basic type (such as number or string) or a complex structure (such as list or set).

[0111] Predefined merging capability flags: The system may have configured merging strategies for each status field, such as "summable", "appendable", "get latest" or "requires manual intervention".

[0112] Business semantics: For example, in a ticketing system, two requests to change seats from area A to area B and area C at the same time may be mutually exclusive and cannot be automatically merged; however, simultaneously increasing the quantity of the same product is additive and can be merged.

[0113] S5, Multi-level Caching and Efficient State Access: Builds and manages a collaborative multi-level storage system, responds to state queries and synchronization requests, and executes state access services, including the following steps:

[0114] S51, Collaborative Query of Response Status Read Request: Initiate a session status query based on the response status read request, and execute it in sequence:

[0115] Query the first-level cache: Search in the thread-local cache of the local service instance that is handling the request. If a match is found, the state is returned directly to the requester (S2 semantic parsing queries context information or S4 state management service performs conflict detection).

[0116] Query the second-level cache: If the first-level cache is not hit, a query is sent to the second-level cache cluster; if it is hit, the returned status data is provided to the requester and asynchronously copied to the first-level cache of the local service instance.

[0117] Load persistent storage: If the second-level cache is not hit, the complete state is asynchronously loaded from the third-level persistent storage, backfilled by the second-level cache, and then provided to the requester.

[0118] S52. Cache synchronization after execution state update: Cache synchronization is triggered based on the updated session state, including:

[0119] Update the global authoritative copy: Atomically write the updated session state to the second-level cache, making it the new authoritative state copy.

[0120] Maintain cache consistency: Broadcast cache invalidation notifications to all service instances to invalidate the corresponding old state entries in the first-level cache of each instance, ensuring that subsequent reads can retrieve the latest data.

[0121] Proactive preheating optimization: Based on the prediction strategy, the latest status of high-frequency sessions is proactively pushed to the first-level cache of the specified service instance to achieve preheating before access.

[0122] S53, Incremental Compression and Lazy Loading Optimization: When writing state to the second-level cache or persistent storage, it is differentially compared with the previous version, and only the incremental patch of the changed fields and the version identifier are stored; when reading state, if the incremental storage is hit, the complete state is reconstructed in real time by applying the patch.

[0123] S54, Dynamic scheduling of cached resources: Dynamically optimizing resources based on access patterns.

[0124] Cold and hot data migration: Based on metrics such as access frequency and last access time, cold data in the second-level cache is asynchronously archived to persistent storage, and reactivated hot data is preloaded back into the second-level cache.

[0125] Local cache eviction: Each service instance proactively evicts inactive entries from its local first-level cache based on capacity and the LRU (Least Recently Used) policy to maintain efficient memory utilization.

[0126] Understandably, multi-level caching and efficient state access provide high-performance, low-latency state data read and write support for semantic parsing in step S2 and state updates in step S4. Through the aforementioned proactive management, scheduling, and optimization operations, step S5 constructs a transparent and efficient data access layer. This system serves as the underlying support infrastructure, permeating and serving the state data access operations in steps S2, S4, S6, and S7.

[0127] It should be noted that the activity determination logic for session state objects includes:

[0128] Passive Inactivity (Inactive): When the last access time of a session state object is earlier than the preset TTL (Time to Live) threshold, the system determines that it is "no longer active" and will trigger its clearing.

[0129] Active identification (inactive): When a session phase is marked as completed or terminated, the system determines that its main interaction has ended, that is, it becomes "inactive" and will trigger archiving.

[0130] Relative popularity (activity level): In sessions not marked as invalid or terminated, activity weights are used to further distinguish their "activity level". Sessions with higher weights are considered "highly active" and are preferentially retained in the fast cache; sessions with lower weights are considered "low-frequency active" and may be downgraded.

[0131] S6. Streaming Modeling and Maintenance of Long Contexts: Key information is extracted through long sequence encoding, the session graph and intent chain are dynamically updated, and the context is hierarchically managed and refined based on importance weights and sliding windows, outputting active context packets, such as... Figure 4 The above includes the following steps:

[0132] S61. Historical Dialogue Encoding and Key Information Extraction: Taking the enhanced dialogue state update fragment as input, perform long sequence encoding and information extraction, and output a set of structured information units.

[0133] Long sequence encoding involves concatenating the new dialogue content (including user input and system response) of the current round with recent historical text and inputting it into the long sequence encoding model for processing. The model can adopt the Transformer-XL architecture (which captures long-range dependencies through a fragment recursion mechanism) or the Longformer architecture (which reduces computational overhead through a sparse attention mechanism).

[0134] Information extraction involves using information extraction units integrated into the encoding model or as post-processing modules to identify and extract key entities, user intents, and slot relationships from the encoded representation.

[0135] Specifically, key entities include named entities such as people, places, times, and products. User intent includes the core intent of the current conversation turn. Slot relationships include the semantic relationships between entities and intents, and between entities themselves.

[0136] S62. Construction and updating of the session entity graph and intent chain: Receive a set of structured information units and update the context model accordingly, including operations on graph nodes and edges and operations on intent chains, and update the session entity graph and intent chain.

[0137] The operations on graph nodes and edges include adding extracted key entities as nodes to the session entity graph. If an entity already exists, its attributes or active timestamp are updated. Simultaneously, based on the extracted semantic relationships, directed edges are established between entity nodes and between entities and intent nodes, or the weights of existing edges are increased.

[0138] The operation of the intent chain includes adding the identified current user intent as a node to the intent chain sequence, and establishing logical relationship edges between the new intent node and the previous intent node according to the dialogue logic (such as follow-up questioning, confirmation, and transfer).

[0139] S63. Dynamic context management based on sliding window and importance weight: Dynamically calculate the importance weight for each entity node in the session entity graph and each node in the intent chain, set a sliding window based on the most recent round or duration, classify information inside and outside the window by setting a weight threshold, and trigger storage degradation and information removal operations when the weight is lower than the threshold.

[0140] Understandably, high-weight core contexts are always retained in memory and directly provided to step S2. For medium- and low-weight contexts, when their weight falls below a threshold, a "gradual forgetting" operation is triggered.

[0141] Storage degradation: migrate it from the main graph structure in memory to the associated secondary storage or compressed representation; information removal: remove information with very low weight and irrelevant information from the active graph (metadata can be retained).

[0142] It should be noted that the streaming modeling and maintenance of long contexts is based on the enhanced dialogue state update fragments output by step S2. The original semantic information is transformed into a structured graph, and then refined into active contexts. The active context package, which includes high-weight entity subgraphs and related intent fragments, is fed back to step S2, so that the next round of semantic parsing can be based on accurate and concise historical context.

[0143] Understandably, this step, together with S2, forms a contextual collaborative understanding closed loop: S2 uses the refined context provided by S6 for precise parsing, and the parsing results serve as input for S6 to update the context model. This iterative process drives the continuous evolution of the semantic state of the dialogue.

[0144] S7. Lifecycle Management of State Objects: By collecting and maintaining session state lifecycle metadata in real time, periodically scanning and generating resource scheduling instructions based on policies, driving the execution of cache cleanup, data archiving, and priority adjustment, automated lifecycle management of system resources is achieved, such as... Figure 5 As shown, it includes the following steps:

[0145] S71. Lifecycle Metadata Collection and Maintenance: For each session state object (i.e., a structured entity maintained by the system containing all dynamic semantic data of the dialogue, which is the target of changes in steps S3 / S4 and the unit of storage in step S5), a lifecycle metadata record is attached and maintained. The record update drivers include:

[0146] Creation time: Recorded during session initialization (step S1 or S3);

[0147] Last access time: Updated synchronously when reading or writing the session state in step S2 (semantic parsing) or step S4 (session state update);

[0148] Activity weight: The weight is dynamically calculated based on access frequency (derived from access records in S2 / S4), dialogue round depth, and task criticality, and is recalculated after each access.

[0149] Session stage label: The transition (such as from in progress to completed or terminated) is driven by the intent recognition results of step S2 and business rules.

[0150] Specifically, session phase transitions are implemented through a lightweight, rule-based decision module. This module maintains a session phase transition rule base, consisting of a series of IF-THEN business rules. The system matches and evaluates the latest state of the current session (output from S2) and the historical context (session graph / intent chain from S6) against these rules. For example, IF (currently identified intent == "explicit confirmation" or "thank you goodbye") AND (all required slots for the core task are filled) AND (a corresponding task intent exists in the previous intent chain, such as "book a flight"). THEN updates the session phase label from in progress to completed.

[0151] S72. Periodic scanning and scheduling decisions based on metadata: Periodically scan the metadata of all session state objects and make decisions based on preset strategies to trigger corresponding scheduling instructions;

[0152] The preset strategies include:

[0153] Expiration determination and removal decision: Compare the last access time of the object with the preset lifespan threshold. If the object has expired, a removal instruction is generated.

[0154] Phase-driven archiving decisions: Check the session phase tag of the object. If the tag is completed or terminated, generate an archive migration instruction, targeting Tier 3 persistent storage.

[0155] Popularity-driven priority adjustment decisions: Sort all objects according to activity weight, generate downgrade instructions for low-frequency objects with lower ranking (such as moving from the first-level cache to the second-level cache), and generate upgrade / lock instructions for high-frequency objects with higher ranking (to ensure that they are retained in the first-level cache).

[0156] S73. Execution of scheduling instructions and resource operations: Based on the generated scheduling instructions, return to the multi-level storage system in step S5 for execution to complete resource scheduling.

[0157] Understandably, resource scheduling includes:

[0158] For the clear command, the corresponding state data is deleted from the first and second level caches, and can be selectively cleared from persistent storage;

[0159] For archive commands, an asynchronous migration task is initiated to write the state data completely from the second-level cache to the third-level persistent storage, and then remove it from the cache;

[0160] For downgrade / upgrade instructions, data objects are moved between different levels of cache. For example, an object may be evicted from the first-level thread-local cache or actively preloaded into the first-level cache.

[0161] This invention standardizes and decouples multimodal input by introducing a unified intermediate semantic representation object, providing a unified interface for context understanding. By employing event sourcing and distributed logging to asynchronously handle state changes, combined with multi-level caching and incremental compression mechanisms, it significantly improves state read / write performance and system scalability under high concurrency. Through long sequence encoding and conversation graph construction, it achieves accurate structured memorization of long dialogue histories and dynamically manages context based on streaming windows and importance weights, balancing resource consumption and information integrity. Utilizing version stamp comparison, optimistic locking, and idempotency design, it effectively detects and resolves concurrent conflicts, ensuring eventual consistency of state updates in a distributed environment. Overall, this invention forms a closed-loop collaborative system from input, understanding, state synchronization to resource management, significantly improving the concurrent processing capabilities, contextual coherence, real-time response speed, and overall robustness of dialogue systems in complex interaction scenarios.

[0162] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Although the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make some modifications or alterations to the above-disclosed technical content to create equivalent embodiments without departing from the scope of the present invention. Any simple modifications, equivalent changes and alterations made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the scope of the present invention.

Claims

1. A method for state tracking and context management in high-concurrency real-time dialogue, characterized in that: Includes the following steps: S1. Multimodal user input preprocessing: Receive raw user input from different interaction channels, perform preliminary identification of the raw input through the corresponding modality perception module, and convert the identification results of all modalities into intermediate semantic representation objects; S2. Semantic parsing and slot filling: Dynamically fuse intermediate semantic representation objects, active context packages extracted and maintained from historical dialogues, and external knowledge graphs, and output an enhanced dialogue state update fragment through a context-aware slot filling algorithm; wherein, the active context package is generated and maintained in the previous round or multiple rounds of dialogue in step S6. S3. Generation and Publication of State Change Events: Determine the state change of the session based on the enhanced dialogue state update fragment, generate a state change event object based on the change encapsulation, and publish it to the specified partition of the distributed event log system for persistence. S4. Global Session State Update: Read events sequentially from the distributed event log system and update the session state in the global state store based on an optimistic concurrency control strategy. S5, Multi-level caching and efficient state access: Build and manage a collaborative multi-level storage system, respond to state queries and synchronization requests, and execute state access services; S6. Streaming Modeling and Maintenance of Long Contexts: Extract key information through long sequence encoding, dynamically update the session graph and intent chain, and manage the context hierarchically based on importance weights and sliding windows to output active context packets. S7. Lifecycle Management of State Objects: By collecting and maintaining session state lifecycle metadata in real time, periodically scanning and generating resource scheduling instructions based on policies, driving the execution of cache cleanup, data archiving and priority adjustment, the system resources achieve automated lifecycle management.

2. The method for state tracking and context management in high-concurrency real-time dialogue according to claim 1, characterized in that: The intermediate semantic representation object adopts the JSON-based Intent Object format and includes the original recognition result, intent classification result, slot field and metadata; the modality perception module includes an automatic speech recognition module, a computer vision module and a gesture recognition module.

3. The method for state tracking and context management in high-concurrency real-time dialogue according to claim 1, characterized in that: The output of the enhanced dialogue state update fragment includes the following steps: S21. Multi-source information input and feature extraction: Feature representation of three types of data, including current input features, historical context features, and external knowledge features; S22. Attention-based multi-source information fusion: Dynamically fuse current input features, historical context features, and external knowledge features through a multi-source information fusion network, calculate the correlation weights between current input features, historical context features, and external knowledge features, and generate context-enhanced joint features. S23, Intent Classification and Slot Filling: Input the joint features into the classifier, output the intent category and confidence level of the current user input, and use a sequence labeling model to label the current input sequence with the joint features as context conditions to extract the slot type and value; S24. Output Generation: Output a structured data object to build an enhanced dialogue state update fragment, including the confirmed intent, the set of slots to be filled, and the updated context pointer.

4. The method for state tracking and context management in high-concurrency real-time dialogue according to claim 1, characterized in that: The generation and publication of the state change event includes the following steps: S31. Change Detection and Event Encapsulation: Based on the enhanced dialogue state update fragment, a change is determined through an event generator. If the session state is determined to have changed, an event is generated. The event generation includes: creating a state change event object for each independent changed field. The state change event object follows a predefined pattern and includes fields such as: event identifier, session identifier, operation type, changed field path, old value snapshot, new value snapshot, timestamp, version stamp, and source service identifier. S32. Event Persistence and Publication: Persist the encapsulated event objects to a distributed event log system, including partitioned routing, reliable delivery, and local cache updates after publication.

5. The method for state tracking and context management in high-concurrency real-time dialogue according to claim 1, characterized in that: The optimistic concurrency control strategy includes the following steps: S41. Event Acquisition and Parsing: Acquire the state change event object and parse it to extract key fields, including event identifier, session identifier, operation type, changed field path, new value snapshot, current version stamp, and expected version stamp; S42. State reading and version comparison: Based on the extracted session identifier, query the current complete state object and metadata of the session from the second-level cache, obtain the current global version stamp of the session state, and compare whether the current version stamp extracted from the state change event object is equal to the global version stamp. S43. Conflict Resolution and Path Selection: Based on the version stamp comparison results, different processing paths are selected. When the comparison results are equal, there is no conflict and the process proceeds to the conflict-free state update. When the comparison results are different, a conflict occurs and the process proceeds to conflict resolution and state merging. S44, Conflict-free state update: Based on the operation type of the event and the path of the changed field, apply the new value snapshot to the corresponding field of the state object read from the global storage; write the updated complete state object along with the new version number as an atomic operation back to the global state storage; S45. Conflict Resolution and State Merging: Based on preset business rules, determine whether the current conflict can be automatically merged. If it can be merged, logically merge the change of the current event with the latest state corresponding to the global version stamp to generate a new merged state. Then, generate a new merged event based on the global version stamp, and jump to state reading and version comparison to apply the new merged event. If it cannot be merged, abandon the application of the current event and mark it as a conflict event.

6. The method for state tracking and context management in high-concurrency real-time dialogue according to claim 1, characterized in that: The multi-level caching and efficient state access include the following steps: S51, Collaborative Query of Response Status Read Request: Initiate a session status query based on the response status read request, and execute it in sequence: Query the first-level cache: Search in the thread-local cache of the local service instance that handled the request. If a match is found, the status is returned directly to the requester. Query the second-level cache: If the first-level cache is not hit, a query is sent to the second-level cache cluster; if it is hit, the returned status data is provided to the requester and asynchronously copied to the first-level cache of the local service instance. Load persistent storage: If the second-level cache is not hit, the complete state is asynchronously loaded from the third-level persistent storage, backfilled by the second-level cache, and then provided to the requester. S52. Cache synchronization after execution state update: Cache synchronization is triggered based on the updated session state, including: Update the global authoritative copy: Atomically write the updated session state to the second-level cache, making it the new authoritative state copy; Maintain cache consistency: Broadcast cache invalidation notifications to all service instances to invalidate the corresponding old state entries in the first-level cache of each instance; Proactive preheating optimization: Based on a prediction strategy, the latest status of high-frequency sessions is proactively pushed to the first-level cache of the specified service instance; S53, Incremental Compression and Lazy Loading Optimization: When writing state to the second-level cache or persistent storage, the session state is differentially compared with the previous version, and only incremental patches of changed fields and version identifiers are stored; when reading state, if incremental storage is hit, the complete state is reconstructed in real time by applying patches. S54, Dynamic scheduling of cached resources: Dynamically optimizing resources based on access patterns. Cold and hot data migration: Based on access frequency and last access time metrics, cold data in the second-level cache is asynchronously archived to persistent storage, and reactivated hot data is preloaded back into the second-level cache; Local cache eviction: Each service instance actively evicts inactive entries from its local first-level cache based on capacity and LRU policy.

7. The method for state tracking and context management in high-concurrency real-time dialogue according to claim 1, characterized in that: The streaming modeling and maintenance of the long context includes the following steps: S61. Historical Dialogue Encoding and Key Information Extraction: Taking the enhanced dialogue state update fragment as input, perform long sequence encoding and information extraction, and output a set of structured information units. S62. Construction and updating of session entity graph and intent chain: Receive a set of structured information units and update the context model accordingly, including operations on graph nodes and edges and operations on intent chains, and update the session entity graph and intent chain. S63. Dynamic context management based on sliding window and importance weight: Dynamically calculate the importance weight for each entity node in the session entity graph and each node in the intent chain, set a sliding window based on the most recent round or duration, classify information inside and outside the window by setting a weight threshold, and trigger storage degradation and information removal operations when the weight is lower than the threshold.

8. The method for state tracking and context management in high-concurrency real-time dialogue according to claim 7, characterized in that: The long sequence encoding includes: concatenating the newly added dialogue content of the current round with recent historical text and inputting it into the long sequence encoding model for processing; The information extraction includes: using an information extraction unit integrated in the encoding model or as a post-processing module to identify and extract key entities, user intents, and slot relationships from the encoded representation; The operations on the graph nodes and edges include: adding the extracted key entities as nodes to the session entity graph; if the entity already exists, updating its attributes or active timestamp; and establishing directed edges between entity nodes and between entities and intent nodes based on the extracted semantic relationships. The operation of the intent chain includes: adding the identified current user intent as a node to the intent chain sequence, and establishing a logical relationship edge between the new intent node and the previous intent node according to the dialogue logic.

9. The method for state tracking and context management in high-concurrency real-time dialogue according to claim 1, characterized in that: The lifecycle management of the state object includes the following steps: S71. Lifecycle Metadata Collection and Maintenance: Attach and maintain a lifecycle metadata record for each session state object. The record update driver includes: Creation time: Recorded during session initialization; Last access time: Updated synchronously when reading or writing session state during semantic parsing or session state updates; Activity weight: The weight is dynamically calculated based on access frequency, dialogue round depth and task criticality, and is recalculated after each access; Session phase labels: Drive conversion through intent recognition results and business rules; S72. Periodic scanning and scheduling decisions based on metadata: Periodically scan the metadata of all session state objects and make decisions based on preset strategies to trigger corresponding scheduling instructions; S73. Execution of scheduling instructions and resource operations: Based on the generated scheduling instructions, return to the multi-level storage system for execution to complete resource scheduling.

10. The method for state tracking and context management in high-concurrency real-time dialogue according to claim 9, characterized in that: The preset strategy includes: Expiration determination and removal decision: Compare the last access time of the object with the preset lifespan threshold. If the object has expired, a removal instruction is generated. Phase-driven archiving decisions: Check the session phase tag of the object. If the tag is completed or terminated, generate an archive migration instruction, targeting Tier 3 persistent storage. Popularity-driven priority adjustment decision: Sort all objects according to activity weight, generate downgrade instructions for low-frequency objects with lower ranking, and generate upgrade / lock instructions for high-frequency objects with higher ranking; The resource scheduling includes: For the clear command, the corresponding state data is deleted from the first-level cache and the second-level cache, and selectively cleaned from persistent storage; For archive commands, initiate an asynchronous migration task to write the state data completely from the second-level cache to the third-level persistent storage and remove it from the cache; For downgrade / upgrade instructions, data objects are moved between different cache levels.

Citation Information

Patent Citations

  • Reverse question guiding question-answering implementation method and system

    CN120723868A

  • Precise international communication digital human real-time dialogue method fused with multi-modal technology

    CN121188157A