Multi-round dialogue method and device based on memory management and electronic equipment

By determining the topic in multiple rounds of conversations and updating historical memory information, the problem of insufficient storage pressure and forgetting mechanisms in multiple rounds of conversations is solved, and the freshness of the conversation and the optimization of storage space is achieved.

CN119090012APending Publication Date: 2024-12-06ZHEJIANG GEELY HLDG GRP CO LTD +1
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411138649.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-19
Publication Date
2024-12-06

AI Technical Summary

Technical Problem

The existing multi-round dialogue methods have problems such as storage pressure and lack of forgetting mechanisms in long-term dialogue content management, resulting in excessive storage space and no longer fresh dialogue content.

Method used

By determining whether the multiple rounds of conversation information between the user and the large language model change the topic, and when the preset forgetting conditions meet, the memory information with the earliest storage time in the historical memory information is selected as a new topic, update the historical memory information, and reduce the storage space usage when the preset forgetting conditions are met. , and provide forgetting mechanisms in human communication mode.

Benefits of technology

It effectively reduces the storage space of historical memory information, maintains the freshness and interactivity of dialogue, and provides a forgetting mechanism that conforms to human communication mode, which not only provides information guidance for new topics but also reduces storage pressure.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119090012A_ABST
    Figure CN119090012A_ABST
Patent Text Reader

Abstract

The invention provides a multi-round dialogue method and device based on memory management and electronic equipment. According to one embodiment of the invention, the method comprises the following steps: judging whether to replace a topic or not according to multi-round dialogue information of a user and a large language model; if it is judged that the topic is replaced and the historical memory information meets the preset forgetting condition, the earliest memory information with the earliest storage time in the historical memory information is selected to serve as a new topic after replacement, and the historical memory information is updated; wherein the historical memory information is obtained by summarizing historical dialogue contents; and obtaining reply information output by the large language model based on the multi-round dialogue information and the guidance information corresponding to the new topic.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to a multi-round dialogue method, device and electronic device based on memory management. Background Art

[0002] In the field of artificial intelligence, human-computer dialogue applications have always received high attention. Currently, most research and applications focus on single-round human-computer dialogue, mainly because its implementation is relatively simple and only requires understanding and responding to a user's question or instruction.

[0003] The complexity of multi-round dialogues is far greater than that of single-round dialogues. Multi-round dialogues must have continuous context awareness and long-term memory functions. It is necessary to understand the user's current dialogue intention based on the memory information of historical dialogues, understand and meet the user's needs at a deeper level, and generate appropriate responses.

[0004] The current multi-round dialogue method still has shortcomings in the management of long-term dialogue content. Generally, new dialogues are directly stored in the historical dialogue content, which causes great storage pressure. In addition, there is no good forgetting mechanism for some dialogue content that has been stored for a long time or expired. Summary of the invention

[0005] In order to overcome the problems existing in the related art, the present application provides a multi-round dialogue method, device and electronic device based on memory management.

[0006] According to a first aspect of any embodiment of the present application, a multi-round dialogue method based on memory management is provided, the method comprising:

[0007] Determine whether to change the topic based on multiple rounds of conversations between the user and the large language model;

[0008] If it is determined that the topic is changed and the historical memory information meets the preset forgetting condition, the earliest memory information with the earliest storage time in the historical memory information is selected as the new topic after the change, and the historical memory information is updated; wherein the historical memory information is obtained by summarizing the historical conversation content;

[0009] Based on the multiple rounds of dialogue information and the guidance information corresponding to the new topic, reply information output by the large language model is obtained.

[0010] According to a second aspect of any embodiment of the present application, a multi-round dialogue device based on memory management is provided, the device comprising:

[0011] The topic determination module is used to determine whether to change the topic based on the multi-round dialogue information between the user and the large language model;

[0012] An information updating module, for selecting the earliest memory information with the earliest storage time in the historical memory information as the new topic after the change, and updating the historical memory information if it is determined that the topic is changed and the historical memory information meets the preset forgetting condition; wherein the historical memory information is obtained by summarizing the historical conversation content;

