Session processing method and device based on long and short term memory, equipment and medium

By introducing long and short-term memory mechanisms and federated learning update large language model in the conversation system, the problems of memory decline and insufficient consistency in existing conversation systems in multiple rounds of conversations are solved, and the flexibility and integration of the system are improved, and the system is realized. Efficient and personalized session processing.

CN119396973APending Publication Date: 2025-02-07CHINA PING AN PROPERTY INSURANCE CO LTD
View PDF 0 Cites 7 Cited by

Patent Information

Application Number
CN202411481236.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-22
Publication Date
2025-02-07

AI Technical Summary

Technical Problem

The existing conversation system has problems such as memory loss, insufficient memory consistency, lack of flexibility and poor integration when handling multiple rounds and long sessions, which affects the user experience.

Method used

Using a conversational processing method based on long and short-term memory, the updated large language model responds to user input based on stored and downloaded long-term memory data, and the model is updated through federated learning. Important memory data are filtered according to preset priorities and stored incrementally as long-term memory data, and are synchronized and integrated into message queue middleware in real time.

Benefits of technology

It effectively solves the problems of memory loss and insufficient memory consistency, improves the application flexibility and integration of the conversation system, and ensures that context-consistent, accurate and personalized answers are provided in high-frequency and multi-round consultation scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119396973A_ABST
    Figure CN119396973A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of long and short term memory and natural language processing, and discloses a session processing method and device based on long and short term memory, equipment and a medium. Using the updated large language model to respond to the input verbal skill based on the stored and downloaded long-term memory data to form interactive session information, and storing the interactive session information as short-term memory data in real time; wherein the large language model is updated through federal learning according to the short-term memory data; determining a theme according to the short-term memory data, screening important memory data in the short-term memory data based on a preset priority, and incrementally storing the important memory data as long-term memory data of the corresponding theme; and releasing the long-term memory data subjected to incremental storage to the message queue middleware according to the theme, so that other service line servers subscribing to the theme download the long-term memory data. The problems of memory decline, poor memory consistency and poor integration of a session system are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of long short-term memory and natural language processing, and in particular to a conversation processing method, device, equipment and medium based on long short-term memory. Background Art

[0002] Existing conversation systems are mainly divided into rule-based conversation systems, retrieval-based conversation systems, and generation-based conversation systems. Rule-based conversation systems manage conversation processes through predefined rules or dialogue trees; retrieval-based conversation systems generate replies by retrieving the most similar historical conversation fragments from a large amount of conversation data; generation-based conversation systems use neural network models to directly generate reply text.

[0003] Existing conversation systems have the following deficiencies when processing multi-round, long-duration conversations:

[0004] Memory decay. As the number of conversation turns increases, the system will usually "forget" the previous context information. The memory decay problem will cause the system to be unable to maintain a coherent conversation flow, thus affecting the user experience.

[0005] Insufficient memory consistency. Existing systems usually lack a unified memory storage and management mechanism, resulting in inconsistent memory information between different conversation rounds.

[0006] Lack of flexibility. Existing conversational systems are usually rigid and cannot be dynamically adjusted according to different business needs.

[0007] Poor integration. Different business lines may use different technology stacks and data structures, making it difficult to integrate memory data.

[0008] Therefore, there is an urgent need for a conversation processing method that can effectively manage and utilize users' historical interaction information to ensure that context-consistent, accurate, and personalized answers are provided in high-frequency, multi-round consultation scenarios. Summary of the invention

[0009] The present invention provides a conversation processing method, device, equipment and medium based on long-term and short-term memory, which effectively solves the problems of memory decay, poor memory consistency and poor integration by introducing short-term memory and long-term memory, and improves the application flexibility of the conversation system.

[0010] In a first aspect, a session processing method based on long short-term memory is provided, the method being executed by any one of the service line service terminals of the communication connection, the method comprising:

[0011] Receive the user's input from the client, use the updated large language model to respond to the input based on the stored and downloaded long-term memory data to form interactive conversation information, and store the interactive conversation information in real time as short-term memory data; wherein the large language model is updated through federated learning based on the short-term memory data;

[0012] Determine a topic based on the short-term memory data, filter important memory data in the short-term memory data based on preset priorities, and incrementally store the important memory data as long-term memory data of the corresponding topic;

[0013] The incrementally stored long-term memory data is published to the message queue middleware according to the topic, so that other business line servers that subscribe to the topic can download the long-term memory data.

[0014] In a second aspect, a session processing device based on long short-term memory is provided, the device being deployed in any one of the service line service terminals of the communication connection, the device comprising:

[0015] A short-term memory data forming unit is used to receive the user's input speech from the client, use the updated large language model to respond to the input speech based on the stored and downloaded long-term memory data to form interactive session information, and store the interactive session information in real time as short-term memory data; wherein the large language model is updated through federated learning based on the short-term memory data;

[0016] A long-term memory data forming unit, used to determine a theme according to the short-term memory data, filter important memory data in the short-term memory data based on a preset priority, and incrementally store the important memory data as long-term memory data of the corresponding theme;

[0017] The long-term memory data integration unit is used to publish the incrementally stored long-term memory data to the message queue middleware according to the topic, so that other business line servers that subscribe to the topic can download the long-term memory data.

[0018] In a third aspect, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned long short-term memory-based session processing method when executing the computer program.

[0019] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned conversation processing method based on long short-term memory are implemented.

