A method, system, device, and medium for memory management in long-term health conversation scenarios.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-23
- Publication Date
- 2026-08-14
AI Technical Summary
[0008]本申请的目的是提供一种长期健康对话场景的记忆管理方法、系统、设备及介质,以解决长期健康对话场景中记忆数据冗余、更新效率低、响应延迟高、医疗高价值信息易丢失的技术问题
[0021]本申请提供了一种长期健康对话场景的记忆管理方法、系统、设备及介质,本申请通过对历史对话数据进行感知,提取对话意图特征、健康需求特征、交互频次特征、医疗实体特征和健康时间特征等,计算价值量化得分,根据价值量化得分对长期健康记忆(对话记忆单元)进行分层压缩处理,实现高价值核心记忆无损保留、冗余信息精准剔除;同时采用独立于对话响应进程的异步批量处理模式,实现新增健康记忆的增量更新,避免记忆更新与对话响应的资源竞争。本申请能够在保证健康记忆准确性和连贯性的前提下,大幅降低系统存储开销与计算量、缩短对话响应延迟,适配医疗智能体与用户的长期多轮健康交互场景,支撑医疗智能体的持续个性化演化。
Smart Images

Figure CN122575609A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of intelligent dialogue and medical memory management technology, and in particular to a memory management method, system, device and medium for long-term health dialogue scenarios. Background Technology
[0002] With the deep application of large language models in the healthcare field, medical intelligent agents need to engage in long-term, multi-round health dialogues with users to continuously accumulate personalized long-term memory information such as users' medical history, medication records, symptom changes, health needs, and medical order execution, thereby achieving personalized health services that "understand users better the more they are used".
[0003] Current dialogue memory management technologies are mainly divided into two categories, both of which have a core deficiency in adapting to long-term healthy dialogue scenarios: The first type is the full context memory scheme, which inputs all historical dialogue content into the context window of the large model. Although this scheme ensures the integrity of the memory, the amount of memory data increases linearly with the number of dialogue rounds, causing the inference computation overhead of the large model to increase exponentially, and the dialogue response latency to increase significantly, even exceeding the maximum limit of the context window. It is completely unsuitable for long-term healthy interaction scenarios that last for months or years.
[0004] The second category is general dialogue memory compression schemes, which compress historical dialogues and reduce data volume through methods such as vector quantization, text summarization, and keyword extraction. For example, existing publicly available technologies achieve compression by clustering and summarizing historical dialogues, or by designing dynamic compression mechanisms based on the forgetting curve. However, these schemes are designed for general casual conversation and customer service dialogue scenarios, and do not consider the specific characteristics and medical compliance requirements of medical and health dialogues. They cannot accurately distinguish between high-value core medical information and non-core redundant information. In practical applications, it is very easy for core medical information related to user safety, such as allergy history, chronic disease history, medication contraindications, and history of serious illnesses, to be compressed and lost, while redundant small talk and non-healthy casual information are retained. This completely fails to meet the stringent requirements of medical intelligent agents for memory accuracy, security, and compliance.
[0005] Meanwhile, existing memory update schemes generally adopt a synchronous update mode, that is, after each round of dialogue, the memory update and compression operation is immediately triggered. This operation competes with the dialogue response reasoning process for computing resources such as CPU (Central Processing Unit) and memory. In long-term, multi-round dialogues, as the memory volume continues to increase, the memory update time increases linearly, further aggravating the dialogue response delay, seriously affecting the user's real-time interactive experience, and even causing the dialogue system to freeze or time out.
[0006] Furthermore, existing solutions do not dynamically adapt to the specific state characteristics of medical dialogues, such as the timeliness of health memories, the dynamic changes in users' health needs, and the frequency of interactions on the same health topic. The temporal coherence and logical consistency of long-term memories are insufficient, which cannot support the continuous personalized evolution of medical intelligent agents in response to users' health conditions, and makes it difficult to achieve the service goal of long-term health management.
[0007] In summary, existing technologies cannot simultaneously solve the technical problems of redundant memory data, low update efficiency, high response latency, and easy loss of high-value medical information in long-term health dialogue scenarios. There is an urgent need for a dedicated memory compression and update solution adapted to medical and health scenarios. Summary of the Invention
[0008] The purpose of this application is to provide a memory management method, system, device, and medium for long-term health dialogue scenarios, in order to solve the technical problems of memory data redundancy, low update efficiency, high response latency, and easy loss of high-value medical information in long-term health dialogue scenarios.
[0009] To achieve the above objectives, this application provides the following solution.
[0010] Firstly, this application provides a memory management method for long-term health conversation scenarios, including: The historical dialogue data between the user and the medical intelligent agent is preprocessed and dialogue state features are extracted to obtain a historical dialogue state feature set. The historical dialogue state feature set includes the dialogue state features of at least one dialogue memory unit in each round of historical dialogue. The dialogue state features include dialogue intent features, health need features, interaction frequency features, medical entity features, and health time features. The memory value of each dialogue memory unit is evaluated based on its dialogue state characteristics, and a quantitative value score is obtained for each dialogue memory unit. Based on the value quantification score of each dialogue memory unit, each memory unit is compressed in layers and stored in a memory layered storage architecture; the memory layered storage architecture includes a core memory layer, an auxiliary memory layer, and a temporary memory layer; During real-time dialogue response, based on the current dialogue content input by the user, matching memory content is retrieved from the hierarchical memory storage architecture, and a dialogue response adapted to the user's health status is generated using a large language model; the memory content is obtained by compressing the dialogue memory unit. When a round of real-time dialogue is completed, an asynchronous batch incremental update mode is adopted to compress the current dialogue data in layers and store it in layers in a memory-layered storage architecture.
[0011] Optionally, the historical dialogue data between the user and the medical intelligent agent is preprocessed and dialogue state features are extracted to obtain a set of historical dialogue state features, specifically including: The historical dialogue data is cleaned by removing invalid characters, duplicate expressions, and modal particles to obtain the cleaned historical dialogue data. A pre-trained medical named entity recognition model was used to identify medical entities in each round of historical dialogue in the cleaned historical dialogue data. By combining the medical entities identified in each round of historical dialogue, each round of historical dialogue in the cleaned historical dialogue data is split and labeled to obtain at least one dialogue memory unit for each round of historical dialogue; the dialogue memory unit includes: user ID, session ID, time sequence mark, dialogue text and medical entity list.
[0012] Optionally, the memory value of each dialogue memory unit is evaluated based on its dialogue state characteristics to obtain a quantitative value score for each dialogue memory unit, specifically including: Using a memory value assessment model, the memory value of each dialogue memory unit is assessed based on its dialogue state characteristics, and a quantitative value score is obtained for each dialogue memory unit. The memory value assessment model is as follows: ; in, Quantify the value of the dialogue memory unit. , , , , The preset weighting coefficients, Confidence score for dialogue intent features. The urgency of health needs is scored. The normalized score for interaction frequency features, Weighted scores for medical entity features. The timeliness score for health time characteristics.
[0013] Optionally, based on the value quantification score of each dialogue memory unit, each memory unit is hierarchically compressed and stored in a hierarchical memory storage architecture, specifically including: When the value quantification score of the dialogue memory unit is greater than or equal to the first threshold, the dialogue memory unit is compressed using a medical information lossless compression strategy, and the compressed memory content is stored in the core memory layer. When the value quantification score of the dialogue memory unit is greater than the second threshold and less than the first threshold, the dialogue memory unit is compressed using a compression strategy that combines lossy compression and semantic vector representation, and the compressed memory content is stored in the auxiliary memory layer. When the value quantification score of the dialogue memory unit is less than or equal to the second threshold, the dialogue memory unit is compressed using a short-cycle semantic vector caching compression strategy, and the compressed memory content is stored in the temporary memory layer.
[0014] Optionally, based on the current dialogue content input by the user, matching memory content is retrieved from the hierarchical memory storage architecture, and a dialogue response adapted to the user's health status is generated using a large language model, specifically including: Perform semantic parsing and medical entity recognition on the current dialogue content to generate a retrieval feature vector; Retrieve memory content that semantically matches the retrieved feature vector from the hierarchical memory storage architecture in the order of core memory layer, auxiliary memory layer, and temporary memory layer; All memory contents that semantically match the retrieved feature vector are reordered and filtered to generate a memory context that conforms to the context window constraint; The memory context and the current dialogue content are input into the large language model to generate a dialogue response that is adapted to the user's health status.
[0015] Optionally, an asynchronous batch incremental update mode is adopted to perform layered compression on the current dialogue data and store it in a layered memory storage architecture, specifically including: Preprocess the current dialogue data and extract dialogue state features to obtain at least one temporary dialogue memory unit of the current dialogue data. Store the temporary dialogue memory unit in the cache queue and monitor the idle status of system computing resources and the length of the cache queue in real time. When the preset triggering conditions are met, each temporary dialogue memory unit in the cache queue is evaluated for memory value, compressed in layers, and stored in layers to the memory layered storage architecture. Automatic checks are performed on the consistency and temporal logical coherence of medical entities in the core memory layer, conflicting medical entities are identified and corrected, and a memory update log is generated.
[0016] Optionally, the preset triggering condition is a first triggering condition, a second triggering condition, or a third triggering condition; the first triggering condition is: the idle rate of the system's computing resources is higher than the idle rate threshold, and the number of temporary memory units in the cache queue reaches a preset number; the second triggering condition is: the current time is during the low period of system computing resource utilization, and there are unprocessed temporary memory units in the cache queue; the third triggering condition is: the time elapsed since the completion of the real-time dialogue reaches a preset time.
[0017] Secondly, this application provides a memory management system for long-term health dialogue scenarios, which is applied to the aforementioned memory management method for long-term health dialogue scenarios. The memory management system for long-term health dialogue scenarios includes: The dialogue preprocessing and state awareness module is used to preprocess the historical dialogue data between the user and the medical intelligent agent and extract dialogue state features to obtain a historical dialogue state feature set. The historical dialogue state feature set includes the dialogue state features of at least one dialogue memory unit in each round of historical dialogue. The dialogue state features include dialogue intent features, health need features, interaction frequency features, medical entity features, and health time features. The memory value quantification assessment module is used to assess the memory value of the dialogue state characteristics of each dialogue memory unit and obtain a value quantification score for each dialogue memory unit. The hierarchical compression processing module is used to compress each memory unit in a hierarchical manner according to the value quantification score of each dialogue memory unit, and store them in a hierarchical memory storage architecture; the hierarchical memory storage architecture includes a core memory layer, an auxiliary memory layer and a temporary memory layer; The asynchronous incremental update module is used to retrieve matching memory content from the memory hierarchical storage architecture based on the current dialogue content input by the user during real-time dialogue response, and generate a dialogue response adapted to the user's health status using a large language model; the memory content is obtained by compressing the dialogue memory unit. The memory retrieval and reuse module is used to perform layered compression of the current dialogue data and store it in a layered memory storage architecture when a round of real-time dialogue is completed, using an asynchronous batch incremental update mode.
[0018] Thirdly, this application provides a computer device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the memory management method for the above-described long-term health dialogue scenario.
[0019] Fourthly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the memory management method for the long-term health dialogue scenario described above.
[0020] According to the specific embodiments provided in this application, this application has the following technical effects.
[0021] This application provides a method, system, device, and medium for memory management in long-term health dialogue scenarios. By sensing historical dialogue data, this application extracts features such as dialogue intent, health needs, interaction frequency, medical entity characteristics, and health time characteristics, calculates a value quantification score, and performs layered compression processing on long-term health memories (dialogue memory units) based on the value quantification score. This achieves lossless retention of high-value core memories and precise removal of redundant information. Simultaneously, it employs an asynchronous batch processing mode independent of the dialogue response process to achieve incremental updates of new health memories, avoiding resource competition between memory updates and dialogue responses. This application can significantly reduce system storage overhead and computational load, shorten dialogue response latency, and adapt to long-term, multi-turn health interaction scenarios between medical intelligent agents and users, supporting the continuous personalized evolution of medical intelligent agents, while ensuring the accuracy and continuity of health memories. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 This is a flowchart illustrating a memory management method for a long-term health dialogue scenario provided in an embodiment of this application.
[0024] Figure 2 This is a schematic diagram illustrating the principle of a memory management method for a long-term health dialogue scenario provided in one embodiment of this application.
[0025] Figure 3 This is a logical schematic diagram of a three-level memory hierarchical compression process provided in an embodiment of this application.
[0026] Figure 4 A flowchart illustrating the asynchronous batch incremental update scheduling process provided in one embodiment of this application.
[0027] Figure 5 This is a schematic diagram of the structure of a memory management system for a long-term health dialogue scenario provided in an embodiment of this application.
[0028] Figure 6 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0029] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0030] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0031] In one exemplary embodiment, a memory management method for long-term health dialogue scenarios is provided, such as... Figure 1 As shown, it includes the following steps 101-105.
[0032] Step 101: Preprocess and extract dialogue state features from the historical dialogue data between the user and the medical intelligent agent to obtain a historical dialogue state feature set; the historical dialogue state feature set includes the dialogue state features of at least one dialogue memory unit in each round of historical dialogue; the dialogue state features include dialogue intent features, health need features, interaction frequency features, medical entity features, and health time features. Step 102: Evaluate the memory value of the dialogue state features of each dialogue memory unit to obtain a value quantification score for each dialogue memory unit. Step 103: Based on the value quantification score of each dialogue memory unit, each memory unit is compressed in layers and stored in a memory layered storage architecture; the memory layered storage architecture includes a core memory layer, an auxiliary memory layer, and a temporary memory layer. Step 104: During real-time dialogue response, based on the current dialogue content input by the user, retrieve matching memory content from the memory hierarchical storage architecture, and use a large language model to generate a dialogue response adapted to the user's health status; the memory content is obtained by compressing the dialogue memory unit. Step 105: Upon completion of a round of real-time dialogue, an asynchronous batch incremental update mode is adopted to perform layered compression on the current dialogue data and store it in a layered memory storage architecture.
[0033] Implementing steps 101-105 above can achieve the following technical effects.
[0034] Steps 101-105 above, while ensuring the accuracy and consistency of health memories, significantly reduce system storage overhead and computational load, shorten dialogue response latency, adapt to long-term, multi-round health interaction scenarios between medical intelligent agents and users, and support the continuous personalized evolution of medical intelligent agents.
[0035] In the following exemplary descriptions, the example will be a long-term health management dialogue scenario specifically applied to users with type 2 diabetes. The user will have a long-term, multi-round health dialogue with the medical AI agent for 6 months, including daily blood glucose monitoring data reporting, medication consultation, symptom complaints, diet and exercise consultation, follow-up visit reminders and other health-related dialogues, as well as a small amount of non-healthy casual conversation.
[0036] In another exemplary embodiment, such as Figure 2 As shown, step 101 above is used for medical dialogue data preprocessing and dialogue state feature extraction, that is, preprocessing the historical dialogue data between the user and the medical intelligent agent, identifying and extracting dialogue state features specific to medical dialogue, which can be achieved by the following steps 201-203.
[0037] Step 201: Clean the historical dialogue data by removing invalid characters, duplicate expressions, and modal particles to obtain cleaned historical dialogue data.
[0038] For example, the original dialogue text is cleaned to remove invalid characters, repeated modal particles (such as "ah," "oh," "um"), and meaningless repetitive expressions. Step 202: Use a pre-trained medical named entity recognition model to identify medical entities in each round of historical dialogue in the cleaned historical dialogue data. These medical entities include diseases, medications, symptoms, signs, examination results, medical orders, allergy history, and medical history. In this example, the clinical importance level of each medical entity is also labeled.
[0039] For example, a pre-trained Chinese medical NER (Named Entity Recognition) model (based on the BERT (Bidirectional Encoder Representations from Transformers) architecture, fine-tuned on a diabetes medical dialogue dataset) was used to identify medical entities in the dialogue text, including: type 2 diabetes (disease entity, clinical importance level 1), metformin (drug entity, clinical importance level 1), fasting blood glucose (examination indicator entity, clinical importance level 2), dizziness and fatigue (symptom entity, clinical importance level 2), insulin allergy (allergy history entity, clinical importance level 1), etc., and the clinical importance level of each entity was labeled.
[0040] Step 203: Combining the identified medical entities from each round of historical dialogue, each round of historical dialogue in the cleaned historical dialogue data is split and labeled to obtain at least one dialogue memory unit for each round of historical dialogue. The dialogue memory unit includes: user ID, session ID, time sequence marker, dialogue text, and a list of medical entities. That is, each round of historical dialogue is time-series labeled, session ID bound, and associated with a unique user identifier, completing the structured processing of the historical dialogue data and generating the smallest granularity dialogue memory unit.
[0041] For example, each round of dialogue is time-stamped (accurate to the second), bound to a session ID and associated with a unique user ID, and each round of dialogue is broken down into the smallest granularity of dialogue memory units.
[0042] In another exemplary embodiment, the aforementioned dialogue intent features include classification features for health consultation, medication reminders, symptom complaints, follow-up visit reminders, and non-healthy casual conversation, as well as confidence scores for the corresponding intents; The aforementioned health needs characteristics include the dimensional characteristics of the urgency of health needs, chronic disease management attributes, daily health attributes, and rehabilitation follow-up attributes, as well as the corresponding clinical importance scores; for example, the urgency score of the chief complaint of hypoglycemia symptoms is 95, and the chronic disease management attribute score of daily blood glucose reporting is 90.
[0043] The aforementioned interaction frequency characteristics include the temporal characteristics of dialogue frequency, interaction cycle, and most recent interaction time for the same health topic. For example, the dialogue frequency, most recent interaction time, and interaction cycle for the same health topic (such as blood glucose monitoring and metformin use) are statistically analyzed, normalized, and an interaction frequency score of 0-100 is obtained.
[0044] The aforementioned medical entity characteristics include the clinical importance level, entity relevance, and weighted characteristics of the frequency of occurrence of the identified medical entities; for example, the weight score for a history of insulin allergy is 100, and the weight score for a single dietary consultation is 30. Health time characteristics include the time of occurrence of health events, the clinical validity period, and the timeliness characteristics of event update frequency. For example, the timeliness score of a diagnosis of type 2 diabetes is 100 (permanently valid), while the timeliness score of a single cold symptom decays over time.
[0045] In another exemplary embodiment, such as Figure 2 As shown, step 102 above is used for quantitative evaluation of memory value based on dialogue state features, that is, to construct a memory value evaluation model specific to the medical and health scenario, input the extracted dialogue state features into the memory value evaluation model, and output the value quantification score of each dialogue memory unit. The memory value evaluation model is as follows: ; in, The value of each dialogue memory unit is quantified and scored, ranging from 0 to 100. , , , , The preset weighting coefficients, and , Confidence score for dialogue intent features. The urgency of health needs is scored. The normalized score for interaction frequency features, Weighted scores for medical entity features. The timeliness score represents the health time characteristic, with each score ranging from 0 to 100.
[0046] In another exemplary embodiment, the above-described , , , , The system can be pre-trained and optimized using a medical and health dialogue annotation dataset, and can be dynamically adjusted according to different medical sub-scenarios. For example, the weight coefficients are pre-trained and optimized using a diabetes medical dialogue annotation dataset and confirmed by clinical endocrinology experts. The weights of core medical entities and dialogue intent are the highest, ensuring the value priority of core medical information. The scores of each feature are all between 0 and 100, and the final value quantification score V ranges from 0 to 100.
[0047] For example, the memory unit in which a user states "I have a history of insulin allergy and previously used metformin to lower blood sugar" has an intent matching score of I=98, a health need importance score of N=95, an interaction frequency score of F=80, a medical entity weight score of W=100, a timeliness score of T=100, and a final value quantification score of V=97.4. The user's non-healthy casual conversation memory unit, "The weather was nice today, so I went for a walk," has an intent matching score of I=10, a health need importance score of N=0, an interaction frequency score of F=5, a medical entity weight score of W=0, a timeliness score of T=10, and a final value quantification score of V=3.75.
[0048] In another exemplary embodiment, such as Figure 2 and Figure 3 As shown, step 103 above is used for hierarchical compression processing based on the value quantification result, that is, to construct a three-level memory hierarchical storage architecture, and to process memory units at different levels using differentiated compression strategies according to the value quantification score of the memory unit. This can be achieved by the following steps 301-303.
[0049] Step 301: When the value quantification score of the dialogue memory unit is greater than or equal to the first threshold, the dialogue memory unit is compressed using a medical information lossless compression strategy, and the compressed memory content is stored in the core memory layer. This medical information lossless compression strategy can retain complete medical entities, temporal information and logical associations, remove only redundant text content, and store it permanently without an expiration and deletion mechanism.
[0050] For example, dialogue memory units with a value quantification score of ≥80 are classified into the core memory layer, including the user's core medical information such as type 2 diabetes history, insulin allergy history, metformin medication history, and chronic complications history.
[0051] Step 302: When the value quantification score of the dialogue memory unit is greater than the second threshold and less than the first threshold, the dialogue memory unit is compressed using a compression strategy that combines lossy compression and semantic vector representation, and the compressed memory content is stored in the auxiliary memory layer. This compression strategy that combines lossy compression and semantic vector representation can retain core health information, set a graded validity period, and automatically downgrade or clear the memory after the expiration.
[0052] For example, dialogue memory units with a value quantification score between 30 and 80 are classified into the auxiliary memory layer. These include users' daily blood glucose monitoring data, periodic dizziness and fatigue symptoms, dietary and exercise consultation records, and single follow-up visit reminders, among other periodic health information. A compression strategy combining lossy compression and semantic vector representation is employed. A structured memory summary (e.g., "2026-04-01, user's fasting blood glucose 7.2 mmol / L, no discomfort symptoms") is generated through a fine-tuned medical model. Simultaneously, a corresponding 768-dimensional high-dimensional semantic vector is generated through a medical embedding model, preserving core health information, achieving a text compression rate of over 70%. Tiered validity periods are set: blood glucose monitoring data is valid for 1 year, and symptom records are valid for 3 months, automatically downgrading or being deleted upon expiration.
[0053] Step 303: When the value quantification score of the dialogue memory unit is less than or equal to the second threshold, the dialogue memory unit is compressed using a short-cycle semantic vector caching compression strategy, and the compressed memory content is stored in a temporary memory layer. This short-cycle semantic vector caching compression strategy only retains the high-dimensional semantic vectors of the dialogue, sets a fixed short caching period, and automatically clears the cache when it expires.
[0054] Dialogue memory units with a value quantification score ≤30 are classified into the temporary memory layer, including users' unhealthy casual conversations and small talk without substantial health information. A short-cycle semantic vector caching and compression strategy is adopted, retaining only the 768-dimensional high-dimensional semantic vector of the dialogue, without storing the original text, and setting a fixed 7-day cache period, which is automatically cleared upon expiration, significantly reducing storage overhead.
[0055] In another exemplary embodiment, the first threshold and the second threshold described above are determined by combining grid search with clinical medical expert review.
[0056] In another exemplary embodiment, such as Figure 2 As shown, step 104 above is used for the retrieval and reuse of compressed memory. That is, during real-time dialogue response, based on the dialogue content input by the current user, the matching memory content is retrieved from the three-level memory hierarchical storage architecture, and input into the large language model to generate a dialogue response that is adapted to the user's health status. This can be achieved by the following steps 401-404.
[0057] Step 401: Perform semantic parsing and medical entity recognition on the current dialogue content to generate a retrieval feature vector; Step 402: Retrieve memory content that semantically matches the retrieved feature vector from the memory hierarchical storage architecture in the order of core memory layer, auxiliary memory layer and temporary memory layer; Step 403: Reorder and filter all memory contents that semantically match the retrieved feature vector to generate a memory context that conforms to the context window constraint; Step 404: Input the memory context and the current dialogue content into the large language model to generate a dialogue response that is adapted to the user's health status.
[0058] For example, taking the long-term health management dialogue scenario of a type 2 diabetes user as an example, step 104 above is implemented by performing the following steps.
[0059] The user's current input is "I've been feeling a bit dizzy these past two days, is it because of the medication?". First, the input text is semantically parsed and medical entity is identified to recognize the "dizziness" symptom entity and the medication-related intent, generating a retrieval feature vector. Following the priority order of core memory layer first, auxiliary memory layer second, and temporary memory layer last, memory content that semantically matches the retrieved feature vector is retrieved from the three-level memory storage architecture through cosine similarity calculation. This includes the history of type 2 diabetes, metformin medication history, and insulin allergy history in the core memory layer, and the blood glucose monitoring data of the past month and recent dizziness symptom records in the auxiliary memory layer. The retrieved memory content is reordered and filtered to generate a memory context that conforms to the constraints of the large model context window. This context is then input into the medical language model and combined with the current user input to generate an accurate response that is tailored to the user's health condition, enabling efficient reuse of long-term health memories.
[0060] In another exemplary embodiment, such as Figure 2 and Figure 4As shown, step 105 above is used for asynchronous batch incremental update scheduling, that is, setting up a memory update background process independent of the dialogue response reasoning process, adopting the asynchronous batch incremental update mode for new dialogue memory, completing the hierarchical compression and hierarchical merging of new memory, and performing memory continuity verification at the same time, which can be implemented by the following steps 501-503.
[0061] Step 501: Preprocess the current dialogue data and extract dialogue state features to obtain at least one temporary dialogue memory unit of the current dialogue data. Store the temporary dialogue memory unit in the cache queue and monitor the idle status of system computing resources and the length of the cache queue in real time.
[0062] Step 501 is used for incremental memory capture, that is, after each round of real-time dialogue is completed, the newly added dialogue content is captured, a temporary memory unit is generated and stored in the cache queue, without triggering real-time full memory update.
[0063] Step 502: When the preset triggering conditions are met, each temporary dialogue memory unit in the cache queue performs memory value evaluation, hierarchical compression, and hierarchical storage to the memory hierarchical storage architecture.
[0064] Step 502 is used for asynchronous process scheduling and incremental update processing. Asynchronous process scheduling means that the memory update background process runs independently of the dialogue response inference process, monitors the idle status of system computing resources and the length of the cache queue in real time, and initiates batch update operations when preset trigger conditions are met. Incremental update processing means that only newly added temporary memory units in the cache queue are processed sequentially, including dialogue state feature extraction, memory value quantification and evaluation, and hierarchical compression. The processed memory units are then merged into the corresponding level of memory storage architecture, without the need to reprocess the entire historical memory.
[0065] The aforementioned preset triggering conditions are either the first triggering condition, the second triggering condition, or the third triggering condition; the first triggering condition is: the idle rate of the system's computing power resources is higher than the idle rate threshold, and the number of temporary memory units in the cache queue reaches a preset number; the second triggering condition is: the current time is during the low period of system computing power resource utilization (e.g., 2:00 AM - 5:00 AM), and there are unprocessed temporary memory units in the cache queue; the third triggering condition is: the time elapsed since the completion of the real-time dialogue reaches a preset time.
[0066] Step 503: Perform automatic verification of consistency and temporal logical coherence of medical entities in the core memory layer, identify and correct conflicting medical entities, and generate a memory update log.
[0067] Step 503 is used for memory consistency verification. That is, after the incremental merging is completed, the consistency of medical entities and the temporal logical consistency of the core memory layer are automatically verified, conflicting memory information is identified and corrected, and a memory update log is generated.
[0068] For example, taking a long-term health management dialogue scenario for type 2 diabetes users as an example, step 105 above, by setting up a memory update background process independent of the dialogue response reasoning process, adopts an asynchronous batch incremental update mode for newly added dialogue memories, specifically including: Incremental memory capture: After each round of real-time dialogue is completed, the newly added dialogue content is immediately captured, a temporary memory unit is generated and stored in the Redis cache queue, without triggering a real-time full memory update, ensuring that all computing resources of the dialogue response process are used for real-time dialogue inference, and there is no resource preemption.
[0069] Asynchronous process scheduling: The memory update background process is an independent daemon process that monitors the system's CPU and memory resource idle rates, as well as the length of the cache queue, in real time. In this embodiment, the preset trigger conditions are: the system CPU idle rate is higher than 60%, and the number of temporary memory units in the cache queue reaches 10; or a scheduled update is triggered at 2:00 AM daily (system off-peak period); or an incremental update for the current session is triggered 5 minutes after the current session ends. When any of the trigger conditions are met, a batch update operation is initiated.
[0070] Incremental update processing: For newly added temporary memory units in the cache queue, the dialogue state feature extraction in step S1, the memory value quantification evaluation in step S2, and the hierarchical compression processing in step S3 are executed in sequence. The processed memory units are merged into the corresponding user's three-level memory storage architecture. There is no need to recalculate and process the user's full historical memory, which greatly reduces the computational overhead.
[0071] Memory consistency verification: After incremental merging is completed, the consistency of medical entities and the sequential logical consistency of the core memory layer are automatically verified. For example, when a user adds a memory unit "I am now using dapagliflozin to lower blood sugar", the medication records in the core memory layer are automatically verified, the medication history sequence is updated, and medication information conflicts are avoided. If contradictory core medical information is identified, it is automatically marked and manual review is triggered. At the same time, a complete memory update log is generated to meet the requirements for medical data compliance and traceability.
[0072] In this embodiment, during a user's long-term health dialogue over 6 months, the amount of memory data stored is reduced by 92%, the retention rate of core medical information is 100%, the average dialogue response latency is reduced from 1200ms in the original solution to 210ms, the memory update time is reduced by 78%, there are no memory conflicts or information loss issues, it is fully adapted to the long-term health management dialogue scenario, and realizes the medical intelligent agent's continuous and accurate perception of the user's health status and the evolution of personalized services.
[0073] Based on the same inventive concept, this application also provides a memory management system for long-term health dialogue scenarios, used to implement the memory management method for long-term health dialogue scenarios described above. The solution provided by this device is similar to the implementation described in the above method; therefore, the specific limitations of one or more embodiments of the memory management system for long-term health dialogue scenarios provided below can be found in the limitations of the memory management method for long-term health dialogue scenarios described above, and will not be repeated here.
[0074] In one exemplary embodiment, a memory management system for long-term health conversation scenarios is provided, such as... Figure 5 As shown, it includes: The dialogue preprocessing and state awareness module is used to preprocess and extract dialogue state features from the historical dialogue data between the user and the medical intelligent agent to obtain a historical dialogue state feature set. The historical dialogue state feature set includes the dialogue state features of at least one dialogue memory unit in each round of historical dialogue. The dialogue state features include dialogue intent features, health need features, interaction frequency features, medical entity features, and health time features. That is, the medical dialogue data is preprocessed to identify and extract dialogue state features specific to medical dialogues.
[0075] The memory value quantification assessment module is used to assess the memory value of each dialogue memory unit based on its dialogue state characteristics, and obtain a value quantification score for each dialogue memory unit; that is, to build a memory value assessment model specifically for the medical and health scenario and output the value quantification score for each dialogue memory unit.
[0076] The hierarchical compression processing module is used to compress each memory unit in a hierarchical manner according to the value quantification score of each dialogue memory unit, and store them in a hierarchical memory storage architecture. The hierarchical memory storage architecture includes a core memory layer, an auxiliary memory layer, and a temporary memory layer. That is, a three-level hierarchical memory storage architecture is constructed, and a differentiated compression strategy is executed on memory units at different levels according to the value quantification score.
[0077] The memory retrieval and reuse module is used to retrieve matching memory content from the hierarchical memory storage architecture based on the current dialogue content input by the user during real-time dialogue response, and to generate a dialogue response adapted to the user's health status using a large language model; the memory content is obtained by compressing the dialogue memory unit; that is, during real-time dialogue response, the matching compressed memory content is retrieved to support the generation of dialogue responses by the large language model.
[0078] The asynchronous incremental update module is used to perform asynchronous batch incremental update on the current dialogue data in a layered compression mode when a round of real-time dialogue is completed, and store the data in a layered memory storage architecture. That is, it has a built-in memory update background process that is independent of the dialogue response reasoning process, which is used to perform asynchronous batch incremental updates of new memories and memory continuity verification.
[0079] In another exemplary embodiment, such as Figure 5 As shown, the system also includes a hierarchical storage module, which is used to implement hierarchical storage and read / write management of the core memory layer, auxiliary memory layer, and temporary memory layer.
[0080] In one exemplary embodiment, a computer device is provided, which may be a server or a terminal, and its internal structure diagram may be as follows. Figure 6 As shown, this computer device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and databases. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communication with external terminals via a network connection. When the computer program is executed by the processor, it implements a memory management method for a long-term healthy dialogue scenario.
[0081] Those skilled in the art will understand that Figure 6 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0082] In one exemplary embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.
[0083] In one exemplary embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.
[0084] According to the specific embodiments provided in this application, this application has the following technical effects.
[0085] This application designs a dedicated dialogue state perception and memory value assessment mechanism for medical and health dialogue scenarios, accurately distinguishing between high-value medical information and redundant information. Through a three-level hierarchical differentiated compression strategy, it achieves lossless preservation of core medical memories and precise removal of redundant information. While reducing the redundancy of memory data by more than 90%, the retention rate of core medical information reaches 100%, solving the technical problems of existing general compression solutions that make medical information easy to be lost and unable to meet medical compliance requirements.
[0086] This application adopts an asynchronous batch incremental update mechanism that is independent of the dialogue response reasoning process. It only processes newly added memories and does not need to repeatedly calculate the entire historical memory. This completely avoids the competition of computing resources between memory updates and dialogue responses, reduces dialogue response latency by more than 80%, and improves memory update efficiency by more than 70%. It completely solves the technical problems of low update efficiency and high response latency in long-term multi-turn dialogues.
[0087] The technical solution of this application deeply integrates algorithm features with the computing power scheduling and storage management technology features of computer systems, thereby achieving a significant improvement in the storage performance, processing speed and response efficiency of computer systems in long-term dialogue scenarios of medical intelligent agents.
[0088] This application ensures the temporal continuity of long-term health memories and consistency with medical entities through a memory continuity verification mechanism, avoiding memory conflicts and drifts in long-term dialogues. It is suitable for long-term health interaction scenarios lasting for months or years, and can support medical intelligent agents to achieve continuous personalized health service evolution, possessing strong practicality and implementation value.
[0089] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0090] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM).
[0091] The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0092] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0093] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. Furthermore, those skilled in the art will recognize that, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A memory management method for long-term health dialogue scenarios, characterized in that, include: The historical dialogue data between the user and the medical intelligent agent is preprocessed and dialogue state features are extracted to obtain a historical dialogue state feature set. The historical dialogue state feature set includes the dialogue state features of at least one dialogue memory unit in each round of historical dialogue. The dialogue state features include dialogue intent features, health need features, interaction frequency features, medical entity features, and health time features. The memory value of each dialogue memory unit is evaluated based on its dialogue state characteristics, and a quantitative value score is obtained for each dialogue memory unit. Based on the value quantification score of each dialogue memory unit, each memory unit is compressed in layers and stored in a memory hierarchical storage architecture. The memory hierarchical storage architecture includes a core memory layer, an auxiliary memory layer, and a temporary memory layer; During real-time dialogue response, based on the current dialogue content input by the user, matching memory content is retrieved from the hierarchical memory storage architecture, and a dialogue response adapted to the user's health status is generated using a large language model; the memory content is obtained by compressing the dialogue memory unit. When a round of real-time dialogue is completed, an asynchronous batch incremental update mode is adopted to compress the current dialogue data in layers and store it in layers in a memory-layered storage architecture.
2. The memory management method for long-term health dialogue scenarios according to claim 1, characterized in that, The historical dialogue data between the user and the medical intelligent agent is preprocessed and dialogue state features are extracted to obtain a set of historical dialogue state features, specifically including: The historical dialogue data is cleaned by removing invalid characters, duplicate expressions, and modal particles to obtain the cleaned historical dialogue data. A pre-trained medical named entity recognition model was used to identify medical entities in each round of historical dialogue in the cleaned historical dialogue data. By combining the medical entities identified in each round of historical dialogue, each round of historical dialogue in the cleaned historical dialogue data is split and labeled to obtain at least one dialogue memory unit for each round of historical dialogue; the dialogue memory unit includes: user ID, session ID, time sequence mark, dialogue text and medical entity list.
3. The memory management method for long-term health dialogue scenarios according to claim 1, characterized in that, The memory value of each dialogue memory unit is evaluated based on its dialogue state characteristics, resulting in a quantitative value score for each unit. This score includes: Using a memory value assessment model, the memory value of each dialogue memory unit is assessed based on its dialogue state characteristics, and a quantitative value score is obtained for each dialogue memory unit. The memory value assessment model is as follows: ; in, Quantify the value of the dialogue memory unit. , , , , The preset weighting coefficients, Confidence score for dialogue intent features. The urgency of health needs is scored. The normalized score for interaction frequency features, Weighted scores for medical entity features. The timeliness score for health time characteristics.
4. The memory management method for long-term health dialogue scenarios according to claim 1, characterized in that, Based on the value quantification score of each dialogue memory unit, each memory unit is stratified and compressed, and then stored in a hierarchical memory storage architecture, specifically including: When the value quantification score of the dialogue memory unit is greater than or equal to the first threshold, the dialogue memory unit is compressed using a medical information lossless compression strategy, and the compressed memory content is stored in the core memory layer. When the value quantification score of the dialogue memory unit is greater than the second threshold and less than the first threshold, the dialogue memory unit is compressed using a compression strategy that combines lossy compression and semantic vector representation, and the compressed memory content is stored in the auxiliary memory layer. When the value quantification score of the dialogue memory unit is less than or equal to the second threshold, the dialogue memory unit is compressed using a short-cycle semantic vector caching compression strategy, and the compressed memory content is stored in the temporary memory layer.
5. The memory management method for long-term health dialogue scenarios according to claim 1, characterized in that, Based on the current dialogue content input by the user, matching memory content is retrieved from the hierarchical memory storage architecture, and a dialogue response adapted to the user's health status is generated using a large language model, specifically including: Perform semantic parsing and medical entity recognition on the current dialogue content to generate a retrieval feature vector; Retrieve memory content that semantically matches the retrieved feature vector from the hierarchical memory storage architecture in the order of core memory layer, auxiliary memory layer, and temporary memory layer; All memory contents that semantically match the retrieved feature vector are reordered and filtered to generate a memory context that conforms to the context window constraint; The memory context and the current dialogue content are input into the large language model to generate a dialogue response that is adapted to the user's health status.
6. The memory management method for long-term health dialogue scenarios according to claim 1, characterized in that, An asynchronous batch incremental update mode is adopted to perform layered compression on the current dialogue data and store it in a layered memory storage architecture, specifically including: Preprocess the current dialogue data and extract dialogue state features to obtain at least one temporary dialogue memory unit of the current dialogue data. Store the temporary dialogue memory unit in the cache queue and monitor the idle status of system computing resources and the length of the cache queue in real time. When the preset triggering conditions are met, each temporary dialogue memory unit in the cache queue is evaluated for memory value, compressed in layers, and stored in layers to the memory layered storage architecture. Automatic checks are performed on the consistency and temporal logical coherence of medical entities in the core memory layer, conflicting medical entities are identified and corrected, and a memory update log is generated.
7. The memory management method for long-term health dialogue scenarios according to claim 6, characterized in that, The preset triggering condition is a first triggering condition, a second triggering condition, or a third triggering condition; the first triggering condition is: the idle rate of the system computing resources is higher than the idle rate threshold, and the number of temporary memory units in the cache queue reaches a preset number; the second triggering condition is: the current time is in the low period of system computing resource utilization, and there are unprocessed temporary memory units in the cache queue; the third triggering condition is: the time elapsed since the completion of the real-time dialogue reaches a preset time.
8. A memory management system for long-term health dialogue scenarios, characterized in that, The memory management system for the long-term health dialogue scenario is applied to the memory management method for the long-term health dialogue scenario according to any one of claims 1-7, wherein the memory management system for the long-term health dialogue scenario includes: The dialogue preprocessing and state awareness module is used to preprocess the historical dialogue data between the user and the medical intelligent agent and extract dialogue state features to obtain a historical dialogue state feature set. The historical dialogue state feature set includes the dialogue state features of at least one dialogue memory unit in each round of historical dialogue. The dialogue state features include dialogue intent features, health need features, interaction frequency features, medical entity features, and health time features. The memory value quantification assessment module is used to assess the memory value of the dialogue state characteristics of each dialogue memory unit and obtain a value quantification score for each dialogue memory unit. The hierarchical compression processing module is used to compress each memory unit in a hierarchical manner according to the value quantification score of each dialogue memory unit, and store them in a hierarchical memory storage architecture; the hierarchical memory storage architecture includes a core memory layer, an auxiliary memory layer and a temporary memory layer; The asynchronous incremental update module is used to retrieve matching memory content from the memory hierarchical storage architecture based on the current dialogue content input by the user during real-time dialogue response, and generate a dialogue response adapted to the user's health status using a large language model; the memory content is obtained by compressing the dialogue memory unit. The memory retrieval and reuse module is used to perform layered compression of the current dialogue data and store it in a layered memory storage architecture when a round of real-time dialogue is completed, using an asynchronous batch incremental update mode.
9. A computer device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor executes the computer program to implement the memory management method for a long-term health dialogue scenario according to any one of claims 1-7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the memory management method for long-term health dialogue scenarios as described in any one of claims 1-7.