[0013] A reply output module is used to obtain reply information output by the large language model based on the multi-round dialogue information and the guidance information corresponding to the new topic.

[0014] According to a third aspect of any embodiment of the present application, there is provided an electronic device, including:

[0015] processor;

[0016] a memory for storing processor-executable instructions;

[0017] The processor implements the method described in any embodiment of the present application by running the executable instructions.

[0018] According to a fourth aspect of any embodiment of the present application, a computer-readable storage medium is provided, on which computer instructions are stored. When the instructions are executed by a processor, the method described in any embodiment of the present application is implemented.

[0019] According to a fifth aspect of any embodiment of the present application, a computer program product is provided, on which a computer program / instruction is stored, and when the computer program / instruction is executed by a processor, the method described in any embodiment of the present application is implemented.

[0020] The technical solution provided by this application may have the following beneficial effects:

[0021] According to the above embodiment, it can be known that by determining whether to change the topic based on multiple rounds of dialogue information between the user and the large language model, if it is determined that the topic is changed and the historical memory information meets the preset forgetting condition, the earliest memory information with the earliest storage time in the historical memory information is selected as the new topic after the change, and the historical memory information is updated. Based on the multi-round dialogue information and the guidance information corresponding to the new topic, the reply information output by the large language model is obtained. Since the historical memory information is obtained by summarizing the content of historical dialogues, the least text can be used to retain the most dialogue information, which not only provides information guidance for new dialogues, but also reduces the storage space of historical memory information. In addition, the earliest memory information with the earliest storage time is used as a new topic to start a conversation and update the historical memory information, providing a forgetting mechanism that conforms to the human communication pattern.

[0022] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] The accompanying drawings, which are incorporated in the specification and constitute a part of this application, illustrate embodiments consistent with the application and, together with the description, serve to explain the principles of the application.

[0024] Figure 1 is a flow chart of a multi-round dialogue method based on memory management according to an exemplary embodiment of the present application;

[0025] Figure 2 is a flow chart of another multi-round dialogue method based on memory management according to an exemplary embodiment of the present application;

[0026] Figure 3 is a structural diagram of a dialogue system according to an exemplary embodiment of the present application;

[0027] Figure 4 is a structural schematic diagram of an electronic device according to an exemplary embodiment of the present application;

[0028] Figure 5 It is a block diagram of a multi-round dialogue device based on memory management according to an exemplary embodiment of the present application. DETAILED DESCRIPTION

[0029] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0030] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0031] It should be understood that although the terms first, second, third, etc. may be used in the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0032] Currently, in multi-round conversations, new conversations are usually stored directly in historical conversation content, which puts a lot of storage pressure on them. In addition, there is a lack of a suitable forgetting mechanism for some conversation content that has been stored for a long time or has expired.

[0033] In order to solve the above problems, the present application proposes a multi-round dialogue method based on memory management. To further illustrate the present application, the following embodiments are provided:

[0034] See also Figure 1 , Figure 1 This is a flowchart of a multi-round dialogue method based on memory management according to an exemplary embodiment of the present application. The multi-round dialogue method based on memory management can be executed by a dialogue system with human-computer interaction function, and the dialogue system can be applied to electronic devices such as robots, mobile phones, computers, digital broadcast terminals, tablet devices, personal digital assistants, smart home appliances, etc.

[0035] The multi-round dialogue method based on memory management may include the following steps:

[0036] Step 102: Determine whether to change the topic based on multiple rounds of conversation information between the user and the large language model.

[0037] In this step, the dialogue system can use the multi-round dialogue information between the user and the large language model in the dialogue system in recent rounds during the casual chat with the user, and input the multi-round dialogue information into the large language model.

[0038] The large language model analyzes semantic information such as the semantic relevance between the user's input information in the current round of dialogue and the information in multiple rounds of dialogue, contextual coherence, and the emotional tendency of the input information in multiple rounds of dialogue information. Based on the analysis results of the semantic information, it determines whether the topic of the current round of dialogue needs to be changed.