[0020] In the solution implemented by the above-mentioned conversation processing method, device, equipment and medium based on long-term and short-term memory, a specific business line server receives the user's input words from the client, uses the updated large language model to respond to the input words based on the stored and downloaded long-term memory data to form interactive conversation information, and stores the interactive conversation information in real time as short-term memory data; wherein the large language model is updated through federated learning based on the short-term memory data; the topic is determined based on the short-term memory data, and the important memory data in the short-term memory data is screened based on the preset priority, and the important memory data is incrementally stored as the long-term memory data of the corresponding topic; the incrementally stored long-term memory data is published to the message queue middleware according to the topic, so that other business line servers that subscribe to the topic can download the long-term memory data.

[0021] In the present invention, the use of long short-term memory can effectively solve the problem of memory decay and can have stronger context understanding ability when processing multiple rounds of dialogues; the long-term memory data across business lines is synchronized and integrated in real time, so that each business line server can share long-term memory data based on subscription topics without the need to repeatedly develop or maintain complex integration logic, which greatly improves the collaboration efficiency between the business line servers; the introduction of federated learning enables each business line server to collaboratively train and update the large language model without sharing data, which not only protects the privacy of the short-term memory data of each business line server, but also improves the overall performance of the large language model through multi-party collaboration. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.

[0023] Figure 1 is a schematic diagram of an application environment of a conversation processing method based on long short-term memory in one embodiment of the present invention;

[0024] Figure 2 is a flow chart of a conversation processing method based on long short-term memory in one embodiment of the present invention;

[0025] Figure 3 is a structural diagram of a conversation processing device based on long short-term memory in one embodiment of the present invention;

[0026] Figure 4 is a schematic diagram of the structure of a computer device in one embodiment of the present invention;

[0027] Figure 5 It is a schematic diagram of the structure of a computer device in another embodiment of the present invention. DETAILED DESCRIPTION

[0028] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0029] The conversation processing method based on long short-term memory provided by the embodiment of the present invention can be applied in the following aspects: Figure 1 In an application environment, a client communicates with a business line server cluster through a network. The client can be, but is not limited to, a personal computer, a laptop, a smart phone, a tablet computer, a portable wearable device, and other devices with a display and an input device. The business line server cluster can be implemented by a service platform composed of multiple business line servers, and each business line server can communicate with the client.

[0030] Each business line service end carries the function of processing sessions for its specific business. For example, in the insurance field, business lines may include new insurance business lines, insurance claims business lines, etc. Then the first business line service end carries the function of processing sessions for new insurance business lines, and the second business line service end carries the function of processing sessions for insurance claims business lines, etc.

[0031] Each business line server can provide the client with a business-specific speech receiving page entrance. The user inputs the speech from the corresponding speech receiving page entrance of the client, thereby realizing communication between the client and the specific business line server. The specific business line server responds to the input speech to form an interactive session.

[0032] For the specific business line server that receives the user's input words, it uses the updated large language model to respond to the input words based on the stored and downloaded long-term memory data to form interactive session information, and stores the interactive session information in real time as short-term memory data; wherein, the large language model is updated through federated learning based on the short-term memory data; the topic is determined based on the short-term memory data, and the important memory data in the short-term memory data is filtered based on the preset priority, and the important memory data is incrementally stored as the long-term memory data of the corresponding topic; the incrementally stored long-term memory data is published to the message queue middleware according to the topic, so that other business line servers that subscribe to the topic can download the long-term memory data.

[0033] The present invention is described in detail below through specific embodiments.

[0034] See also Figure 2 As shown, Figure 2A flow chart of a session processing method based on long short-term memory provided by an embodiment of the present invention is provided. The flow chart is executed by any one of the service line service terminals of the communication connection, and includes the following steps:

[0035] S210: receiving user input speech from the client, using the updated large language model to respond to the input speech based on the stored and downloaded long-term memory data to form interactive session information, and storing the interactive session information in real time as short-term memory data; wherein the large language model is updated through federated learning according to the short-term memory data;

[0036] S220, determining a theme according to the short-term memory data, filtering important memory data in the short-term memory data based on a preset priority, and incrementally storing the important memory data as long-term memory data of the corresponding theme;

[0037] S230, publishing the incrementally stored long-term memory data to the message queue middleware according to the topic, so that other business line servers subscribed to the topic can download the long-term memory data.

[0038] In the present invention, the specific business line service end carries the following functions: response to input speech, storage of short-term memory data, storage, publishing and downloading of long-term memory data, and independent training of large language models. The above process is explained in combination with the functions carried by the specific business line service end.

[0039] The specific business line server can respond to the user's input in real time, thereby forming interactive session information.

[0040] For example: a specific business line server receives the first input script from the client and makes a first response, and feeds the first response back to the client; the user sends a second input script based on the first response; the specific business line server receives the second input script from the client and makes a second response, and feeds the second response back to the client; and so on, until the user no longer sends input scripts, forming interactive session information.

[0041] In order to ensure that a specific business line server provides context-consistent, accurate and personalized responses during multiple rounds of conversations, the present invention adopts a large language model of long short-term memory and federated learning.

[0042] Short-term memory data may include all basic information of the current interactive session information, and the basic information may include but is not limited to user information, context information, etc. User information may include but is not limited to user ID, client address, etc.; context information may include but is not limited to input words, response words, user intentions, call content, etc. During the session, the interactive session information is stored as short-term memory data in real time, and the short-term memory data is only stored on the specific business line service end.

[0043] According to the content of the short-term memory data, the key information of the short-term memory data can be determined. For example: in the insurance field, the key information can include but is not limited to claims, policy content, etc. Then, the subject of the short-term memory data can be determined according to the key information. For example: in the insurance field, the subject can include but is not limited to auto insurance, medical insurance, pension insurance, etc.

