An ai active care intelligent interaction method based on long-term memory and multi-round dialogue
By constructing a weighted memory tensor and a dynamic detection window to identify missing regions, and combining the joint encoding of entities and topic paths, the problem of information dilution and missing information in existing dialogue systems is solved, thereby improving the coherence and care effect of long-term interactions.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- KIDSWANT CHILDREN PROD CO LTD
- Filing Date
- 2026-04-29
- Publication Date
- 2026-05-29
AI Technical Summary
Existing dialogue systems suffer from information dilution or loss, insufficient integration of entities and topics, and a lack of ability to identify areas with missing information in long-term memory modeling, resulting in inconsistent interactions and poor care effects in long-term continuous interaction.
By constructing a weighted memory tensor, using a dynamic detection window to identify missing regions and perform memory enhancement, and combining the joint encoding of entities and topic paths, proactive care question text is generated.
It enables fine-grained differentiation of long-term dialogue history, enhances the ability to capture user interest shifts, improves the coherence and relevance of proactive questioning, and improves user experience.
Smart Images

Figure CN122113938A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of natural language processing technology, specifically relating to an AI-driven proactive care intelligent interaction method based on long-term memory and multi-turn dialogue. Background Technology
[0002] With the rapid development of artificial intelligence and natural language processing technologies, intelligent dialogue systems have evolved from early retrieval-based, task-oriented dialogues to generative dialogue models capable of open-domain interaction. In recent years, large-scale pre-trained language models based on the Transformer architecture (such as BERT and GPT series) have significantly improved the ability of dialogue systems to understand contextual semantics, enabling machines to simulate natural human-computer interaction to a certain extent. Regarding proactive interaction, existing technologies mainly fall into two categories: one is proactive questioning methods based on rules or heuristic strategies, such as triggering preset question templates when a user's silence time exceeds a threshold or specific keywords appear; the other is proactive information acquisition methods based on reinforcement learning, which guide the model to proactively ask for missing information during dialogue by designing reward functions. Furthermore, memory-enhanced dialogue systems alleviate long-range dependency problems to some extent by introducing external memory modules to store historical interaction information. However, these technologies still face significant technical bottlenecks when applied to proactive care scenarios requiring long-term continuous interaction.
[0003] Specifically, existing dialogue systems generally employ fixed-length window truncation or simple cyclical state passing in long-term memory modeling, making it difficult to distinguish the timeliness of historical dialogues with fine granularity. As the number of dialogue rounds increases, important early information is easily diluted or lost, while recent redundant information may be over-retained, resulting in a lack of time sensitivity in memory representations. Regarding the fusion of entities and dialogue topics, most methods merely append entity recognition results as features to the current round's input, failing to explicitly model the correlation between entity appearance rounds and topic evolution paths, making it difficult for the system to capture the shifting trajectory of user interests. More critically, existing proactive dialogue systems lack the ability to automatically identify information gaps in historical dialogues. When users avoid answering in certain rounds, topics unexpectedly jump, or the system develops knowledge blind spots, existing technologies cannot effectively locate these semantically fragmented intervals, leading to repetitive questions, deviations from context, or missed opportunities for intervention. While a few proactive learning methods based on perplexity or uncertainty sampling can identify samples where the model is uncertain, their purpose is to improve model training rather than proactively filling information gaps in online dialogues, and they incur significant computational costs. Summary of the Invention
[0004] The purpose of this section is to outline some aspects of the embodiments of the present invention and to briefly introduce some preferred embodiments. Some simplifications or omissions may be made in this section, as well as in the abstract and title of the present application, to avoid obscuring the purpose of this section, the abstract and title of the invention. Such simplifications or omissions shall not be used to limit the scope of the present invention.
[0005] In view of the aforementioned existing problems, the present invention is proposed.
[0006] Therefore, the technical problem solved by this invention is to construct an active care dialogue method with a long-term memory decay mechanism and entity-topic path joint while maintaining low-latency interaction.
[0007] To solve the above-mentioned technical problems, the present invention provides the following technical solution: A proactive care intelligent interaction method based on long-term memory and multi-turn dialogue includes: constructing an original memory tensor based on the dialogue sequence and generating a weighted memory tensor; identifying missing regions based on the original memory tensor and a dynamic detection window, and outputting a set of missing regions; extracting entities from the multi-turn dialogue and storing them in a conversation layer dictionary; and using the weighted memory tensor, the joint encoding of the conversation layer, and the set of missing regions as a state input decision model to output a proactive care question text.
[0008] As a preferred embodiment of the present invention, the generation of the original memory tensor includes: concatenating the user input and system output of the current round into a text string, inputting it into the embedding layer of a pre-trained language model to obtain the original feature vector of the current round; inputting the original feature vector into a topic classifier to obtain the topic label of the current round; and appending the current round, the topic label, and the original feature vector as memory units to a list of historical memory units in chronological order to obtain the original memory tensor.
[0009] As a preferred embodiment of the present invention, the generation of the weighted memory tensor includes: traversing each memory cell in the original memory tensor; calculating an exponential decay weight based on the time difference between the current round and the round stored in the memory cell using a preset decay coefficient; multiplying the original feature vector of the memory cell by the exponential decay weight to obtain a weighted feature vector; and arranging all weighted feature vectors in chronological order to obtain the weighted memory tensor.
[0010] As a preferred embodiment of the present invention, the step of identifying missing regions based on the original memory tensor and dynamic detection window includes: extracting all original feature vectors before the current round from the original memory tensor, calculating the mean vector and covariance matrix; skipping detection if the current round is less than a preset minimum statistical round number; adding a regularization term if the covariance matrix is not invertible; setting a base window length and dynamically adjusting the detection window length according to the current round, so that the detection window length increases with the round number but does not exceed the current total round number; selecting historical memory units whose timestamps fall within the detection window based on the original feature vector of the current round; calculating the Mahalanobis distance between the original feature vector of each selected historical memory unit and the mean vector; marking historical memory units whose Mahalanobis distance is greater than a preset distance threshold as missing candidate units; sorting all missing candidate units in ascending order of timestamps, merging missing candidate units with consecutive timestamps into missing regions; recording the start round, end round, and corresponding set of original feature vectors for each missing region, and outputting a set of missing regions.
[0011] As a preferred embodiment of the present invention, after outputting the set of missing regions and before extracting entities, the method further includes: performing a memory enhancement operation based on linear interpolation on each missing region in the set of missing regions, generating a supplementary memory vector using the original feature vectors of adjacent rounds before and after the missing region, and inserting it into the historical memory unit list; regenerating the weighted memory tensor based on the updated historical memory unit list to obtain the enhanced weighted memory tensor; and filtering the filled missing regions according to the degree of deviation between the supplementary memory vector and the historical distribution to obtain the updated set of missing regions.
[0012] As a preferred embodiment of the present invention, the extraction of entities and storage in the conversation layer dictionary includes: extracting entities from the dialogue text of the most recent fixed number of rounds using named entity recognition technology, recording the round of occurrence and type label of each entity; extracting the topic label sequence from the first round to the current round; the conversation layer dictionary stores entity names, rounds of occurrence and type labels, with dictionary keys being the combination of entity names and rounds of occurrence, and dictionary values being type labels.
[0013] As a preferred embodiment of the present invention, before inputting the decision model, the method further includes: extracting all weighted feature vectors, performing average pooling along the time dimension to obtain memory vectors; inputting each label in the topic label sequence into the topic embedding layer to obtain the corresponding topic embedding vector sequence; inputting the topic embedding vector sequence into a gated recurrent unit, taking the hidden state at the last moment as the original path code; performing dimensional transformation on the original path code through a learnable fully connected layer to obtain aligned path code; extracting the corresponding weighted feature vector from the current weighted memory tensor according to the entity occurrence round in the conversation layer dictionary, and fusing it with the aligned path code to generate a joint encoding vector in real time; performing max pooling on the real-time generated joint encoding vector to obtain a conversation vector; for the missing region set, if it is not empty, averaging the original feature vectors in each region and then performing max pooling on all region vectors to obtain the missing vector; otherwise, setting the missing vector as the zero vector.
[0014] In a preferred embodiment of the present invention, the decision model includes: concatenating the memory vector, session vector, and missing vector into a complete state vector in the order of their beginning and end; inputting the state vector into a decision network; the decision network consists of two fully connected layers and a softmax output layer, outputting the probability of each predefined question intent, and selecting the intent corresponding to the highest probability.
[0015] In a preferred embodiment of the present invention, the output of the proactive care question text includes: retrieving a corresponding question template from the knowledge base according to the selected intent; the question template contains slots to be filled. Based on the predefined intent-entity type mapping table, the system searches the session layer dictionary for an entity value that matches the entity type corresponding to the intent to fill the slot; if there is no corresponding entity, a default word is filled in, and the proactive care question text is generated and output.
[0016] As a preferred embodiment of the present invention, the dynamic adjustment of the detection window length includes setting the detection window length to the base window length plus the integer part of the current round divided by a preset constant.
[0017] The beneficial effects of this invention are as follows, compared with the prior art: By constructing a weighted memory tensor based on an exponential decay mechanism, this invention achieves fine-grained differentiation of the importance of information in long-term dialogue history, preserving the complete interaction trajectory while highlighting recent semantic contributions, effectively solving the problem of long-dependency information loss caused by fixed window truncation; by deeply integrating entity embedding with its weighted features of occurrence rounds and the evolution path of dialogue topics, a joint encoding with time-aware capabilities is generated and stored in the conversation layer dictionary, significantly enhancing the system's ability to capture user interest shifts; furthermore, by automatically identifying semantically missing regions in the dialogue through a dynamic window detection mechanism and performing memory enhancement based on linear interpolation, information gaps are filled, improving the coherence and relevance of proactive questioning.
[0018] Finally, by inputting heterogeneous state vectors into the decision network to generate personalized question texts in an end-to-end manner, we achieved low-latency, highly adaptive proactive care interaction, which significantly improved the user experience and care effect in long-term human-computer dialogue. Attached Figure Description
[0019] Figure 1 This is a flowchart of an AI-driven proactive care intelligent interaction method based on long-term memory and multi-turn dialogue, as described in this invention.
[0020] Figure 2 This is a flowchart of the weighted memory tensor generation process based on exponential time decay described in this invention. Detailed Implementation
[0021] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of this invention. The embodiments described in this application are merely some embodiments of this invention, and not all embodiments. Based on the spirit of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the protection scope of this invention.
[0022] like Figures 1-2 As shown, the AI-driven proactive care intelligent interaction method based on long-term memory and multi-turn dialogue described in this invention includes: S1: Construct the original memory tensor based on the dialogue sequence and generate a weighted memory tensor.
[0023] S1.1: Generate the original feature vector and topic tags based on the current round of dialogue text.
[0024] Specifically, the system acquires complete interaction data for the current round of dialogue. This complete data includes the text input by the user and the system's output responses to the user's input from the previous round. The user input and system output are then concatenated according to a preset concatenation rule to generate the concatenated text string for the current round. The preset concatenation rule is as follows: the system output is placed first, followed by the user input, and the two are separated by a delimiter.
[0025] The concatenated text string is input into the embedding layer of a pre-trained language model, which can be a semantic understanding model based on the Transformer architecture, such as BERT, RoBERTa, or a similar parameter scale. The embedding layer maps each character or word in the concatenated text string to a corresponding low-dimensional dense vector. After multi-layer self-attention encoding by the pre-trained language model, it outputs the hidden state vector corresponding to the first special marker (i.e., the [CLS] marker) in the concatenated text string, which serves as the original feature vector for the current round, denoted as... ,in, Indicates the current round number. This is the hidden layer dimension of the pre-trained language model, and its value range is usually 256, 512 or 768.
[0026] The original feature vector The input is fed into a pre-trained topic classifier. The topic classifier uses a two-layer fully connected network (128 hidden layers), taking the [CLS] vector output by the pre-trained language model as input and outputting the probabilities of K topic categories. It is fine-tuned on labeled dialogue data using cross-entropy loss. Topic categories include, but are not limited to: health consultation, emotional expression, daily life, device operation, and knowledge-based question answering. Output the probability distribution of the current round of dialogue text belonging to each topic category, and take the category with the highest probability as the topic label for the current round. If the highest probability is lower than the preset confidence threshold (ranging from 0.5 to 0.7), the topic tag will be marked as general.
[0027] S1.2: Construct the original memory tensor.
[0028] A memory unit is defined as a structured data object used to store dialogue information for a single turn. Each memory unit... It contains three fields: round number , topic tags and the original feature vector .in, Generated by step S1.1 For the corresponding topic tags.
[0029] Get a list of all memory units generated in the history of the conversation. The subscript indicates the dialogue turn. The memory unit constructed for the current turn... Add them to the end of the historical memory unit list in chronological order to form the updated memory unit list. .
[0030] List of memory cells The original feature vectors of each memory unit in the sequence are stacked along the time axis in round-wise order to obtain a dimension of The two-dimensional tensor, as the original memory tensor Among them, the original memory tensor It records the original semantic features of all dialogue rounds from the first round to the current round, with each row corresponding to the original feature vector of a round.
[0031] S1.3: Traverse the original memory tensor and calculate the time decay weight of each memory unit.
[0032] To emphasize the importance of recent dialogue content and suppress interference from distant information, an exponential time decay is applied to each memory unit in the original memory tensor. The original memory tensor is then traversed. The memory unit corresponding to each row in the memory, for the first row... Each memory unit calculates the current round. Time difference Exponentially decaying weights The calculation expression is: ; in, This is a preset decay coefficient, with a value range of 0.05 to 0.2, used to control the rate of forgetting. The larger the value, the faster the historical information decays; The smaller the value, the longer the historical information is retained. In a preferred embodiment of this invention, The value is 0.1.
[0033] According to the expression, when hour, ,but That is, the weight of the current memory unit is 1. For historical rounds, Its weight decreases exponentially as the time difference increases.
[0034] S1.4: Generate a weighted memory tensor.
[0035] The original memory tensor No. The original feature vector of the row With the corresponding time decay weight Multiplying them together yields a weighted eigenvector. : ; Here, multiplication refers to the scalar multiplication of a scalar and a vector. The above weighting operations are performed sequentially to obtain a weighted feature vector sequence. The weighted feature vector sequences are stacked along the time axis in chronological order (i.e., round order) to obtain a sequence with dimension [missing information]. The two-dimensional tensor, as a weighted memory tensor .
[0036] Among them, the weighted memory tensor Each row in the vector corresponds to a weighted feature vector for a round. The vector magnitude of recent rounds is preserved, while the vector magnitude of distant rounds is exponentially decayed. This allows the model to focus more on historical information that is more relevant to the current dialogue context in subsequent calculations.
[0037] Furthermore, all weighted feature vectors reside in the same semantic space as the original feature vectors, eliminating the need for additional normalization and preserving relative importance information.
[0038] As can be seen, this invention generates a weighted memory tensor through an exponential time decay mechanism, and applies quantifiable decay weights to long-term memories. This not only preserves the complete historical dialogue trajectory, but also highlights the semantic contribution of recent interactions, solving the problem of long dependency information loss caused by fixed-length window truncation. It provides a semantically aligned and time-sensitive memory foundation for subsequent proactive care decisions.
[0039] S2: Identify missing regions based on the original memory tensor and dynamic detection window, and output a set of missing regions.
[0040] In this embodiment, due to the hidden layer dimension of the pre-trained language model output... The number of historical rounds, t, is typically much larger than the number of rounds in the previous dialogue (usually less than 100). Directly calculating the covariance matrix can lead to singularity and unreliable Mahalanobis distance estimation. To address this issue, randomized principal component analysis (PCA) is performed on the original eigenvectors to reduce their dimensionality (e.g., to 20 dimensions) before calculating the mean vector and covariance matrix. Subsequent calculations of the mean vector, covariance matrix, and Mahalanobis distance are all based on the dimensionality-reduced eigenvectors. The random projection matrix from the dimensionality reduction operation is randomly generated and fixed at the start of each dialogue, ensuring consistency within the same dialogue.
[0041] S2.1: Calculate the mean vector and covariance matrix based on the original memory tensor.
[0042] Extract the original feature vectors of all historical rounds (excluding the current round) before the current round t from the original memory tensor to form a feature vector set. Calculate the mean vector of the eigenvector set. : ; Calculate the covariance matrix of the eigenvector set. : ; in, This represents the matrix transpose operation.
[0043] If the number of historical rounds is less than the preset minimum number of statistical rounds (e.g., 5), then S2 is terminated, the set of missing regions is output as an empty set, and no memory enhancement is performed.
[0044] Determine the covariance matrix Is it reversible? The criterion for reversibility is to calculate its condition number or check if the determinant is zero. If... A singular matrix (i.e., a matrix with a determinant of zero or a condition number greater than 10). 10 If the covariance matrix is non-invertible, it is determined to be non-invertible. To prevent numerical instability in subsequent Mahalanobis distance calculations when the covariance matrix is non-invertible, a regularization term is added. The covariance matrix is corrected, where is the regularization coefficient, and its value range is . , The identity matrix. The corrected covariance moments. Represented as: .
[0045] S2.2: Dynamically adjust the detection window length according to the current round.
[0046] Set the base window length The base window length is a preset positive integer, ranging from 3 to 10, used to determine the minimum detection range. This is based on the current round number. The actual detection window length is dynamically calculated using the following expression: ; in, This is a preset step size constant, ranging from 10 to 50, used to control the growth rate of the window length with each round. The dynamic adjustment mechanism ensures that the detection window length gradually increases with each dialogue round to accommodate sparse and missing regions that may appear in long dialogues, while limiting the window length to no more than the current total number of rounds. .
[0047] In the current round The original feature vector Based on this, historical memory units whose timestamps (i.e., round numbers) fall within the detection window are selected. The starting round of the detection window is max. The end of the round is From the primitive memory tensor Extract the original feature vectors of all rounds within the closed interval. This constitutes the feature vector set of the detection window. Among them, the current round eigenvectors It serves as a baseline vector for comparison with other historical vectors.
[0048] S2.3: Calculate Mahalanobis distance and label missing candidate cells.
[0049] For the set of feature vectors of the detection window obtained in step S2.2 Each historical feature vector in The calculated mean vector The Mahalanobis distance between them.
[0050] A better formula for calculating Mahalanobis distance is: ; Mahalanobis distance can eliminate the influence of correlation between feature dimensions and unify the units of measurement for each dimension, making anomaly detection for different semantic features comparable. If the distance exceeds a preset distance threshold (the distance threshold is a value adapted to low-dimensional space, such as 2.0~4.0, which is determined based on the value that maximizes the F1 score on the validation set, typically 3.0), then the [missing value] is determined. The memory unit corresponding to the round is the missing candidate unit, and the round number is set. and the corresponding original feature vector Add to missing candidate set In the missing candidate set, the elements are arranged in ascending order of round number.
[0051] S2.4: Merge consecutive rounds to form missing regions.
[0052] Traverse the missing candidate set and merge missing candidate units with consecutive round numbers into the same missing region. The specific merging rules are as follows: initialize an empty list to store missing regions; process each missing candidate unit in turn. If the round number of the current missing candidate unit is equal to the round number of the previous missing candidate unit, then the current unit is added to the current missing region; otherwise, end the current missing region and start a new missing region.
[0053] Each missing area Record the following information: starting round (Minimum round number in the missing region); Ending round (Maximum round number in the missing region); Original feature vector set (The original feature vectors corresponding to all rounds within this region).
[0054] The set of all missing regions constitutes the missing region set. If the missing candidate set is empty, then the missing region set is... It is an empty set.
[0055] S2.5: Generate a set of missing regions As the final output.
[0056] Each missing region in the missing region set represents a continuous interval of historical dialogue rounds. Within this interval, the semantic features of each round deviate significantly from the overall dialogue distribution (manifested as Mahalanobis distance exceeding a threshold). This deviation may correspond to scenarios such as missing user information, topic jumps, abrupt changes in sentiment, or knowledge gaps not covered by the system. The missing region set provides clear intervention opportunities and semantic anchors for subsequent proactive care decisions.
[0057] It should be noted that the dynamic detection window mechanism enables the detection range to grow adaptively with the length of the dialogue, which ensures both the fine detection of recent dialogues and avoids redundant calculations of the entire history.
[0058] A better approach is to obtain the set of missing regions. Then, a memory enhancement operation is performed on each missing region in the set of missing regions to compensate for the impact of missing information in that region on subsequent decisions. Specifically, this includes: for each missing region... Get the previous adjacent round (i.e., the starting round) of this region. The previous round, round number was -1) original feature vector and the next adjacent round in that region (i.e., the ending round). The next round, round number is +1) original feature vector .in: If the missing region starts from the first round (i.e.) ), then Let it be the zero vector; If the missing region extends to the current round (i.e.) ), then Using the original feature vector of the current round Replacement.
[0059] Furthermore, a linear interpolation method is used to generate a supplementary memory vector for the missing region. The linear interpolation formula is: ; in, (The distance between the previous round and the starting round in the missing area is always 1). (The distance between the next round and the last round after the missing area is always 1).
[0060] Therefore, the above linear interpolation formula can be simplified to: ;
[0061] That is, the supplementary memory vector is the arithmetic mean of the feature vectors of the adjacent rounds before and after the missing region.
[0062] If only one side of the missing region has a valid vector (e.g., the missing region is in the first round or the current round), then the other side is treated as a zero vector. In this case, the supplementary memory vector degenerates into a scaled vector of the single side (i.e., ...). or (This is used to conservatively estimate the semantic content of the missing regions.)
[0063] Furthermore, This is considered as the original feature vector of a virtual memory unit. The round number of this virtual memory unit is set to the middle round value of the missing region: if the length of the missing region is odd, the middle round is taken; if it is even, the midpoint between the starting round and the ending round is rounded down. Since the value after rounding down from the midpoint must fall within the actual round interval of the missing region, it corresponds to a real round.
[0064] Construct virtual memory units, with the round number as follows: The topic tags are set to missing value enhancement, and the original feature vector is... (Unweighted). Insert the virtual unit into the historical memory unit list in round order (if...). If a position already has a real round, replace the original memory unit of that round and record the replacement marker. Simultaneously, remove the missing region (excluding...). Other original memory units outside of rounds are marked as ignored (i.e., when generating weighted memory tensors later, the original feature vectors of these rounds are replaced with zero vectors, or their weights are set to zero), but the records of these rounds are not deleted to maintain the continuity of round numbers.
[0065] Subsequently, steps S1.3 and S1.4 are re-executed to regenerate the weighted memory tensor based on the updated list of historical memory units, ensuring that virtual units participate in the time decay calculation. This ultimately results in an enhanced weighted memory tensor. The enhanced tensor will be used in subsequent steps to extract weighted feature vectors and memory vectors.
[0066] Furthermore, after performing memory enhancement and updating the list of historical memory units, the new mean vector and covariance matrix are recalculated based on the updated original feature vector set, following the method in step S2.1, and the new mean vector is used as the basis for calculation. and the new covariance matrix Using this as a baseline, calculate the Mahalanobis distance of the supplementary memory vector: ; like If the distance is less than or equal to the preset distance threshold in step S2.3, the missing region is determined to have been successfully filled and removed from the missing region set; if it is still greater than the threshold, the region is retained, an enhanced but still missing marker is added, and the semantic center vector of the region is updated to... .
[0067] The final output set of missing regions is the updated set. This set will be used in the next step to extract the missing vectors.
[0068] S3: Extract entities from multi-turn dialogues and store them in the conversation layer dictionary.
[0069] In this embodiment, after completing the missing region identification and memory enhancement, entities are extracted from the enhanced weighted memory tensor and the dialogue text to generate a joint encoding containing context and dialogue path. Step S3 specifically includes the following steps: S3.1: Extract entities from the dialogue text of the most recent fixed number of rounds to generate an entity record set. The extracted dialogue text uses only the original user input and system output, and does not include the text corresponding to the virtual memory units inserted in the memory enhancement step (the virtual units are only used for semantic completion and do not participate in entity extraction).
[0070] Define the preset sliding window length Sliding window length A fixed positive integer, ranging from 3 to 10, used to limit the number of dialogue rounds involved in entity extraction. In the current round... Greater than or equal to At that time, draw from round Up to round The dialogue text; in the current round Less than At that time, draw from the first round to the second round. The complete dialogue text for each round. The extracted dialogue text includes the user input statements and system output statements for each round, concatenated with a delimiter.
[0071] The extracted dialogue text is input into a pre-trained named entity recognition model. This model is based on a Bidirectional Long Short-Term Memory (BiLSTM) network and Conditional Random Field (CRF) architecture, or a sequence labeling model fine-tuned from a pre-trained language model (such as BERT). The output is an entity category label for each character or subword. Entity category labels include, but are not limited to: Person Name (PER), Location (LOC), Date (DATE), Disease Name (DIS), Drug Name (MED), Emotional State (EMO), etc.
[0072] Iterate through the labeled sequence output by the named entity recognition model, extract all consecutive character segments marked as entities, and obtain a list of entities. For each extracted entity, record its name string. Rounds of occurrence (i.e., the dialogue round number in which the entity first appears within the extraction range) and the corresponding entity type label. (For example, disease names, drug names, etc.). All entity records constitute an entity record set. .
[0073] S3.2: Extract the topic tag sequence from the first round to the current round.
[0074] From the historical topic tags output in step S1.1, retrieve the tags from the first round (round 1) to the current round (round number 1). All the topic tags are arranged in chronological order to form a topic tag sequence. ,in, Indicates the first The theme tag for wheels.
[0075] S3.3: Define the session layer dictionary The session layer dictionary is a key-value pair data structure. For each entity record, the dictionary key is a string combining the entity name and the number of times it appears, and the dictionary value is the type label for that entity. Store all key-value pairs of entity records into the session layer dictionary. If the same key already exists in the dictionary, the old value is overwritten with the type label of the current round (usually the type remains unchanged, but the overwriting logic is retained to maintain consistency). The final output session layer dictionary only stores the entity name, the round of occurrence, and the type label; it does not store the joint encoding vector.
[0076] It should be noted that in each round of dialogue, the conversation layer dictionary is reinitialized to an empty dictionary, and entities are only extracted and stored from the dialogue text of the current sliding window (e.g., the last 3 rounds). That is, the dictionary does not accumulate entities outside the history window to ensure the temporal locality of entity information. If it is necessary to retain long-term entities, semantic information can be indirectly obtained in subsequent steps through a weighted memory tensor.
[0077] S4: The weighted memory tensor, the joint encoding of the conversation layer, and the set of missing regions are used as state input decision models to output proactive care question text.
[0078] S4.1: Generate path encoding based on topic tag sequence.
[0079] Each topic tag in the obtained topic tag sequence The input is fed into a trainable topic embedding layer. The topic embedding layer is a lookup table of size equal to the preset total number of topic categories, where each topic label is mapped to a topic embedding vector. ,in The embedded dimension for the theme typically ranges from 64 to 256.
[0080] The obtained topic embedding vector sequence is input into a gated recurrent unit (GRU). The hidden state dimension of the GRU is set to... The initial hidden state is a zero vector. The GRU processes each topic embedding vector sequentially step by step, finally outputting the hidden state of the last time step, which serves as the original path encoding. The original path encoding captures the trajectory of topic evolution from the first round to the current round.
[0081] Set up a learnable fully connected layer (i.e., a linear transformation layer that does not contain an activation function), denoted as . Its input dimension is The output dimension is Encode the original path The input is fed into this fully connected layer to obtain the aligned path code. : ; in, This is the weight matrix. Both are bias vectors and are trainable parameters of the model.
[0082] S4.2: Extract the memory vector from the weighted memory tensor.
[0083] Obtain the weighted memory tensor The weighted memory tensor is subjected to average pooling along the time dimension (i.e., the first dimension), and the arithmetic mean of the weighted feature vectors across all rounds is calculated to obtain the memory vector. : ; It should be noted that memory vectors It compresses the weighted semantic information of the entire dialogue history, reflecting the comprehensive distribution of users' long-term interests and recent concerns.
[0084] S4.3: Extract session vectors from the session layer dictionary.
[0085] Get the session layer dictionary For each entity record, first check if the occurrence round corresponding to that entity is a virtual unit in the historical memory unit list (e.g., determined by a replacement marker). If it is a virtual unit, skip the entity and do not generate a joint encoding vector. If it is not a virtual unit, for each entity record in the dictionary (the key is the entity name and occurrence round, and the value is the type label), extract the corresponding weighted feature vector from the current enhanced weighted memory tensor based on the occurrence round, and then combine it with the aligned path encoding. The vectors are concatenated and then fed into a fully connected layer (with ReLU activation) to obtain the joint encoded vector. , Collect the joint encoding vectors of all entities to form a set. Max pooling is performed on the set to obtain the session vector s. If the dictionary is empty, then s is set as the zero vector.
[0086] It should be noted that the session vector (i.e., the joint encoding of the session layer) captures the most salient joint features of all entities appearing in the current dialogue.
[0087] S4.4: Extract missing vectors from the set of missing regions.
[0088] Determine the set of missing regions Is it empty?: If empty, set the missing vector to the zero vector, with dimension 1. If not empty, then for each missing region Obtain the weighted feature vectors corresponding to all rounds within the region (extracted from the enhanced weighted memory tensor), calculate their arithmetic mean, and obtain the region feature vector. : ; in, Let this be the number of rounds contained within the missing region. Then, for the feature vectors of all missing regions... Perform max pooling to obtain the missing vector. : ; Among them, missing vectors It characterizes the semantic features of the most significant information-deficient regions in the history of dialogue.
[0089] It should be noted that average pooling for memory vectors can preserve overall distribution information, while max pooling for session vectors and missing vectors can highlight the most significant entity features and the most critical missing regions. Experiments show that this combination is superior to single pooling methods.
[0090] S4.5: Concatenate to generate a complete state vector.
[0091] The outputs obtained in steps S4.1 to S4.4 are concatenated in the order of their beginning and end to obtain the complete state vector. : ; where, state vector It integrates three types of heterogeneous information: global memory, entity-level conversational knowledge, and dialogue-missing regions.
[0092] S4.6: The decision network calculates the probability of the question's intent.
[0093] The decision network consists of a first fully connected layer, a second fully connected layer, and a Softmax output layer connected sequentially. The state vector o obtained in step S4.4 is input into the decision network.
[0094] Define the first fully connected layer Input dimension is The output dimension is 256 (this value can be adjusted according to the model size, ranging from 128 to 512), followed by the ReLU activation function: ; in, and These are the trainable parameters for the first fully connected layer.
[0095] The output of the first fully connected layer Input to the second fully connected layer The input dimension is 256, and the output dimension is... ,in The total number of predefined question intent categories.
[0096] The intent behind these questions includes, but is not limited to: inquiring about recent events, providing health reminders, offering emotional support, recommending activities, disseminating knowledge, and confirming information. The second fully connected layer does not contain an activation function. ; in, and These are the trainable parameters for the second fully connected layer. The unnormalized score for each intent.
[0097] Will The input is fed into the Softmax output layer to calculate the probability distribution of each question intent: ; in, for The i-th component. Select the intent with the highest probability as the intent for the current decision output. : ; It should be noted that the decision network needs to be trained in advance through supervised learning or reinforcement learning. During supervised learning, manually labeled multi-turn dialogue samples are collected. Each sample contains a state vector o and its corresponding expected question intent label. The network parameters are updated using the cross-entropy loss function and gradient descent. , , , During reinforcement learning, user feedback (such as clicks, response length, and sentiment scores) is used as reward signals, and the decision network is optimized using a policy gradient method. Before actual deployment, this method is trained using annotated dialogue corpus containing multiple rounds of proactive care scenarios, and the trained network parameters are fixed for online inference. Those skilled in the art can implement the above training process using conventional deep learning frameworks (such as PyTorch and TensorFlow).
[0098] S4.7: Retrieve the question template based on the intent and populate the slot.
[0099] The question template library is a pre-defined collection of key-value pairs. Each key corresponds to a question intent, and each value corresponds to one or more question template strings under that intent. The question template string contains one or more slots to be filled. The slots are identified by curly braces followed by a variable name, such as {body part} in "Have you recently felt discomfort in {body part}?"
[0100] Based on the obtained intent, the corresponding question template is retrieved from the question template library. If the same intent corresponds to multiple templates, a template is selected either according to a preset priority order or randomly.
[0101] Furthermore, an intent-entity type mapping table is constructed, which defines the entity types that each question intent focuses on. For example, the entity types corresponding to a health reminder intent are disease name and drug name; the entity type corresponding to an emotional relief intent is emotional state; and the entity types corresponding to an activity recommendation intent are location and date.
[0102] Based on the intent-entity type mapping table, from the generated session layer dictionary The system searches for entity values that match the entity type required by the intent. The search strategy is as follows: prioritize entity values whose occurrence round is closest to the current round; if multiple entities of the same type exist, select the entity with the largest modulus of the joint encoding vector. The found entity name string is then filled into the corresponding slot in the query template.
[0103] If no entity matching the required entity type exists in the session layer dictionary, the slot is filled with a preset default word. The default word is determined based on the intent type; for example, for a health reminder intent, the default word is "body"; for an emotional relief intent, the default word is "mood".
[0104] The completed question template string, after filling all slots, serves as the final proactive care question text. This question text is then output to the system's front-end interface or speech synthesis module to complete the proactive interaction with the user. Simultaneously, the selected intent and its corresponding question text are used as output results for subsequent rounds of memory updates and model optimization.
[0105] It should be noted that this invention extracts memory vectors, conversation vectors, and missing vectors from the weighted memory tensor, the conversation layer dictionary, and the missing region set, respectively, and concatenates them into a unified state vector. This enables the decision model to simultaneously perceive global dialogue memory, entity-level structured knowledge, and information missing regions. Furthermore, the decision network adopts a two-layer fully connected plus Softmax structure, mapping the state vector to a probability distribution of predefined questioning intent, thus achieving end-to-end decision-making from multi-source heterogeneous states to proactive care behavior.
[0106] In this embodiment of the invention, each learnable module (e.g., topic classifier, named entity recognition model, topic embedding layer, GRU path encoder, and decision network) adopts an end-to-end joint training approach. The training data consists of manually annotated multi-turn dialogue corpora, including proactive care scenarios (health consultation, emotional companionship, etc.). The annotations include: topic tags for each turn (10 categories), named entities (using the BIO annotation scheme, entity types include names, diseases, drugs, emotions, etc.), and the expected questioning intent after each turn (8 categories). Hyperparameter settings are as follows: the pre-trained language model uses BERT-base-uncased, with hidden layer dimension d=768; decay coefficient λ=0.1; base window length is 5; Mahalanobis distance threshold=3.0; learning rate=1e-5; optimizer is AdamW; batch size=16; training for 20 epochs. During training, the complete dialogue is expanded by turn, executing S1 to S4 sequentially, calculating the cross-entropy loss between the intent output by the decision network and the annotated intent, and backpropagating to update the parameters of all modules. The hidden layer dimension of the GRU path encoder is set to 128. The parameters and data scales mentioned above are for illustrative purposes only, and those skilled in the art can adjust them according to actual scenarios.
[0107] The method also includes one or more processors and memory.
[0108] The memory is used to store operable instructions that, when executed by the one or more processors, cause the one or more processors to perform operations, including the flow of the AI proactive care intelligent interaction method based on long-term memory and multi-turn dialogue described in the foregoing embodiments, especially... Figure 1 The flowchart of the method is shown.
[0109] Other aspects disclosed in the embodiments of the present invention also propose a computer-readable medium for storing software including instructions executable by one or more computers, which, upon execution, cause the one or more computers to perform operations including the flow of the AI proactive care intelligent interaction method based on long-term memory and multi-turn dialogue of the foregoing embodiments, particularly... Figure 1 The flowchart of the method is shown.
[0110] It should be recognized that embodiments of the present invention may be implemented or carried out by computer hardware, a combination of hardware and software, or by computer instructions stored in a non-transitory computer-readable storage medium.
[0111] The method can be implemented using standard programming techniques, including a non-transitory computer-readable storage medium configured with a computer program in the computer program, wherein the storage medium is configured such that the computer operates in a specific and predefined manner.
[0112] Each program can be implemented in a high-level procedural or object-oriented programming language to communicate with the computer system; however, if required, the program can be implemented in assembly or machine language.
[0113] In any case, the language can be either compiled or interpreted.
[0114] Furthermore, for this purpose, the program can run on programmed application-specific integrated circuits.
[0115] The processes described herein (or variations and / or combinations thereof) can be executed under the control of one or more computer systems configured with executable instructions, and can be implemented by hardware or a combination thereof as code (e.g., executable instructions, one or more computer programs, or one or more applications) that commonly executes on one or more processors. The computer program includes a plurality of instructions executable by one or more processors.
[0116] Furthermore, the method can be implemented in any suitable type of computing platform, including but not limited to personal computers, minicomputers, mainframes, workstations, networked or distributed computing environments, standalone or integrated computer platforms, or in communication with charged particle tools or other imaging devices.
[0117] Various aspects of the present invention can be implemented in machine-readable code stored on a non-transitory storage medium or device, whether portable or integrated into a computing platform, such as a hard disk, optical read and / or write storage medium, RAM, ROM, etc., such that it can be read by a programmable computer, and when the storage medium or device is read by the computer, it can be used to configure and operate the computer to perform the processes described herein.
[0118] Furthermore, machine-readable code, or parts thereof, can be transmitted via wired or wireless networks.
[0119] When such media includes instructions or programs that combine with a microprocessor or other data processor to implement the steps described above, the invention described herein includes these and other different types of non-transitory computer-readable storage media.
[0120] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. An AI-driven proactive care intelligent interaction method based on long-term memory and multi-turn dialogue, characterized in that, include: The original memory tensor is constructed based on the dialogue sequence, and a weighted memory tensor is generated. Based on the original memory tensor and the dynamic detection window, the missing regions are identified, and the set of missing regions is output. Extract entities from multi-turn dialogues and store them in the conversation layer dictionary; The weighted memory tensor is pooled to obtain a memory vector. A joint encoding vector is generated based on the conversation layer dictionary and then pooled to obtain a conversation vector. The set of missing regions is encoded into a missing vector. The memory vector, conversation vector, and missing vector are concatenated and input into the decision model to output the proactive care question text.
2. The AI-driven proactive care intelligent interaction method based on long-term memory and multi-turn dialogue as described in claim 1, characterized in that, The generation of the original memory tensor includes: The user input and system output of the current round are concatenated into a text string, which is then input into the embedding layer of the pre-trained language model to obtain the original feature vector of the current round. The original feature vector is input into the topic classifier to obtain the topic label for the current round; The current round, the topic tag, and the original feature vector are used as memory units and appended to the historical memory unit list in chronological order to obtain the original memory tensor.
3. The AI-driven proactive care intelligent interaction method based on long-term memory and multi-turn dialogue as described in claim 2, characterized in that, The generation of the weighted memory tensor includes: Traverse each memory cell in the original memory tensor: Based on the time difference between the current round and the round stored in the memory unit, an exponential decay weight is calculated using a preset decay coefficient. Multiply the original feature vector of the memory cell by the exponentially decaying weight to obtain the weighted feature vector; Arrange all weighted eigenvectors in chronological order to obtain the weighted memory tensor.
4. The AI-driven proactive care intelligent interaction method based on long-term memory and multi-turn dialogue as described in claim 3, characterized in that, The method of identifying missing regions based on the original memory tensor and dynamic detection window includes: Extract all original feature vectors from the original memory tensor before the current round, and calculate the mean vector and covariance matrix; if the current round is less than the preset minimum number of rounds, skip the detection. If the covariance matrix is not invertible, then add a regularization term; Set a base window length and dynamically adjust the detection window length according to the current round, so that the detection window length increases with the number of rounds but does not exceed the current total number of rounds; Based on the original feature vector of the current round, select historical memory units whose timestamps fall within the detection window; Calculate the Mahalanobis distance between the original feature vector and the mean vector for each selected historical memory unit; The historical memory units whose Mahalanobis distance is greater than a preset distance threshold are marked as missing candidate units; Sort all missing candidate units in ascending order of timestamp, and merge missing candidate units with consecutive timestamps into a missing region; For each missing region, record the starting round, the ending round, and the corresponding set of original feature vectors, and output the set of missing regions.
5. The AI-driven proactive care intelligent interaction method based on long-term memory and multi-turn dialogue as described in claim 3, characterized in that, After outputting the set of missing regions and before extracting entities, the following is also included: For each missing region in the set of missing regions, a memory enhancement operation based on linear interpolation is performed to generate a supplementary memory vector using the original feature vectors of the previous and next rounds of the missing region, and insert it into the list of historical memory units. The weighted memory tensor is regenerated based on the updated list of historical memory units to obtain the enhanced weighted memory tensor. The missing regions that have been filled are filtered based on the degree of deviation between the supplementary memory vector and the historical distribution, resulting in an updated set of missing regions.
6. The AI-driven proactive care intelligent interaction method based on long-term memory and multi-turn dialogue as described in claim 3, characterized in that, The extracted entities, stored in the session layer dictionary, include: From the dialogue text of the most recent fixed number of rounds, entities are extracted using named entity recognition technology, and the number of rounds in which each entity appears and its type label are recorded; Extract the topic tag sequence from the first round to the current round; The session layer dictionary stores entity names, occurrence rounds, and type labels. The dictionary key is the combination of entity name and occurrence round, and the dictionary value is the type label.
7. The AI-driven proactive care intelligent interaction method based on long-term memory and multi-turn dialogue as described in claim 6, characterized in that, Before inputting the decision model, the following is also included: Extract all weighted feature vectors and perform average pooling along the time dimension to obtain the memory vector; Each tag in the topic tag sequence is input into the topic embedding layer to obtain the corresponding topic embedding vector sequence; The topic is embedded into a vector sequence and input into a gated loop unit. The hidden state at the last moment is taken as the original path encoding. The original path code is dimensionally transformed by a learnable fully connected layer to obtain the aligned path code. Based on the number of times entities appear in the session layer dictionary, the corresponding weighted feature vector is extracted from the current weighted memory tensor and fused with the aligned path encoding to generate a joint encoding vector in real time. Max pooling is performed on the real-time generated joint encoded vector to obtain the session vector; For the set of missing regions, if it is not empty, the original feature vectors in each region are averaged and then max pooled to obtain the missing vector; otherwise, the missing vector is set as the zero vector.
8. The AI-driven proactive care intelligent interaction method based on long-term memory and multi-turn dialogue as described in claim 7, characterized in that, The decision-making model includes: The memory vector, session vector, and missing vector are concatenated into a complete state vector in the order of their beginning and end. The state vector is input into the decision network; The decision network consists of two fully connected layers and a softmax output layer, which outputs the probability of each predefined question intent and selects the intent corresponding to the highest probability.
9. The AI-driven proactive care intelligent interaction method based on long-term memory and multi-turn dialogue as described in claim 8, characterized in that, The output proactive care question text includes: Retrieve the corresponding question template from the knowledge base based on the selected intent; The question template contains slots to be filled; Based on the predefined intent-entity type mapping table, the system searches the session layer dictionary for an entity value that matches the entity type corresponding to the intent to fill the slot; if there is no corresponding entity, a default word is filled in, and the proactive care question text is generated and output.
10. The AI-driven proactive care intelligent interaction method based on long-term memory and multi-turn dialogue according to claim 4, characterized in that, The dynamic adjustment of the detection window length includes setting the detection window length to the base window length plus the integer part of the current round divided by a preset constant.
Citation Information
Patent Citations
Method for extracting and optimizing large model memory based on historical dialogue entities
CN119719290A
Man-machine interaction method and system based on large language model
CN121900620A
Context understanding and memory management system and method in large-model multi-round dialogues
CN121919315A