[0039] Among them, the multi-round dialogue information is the input information and reply information of the most recent rounds of dialogue between the user and the dialogue system in history, for example, the input information and reply information of the most recent five rounds, the input information and reply information of the most recent ten rounds, etc.

[0040] Step 104: If it is determined that the topic is changed and the historical memory information meets the preset forgetting condition, select the earliest memory information with the earliest storage time in the historical memory information as the new topic after the change, and update the historical memory information; wherein, the historical memory information is obtained by summarizing the historical conversation content.

[0041] In this step, when users express boredom or loss of interest, when the same topic has been discussed for a long time without introducing new ideas, or when users show dissatisfaction or resistance, the large language model can determine that the topic needs to be changed to keep the conversation fresh and interactive.

[0042] When the large language model determines that the topic needs to be changed and the historical memory information meets the preset forgetting condition, the dialogue system can select the earliest memory information with the earliest storage time in the historical memory information as the new topic after the topic is changed.

[0043] In addition, the stored historical memory information is updated, for example, the earliest memory information in the historical memory information is deleted, the storage time of the earliest memory information is updated, etc.

[0044] Among them, the historical memory information is obtained by summarizing the historical conversation content according to the time range, historical conversation rounds, token number, etc. The historical memory information may include summary topics, summary events, user portraits and other information.

[0045] The earliest memory information is the memory information with the earliest storage time in the historical memory information. The storage time is the time from when the memory information is stored to the historical memory information.

[0046] A token is the smallest processing unit in the conversation content, which can be a word, a punctuation mark, or a smaller unit. The new topic is the topic of the current round of conversation between the user and the dialogue system.

[0047] The forgetting condition is used to determine whether the earliest memory information needs to be forgotten, for example: the storage space occupied by the historical memory information exceeds the preset threshold, the storage time of the earliest memory information in the historical memory information is longer than the preset date, etc.

[0048] In one embodiment, if it is determined that the topic is changed and the historical memory information does not meet the forgetting condition, the earliest memory information in the historical memory information does not need to be forgotten. The dialogue system can select a topic that does not overlap with the historical memory information from the preset general topics as the new topic after the topic is changed.

[0049] Among them, general topics are open topics that stimulate users to think and communicate, such as interests, hobbies, social culture, etc.

[0050] As described above, if it is determined that the topic has been changed and the historical memory information does not meet the forgetting condition, a topic that does not overlap with the historical memory information is selected from the preset general topics as a new topic. While ensuring that the conversation topic remains within the general range, the diversity and freshness of the conversation are increased, which helps to maintain user interest and engagement.

[0051] Step 106: Based on the multi-round dialogue information and the guidance information corresponding to the new topic, the response information output by the large language model is obtained.

[0052] In this step, the dialogue system can construct guidance information corresponding to the new topic based on the new topic, input the multi-round dialogue information of recent rounds and the guidance information corresponding to the new topic into the large language model, and obtain the reply information output by the large language model.

[0053] When generating reply messages, the large language model can also refer to user portraits, event summary information, and other information in historical memory to generate more personalized and accurate reply messages, avoiding reviewing all historical multi-round conversation information before replying. This reduces the input length of the large language model while maintaining the accuracy of the reply.

[0054] The guidance information corresponding to the new topic is used to guide the large language model to generate reply information that conforms to the new topic. The guidance information may include: new topic, reply examples of reply information, and other information.

[0055] In one embodiment, the dialogue system can pre-set the character background of the large language model through the character prompt. The dialogue system obtains a reply style that matches the character background based on the character background of the large language model. The multi-round dialogue information, new topics, and reply styles of recent rounds are input into the large language model to obtain a reply example output by the large language model.

[0056] The dialogue system can use new topics, response styles, and response examples as guidance information to guide the large language model to generate more complete response information that is consistent with the character's background.

[0057] Among them, the character background is the role that the large language model needs to play, such as tour guide, lecturer, etc. The response style is the language characteristics, tone, wording and other expressions displayed when the large language model generates a response message, such as enthusiasm, gentleness, characteristic dialect, etc.