[0044] Short-term memory data may include valuable important memory data and temporary useless information. Therefore, based on the preset priority, valuable important memory data can be screened out and incrementally stored as long-term memory data of the corresponding topic. For example: short-term memory data (i.e. interactive session information) may include valuable important memory data such as input words "50 years old this year" and responses such as "insurance amount XXX yuan", and this part of important memory data is incrementally stored as long-term memory data; short-term memory data (i.e. interactive session information) may include temporary useless information such as input words "I don't quite understand" and responses such as "Please read the following terms carefully", and this part of temporary useless information will not be stored as long-term memory data.

[0045] In other words, the short-term memory data stored in real time can be understood as memory data stored in transition. That is, the short-term memory data is stored only before the preset clearing time arrives. During the storage time of the short-term memory data, its role is to independently train the large language model and extract important memory data from it and store it as long-term memory data.

[0046] The long-term memory data of a specific business line server consists of two parts: one part is the long-term memory data incrementally stored locally on the specific business line server, and the other part is the long-term memory data that complies with the subscription topic and is downloaded from other business line servers.

[0047] Once the long-term memory data of a specific business line server changes, the incrementally stored long-term memory data will be immediately published to the message queue middleware according to the topic, and other business line servers that subscribe to the topic will receive the incrementally stored long-term memory data based on the message queue middleware and store it locally on other business line servers.

[0048] Similarly, once the long-term memory data of other business line servers changes, the incrementally stored long-term memory data will be immediately published to the message queue middleware according to the topic. When a specific business line server subscribes to the topic, the specific business line server will receive the incrementally stored long-term memory data based on the message queue middleware and store it locally on the specific business line server.

[0049] In other words, based on the subscription topic, the long-term memory data across business lines can be kept consistent, and each business line server can promptly obtain the latest long-term memory data that complies with its subscription topic.

[0050] For example, the specific business line service end is the new insurance business line, and its increment stores the long-term memory data with the theme of "auto insurance"; the other business line service ends include the insurance claims business line, which subscribes to the "auto insurance" theme. Then the incremental long-term memory data with the theme of "auto insurance" will be shared between the new insurance business line service end and the insurance claims business line service end.

[0051] The integration of long-term memory data across business lines can be achieved through the Kafka message queue middleware. Each business line server will subscribe to a specific Kafka topic to receive and store long-term memory data updates from other business line servers. Each business line server will publish the incrementally stored long-term memory data to the Kafka topic so that other business line servers can share this long-term memory data.

[0052] Since the response to input words is based on stored and downloaded long-term memory data, multiple rounds of conversations can maintain a high degree of continuity and consistency, avoiding problems such as memory decay and insufficient memory consistency, while leveraging the synergy between various business lines.

[0053] The large language model is collaboratively trained and updated based on the short-term memory data stored by each business line server without sharing the short-term memory data. Each business line server uses its stored short-term memory data to independently train the large language model, obtain independent model update parameters, and then send the independent model update parameters to the central server for aggregation, and finally form an updated global model to feed back to each business line server.

[0054] The update of the large language model can be done in a synchronous or asynchronous manner. When using the synchronous update method, each business line server can simultaneously perform local training updates based on a unified preset cycle, and then the central server will aggregate them. When using the asynchronous update method, each business line server can perform local training updates based on its own preset cycle, and the central server will aggregate them.

[0055] In order to prevent data inflation and the impact of expired data, short-term memory data is only stored within the preset clearing time. Therefore, the short-term memory data used for independent training and updating of the large language model is always kept relatively new, improving the independent training effect of the large language model.

[0056] pass Figure 2In the method shown, a specific business line server of the present invention receives a user's input speech from a client, uses an updated large language model to respond to the input speech based on stored and downloaded long-term memory data to form interactive session information, and stores the interactive session information in real time as short-term memory data; wherein the large language model is updated through federated learning based on the short-term memory data; a topic is determined based on the short-term memory data, important memory data in the short-term memory data is screened based on preset priorities, and the important memory data is incrementally stored as long-term memory data of the corresponding topic; the incrementally stored long-term memory data is published to the message queue middleware according to the topic, so that other business line servers that subscribe to the topic download the long-term memory data. In the present invention, the use of long short-term memory can effectively solve the problem of memory decay and can have stronger context understanding ability when processing multiple rounds of dialogues; the long-term memory data across business lines is synchronized and integrated in real time, so that each business line server can share long-term memory data based on subscription topics without the need to repeatedly develop or maintain complex integration logic, which greatly improves the collaboration efficiency between the business line servers; the introduction of federated learning enables each business line server to collaboratively train and update the large language model without sharing short-term memory data, which not only protects the privacy of the short-term memory data of each business line server, but also improves the overall performance of the large language model through multi-party collaboration.

[0057] In some optional embodiments, S210 receives user input speech from the client, uses an updated large language model to respond to the input speech based on stored and downloaded long-term memory data to form interactive session information, and stores the interactive session information in real time as short-term memory data, including: encapsulating each user as an independent task, and each independent task is concurrent; for each user, providing a speech receiving page to the client, and continuously receiving input speech based on the speech receiving page using an encryption protocol; using an updated large language model to continuously respond to input speech based on stored and downloaded long-term memory data using an encryption protocol; forming interactive session information based on the continuously received input speech and the continuous response; storing the interactive session information in real time as short-term memory data with the session ID as the index until the input speech is no longer received through the speech receiving page.

[0058] In order to cope with high-concurrency user session management, each user can be encapsulated as an independent task and each independent task can be made concurrent.

