Dialogue data storage method based on large language model and related device
By extracting and verifying key information from dialogue data using a large language model, the problem of unreliable dialogue data storage in existing technologies is solved. This enables effective filtering and hierarchical storage of dialogue data, improving the reliability and efficiency of data management.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- QINGDAO JUSHANGHUI NETWORK TECH CO LTD
- Filing Date
- 2025-12-31
- Publication Date
- 2026-05-08
AI Technical Summary
Existing technologies lack effective filtering and verification methods for storing dialogue data, leading to unreliability issues in the stored dialogue data.
A large language model is used to extract key information from dialogue data. Combined with integrity verification, rationality verification and importance assessment, the key information is stored in long-term, short-term or working memory databases through a preset storage mechanism.
It enables effective filtering and hierarchical storage of dialogue data, improving the reliability and efficiency of data management and reducing invalid storage.
Smart Images

Figure CN121996737A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data storage technology, and in particular to a method and apparatus for storing dialogue data based on a large language model. Background Technology
[0002] With the development of large language models and intelligent agent technology, dialogue with intelligent agents is widely used in scenarios such as intelligent customer service, intelligent assistants, and automated office work. During these dialogues, a large amount of dialogue data in natural language form is continuously generated. In existing technologies, dialogue data is typically stored using simple log recording or bulk storage methods, which easily leads to unreliability issues. Therefore, there is an urgent need for a dialogue data storage method based on large language models to improve the reliability of dialogue data management. Summary of the Invention
[0003] In view of the above problems, this application provides a dialogue data storage method and related apparatus based on a large language model to achieve reliable storage of dialogue data. The specific solution is as follows:
[0004] The first aspect of this application provides a dialogue data storage method based on a large language model, comprising:
[0005] Call the memory encoder to obtain the dialogue data between the user and the intelligent agent. The dialogue data is natural language dialogue data.
[0006] A large language model is used to extract key information from the dialogue data.
[0007] Perform integrity and reasonableness verification on key information;
[0008] If the integrity and reasonableness verifications are passed, the importance of the key information is assessed to obtain an importance assessment value.
[0009] If the importance assessment value is greater than the preset first importance assessment value, the key information will be stored in the long-term memory database;
[0010] If the importance assessment value is less than the preset second importance assessment value, the key information will be stored in the working memory database;
[0011] If the importance assessment value is not less than the preset second importance assessment value and not greater than the preset first importance assessment value, then the key information will be stored in the short-term memory database.
[0012] Optionally, after obtaining the importance assessment value, the following may also be included:
[0013] If the integrity and rationality verification fails, the enhanced guide word guides the large language model to re-extract key information from the dialogue data, and returns to perform integrity and rationality verification on the key information.
[0014] If the re-extracted key information still fails the integrity and reasonableness verification, then the incomplete key information in the re-extracted key information is supplemented, the unreasonable key information in the re-extracted key information is deleted, and the importance of the key information after the supplementation and deletion operations is evaluated to obtain the importance evaluation value.
[0015] Optionally, perform integrity and reasonableness verification on key information, including:
[0016] The key information is converted into pre-defined structured information. The integrity of the main information and semantic content in the structured information is checked, and the presence of time conflicts or data distortion is also checked.
[0017] Optional, the importance assessment process includes:
[0018] The study aims to obtain the context persistence, repetition frequency, and time decay factor of key information. Context persistence is used to characterize the degree to which key information is referenced in multi-turn dialogues, repetition frequency is used to characterize the probability that key information is repeatedly triggered, and time decay factor is used to characterize the trend of the importance of key information changing over time.
[0019] The importance of context persistence, repetitive triggering frequency, and time decay factor is evaluated using a pre-defined evaluation model to obtain importance evaluation values.
[0020] Optionally, incomplete key information in the re-extracted key information can be supplemented, unreasonable key information can be deleted, and the importance of the key information after the supplementation and deletion operations can be evaluated to obtain an importance evaluation value, including:
[0021] The large language model is used to identify the missing semantic elements in incomplete key information, and the missing semantic elements are supplemented by combining the original dialogue data to generate supplemented key information.
[0022] Large language models are used to identify unreasonable key information that has semantic conflicts or incorrect subject attribution with the original dialogue data, and unreasonable key information is removed from the key information.
[0023] The importance of key information after the completion of supplementation and deletion operations is assessed, and the importance assessment value is obtained.
[0024] Optionally, the method also includes:
[0025] The forgetting function is invoked to retrieve key information from all databases and calculate the forgetting score of the key information. The forgetting function is encapsulated by a preset forgetting algorithm, and the forgetting score is calculated by the preset forgetting algorithm and used to characterize the importance of key information in the database.
[0026] If the forgetting score of the key information is greater than the first forgetting threshold and less than the second forgetting threshold, then the big language model is used to generate summary information of the key information, and the key information is replaced with the summary information.
[0027] If the forgetting score of key information is not less than the second forgetting threshold, the key information will be deleted from the database.
[0028] If the forgetting score of key information is not greater than the forgetting threshold, the key information will be retained.
[0029] Optionally, a large language model can be used to extract key information from the dialogue data, including:
[0030] The large language model is called to segment the dialogue data, and semantic understanding and intent recognition operations are performed on the segmented dialogue data to obtain the core semantic content.
[0031] The core semantic content is deduplicated and semantically merged to obtain key information.
[0032] A second aspect of this application provides a dialogue data storage device based on a large language model, comprising:
[0033] The data acquisition module is used to call the memory encoder to acquire the dialogue data between the user and the intelligent agent. The dialogue data is natural language dialogue data.
[0034] The data extraction module is used to extract key information from dialogue data using a large language model.
[0035] The data verification module is used to verify the integrity and reasonableness of key information.
[0036] The assessment module is used to assess the importance of key information if it passes the integrity and reasonableness verification, and obtain the importance assessment value.
[0037] The storage module is used to store key information in a long-term memory database if the importance assessment value is greater than a preset first importance assessment value; to store key information in a working memory database if the importance assessment value is less than a preset second importance assessment value; and to store key information in a short-term memory database if the importance assessment value is not less than a preset second importance assessment value and not greater than a preset first importance assessment value.
[0038] A third aspect of this application provides a computer program product including computer-readable instructions that, when executed on an electronic device, cause the electronic device to implement the large language model-based dialogue data storage method described in the first aspect or any implementation thereof.
[0039] A fourth aspect of this application provides an electronic device, including at least one processor and a memory connected to the processor, wherein:
[0040] Memory is used to store computer programs;
[0041] The processor is used to execute computer programs to enable electronic devices to implement the large language model-based dialogue data storage method described in the first aspect or any implementation thereof.
[0042] The fifth aspect of this application provides a computer storage medium carrying one or more computer programs, which, when executed by an electronic device, enable the electronic device to implement the large language model-based dialogue data storage method described in the first aspect or any of the methods described in the first aspect.
[0043] By employing the above technical solution, compared to existing technologies that simply record or store user-agent dialogue data without effectively filtering and verifying the dialogue content, the dialogue data storage method based on a large language model provided by this invention introduces information extraction, data integrity verification, and importance assessment mechanisms before dialogue data storage. By using a large language model to extract information from the dialogue data and verifying the data integrity of the extraction results based on a preset fault-tolerance mechanism, and by assessing the importance of the verified extraction results and determining the storage method accordingly, effective filtering and hierarchical storage of dialogue data are achieved, reducing invalid storage and improving the reliability of dialogue data management. Attached Figure Description
[0044] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.
[0045] Figure 1 A flowchart illustrating a dialogue data storage method based on a large language model provided in this application;
[0046] Figure 2 A schematic diagram illustrating the application process of a dialogue data storage method based on a large language model provided in this application;
[0047] Figure 3A schematic diagram of the data encoding process for a dialogue data storage method based on a large language model provided in this application;
[0048] Figure 4 A schematic diagram of the data storage process for a dialogue data storage method based on a large language model provided in this application;
[0049] Figure 5 A schematic diagram of the data forgetting check process for a dialogue data storage method based on a large language model provided in this application;
[0050] Figure 6 A schematic diagram of the structure of a dialogue data storage device based on a large language model provided in this application;
[0051] Figure 7 A schematic block diagram of an electronic device provided in this application. Detailed Implementation
[0052] The embodiments of this application are described below with reference to the accompanying drawings. The terminology used in the implementation section of this application is for explaining specific embodiments only and is not intended to limit the scope of this application.
[0053] The embodiments of this application will now be described with reference to the accompanying drawings. Those skilled in the art will recognize that, with technological advancements and the emergence of new scenarios, the technical solutions provided in the embodiments of this application are equally applicable to similar technical problems.
[0054] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such terms are interchangeable where appropriate; this is merely a way of distinguishing objects with the same attributes in the embodiments of this application. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion, so that a process, method, system, product, or apparatus that comprises a series of elements is not necessarily limited to those elements, but may include other elements not explicitly listed or inherent to those processes, methods, products, or apparatuses.
[0055] This application provides a dialogue data storage method based on a large language model, such as... Figure 1 The method may include the following steps:
[0056] S101: Call the memory encoder to obtain the dialogue data between the user and the agent. The dialogue data is natural language dialogue data.
[0057] Optionally, in this embodiment, a memory encoder can first be invoked to acquire dialogue data between the user and the agent. The dialogue data is in the form of natural language. The memory encoder is used to collect, organize, and encode the dialogue content generated during the interaction between the user and the agent, so that the dialogue data can be analyzed and stored subsequently.
[0058] Specifically, users can send dialogue content to the agent through text input, speech recognition and transcription, etc. During the process of generating corresponding responses, the agent records both the user's input and its output as dialogue data. The dialogue data can include multiple consecutive dialogue rounds, each presented as a natural language statement, fully reflecting the semantic interaction between the user and the agent. In this embodiment, the memory encoder can be invoked in real-time during a dialogue or in batches after a dialogue round ends, to uniformly acquire dialogue data within the current dialogue cycle. After acquiring the dialogue data, the memory encoder can perform basic encoding processing, such as adding time stamps, session identifiers, or role identifiers to distinguish between different users, different sessions, and the individual statements of the user and the agent, thus forming a clearly structured and traceable dialogue data input. This ensures that the natural language dialogue data between the user and the agent is acquired completely and accurately, providing a reliable data foundation for subsequent key information extraction, verification, and storage operations based on a large language model.
[0059] S102: Use a large language model to extract key information from the dialogue data to obtain key information;
[0060] Optionally, in this embodiment, after acquiring the dialogue data between the user and the intelligent agent, a large language model is used to extract key information from the dialogue data to obtain key information that can represent the core content of the dialogue.
[0061] Specifically, the dialogue data acquired through a memory encoder is input into a pre-built large language model. This large language model possesses natural language understanding and semantic analysis capabilities, enabling it to analyze the semantic content of multi-turn dialogues. When performing key information extraction, the large language model first segments the dialogue data, dividing the continuous dialogue content into multiple semantic segments, and then performs semantic understanding and intent recognition on each segment to identify the core semantic content contained in the dialogue. In this embodiment, the core semantic content may include important factual information explicitly or implicitly expressed in the dialogue, long-term user preference information, descriptions of stable user needs, key decision-making information, or semantic content that has reference value for subsequent interactions. Subsequently, the large language model can perform deduplication and semantic merging processing on the identified core semantic content to eliminate repetitive or semantically similar information, thereby generating more concise and semantically focused key information.
[0062] S103: Perform integrity verification and reasonableness verification on key information;
[0063] Optionally, in this embodiment, after obtaining the key information, integrity verification and rationality verification operations are performed on the key information to determine whether the key information meets the basic requirements for subsequent importance assessment and storage.
[0064] Specifically, the key information can first be converted into a pre-defined structured information format. This structured information can include fields such as subject information, semantic content, and dialogue-related time information, used for unified expression and validation of the key information. Then, an integrity verification operation is performed on the structured information to check whether the subject information and semantic content are complete. For example, it verifies whether the key information clearly points to a specific dialogue subject and whether it contains a complete semantic description, rather than incomplete fragments or semantically ambiguous expressions. After completing the integrity verification, a rationality verification operation is performed on the key information. Rationality verification is used to determine whether there are any anomalies in the structured information at the semantic and logical levels. Specifically, it checks for time conflicts in the structured information, such as whether the time sequence corresponding to the key information is contradictory, or whether there are time descriptions that are clearly inconsistent with the dialogue context. It also checks for data distortion in the key information, such as significant inconsistencies between the semantic content and the original dialogue data, or incorrect subject attribution. When the key information passes both the integrity and rationality verifications, it indicates that the key information meets the requirements at both the structural and semantic levels and can be considered valid information for subsequent importance assessment processes. When critical information fails integrity or reasonableness verification, it indicates that the information is missing or abnormal, requiring further extraction or correction. These integrity and reasonableness verification mechanisms effectively filter out incomplete or unreasonable critical information before storing dialogue data, improving the reliability and availability of subsequently stored data.
[0065] S104: If the integrity verification and reasonableness verification are passed, the importance assessment of the key information is carried out to obtain the importance assessment value.
[0066] Optionally, after obtaining the importance assessment value, the following processing can be performed:
[0067] If the integrity and reasonableness verification fails, the enhanced guide word guides the large language model to re-extract key information from the dialogue data, and returns to perform integrity and reasonableness verification on the key information. If the re-extracted key information still fails the integrity and reasonableness verification, the incomplete key information in the re-extracted key information is supplemented, the unreasonable key information in the re-extracted key information is deleted, and the importance of the key information after the supplementation and deletion operations is evaluated to obtain the importance evaluation value.
[0068] Optionally, in this embodiment, after completing the integrity verification and rationality verification of the key information, different processing procedures can be executed according to the verification results.
[0069] Specifically, if the critical information passes integrity and reasonableness verification, an importance assessment can be performed directly on it to obtain a corresponding importance assessment value. This importance assessment value characterizes the degree of importance of the critical information in subsequent memory storage, providing a basis for hierarchical memory storage.
[0070] If the key information fails the integrity or reasonableness verification, enhanced prompts are used to guide the large language model to re-extract the key information from the dialogue data. These enhanced prompts explicitly prompt the large language model to focus on missing semantic elements or conflicting content, thereby improving the completeness and reasonableness of the re-extracted key information. After re-extraction is complete, the process returns to verifying the completeness and reasonableness of the re-extracted key information.
[0071] If the re-extracted key information still fails the integrity and rationality verification, a correction process is performed on the re-extracted key information. Specifically, incomplete key information in the re-extracted key information can be supplemented to complete missing main information or semantic elements. Simultaneously, unreasonable key information in the re-extracted key information can be deleted to remove content that semantically conflicts with or contains logical errors in the original dialogue data. After completing the supplementation and deletion operations, an importance assessment operation is performed on the corrected key information to obtain the corresponding importance assessment value. This step can preserve as much valuable information in the dialogue as possible while ensuring the quality of key information, improving the robustness and accuracy of key information extraction and storage, and providing a reliable data foundation for subsequent long-term memory, short-term memory, or working memory storage.
[0072] S105: If the importance assessment value is greater than the preset first importance assessment value, the key information is stored in the long-term memory database; if the importance assessment value is less than the preset second importance assessment value, the key information is stored in the working memory database; if the importance assessment value is not less than the preset second importance assessment value and not greater than the preset first importance assessment value, the key information is stored in the short-term memory database.
[0073] Optionally, in this embodiment, after obtaining the importance assessment value corresponding to the key information, a hierarchical storage operation is performed on the key information according to the relationship between the importance assessment value and a preset threshold, so as to achieve differentiated management of information with different levels of importance.
[0074] Specifically, a first importance assessment value and a second importance assessment value are preset, with the first importance assessment value being greater than the second importance assessment value, used to classify different memory levels. When the importance assessment value is greater than the preset first importance assessment value, it indicates that the key information has high long-term value and lasting influence in the dialogue process, such as involving the user's long-term preferences, stable identity information, or key decision results. In this case, the key information is stored in the long-term memory database so that it can be continuously referenced and retrieved over a longer period of time.
[0075] When the importance assessment value is less than the preset second importance assessment value, it means that the key information only has immediate reference value in the current or a few dialogue rounds, such as one-time instructions or temporary status information. In this case, the key information is stored in the working memory database to support the contextual understanding of the current dialogue or a short period of time.
[0076] When the importance assessment value is not less than the preset second importance assessment value and not greater than the preset first importance assessment value, it indicates that the key information has certain phased reference value but does not need to be retained in the long term. Examples include short-term goals or phased preference information. In this case, the key information is stored in the short-term memory database. This step, based on a hierarchical storage method using importance assessment values, enables a reasonable distribution of key dialogue information among long-term memory, short-term memory, and working memory. This avoids high-value information being forgotten prematurely while reducing the occupation of long-term storage resources by low-value information, thereby improving the efficiency of agent memory management and overall operational stability.
[0077] like Figure 2 As shown, in another embodiment, the user at the user layer sends the dialogue to the Agent core at the Agent core layer, where the Agent is the intelligent agent mentioned above. Next, the dialogue data between the user and the intelligent agent can be sent to the memory manager at the memory management layer. After processing, the dialogue data is stored in the working memory database, short-term memory database, and long-term memory database respectively. Additionally, based on the user's dialogue habits, some dialogue data can be stored in the preference memory database. The working memory database and short-term memory database are built based on the Redis working memory database, the long-term memory database is built based on the PostgreSQL long-term memory database and vector database indexes, and the preference memory is built based on the PostgreSQL long-term memory database. Third, the memory manager can process the dialogue data through the memory processing layer, which can include a memory encoder, a memory retrieval unit, a memory integrator, and a memory forgetting unit. Their functions are respectively to encode and store the dialogue data, retrieve the dialogue data, integrate the dialogue data, and periodically clean up the dialogue data. Finally, the dialogue data can be input into a large language model for learning.
[0078] In one embodiment, the integrity and reasonableness verification of key information includes:
[0079] The key information is converted into pre-defined structured information. The integrity of the main information and semantic content in the structured information is checked, and the presence of time conflicts or data distortion is also checked.
[0080] Specifically, the integrity and rationality verification of key information includes: converting key information into preset structured information, and checking the completeness of subject information and semantic content based on the structured information, while also checking for time conflicts or data distortion in the structured information. In this embodiment, assume that a user inputs the following dialogue during a multi-turn dialogue with the agent: "I have a project review meeting with Manager Wang in Beijing next Monday morning, please remind me." The system obtains the above dialogue data through a memory encoder, and extracts the corresponding key information from the large language model in the aforementioned steps, such as "I have a project review meeting with Manager Wang in Beijing next Monday morning, please remind me." Subsequently, the key information can be converted into preset structured information. Structured information is an information representation format organized according to a predefined field format, used to describe the core semantic content in the dialogue in a structured manner. It includes at least subject information, event type, time information, object information, and semantic description content. In this embodiment, the structured information may include: subject is user, event type is project review meeting, participant is Manager Wang, time is next Monday morning, location is Beijing, and additional operation is reminder. After the structured data transformation is completed, the system performs an integrity verification operation on the structured information to check whether it contains complete subject information and semantic content. For example, it determines whether it simultaneously contains a clear event type, time element, and participating parties. If any key field is missing, the key information is deemed to have failed the integrity verification. Simultaneously, it can also perform a rationality verification operation on the structured information to check whether it is semantically and logically reasonable. For example, it checks whether the time information is contradictory or contrary to common sense, whether there are obvious semantic conflicts between the subject and the event, or whether there is data distortion caused by information extraction errors.
[0081] From the above, it can be concluded that this application can avoid the storage of incomplete or distorted memory content, thereby improving the accuracy and consistency of conversational memory data and enhancing the reliability of long-term memory systems.
[0082] like Figure 3As shown, in another embodiment, the user can send dialogue information to an agent, which then processes it to generate a response. The agent then requests an encoding encoder to encode the dialogue data. The encoder then sends the dialogue data to a large language model for analysis and returns the analysis results to the encoder. Finally, based on the analysis results, the encoder stores the dialogue data according to importance in a vector database and a PostgreSQL database, respectively.
[0083] like Figure 4 As shown, in another embodiment, the memory encoder can also analyze the dialogue data between the user and the agent and perform an importance assessment operation to obtain the corresponding importance assessment value (i.e., importance score), and store and manage the key information in the dialogue data hierarchically based on the importance assessment value.
[0084] Specifically, when the importance assessment value is less than 0.4, the importance of the dialogue data is determined to be low. At this time, the key information in the dialogue data is temporarily stored in the working memory database and discarded after the current dialogue round ends, so as to avoid low-value information occupying storage resources for a long time.
[0085] When the importance assessment value is between 0.4 and 0.7, the dialogue data is determined to be of medium importance. Key information from the dialogue data is stored in a short-term memory database, and the access and storage time of this key information are monitored, while simultaneously checking whether preset migration conditions are met. Migration conditions may include: the key information being accessed more than three times after the dialogue ends, or the key information containing user preference information. When the migration conditions are met, the key information is migrated and stored in a long-term memory database; when the key information is not accessed within a preset time, it is deleted from the short-term memory database.
[0086] In an optional implementation, when the importance assessment value of key information within the 0.4 to 0.7 range further increases and exceeds 0.5, the key information can be directly elevated and stored in the long-term memory database to improve response efficiency to important information. When the importance assessment value is greater than or equal to 0.7, the dialogue data is determined to have high importance, and the key information in the dialogue data is directly stored in the long-term memory database. Simultaneously, a forgetting mechanism can be applied to the key information stored in the long-term memory database at preset time intervals k (e.g., 12 hours), and the corresponding forgetting score is calculated based on a forgetting algorithm.
[0087] When the forgetting score is greater than 0.8, the corresponding key information is deleted from the long-term memory database; when the forgetting score is between 0.6 and 0.8, the key information is compressed into summary information and replaced with the original key information; when the forgetting score is less than 0.6, the key information is retained without processing.
[0088] like Figure 5 As shown, in another embodiment, the stored dialogue data can be periodically cleared by a scheduler. Specifically, the scheduler can invoke a forgetter at preset time intervals to calculate the corresponding forget score for the stored dialogue data and process the dialogue data based on the forget score.
[0089] In this embodiment, different data processing methods can be adopted according to different ranges of forgetting scores. These methods may include: when the forgetting score is within a preset range, generating corresponding summary information from the dialogue data and replacing the original dialogue data with the summary information; when the forgetting score is greater than a preset threshold, directly deleting the dialogue data from storage; and when the forgetting score is less than the preset threshold, continuing to retain the dialogue data. The process of generating summary information can be implemented using a large language model. By semantically compressing and extracting key information from the original dialogue data, summary information that can represent the core content of the dialogue is generated, thereby reducing storage costs while retaining information valuable for subsequent agent reasoning and decision-making.
[0090] In one embodiment, the importance assessment process includes:
[0091] The study aims to obtain the context persistence, repetition frequency, and time decay factor of key information. Context persistence is used to characterize the degree to which key information is referenced in multi-turn dialogues, repetition frequency is used to characterize the probability that key information is repeatedly triggered, and time decay factor is used to characterize the trend of the importance of key information changing over time.
[0092] The importance of context persistence, repetitive triggering frequency, and time decay factor is evaluated using a pre-defined evaluation model to obtain importance evaluation values.
[0093] Specifically, continuing with the aforementioned user-agent dialogue example, the user repeatedly mentions in multiple rounds of dialogue that they have a project review meeting with Manager Wang in Beijing next Monday morning and needs a reminder. For example, the user mentions the meeting arrangements in the first dialogue, then inquires about the preparation of meeting materials in subsequent dialogues, and reconfirms the reminder time. The occurrence of this key information in different dialogue rounds is continuously recorded throughout the dialogue. The contextual persistence of the key information can be assessed first. Contextual persistence characterizes the degree to which the key information is referenced or associated in multiple rounds of dialogue. For example, if meeting-related information is mentioned in consecutive rounds of dialogue or serves as the contextual basis for subsequent questions, its contextual persistence is considered high; if it only appears in a single round of dialogue, its contextual persistence is low.
[0094] Secondly, the frequency of repeated triggering of key information can be obtained. The frequency of repeated triggering is used to characterize the probability that key information is repeatedly triggered or repeatedly extracted. For example, in this embodiment, if a user is detected mentioning the same meeting arrangement and reminder request multiple times in different ways, the corresponding frequency of repeated triggering is relatively high.
[0095] Finally, the time decay factor of key information can be obtained. The time decay factor characterizes the changing trend of the importance of key information over time. For example, for a recently occurring meeting event, the time decay factor is smaller, indicating that its importance decays slowly over time. Conversely, for past events or events far removed from the present, the time decay factor is larger, indicating that its importance decreases rapidly over time. After obtaining the context persistence, repetition frequency, and time decay factor, the parameters can be input into a preset evaluation model, and each parameter can be weighted to obtain the importance evaluation value of the key information. The importance evaluation value is used to comprehensively reflect the overall importance of the key information in the current dialogue and long-term interactions, and provides a basis for subsequently storing the key information in different memory databases.
[0096] From the above, it can be concluded that this application, by introducing context persistence, repetitive triggering frequency, and time decay factor to conduct multi-dimensional importance assessment of key information, can quantify the actual value of key information in multi-turn dialogues and time dimensions, making the importance assessment results more consistent with the user's real usage scenarios, thereby improving the rationality and intelligence of memory storage decisions.
[0097] In one embodiment, incomplete key information in the re-extracted key information is supplemented, unreasonable key information in the re-extracted key information is deleted, and the importance of the key information after the supplementation and deletion operations is evaluated to obtain an importance evaluation value, including:
[0098] The large language model is used to identify the missing semantic elements in incomplete key information, and the missing semantic elements are supplemented by combining the original dialogue data to generate supplemented key information.
[0099] Large language models are used to identify unreasonable key information that has semantic conflicts or incorrect subject attribution with the original dialogue data, and unreasonable key information is removed from the key information.
[0100] The importance of key information after the completion of supplementation and deletion operations is assessed, and the importance assessment value is obtained.
[0101] Specifically, for example, a large language model extracts the following key information from dialogue data: "There is a project review meeting in Beijing next Monday, please remind me." During subsequent integrity and reasonableness verification, the system finds that this key information lacks a specific time (e.g., morning or afternoon) and information about the participants, thus determining that the key information is incomplete.
[0102] In this scenario, the system employs enhanced prompts to guide the large language model in re-extracting key information from the original dialogue data. For example, by prompting the large language model to focus on time, location, and people, more complete semantic information can be obtained. If the re-extracted key information is still missing, such as the meeting start time not being clearly stated, the system further utilizes the large language model to identify the missing semantic elements in the incomplete key information and supplements it by combining it with the original dialogue content. For example, based on the user's mention of "meeting at 9:00 AM" in other dialogue rounds, the system generates the key information "Next Monday at 9:00 AM, a project review meeting with Manager Wang in Beijing; a reminder is needed." Simultaneously, the system performs a rationality check on the re-extracted key information. For example, if the key information incorrectly identifies the meeting participant as "Manager Li," while the original dialogue clearly mentions "Manager Wang," the large language model can identify this unreasonable key information that semantically conflicts with the original dialogue data or has an incorrect subject attribution, and delete or correct this unreasonable content from the key information. After completing the supplementation and deletion operations, the importance assessment process can be performed again on the corrected key information to obtain context persistence, repetitive triggering frequency and time decay factor, and calculate the final importance assessment value based on the preset assessment model, providing a basis for subsequent memory storage decisions.
[0103] From the above, it can be concluded that this application, by supplementing incomplete key information at the field level and deleting unreasonable key information when re-extraction still fails verification, can repair the key information structure without introducing erroneous semantics, thereby improving the usability and completeness of key information.
[0104] In one embodiment, a forgetting function is invoked to retrieve key information from all databases and calculate the forgetting score of the key information. The forgetting function is encapsulated by a preset forgetting algorithm, and the forgetting score is calculated by the preset forgetting algorithm and used to characterize the importance of the key information in the database.
[0105] If the forgetting score of the key information is greater than the first forgetting threshold and less than the second forgetting threshold, then the big language model is used to generate summary information of the key information, and the key information is replaced with the summary information.
[0106] If the forgetting score of key information is not less than the second forgetting threshold, the key information will be deleted from the database.
[0107] If the forgetting score of key information is not greater than the forgetting threshold, the key information will be retained.
[0108] Specifically, the forgetting mechanism can be periodically invoked to traverse key information stored in the long-term memory database, short-term memory database, and working memory database, and calculate the forgetting score for each key piece of information based on a preset forgetting algorithm. The forgetting score is used to characterize the current importance of the key information as it changes over time and with varying usage frequency.
[0109] For example, regarding the crucial information "A project review meeting with Manager Wang will be held in Beijing at 9:00 AM next Monday; a reminder is needed," if this information is cited multiple times before the meeting, and the meeting is imminent, its forgetting score is low, leading the system to determine its high importance and retain it fully in the database. After the meeting, if the information still has some reference value but its frequency of citation decreases significantly, its forgetting score may fall between the first and second forgetting thresholds. In this case, the system uses a large language model to generate a summary of the information, such as a summary of "The user has scheduled and completed a project review meeting," and replaces the original detailed information with this summary to reduce storage redundancy. If the forgetting score of certain key information further increases and is not less than the second forgetting threshold, such as temporary reminders that were completed early and have not been cited for a long time, the system determines that the long-term value of this information is low and deletes it from the database. For key information with a forgetting score not exceeding the preset forgetting threshold, such as information related to a user's long-term preferences or persistent behavioral habits, the system directly retains it in the corresponding memory database. By employing the aforementioned forgetting mechanism, the availability of critical information can be guaranteed while effectively controlling the scale of memory and improving the overall memory management efficiency of the system.
[0110] From the above, it can be concluded that this application, by introducing a forgetting score mechanism based on a forgetting algorithm and adopting differentiated processing strategies such as retention, summary replacement, or deletion according to different forgetting scores, can dynamically adjust the storage form of memory content, effectively control the memory scale while ensuring the long-term retention of important information, thereby improving the storage efficiency and long-term operational stability of the memory system.
[0111] In one embodiment, a large language model is used to extract key information from the dialogue data to obtain key information, including:
[0112] The large language model is called to segment the dialogue data, and semantic understanding and intent recognition operations are performed on the segmented dialogue data to obtain the core semantic content.
[0113] The core semantic content is deduplicated and semantically merged to obtain key information.
[0114] Specifically, consider a user inputting the following natural language content in a multi-turn dialogue: "I have a project review meeting in Beijing next Monday," "Remember to remind me at 9 AM," and "The meeting is with Manager Wang." Dialogue data typically contains multi-turn interactions, with semantically dispersed content and instances of information repetition or supplementation. First, a large language model can be used to segment the dialogue data, dividing the continuous multi-turn dialogue into multiple dialogue segments based on chronological order or semantic boundaries. For example, "I have a project review meeting in Beijing next Monday," "Remember to remind me at 9 AM," and "The meeting is with Manager Wang" can be processed as independent dialogue segments.
[0115] Subsequently, the large language model performs semantic understanding and intent recognition operations on each dialogue segment to extract the core semantic content contained in each segment. For example, the core semantic content identified in the first dialogue is "the meeting type is a project review meeting, the time is next Monday, and the location is Beijing." The core semantic content identified in the second dialogue is "the reminder intent and the reminder time is 9:00 AM." The core semantic content identified in the third dialogue is "the meeting participant is Manager Wang." After obtaining multiple core semantic contents, deduplication and semantic merging processes can be performed on the core semantic contents. Specifically, for information that appears repeatedly or has the same semantics in different dialogue segments, such as multiple mentions of "project review meeting" or "next Monday," the system retains only one valid piece of information through semantic deduplication. Simultaneously, complementary semantic information scattered across different dialogue segments is merged to generate semantically complete and structurally clear key information.
[0116] From the above, it can be concluded that this application, by segmenting dialogue data and performing semantic understanding, intent recognition, deduplication, and semantic merging operations on the basis of segmentation, can more accurately extract the core semantic information in the dialogue, avoid redundant information from being stored repeatedly, and thus improve the accuracy of key information extraction and the compactness of the memory content.
[0117] The above describes a dialogue data storage method based on a large language model provided by the embodiments of this application. The following will describe the dialogue data storage device based on the large language model that performs the above.
[0118] Please see Figure 6 , Figure 6 This is a schematic diagram of the structure of a dialogue data storage device based on a large language model, provided as an embodiment of this application. Figure 6 As shown, the dialogue data storage device based on a large language model includes:
[0119] The dialogue invocation module 400 is used to invoke the memory encoder to obtain dialogue data between the user and the intelligent agent, wherein the dialogue data is natural language dialogue data;
[0120] Data extraction module 401 is used to extract key information from dialogue data using a large language model to obtain key information;
[0121] Data verification module 402 is used to verify the integrity and rationality of key information;
[0122] The evaluation module 403 is used to evaluate the importance of key information if it passes the integrity verification and reasonableness verification, and obtain the importance evaluation value.
[0123] Optionally, the evaluation module 403 is also used to, after obtaining the importance evaluation value, if the integrity verification and reasonableness verification fail, use enhanced guiding words to guide the large language model to re-extract key information from the dialogue data, and return to perform integrity verification and reasonableness verification on the key information; if the re-extracted key information still fails the integrity verification and reasonableness verification, then supplement the incomplete key information in the re-extracted key information, delete the unreasonable key information in the re-extracted key information, and perform an importance evaluation on the key information after the supplementation and deletion operations to obtain the importance evaluation value;
[0124] The storage module 404 is used to store key information in a long-term memory database if the importance assessment value is greater than a preset first importance assessment value; to store key information in a working memory database if the importance assessment value is less than a preset second importance assessment value; and to store key information in a short-term memory database if the importance assessment value is not less than a preset second importance assessment value and not greater than a preset first importance assessment value.
[0125] In one embodiment, the data verification module 402 is specifically used to: convert key information into preset structured information, check whether the main information and semantic content in the structured information are complete, and check whether there are time conflicts or data distortions in the structured information.
[0126] In one embodiment, the evaluation module 403 is specifically used to: obtain the context persistence, repetition frequency and time decay factor of key information. The context persistence is used to characterize the degree to which key information is referenced in multi-turn dialogues, the repetition frequency is used to characterize the probability that key information is repeatedly triggered, and the time decay factor is used to characterize the trend of the importance of key information changing over time.
[0127] The importance of context persistence, repetitive triggering frequency, and time decay factor is evaluated using a pre-defined evaluation model to obtain importance evaluation values.
[0128] In one embodiment, the evaluation module 403 is specifically used to: use a large language model to identify missing semantic elements in incomplete key information, and combine the original dialogue data to supplement the missing semantic elements to generate supplemented key information.
[0129] Large language models are used to identify unreasonable key information that has semantic conflicts or incorrect subject attribution with the original dialogue data, and unreasonable key information is removed from the key information.
[0130] The importance of key information after the completion of supplementation and deletion operations is assessed, and the importance assessment value is obtained.
[0131] In one embodiment, a forgetting module is further included, which is used to: call the forgetting device to obtain key information from all databases and calculate the forgetting score of the key information. The forgetting device is encapsulated by a preset forgetting algorithm, and the forgetting score is calculated by the preset forgetting algorithm and used to characterize the importance of the key information in the database.
[0132] If the forgetting score of the key information is greater than the first forgetting threshold and less than the second forgetting threshold, then the big language model is used to generate summary information of the key information, and the key information is replaced with the summary information.
[0133] If the forgetting score of key information is not less than the second forgetting threshold, the key information will be deleted from the database.
[0134] If the forgetting score of key information is not greater than the forgetting threshold, the key information will be retained.
[0135] In one embodiment, the data extraction module 401 is specifically used to: call a large language model to segment the dialogue data, and perform semantic understanding and intent recognition operations on the segmented dialogue data to obtain core semantic content.
[0136] The core semantic content is deduplicated and semantically merged to obtain key information.
[0137] This application also provides an electronic device in its embodiments. (See reference...) Figure 7 The diagram illustrates a structural schematic of an electronic device suitable for implementing the large language model-based dialogue data storage method in the embodiments of this application. The electronic device in the embodiments of this application may include, but is not limited to, fixed terminals such as mobile phones, laptops, PDAs (personal digital assistants), PADs (tablet computers), desktop computers, etc. Figure 7 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0138] like Figure 7As shown, the electronic device may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603. When the electronic device is powered on, the RAM 603 also stores various programs and data required for the operation of the electronic device. The processing unit 601, ROM 602, and RAM 603 are interconnected via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0139] Typically, the following devices can be connected to I / O interface 605: input devices 606 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 607 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 608 including, for example, memory cards, hard drives, etc.; and communication devices 609. Communication device 609 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 7 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown. More or fewer devices may be implemented or have alternatively.
[0140] This application also provides a computer program product including computer-readable instructions, which, when executed on an electronic device, cause the electronic device to implement any of the dialogue data storage methods based on a large language model provided in this application.
[0141] This application also provides a computer-readable storage medium that carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any of the dialogue data storage methods based on a large language model provided in this application.
[0142] It should also be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. In addition, in the device embodiment drawings provided in this application, the connection relationship between modules indicates that they have a communication connection, which can be implemented as one or more communication buses or signal lines.
[0143] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware, or it can be implemented by special-purpose hardware including application-specific integrated circuits, special-purpose CPUs, special-purpose memory, special-purpose components, etc. Generally, any function performed by a computer program can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be diverse, such as analog circuits, digital circuits, or special-purpose circuits. However, for this application, software program implementation is more often the preferred implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium, such as a computer floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk, or optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, training equipment, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0144] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product.
[0145] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, training device, or data center to another website, computer, training device, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state drives (SSDs)).
Claims
1. A dialogue data storage method based on a large language model, characterized in that, include: The memory encoder is invoked to obtain the dialogue data between the user and the intelligent agent, and the dialogue data is natural language dialogue data; The dialogue data is processed using a large language model to extract key information. The integrity and reasonableness of the key information are verified. If the integrity verification and reasonableness verification are passed, the importance of the key information is assessed to obtain an importance assessment value; If the importance assessment value is greater than the preset first importance assessment value, the key information will be stored in the long-term memory database. If the importance assessment value is less than the preset second importance assessment value, the key information is stored in the working memory database; If the importance assessment value is not less than a preset second importance assessment value and not greater than a preset first importance assessment value, then the key information is stored in a short-term memory database.
2. The dialogue data storage method based on a large language model according to claim 1, characterized in that, After obtaining the importance assessment value, the following is also included: If the integrity and rationality verification fails, the enhanced guide word guides the large language model to re-extract key information from the dialogue data, and returns to perform integrity and rationality verification on the key information. If the re-extracted key information still fails the integrity and reasonableness verification, then the incomplete key information in the re-extracted key information is supplemented, the unreasonable key information in the re-extracted key information is deleted, and the importance of the key information after the supplementation and deletion operations is evaluated to obtain the importance evaluation value.
3. The dialogue data storage method based on a large language model according to claim 1, characterized in that, The process of verifying the integrity and reasonableness of the key information includes: The key information is converted into preset structured information. The integrity of the main information and semantic content in the structured information is checked, and the time conflict or data distortion of the structured information is checked.
4. The dialogue data storage method based on a large language model according to claim 1, characterized in that, The process of the importance assessment includes: The context persistence, repetition frequency, and time decay factor of the key information are obtained. The context persistence is used to characterize the degree to which the key information is referenced in multi-turn dialogues. The repetition frequency is used to characterize the probability that the key information is repeatedly triggered. The time decay factor is used to characterize the trend of the importance of the key information changing over time. The importance of the context persistence, repetitive triggering frequency, and time decay factor is evaluated using a preset evaluation model to obtain importance evaluation values.
5. The dialogue data storage method based on a large language model according to claim 2, characterized in that, The process involves supplementing incomplete key information in the re-extracted key information, deleting unreasonable key information, and then evaluating the importance of the key information after the supplementation and deletion operations to obtain an importance evaluation value, including: The missing semantic elements in the incomplete key information are identified using a large language model, and the missing semantic elements are supplemented by combining the original dialogue data to generate supplemented key information. The large language model is used to identify unreasonable key information that has semantic conflicts or incorrect subject attribution with the original dialogue data, and the unreasonable key information is removed from the key information. The importance of the key information after the completion of the supplementation and deletion operations is evaluated to obtain the importance evaluation value.
6. The dialogue data storage method based on a large language model according to claim 1, characterized in that, Also includes: The forgetting function is invoked to retrieve key information from all databases and calculate the forgetting score of the key information. The forgetting function is encapsulated by a preset forgetting algorithm, and the forgetting score is calculated by the preset forgetting algorithm and used to characterize the importance of the key information in the database. If the forgetting score of the key information is greater than the first forgetting threshold and less than the second forgetting threshold, then a summary of the key information is generated using a large language model, and the key information is replaced with the summary information. If the forgetting score of the key information is not less than the second forgetting threshold, the key information will be deleted from the database; If the forgetting score of the key information is not greater than the forgetting threshold, the key information will be retained.
7. The dialogue data storage method based on a large language model according to claim 1, characterized in that, The process of extracting key information from the dialogue data using a large language model yields key information, including: The large language model is invoked to segment the dialogue data, and semantic understanding and intent recognition operations are performed on the segmented dialogue data to obtain the core semantic content. The core semantic content is deduplicated and semantically merged to obtain key information.
8. A computer program product, characterized in that, It includes computer-readable instructions that, when executed on an electronic device, cause the electronic device to implement the dialogue data storage method based on a large language model as described in any one of claims 1 to 7.
9. An electronic device, characterized in that, It includes at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is used to execute the computer program to enable the electronic device to implement the dialogue data storage method based on a large language model as described in any one of claims 1 to 7.
10. A computer storage medium, characterized in that, The storage medium carries one or more computer programs, which, when executed by an electronic device, enable the electronic device to implement the dialogue data storage method based on a large language model as described in any one of claims 1 to 7.
Citation Information
Cited By
Method, device, equipment, storage medium and program product for context query
CN122173642A