[0058] As described above, by obtaining a reply style that matches the personality background based on the personality background of the large language model, and obtaining reply examples output by the large language model based on multi-round dialogue information, new topics, and reply styles, the new topics, reply styles, and reply examples are used as guidance information, so that the reply information output by the large language model not only matches the personality background, but also improves the accuracy and relevance of the reply information, thereby bringing users a better dialogue experience.

[0059] The multi-round dialogue method based on memory management of this embodiment determines whether to change the topic based on the multi-round dialogue information between the user and the large language model. If it is determined that the topic is changed and the historical memory information meets the preset forgetting condition, the earliest memory information with the earliest storage time in the historical memory information is selected as the new topic after the change, and the historical memory information is updated. Based on the multi-round dialogue information and the guidance information corresponding to the new topic, the reply information output by the large language model is obtained. Since the historical memory information is obtained by summarizing the historical dialogue content, the most dialogue information can be retained with the least text, which not only provides information guidance for the new dialogue, but also reduces the storage space of the historical memory information. In addition, the earliest memory information with the earliest storage time is used as the new topic to start the conversation and update the historical memory information, providing a forgetting mechanism that conforms to the human communication pattern.

[0060] In the above-mentioned embodiment, when it is determined that the topic is changed and the historical memory information meets the preset forgetting condition, the oldest memory information with the earliest storage time is used for conversation to update the historical memory information. In the following embodiment, how to store the memory information will be described in detail, and it can be applied to any of the above embodiments.

[0061] In one embodiment, the dialogue system may use a large language model to summarize current round input information and response information in multiple rounds of dialogue information to obtain current round memory information of the current round of dialogue.

[0062] The dialogue system uses similarity matching algorithms such as cosine similarity and Euclidean distance to calculate the similarity between each piece of historical memory information and the current round of memory information, and to determine whether there is matching memory information in the historical memory information that matches the current round of memory information.

[0063] If the similarity between a piece of historical memory information and the current round of memory information exceeds a preset similarity threshold, then the historical memory information is the matching memory information that matches the current round of memory information; if there is no memory information in the historical memory information whose similarity exceeds the similarity threshold, then there is no matching memory information in the historical memory information that matches the current round of memory information.

[0064] If there is no matching memory information in the historical memory information, the dialogue system can add the current round of memory information to the historical memory information to provide a reference for subsequent dialogues.

[0065] The current round input information is the information input by the user in the current round of dialogue, which can be text information, audio information, etc. The current round memory information is the memory information obtained by summarizing the content of the current round of dialogue. The matching memory information is the memory information in the historical memory information that matches the current round memory information.

[0066] As described above, by summarizing the input information and reply information of this round in multiple rounds of dialogue information, the memory information of this round is obtained, and the similarity matching algorithm is used to determine whether there is matching memory information in the historical memory information that matches the memory information of this round. If there is no matching memory information in the historical memory information, the memory information of this round is added to the historical memory information, and the summary information of the new dialogue content is continuously accumulated, making the large language model more intelligent and personalized.

[0067] In one embodiment, when summarizing the conversation content, the dialogue system can also use the large language model to determine the user's emotional inclination towards the conversation content, and the summarized historical memory information can represent the user's preference for the conversation content.

[0068] If the matching memory information matches the user's current user preference for this round of memory information, it means that the user preference has not changed. The similar matching memory information and the current round of memory information are merged, or the matching memory information is replaced with the current round of memory information, so as to update the storage time of the matching memory information to the storage time of this conversation.

[0069] If the matching memory information does not match the current user preference, it means that the user preference has changed. The matching memory information is deleted and the current round of memory information is added to the historical memory information, thereby storing the latest memory information.

[0070] The matching memory information is at least used to represent the user's historical user preference for the matching memory information. The matching memory information may include: the user's historical user preference for the matching memory information. The historical user preference is the user's user preference for the historical memory information.

[0071] The current round of memory information is at least used to represent the user's current user preference for the current round of memory information. The current round of memory information may include: the user's current user preference for the current round of memory information. The current user preference is the user's user preference for the current round of memory information.