[0059] For example, each business line server can adopt the Akka Actor model, and by encapsulating each user as an independent Actor, it avoids the competition and locking problems in traditional multi-threading. Each Actor only processes the session messages of one user, and the session messages of each user do not share the state, thus achieving lock-free concurrency. For a high-concurrency user session environment, each user session is managed by an independent Actor to ensure efficient processing of concurrent sessions while maintaining the integrity of each user session context.

[0060] In addition, a line-of-business server can be composed of multiple line-of-business servers, and a line-of-business server constitutes a node of the line-of-business server. Akka's cluster mode can support the deployment of Actors on multiple nodes. Therefore, it can be dynamically expanded according to the load situation, so that each node can allocate Actors to process user session messages according to the load balancing strategy. The number of line-of-business servers (i.e. nodes) included in a line-of-business server can be flexibly increased or decreased to cope with traffic fluctuations. The load balancer can intelligently distribute user sessions to the most appropriate line-of-business server based on the current user session volume and the health of the line-of-business server, thereby ensuring the response speed of high-concurrency user sessions.

[0061] For each user, the business line server provides the client with a speech receiving page, so that the user can input speech based on the speech receiving page, and use the updated large language model to continuously respond to the input speech based on the stored and downloaded long-term memory data. In order to ensure that the data during the transmission process is not stolen or tampered with, a secure communication channel is established between the client and the business line server.

[0062] For example: Data transmission between clients and business line servers can be encrypted through the TLS1.3 (Transport Layer Security) protocol. Compared with other security protocols, TLS1.3 has higher security and better performance, especially in resisting man-in-the-middle attacks and replay attacks.

[0063] Interactive session information is formed based on the continuously received input speech and the continuous response, and the interactive session information is stored in real time as short-term memory data with the session ID as the index until the input speech is no longer received through the speech receiving page.

[0064] Redis can be used as a storage medium for short-term memory data. Redis supports a variety of data structures, including but not limited to strings, hashes, lists, sets, etc. Its high throughput and low latency make it very suitable for small data blocks that need to be read and written quickly. Therefore, Redis storage media is used to store short-term memory data.

[0065] In short-term memory data, each interactive session information can be indexed by the session ID. Redis's key-value pair storage method can efficiently manage short-term memory data. The value corresponding to each session ID can be a complex data structure that contains all the basic information of the current interactive session information. This basic information can include the content of the most recent N rounds of conversations, user intent, etc.

[0066] In some optional embodiments, an updated large language model is used to continuously respond to input speech using an encryption protocol based on stored and downloaded long-term memory data, including: using an updated large language model to understand the input speech; based on the understanding result, using a calling interface to access the corresponding stored and downloaded long-term memory data according to the permission control level; performing differential privacy protection on the corresponding stored and downloaded long-term memory data to form protected memory data; using an updated large language model to continuously respond to input speech using an encryption protocol based on the protected memory data.

[0067] The user's input words may be query words. After the updated big language model understands the input words, it needs to access and retrieve the long-term memory data stored and downloaded by the business line server. For example: User A's input words are "Query user A's car insurance policy", then the updated big language model understands the input words, and the business line server retrieves user A's car insurance policy from the stored and downloaded long-term memory data and feeds it back to the client.

[0068] In some cases, the query sent by the user does not query the content within the user's permissions. This requires permission control for accessing and retrieving stored and downloaded long-term memory data. For example, user A's input phrase is "query user B's car insurance policy". Based on permission control, after the updated large language model understands the user's input phrase, the business line server has no right to access and retrieve user B's car insurance policy. The updated large language model then feeds back to the client the generated text indicating that it has no right to view.

[0069] The updated large language model is used to understand the input words and generate polished reply text. When responding to the user's input words, it is necessary to access and retrieve the stored and downloaded long-term memory data to give the client accurate feedback. For different business line servers, personalized interface types can be used to define the method of accessing and retrieving the stored and downloaded long-term memory data for each business line server.

[0070] For example, the GraphQL API interface can be used. The GraphQL interface can obtain accurate memory data through simple request instructions. And its layered architecture can flexibly expand new query types and data structures. Different business line servers customize personalized data types and query methods according to business conditions, which can make the access and retrieval of long-term memory data more in line with business reality. For example, the insurance claims business line can design a special call interface to retrieve the user's policy change history when responding to the user's input script; the new insurance business line can design a special call interface to retrieve the user's interest preferences and purchase records when responding to the user's input script. The GraphQL API can also integrate a response cache mechanism to reduce the impact of repeated calls on performance. For example, for common user input scripts, the business line server can cache the results of accessing and retrieving long-term memory data. When multiple requests are made to access and retrieve the same long-term memory data in a short period of time, the cached results are directly fed back to the client, thereby improving the response speed.

[0071] The business line server can use the OAuth2.0 protocol for identity authentication and authorization. When responding to the user's input session, access to stored and downloaded long-term memory data must be authenticated by OAuth2.0. Role-based access control can also be used to give different users different permission levels. Only users who meet the permission level can access the corresponding stored and downloaded long-term memory data, thereby ensuring that access to stored and downloaded long-term memory data is minimized.

[0072] Each access to the stored and downloaded long-term memory data can be logged. The log content may include, but is not limited to, the access time, access user, access type, etc. These log records can be transmitted to the security information and event management system. By analyzing the log data, the security information and event management system can monitor and identify potential security threats in real time, trigger alarms when abnormal behavior is detected (such as abnormally frequent access or unauthorized access attempts), and take measures to prevent potential attacks.

[0073] In addition, in order to further enhance the user privacy of stored and downloaded long-term memory data, differential privacy is introduced to protect the corresponding stored and downloaded long-term memory data, thereby forming protected memory data. Differential privacy protects the privacy of user data by introducing a certain degree of noise into the corresponding stored and downloaded long-term memory data. The differential privacy algorithm is automatically applied when the corresponding stored and downloaded long-term memory data is accessed and called for query or analysis, thereby ensuring that user information in the stored and downloaded long-term memory data is not abused or leaked.

[0074] Utilizing an updated large language model, an encrypted protocol is used to continuously respond to input speech based on protected memory data, thereby providing contextually consistent, accurate responses that prevent data leakage in high-frequency, multi-round conversation scenarios.

[0075] In some optional implementations, the large language model is updated by the following method: independently training the large language model using short-term memory data to obtain independent model update parameters; transmitting the independent model update parameters to a central server so that the central server aggregates the independent model update parameters received from each business line server to obtain an updated large language model; wherein the central server is in communication with each business line server; and receiving the updated large language model from the central server.

[0076] Federated learning is used for training and updating of large language models. Federated learning allows multiple business line servers to collaboratively train models without sharing short-term memory data. This not only protects the privacy of short-term memory data of each business line server, but also improves the overall performance of the large language model through multi-party collaboration.

[0077] That is to say, long-term memory data can be shared between different business line servers that subscribe to the same topic; short-term memory data is stored separately by each business line server and is not shared even when training and updating large language models.

[0078] For example: Take three business line servers as an example. The first business line server subscribes to topics a and b, the second business line server subscribes to topics a and c, and the third business line server subscribes to topics b and c. When the first business line server incrementally stores the first long-term memory data of topic a, the first long-term memory data will be shared with the second business line server, when the second business line server incrementally stores the second long-term memory data of topic c, the second long-term memory data will be shared with the third business line server, and when the third business line server incrementally stores the third long-term memory data of topic b, the third long-term memory data will be shared with the first business line server. Then the first business line server stores the first long-term memory data and downloads the third long-term memory data, the second business line server stores the second long-term memory data and downloads the first long-term memory data, and the third business line server stores the third long-term memory data and downloads the second long-term memory data. This is the sharing of long-term memory data between different business line servers that subscribe to the same topic.

[0079] Still taking the three business line servers as an example, the first business line server independently trains the large language model based on the short-term memory data stored locally before the preset clearing time, the second business line server independently trains the large language model based on the short-term memory data stored locally before the preset clearing time, and the third business line server independently trains the large language model based on the short-term memory data stored locally before the preset clearing time. This is the short-term memory data stored in isolation on each business line server.

[0080] The PySyft federated learning framework can be used to conduct secure independent training between multiple business line servers to obtain independent model update parameters, and then transmit the independent model update parameters to the central server so that the central server can aggregate the independent model update parameters and obtain the updated large language model to feed back to each business line server. During the entire training and updating process, the short-term memory data of each business line server is always stored locally and will not be directly shared with other business line servers, thus avoiding the risk of data leakage.

[0081] In some optional embodiments, S220 determines the topic based on the short-term memory data, filters the important memory data in the short-term memory data based on a preset priority, and incrementally stores the important memory data as long-term memory data of the corresponding topic, including: identifying the content of the short-term memory data, determining the key information of the short-term memory data, and determining the topic based on the key information; filtering the important memory data based on a preset priority, preprocessing the important memory data and generating metadata for the preprocessed important memory data; incrementally storing the preprocessed important memory data and metadata as long-term memory data with session ID and user ID as indexes and topics as shards; and deleting the short-term memory data when the preset clearing time is reached.

[0082] According to the content of short-term memory data, it is necessary to identify key information in it to determine the topic. The topic is intended to classify short-term memory data so that when important memory data in the short-term memory data is stored as long-term memory data, it indicates which other business line service ends can subscribe to and share the long-term memory data.

[0083] For short-term memory data, a hierarchical storage mechanism is used according to different preset priorities. For high-priority information (such as key user intent information), it is determined to be important memory data and will be stored as long-term memory data; for low-priority information (such as temporary non-critical information), it will not be stored as long-term memory data.

[0084] Short-term memory data is only temporarily stored and will be automatically deleted when the preset clearing time is reached. Before being automatically deleted, short-term memory data is also used for independent training and updating of large language models.

[0085] The preset priority can be dynamically adjusted based on the real-time nature and importance of the conversation. For example, when it is detected that a user conversation continues to focus on a certain topic, or when it is determined that a certain conversation message may be related to the user's future behavior (such as the expression of insurance purchase intention), the priority level of the user conversation can be increased to ensure that it is preserved and used in long-term memory.

[0086] The modalities of long-term memory data may be diverse, such as text, voice, image, video, etc. In order to uniformly store multi-modal long-term memory data, tools such as FFmpeg and OpenCV can be introduced to pre-process important memory data. For example: audio and video data can be converted into standardized formats (such as MP4, WAV, etc.) through FFmpeg, and image data can be format converted and compressed through OpenCV.

[0087] For multimodal long-term memory data, metadata is generated accordingly. Metadata may include, but is not limited to, timestamp, data source, file type, content summary, etc. The preprocessed important memory data and its related metadata are stored as long-term memory data. Through standardized preprocessing, multiple types of data can be managed uniformly, improving the integration and accessibility of multimodal data.

[0088] Multimodal long-term memory data and metadata can be uniformly stored in Elasticsearch, and efficient indexes can be established. Elasticsearch supports full-text search based on Lucene, which can provide fast responses to complex queries, which is especially important for scenarios that require access and retrieval of a large number of historical sessions, image recognition, or speech analysis. Metadata is stored in Elasticsearch, which supports fast query and filtering of metadata.