[0072] User preferences may include positive preferences such as likes and interests and negative preferences such as dislikes and disinterests.

[0073] As described above, if the matching memory information matches the current user preferences, the storage time of the matching memory information is updated to avoid repeated storage of similar memory information, which leads to redundant memory information; if the matching memory information does not match the current user preferences, the matching memory information is deleted, and the current round of memory information is added to the historical memory information, which can ensure that the historical memory information is close to the user's current needs and interests, and ensure the real-time and accuracy of the memory information.

[0074] In the above-mentioned embodiment, it is introduced that if there is no matching memory information in the historical memory information, the current round of memory information is directly stored; the storage time of the matching memory information whose user preference has not changed is updated, and the matching memory information whose user preference has changed is replaced. In the following embodiment, the forgetting mechanism of memory information will be described in more detail, and can be applied to any of the above embodiments.

[0075] In one embodiment, the dialogue system may periodically delete historical memory information whose storage time exceeds a preset date range according to a set time interval of 30 days, 60 days, etc.

[0076] The preset date range is greater than the time interval. When the time interval is 30 days, the preset date range may be the last 80 days, the last 120 days, etc.

[0077] As described above, by deleting historical memory information whose storage time exceeds the preset date range according to the set time interval, and regularly clearing memory information that has not been used for a long time, while freeing up storage space, it ensures that the reply information is more in line with the user's recent interests and needs.

[0078] In one embodiment, the forgetting condition includes: the storage space occupied by the historical memory information exceeds a preset proportion of the total storage capacity. For example, the storage space occupied by the historical memory information exceeds 70% of the total storage capacity.

[0079] When the dialogue system determines that the topic has been changed and the storage space occupied by the historical memory information exceeds a preset proportion of the total storage capacity, the dialogue system can use the earliest memory information as the new topic after the change to conduct a dialogue with the user and update the historical memory information.

[0080] As described above, by selecting the earliest memory information as the new topic after the change when it is determined that the topic has been changed and the storage amount of historical memory information exceeds a preset proportion of the total storage capacity, it helps to naturally and smoothly guide the user into the new topic, update the historical memory information, and provide sufficient space for the new memory information.

[0081] To further illustrate the multi-round dialogue process based on memory management, Figure 2 A flowchart of another multi-round dialogue method based on memory management is shown. The multi-round dialogue method may include the following steps:

[0082] Step 202: Determine whether to change the topic based on multiple rounds of dialogue information between the user and the large language model.

[0083] In this step, the dialogue system uses a large language model to analyze the semantic information in multiple rounds of dialogue information between the user and the large language model to determine whether to change the topic.

[0084] See also Figure 3 , Figure 3 The structure diagram of a dialogue system is shown. The dialogue system may include: a memory forgetting module 31 , a guidance module 32 , a dialogue module 33 , a memory updating module 34 and a memory storage module 35 .

[0085] Among them, the memory forgetting module 31 is used to implement the forgetting mechanism for historical memory information. The guidance module 32 is used to analyze the topic of the conversation content, provide guidance information, etc. The dialogue module 33 is used to provide reply information for the conversation. The memory updating module 34 is used to summarize and update the memory information of this round of conversation. The memory storage module 35 is used to store historical memory information.

[0086] The guidance module 32 can use a large language model to analyze semantic information in multiple rounds of dialogue information, determine the user's intentions and emotions, and determine whether to change the topic of this round of dialogue.

[0087] Step 204: If it is determined that the topic is to be changed and the storage space occupied by the historical memory information does not exceed a preset proportion of the storage space in the total storage capacity, a topic that does not overlap with the historical memory information is selected from the preset general topics as the new topic.

[0088] In this step, when it is determined that the topic of this round of conversation needs to be changed and the storage space occupied by the historical memory information does not exceed the preset proportion of the total storage capacity, the memory forgetting module 31 can output identification information {'flag': '0', 'topic': ''}.