[0089] Long-term memory data can be indexed based on user ID and session ID. For each user, the stored long-term memory data will store important interaction history, including important conversation content, important responses, important user behavior data, user preference information, etc. The stored long-term memory data can be sharded by topic to ensure fast access and retrieval.

[0090] When important memory data is stored as long-term memory data, newly generated key data can be incrementally stored in the long-term memory data based on user ID, session ID and subject, without the need to store the important memory data in its entirety.

[0091] In some optional implementations, the processed important memory data and metadata are incrementally stored as long-term memory data with session ID and user ID as indexes and topics as shards, including: distributing the long-term memory data in multiple data centers; regularly backing up the stored long-term memory data to a long-term storage data platform; wherein the long-term storage data platform is in communication with each business line server; and deleting the pre-processed important memory data that has not been accessed for a preset period of time.

[0092] In order to improve the disaster tolerance and high availability of long-term memory data storage, multi-data center distributed storage of long-term memory data can be used. That is, a business line service end can include multiple business line servers, each business line server as a data center, and synchronization and redundant storage of long-term memory data are achieved between data centers. Even if a data center fails, the business line service end can quickly switch to another data center to ensure the availability of long-term memory data.

[0093] Cassandra can be used as a storage medium for long-term memory data. Cassandra is a distributed database system that can be horizontally expanded on a large number of nodes. Its masterless architecture and multi-data center support make it suitable as a storage medium for long-term memory data. Cassandra's masterless architecture allows automatic switching to other data centers to continue providing services when a data center fails, ensuring the high availability of long-term memory data. By setting up multiple data centers and replication factors, cross-regional redundant storage and disaster recovery of long-term memory data can be achieved, ensuring that long-term memory data can still be accessed normally even in the event of a large-scale failure. Different fault-tolerant strategies can be set according to business needs, such as adjusting the read-write consistency level, to balance the availability and performance of multiple data centers.

[0094] For the long-term memory data stored on each business line server, it can be backed up regularly to an independent long-term storage platform. The long-term storage platform is connected to each business line server. The backup operation can be performed through HBase, and the long-term storage platform can use Amazon S3 or Google Cloud Storage. When data corruption occurs on the business line server, it can be quickly restored through the backup data, thereby reducing the impact of data corruption on session processing. The recovery process can include extracting the backup data and re-importing it into Cassandra.

[0095] For long-term memory data that has not been accessed for a preset period of time, the pre-processed important memory data can be deleted in the business line server, but the metadata can be retained. At the same time, the backup data is still stored in the long-term storage platform. In this way, Cassandra's storage resources can be efficiently used.

[0096] In some optional embodiments, the method further includes: encrypting the interactive session information using an encryption algorithm before the step of storing the interactive session information as short-term memory data; and / or encrypting the important memory data using an encryption algorithm before the step of storing the important memory data increment as long-term memory data of the corresponding subject.

[0097] Before storing short-term memory data and long-term memory data, encryption can be performed to prevent unauthorized access. For example, interactive session information and important memory data can be encrypted using the AES-256 algorithm. To further enhance security, encryption key management can use hardware security modules to ensure that the keys are not leaked or abused.

[0098] In the present invention, Redis can be used as a storage medium for short-term memory data, and Cassandra can be used as a storage medium for long-term memory data. The combination of the dual-layer memory of Redis and Cassandra can effectively solve the problem of memory decay, enabling stronger context understanding capabilities during multiple rounds of conversations. Redis, with its high performance and low latency, ensures that key context information in the current session can be processed quickly. Cassandra ensures the continuity and consistency of long-term sessions through high scalability and strong disaster recovery capabilities. The dual-layer memory can efficiently manage and utilize session information on different time scales, and has high response accuracy and relevance for both short-term context processing and long-term user history data queries.

[0099] In the present invention, the flexible API design of GraphQL can enable each business line server to flexibly call long-term memory data according to its own needs. This flexibility not only reduces unnecessary data transmission, improves response speed, but also provides more accurate and personalized responses.

[0100] In the present invention, multimodal long-term memory data can support efficient retrieval of Elasticsearch after preprocessing. Users can interact with each other in a variety of ways such as voice and image, which enhances the conversation experience.

[0101] In the present invention, Kafka and Akka can be introduced to provide support for long-term memory data integration and high-concurrency processing of user sessions across business lines. Kafka uses an efficient message queue mechanism to achieve real-time synchronization and integration of long-term memory data between different business line servers. Each business line server can share long-term memory data based on subscription topics without the need to repeatedly develop or maintain complex integration logic, which greatly reduces the technical threshold, reduces development costs, and improves the collaboration efficiency between business lines. Akka concurrent processing and cluster deployment mode ensures that high-concurrency user sessions can be handled and the stability of response can be maintained.

[0102] In the present invention, various security measures such as AES-256 encryption, TLS1.3 protocol, OAuth 2.0 authentication and authorization can be used to enhance data security and privacy protection. Data can be highly encrypted during storage and transmission to ensure that the data is not stolen or tampered with. The introduction of federated learning and differential privacy technology enables each business line service end to collaboratively improve model performance and maximize data value while protecting data privacy. The above measures significantly improve security and user trust.

[0103] In the present invention, the implementation of each function of the above method can be designed by modularization, and then the modules are integrated into a system, and the system provides responses to the user's input conversation. The use of modular design allows each functional part to be independently developed, tested and deployed without affecting the overall stability and performance of the system. By introducing long short-term memory and large language models, a solid foundation is laid for the intelligence of the conversation system. The system can efficiently manage and utilize the user's conversation memory, promoting the widespread application of AI technology in the insurance industry and other industries.

[0104] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.