[0089] Among them, flag represents identification information, which is used to identify whether the historical memory information meets the forgetting condition. When the value corresponding to flag is 0, it means that the forgetting condition is not met; when the value corresponding to flag is 1, it means that the forgetting condition is met.

[0090] Topic indicates a new topic, which is used to identify the topic of this round of conversation. When the value corresponding to topic is null, it indicates that the memory forgetting module 31 has not selected the earliest memory information from the historical memory information.

[0091] The guidance module 32 obtains the historical memory information from the memory storage module 35 according to the identification information output by the memory forgetting module 31. A topic that does not overlap with the historical memory information is selected from the preset general topics as the new topic after replacement.

[0092] Step 206: If it is determined that the topic is changed and the storage space occupied by the historical memory information exceeds a preset proportion of the total storage capacity, the earliest memory information is selected as the new topic after the change, and the historical memory information is updated.

[0093] In this step, when it is determined that the topic of this round of conversation needs to be changed and the storage space occupied by the historical memory information exceeds a preset proportion of the total storage capacity, the memory forgetting module 31 can output identification information of {'flag':'1', 'topic':'earliest memory information'} and delete the earliest memory information stored in the memory storage module 35.

[0094] The guidance module 32 can use the earliest memory information in the identification information as the new topic after replacement according to the identification information output by the memory forgetting module 31.

[0095] Step 208: Use the new topic, reply style and reply examples as guidance information.

[0096] In this step, the guidance module 32 can obtain a response style that matches the personality background according to the personality background of the large language model, and obtain a response example output by the large language model by combining multiple rounds of dialogue information, new topics and response styles.

[0097] The guidance module 32 uses the new topic, the response style and the response example as guidance information. For example, the guidance information may be {'topic': 'new topic', 'style': 'response style', 'response': 'response example'}. Wherein, style represents the identifier of the response style, and the value corresponding to style is the response style. response represents the identifier of the response example, and the value corresponding to response is the response example.

[0098] Step 210: Based on the multi-round dialogue information and the guidance information corresponding to the new topic, the response information output by the large language model is obtained.

[0099] In this step, the dialogue module 33 can input the user's multi-round dialogue information and the guidance information generated by the guidance module 32 into the large language model. The dialogue module 33 obtains the historical memory information stored in the memory storage module 35 so that the large language model can refer to the historical memory information when generating the reply information. The dialogue module 33 returns the reply information output by the large language model to the user.

[0100] Step 212: Summarize the input information and reply information of this round to obtain the memory information of this round.

[0101] In this step, the memory update module 34 can summarize the input information and reply information of this round of dialogue to obtain the memory information of this round. Exemplarily, the memory information of this round summarized by the memory update module 34 can be {'topic': 'new topic', 'like': 'memory information with positive preference', 'dislike': 'memory information with negative preference'}.

[0102] Among them, like represents the positive preference mark, which is used to identify the user's positive user preference for this round of dialogue, and the value corresponding to like is the memory information of positive preference. dislike represents the negative preference mark, which is used to identify the user's negative user preference for this round of dialogue, and the value corresponding to dislike is the memory information of negative preference.

[0103] Step 214: Determine whether there is matching memory information.

[0104] In this step, the memory update module 34 can determine whether there is matching memory information matching the current round of memory information in the historical memory information by using similarity matching algorithms, utilizing large language models and other technologies.

[0105] If there is no matching memory information in the historical memory information, continue to execute step 216;

[0106] If there is matching memory information in the historical memory information, step 218 is executed.

[0107] Step 216: Add the memory information of this round to the historical memory information.

[0108] In this step, if there is no matching memory information in the historical memory information, the memory update module 34 sends the current round of memory information to the memory storage module 35, and the memory storage module 35 adds the current round of memory information to the historical memory information and stores the current round of memory information.

[0109] Step 218: Determine whether the matching memory information matches the current user preference.

[0110] In this step, if there is matching memory information in the historical memory information, the memory update module 34 determines whether the matching memory information matches the user's current user preference for the current round of memory information.

[0111] If the matching memory information matches the current user preference, continue to step 220;

[0112] If the matching memory information does not match the current user preference, step 222 is executed.