[0105] In one embodiment, a session processing device based on long short-term memory is provided, and the device is deployed in any one of the service line service terminals of the communication connection. The session processing device based on long short-term memory corresponds to the session processing method based on long short-term memory in the above embodiment. Figure 3 As shown, the conversation processing device based on long short-term memory includes:

[0106] The short-term memory data forming unit 301 is used to receive the user's input speech from the client, use the updated large language model to respond to the input speech based on the stored and downloaded long-term memory data to form interactive session information, and store the interactive session information in real time as short-term memory data; wherein the large language model is updated through federated learning according to the short-term memory data;

[0107] The long-term memory data forming unit 302 is used to determine the theme according to the short-term memory data, filter the important memory data in the short-term memory data based on the preset priority, and store the important memory data incrementally as the long-term memory data of the corresponding theme;

[0108] The long-term memory data integration unit 303 is used to publish the incrementally stored long-term memory data to the message queue middleware according to the topic, so that other business line servers that subscribe to the topic can download the long-term memory data.

[0109] In some optional embodiments, the short-term memory data forming unit 301 includes: a concurrent control module, which is used to encapsulate each user into an independent task, and each independent task is concurrent; an input speech receiving module, which is used to provide a speech receiving page to the client for each user, and continuously receive input speech based on the speech receiving page using an encryption protocol; a response module, which is used to continuously respond to input speech based on the stored and downloaded long-term memory data using an encrypted protocol using an updated large language model; an interactive session information forming module, which is used to form interactive session information based on the continuously received input speech and the continuous response; a short-term memory data storage module, which is used to store the interactive session information as short-term memory data in real time with the session ID as the index until the input speech is no longer received through the speech receiving page.

[0110] In some optional implementations, the response module is specifically used to: use an updated large language model to understand input speech; based on the understanding result, use a calling interface to access corresponding stored and downloaded long-term memory data according to the authority control level; perform differential privacy protection on the corresponding stored and downloaded long-term memory data to form protected memory data; use an updated large language model to continuously respond to input speech using an encryption protocol based on the protected memory data.

[0111] In some optional embodiments, the short-term memory data forming unit 301 further includes: a large language model independent training module, which is used to independently train the large language model using short-term memory data to obtain independent model update parameters; transmit the independent model update parameters to the central server, so that the central server aggregates the independent model update parameters received from each business line server to obtain an updated large language model; wherein the central server is in communication connection with each business line server; and receives the updated large language model from the central server.

[0112] In some optional embodiments, the long-term memory data forming unit 302 includes: a subject determination module, which is used to identify the content of the short-term memory data, determine the key information of the short-term memory data, and determine the subject based on the key information; an important memory data processing unit, which is used to screen the important memory data based on a preset priority, pre-process the important memory data and generate metadata of the pre-processed important memory data; a long-term memory data storage unit, which is used to store the processed important memory data and metadata as long-term memory data with session ID and user ID as indexes and themes as shards in increments; a short-term memory data deletion module, which is used to delete the short-term memory data when the preset clearing time is reached.

[0113] In some optional embodiments, the long-term memory data storage unit is specifically used to: use multiple data centers to distribute the storage of long-term memory data; regularly back up the stored long-term memory data to a long-term storage data platform; wherein the long-term storage data platform is communicatively connected with each business line server; and delete pre-processed important memory data that has not been accessed for more than a preset period of time.

[0114] In some optional embodiments, the short-term memory data forming unit 301 further includes: a first encryption module, used to encrypt the interactive session information using an encryption algorithm before storing the interactive session information as short-term memory data; the long-term memory data forming unit 302 further includes: a second encryption module, used to encrypt the important memory data using an encryption algorithm before storing the important memory data increments as the long-term memory data of the corresponding subject.

[0115] For the specific definition of the conversation processing device based on long short-term memory, please refer to the definition of the conversation processing method based on long short-term memory above, which will not be repeated here. Each module in the above-mentioned conversation processing device based on long short-term memory can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0116] In one embodiment, a computer device is provided. The computer device may be a service line server. The internal structure diagram thereof may be as follows: Figure 4As shown. The computer device includes a processor, a memory, a network interface and a database connected via a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile and / or volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external client through a network connection. When the computer program is executed by the processor, it implements the functions or steps of a service end side of a business line of a session processing method based on long short-term memory.

[0117] In one embodiment, a computer device is provided. The computer device may be a client, and its internal structure diagram may be as follows: Figure 5 As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external server through a network connection. When the computer program is executed by the processor, it implements the functions or steps of the client side of a session processing method based on long short-term memory

[0118] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:

[0119] Receive the user's input from the client, use the updated large language model to respond to the input based on the stored and downloaded long-term memory data to form interactive conversation information, and store the interactive conversation information in real time as short-term memory data; wherein the large language model is updated through federated learning based on the short-term memory data;

[0120] Determine a topic based on the short-term memory data, filter important memory data in the short-term memory data based on preset priorities, and incrementally store the important memory data as long-term memory data of the corresponding topic;

[0121] The incrementally stored long-term memory data is published to the message queue middleware according to the topic, so that other business line servers that subscribe to the topic can download the long-term memory data.

[0122] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0123] Receive the user's input from the client, use the updated large language model to respond to the input based on the stored and downloaded long-term memory data to form interactive conversation information, and store the interactive conversation information in real time as short-term memory data; wherein the large language model is updated through federated learning based on the short-term memory data;

[0124] Determine a topic based on the short-term memory data, filter important memory data in the short-term memory data based on preset priorities, and incrementally store the important memory data as long-term memory data of the corresponding topic;

[0125] The incrementally stored long-term memory data is published to the message queue middleware according to the topic, so that other business line servers that subscribe to the topic can download the long-term memory data.

[0126] It should be noted that the above functions or steps that can be implemented by the computer-readable storage medium or computer device can refer to the relevant descriptions of the business line service side and the client side in the aforementioned method embodiment. To avoid repetition, they will not be described one by one here.

[0127] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0128] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

[0129] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.

Claims

1. A conversation processing method based on long short-term memory, characterized in that: The method is performed by any one of the business line service terminals in the communication connection, and the method includes: Receive user input speech from the client, use the updated large language model to respond to the input speech based on the stored and downloaded long-term memory data to form interactive session information, and store the interactive session information in real time as short-term memory data; wherein the large language model is updated through federated learning according to the short-term memory data; Determine a theme according to the short-term memory data, filter important memory data in the short-term memory data based on a preset priority, and incrementally store the important memory data as the long-term memory data corresponding to the theme; The incrementally stored long-term memory data is published to the message queue middleware according to the topic, so that other business line servers that subscribe to the topic can download the long-term memory data.

2. The conversation processing method based on long short-term memory according to claim 1, characterized in that: The receiving of user input speech from the client, using the updated large language model to respond to the input speech based on the stored and downloaded long-term memory data to form interactive session information, and storing the interactive session information in real time as short-term memory data, includes: Encapsulate each user into an independent task, and perform each independent task concurrently; For each of the users, providing a speech receiving page to the client, and continuously receiving the input speech using an encryption protocol based on the speech receiving page; Using the updated large language model to continuously respond to the input speech using the encryption protocol based on the stored and downloaded long-term memory data; forming the interactive session information according to the continuously received input speech and the continuously received response; The interactive session information is stored in real time as the short-term memory data using the session ID as an index until the input speech is no longer received through the speech receiving page.

3. The conversation processing method based on long short-term memory according to claim 2, characterized in that: The method of using the updated large language model to continuously respond to the input speech using the encryption protocol based on the stored and downloaded long-term memory data includes: Using an updated large language model to understand the input speech; Based on the understanding result, using the calling interface to access the corresponding stored and downloaded long-term memory data according to the authority control level; Performing differential privacy protection on the corresponding stored and downloaded long-term memory data to form protected memory data; The input speech is continuously responded to using the updated large language model based on the protected memory data using the encryption protocol.

4. The conversation processing method based on long short-term memory according to claim 1, characterized in that: The large language model is updated by the following method: Using the short-term memory data to independently train the large language model to obtain independent model update parameters; The independent model update parameters are transmitted to the central server, so that the central server aggregates the independent model update parameters received from each of the business line servers to obtain the updated large language model; wherein the central server is in communication connection with each of the business line servers; The updated large language model is received from the central server.

5. The conversation processing method based on long short-term memory according to claim 1, characterized in that: The determining of a theme according to the short-term memory data, screening important memory data in the short-term memory data based on a preset priority, and incrementally storing the important memory data as the long-term memory data corresponding to the theme includes: Identifying the content of the short-term memory data, determining key information of the short-term memory data, and determining the subject according to the key information; Filter the important memory data based on the preset priority, preprocess the important memory data and generate metadata of the preprocessed important memory data; The pre-processed important memory data and the metadata are incrementally stored as the long-term memory data with the session ID and the user ID as indexes and the subject as slices; The short-term memory data is deleted when the preset clearing time is reached.

6. The conversation processing method based on long short-term memory according to claim 5, characterized in that: The preprocessed important memory data and the metadata are incrementally stored as the long-term memory data with the session ID and the user ID as indexes and the subject as slices, including: Distributing the long-term memory data across multiple data centers; Regularly backing up the stored long-term memory data to a long-term storage data platform; wherein the long-term storage data platform is in communication connection with each of the service line servers; The pre-processed important memory data that has not been accessed for more than a preset time period is deleted.

7. The conversation processing method based on long short-term memory according to claim 1, characterized in that: The method further comprises: Before the step of storing the interactive session information as short-term memory data, encrypting the interactive session information using an encryption algorithm; And / or, before the step of incrementally storing the important memory data as the long-term memory data corresponding to the subject, the important memory data is encrypted using the encryption algorithm.

8. A conversation processing device based on long short-term memory, characterized in that: The device is deployed in any one of the service line service terminals of the communication connection, and the device includes: A short-term memory data forming unit, configured to receive a user's input speech from a client, respond to the input speech using an updated large language model based on the stored and downloaded long-term memory data to form interactive session information, and store the interactive session information as short-term memory data in real time; wherein the large language model is updated through federated learning according to the short-term memory data; a long-term memory data forming unit, configured to determine a theme according to the short-term memory data, filter important memory data in the short-term memory data based on a preset priority, and incrementally store the important memory data as the long-term memory data corresponding to the theme; The long-term memory data integration unit is used to publish the incrementally stored long-term memory data to the message queue middleware according to the topic, so that other business line servers subscribed to the topic can download the long-term memory data.

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: When the processor executes the computer program, the steps of the conversation processing method based on long short-term memory are implemented as described in any one of claims 1 to 7.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the conversation processing method based on long short-term memory are implemented as described in any one of claims 1 to 7.

Citation Information

Cited By

  • Self-learning intelligent question answering system and method with long-term and short-term memory

    CN119829726A

  • Automatic memory management method based on context awareness and hierarchical routing

    CN121092650A

  • Conversation processing method and computer equipment

    CN121212379A

  • Dialogue processing methods and computer equipment

    CN121212379B

  • Question and answer management method and device based on large model, storage medium and program product

    CN121233825A