[0113] Step 220: Update the storage time of the matching memory information.

[0114] In this step, if the matching memory information matches the current user preference, the memory update module 34 merges or replaces the matching memory information and the current round memory information, and updates the storage time of the matching memory information to the current time.

[0115] Step 222: Delete the matching memory information and add the current round memory information to the historical memory information.

[0116] In this step, if the matching memory information does not match the current user preference, the memory update module 34 deletes the matching memory information stored in the memory storage module 35 and adds the current round of memory information to the historical memory information.

[0117] Step 224: According to the set time interval, delete the historical memory information whose storage time exceeds the preset date range.

[0118] In this step, the memory forgetting module 31 can regularly delete the historical memory information whose storage time exceeds the preset date range according to the set time interval.

[0119] It can be understood that the various modules in the dialogue system of the example of the present application are only examples, and other system structures can also be adopted. As long as the dialogue system implements the method described in the embodiment of the present application, the embodiment of the present application does not limit this.

[0120] Figure 4 1 is a schematic diagram of a structure of an electronic device according to an exemplary embodiment of the present application. The electronic device may be, for example, a mobile phone, a computer, a digital broadcast terminal, a message transceiver device, a game console, a tablet device, a personal digital assistant, a server, a smart home appliance, etc. Figure 4 At the hardware level, the electronic device includes a processor 402, an internal bus 404, a network interface 406, a memory 408, and a non-volatile memory 410, and may also include hardware required for other services. The processor 402 reads the corresponding computer program from the non-volatile memory 410 into the memory 408 and then runs it, forming a multi-round dialogue device based on memory management at the logical level. Of course, in addition to the software implementation, this application does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0121] Figure 5 is a block diagram of a multi-round dialogue device based on memory management according to an exemplary embodiment of the present application. Figure 5 , the device may include: a topic determination module 502, an information update module 504 and a reply output module 506, wherein:

[0122] The topic determination module 502 is used to determine whether to change the topic based on multiple rounds of dialogue information between the user and the large language model;

[0123] The information updating module 504 is used to select the earliest memory information with the earliest storage time in the historical memory information as the new topic after the change if it is determined that the topic is changed and the historical memory information meets the preset forgetting condition; wherein the historical memory information is obtained by summarizing the historical conversation content;

[0124] The reply output module 506 is used to obtain the reply information output by the large language model based on the multi-round dialogue information and the guidance information corresponding to the new topic.

[0125] In one example, the reply output module 506 is also used to summarize the current round input information and the reply information in the multiple rounds of dialogue information to obtain the current round memory information; use a similarity matching algorithm to determine whether there is matching memory information in the historical memory information that matches the current round memory information; if the matching memory information does not exist in the historical memory information, add the current round memory information to the historical memory information.

[0126] In one example, the matching memory information is at least used to characterize the user's historical user preference for the matching memory information; the current round memory information is at least used to characterize the user's current user preference for the current round memory information; the reply output module 506 is also used to update the storage time of the matching memory information if the matching memory information matches the current user preference; if the matching memory information does not match the current user preference, delete the matching memory information and add the current round memory information to the historical memory information.

[0127] In one example, the reply output module 506 is further configured to delete the historical memory information whose storage time exceeds a preset date range according to a set time interval.

[0128] In one example, the forgetting condition includes: the storage space occupied by the historical memory information exceeds a preset proportion of the total storage capacity.

[0129] In one example, the reply output module 506, before being used to obtain the reply information output by the large language model based on the multi-round dialogue information and the guidance information corresponding to the new topic, further includes: obtaining a reply style that matches the personality background according to the personality background of the large language model; obtaining a reply example output by the large language model based on the multi-round dialogue information, the new topic and the reply style; and using the new topic, the reply style and the reply example as the guidance information.

[0130] In one example, the reply output module 506, before being used to obtain the reply information output by the large language model based on the multi-round dialogue information and the guidance information corresponding to the new topic, further includes: if it is determined that the topic is changed and the historical memory information does not meet the forgetting condition, a topic that does not overlap with the historical memory information is selected from the preset general topics as the new topic.

[0131] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.

[0132] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present application scheme. A person of ordinary skill in the art can understand and implement it without paying creative labor.

[0133] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory including instructions, and the above instructions can be executed by a processor of a multi-turn dialogue device based on memory management to implement any method as described in the above embodiments.

[0134] The non-temporary computer-readable storage medium may be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc., and the present application does not limit this.

[0135] In an exemplary embodiment, a computer program product including a computer program / instruction is also provided. The computer program / instruction can be executed by a processor of a multi-turn dialogue device based on memory management to implement any of the methods described in the above embodiments.

[0136] The above describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0137] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the inventions claimed herein. The present application is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

[0138] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.

Claims

1. A multi-round dialogue method based on memory management, characterized in that: The method comprises: Determine whether to change the topic based on multiple rounds of conversations between the user and the large language model; If it is determined that the topic is changed and the historical memory information meets the preset forgetting condition, the earliest memory information with the earliest storage time in the historical memory information is selected as the new topic after the change, and the historical memory information is updated; wherein the historical memory information is obtained by summarizing the historical conversation content; Based on the multiple rounds of dialogue information and the guidance information corresponding to the new topic, reply information output by the large language model is obtained.

2. The method according to claim 1, characterized in that The method further comprises: Summarizing the current round input information and the reply information in the multiple rounds of dialogue information to obtain the current round memory information; Using a similarity matching algorithm, determining whether there is matching memory information in the historical memory information that matches the memory information of the current round; If the matching memory information does not exist in the historical memory information, the current round memory information is added to the historical memory information.

3. The method according to claim 2, characterized in that The matching memory information is at least used to characterize the user's historical user preference for the matching memory information; The current round of memory information is at least used to represent the user's current user preference for the current round of memory information; The method further comprises: If the matching memory information matches the current user preference, updating the storage time of the matching memory information; If the matching memory information does not match the current user preference, the matching memory information is deleted, and the current round memory information is added to the historical memory information.

4. The method according to claim 1, characterized in that: The method further comprises: According to the set time interval, the historical memory information whose storage time exceeds the preset date range is deleted.

5. The method according to claim 1, characterized in that The forgetting condition includes: the storage space occupied by the historical memory information exceeds a preset proportion of the total storage capacity.

6. The method according to claim 1, characterized in that Before obtaining the reply information output by the large language model based on the multi-round dialogue information and the guidance information corresponding to the new topic, the method further includes: According to the personality background of the large language model, obtaining a response style that matches the personality background; Based on the multi-round dialogue information, the new topic and the reply style, obtaining a reply example output by the large language model; The new topic, the reply style and the reply example are used as the guidance information.

7. The method according to claim 1, characterized in that Before obtaining the reply information output by the large language model based on the multi-round dialogue information and the guidance information corresponding to the new topic, the method further includes: If it is determined that the topic is to be changed and the historical memory information does not meet the forgetting condition, a topic that does not overlap with the historical memory information is selected from preset general topics as the new topic.

8. A multi-round dialogue device based on memory management, characterized in that: The device comprises: The topic determination module is used to determine whether to change the topic based on the multi-round dialogue information between the user and the large language model; An information updating module, for selecting the earliest memory information with the earliest storage time in the historical memory information as the new topic after the change, and updating the historical memory information if it is determined that the topic is changed and the historical memory information meets the preset forgetting condition; wherein the historical memory information is obtained by summarizing the historical conversation content; The reply output module is used to obtain the reply information output by the large language model based on the multi-round dialogue information and the guidance information corresponding to the new topic.

9. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor implements the method according to any one of claims 1 to 7 by running the executable instructions.

10. A computer-readable storage medium having computer instructions stored thereon, characterized in that: When the instruction is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

11. A computer program product having a computer program / instructions stored thereon, characterized in that: When the computer program / instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Dialogue content memorizing method and device, equipment, storage medium and program product

    CN119884350A

  • Memory information updating method, dialogue reply method and device

    CN120780803A