Memory processing method and device of large language model, electronic equipment and medium

By introducing a memory mechanism into the large language model and extracting and detecting user memory information, the problem of poor conversation coherence in the large language model is solved, and accurate updates of the memory book and improved user interaction experience are achieved.

CN119740659BActive Publication Date: 2025-10-10BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411786775.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-05
Publication Date
2025-10-10
Estimated Expiration
2044-12-05

AI Technical Summary

Technical Problem

Large language models lack memory capabilities, resulting in poor conversational coherence, poor multi-round interaction effects, and prone to memory conflicts.

Method used

A memory mechanism is introduced to extract memory information during the conversation between the user and the large language model, perform conflict detection before storing it in the memory book, and update the memory in the memory book.

Benefits of technology

Ensure the accuracy and effectiveness of memories in the memory book, improve user interaction experience, reduce the trouble caused by memory conflicts, and achieve more coherent and efficient multi-round conversations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119740659B_ABST
    Figure CN119740659B_ABST
Patent Text Reader

Abstract

The present disclosure provides a memory processing method and device of a large language model, electronic equipment, computer readable storage medium and computer program product, relates to the field of artificial intelligence, and particularly relates to the fields of natural language processing, digital people, intelligent agents and generative search technology. The implementation scheme is as follows: in response to receiving first dialogue information of a user and a first language model, first memory information related to the user is extracted based on the first dialogue information; one or more pieces of second memory information in a memory book related to the user are obtained; the first memory information and the one or more pieces of second memory information are subjected to conflict detection; in response to determining that the first memory information and a corresponding piece of second memory information among the one or more pieces of second memory information exist in conflict, the corresponding piece of second memory information in the memory book is deleted, and the first memory information is stored in the memory book as a new piece of second memory information.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the field of artificial intelligence, in particular to the fields of natural language processing, digital human, intelligent agent, generative search, and specifically to a memory processing method and device of a large language model, an electronic device, a computer readable storage medium and a computer program product. BACKGROUND

[0002] Artificial intelligence is a discipline that studies enabling computers to simulate some thinking processes and intelligent behaviors of humans (such as learning, reasoning, thinking, planning, etc.), which has both hardware and software technologies. Artificial intelligence hardware technology generally includes technologies such as sensors, special artificial intelligence chips, cloud computing, distributed storage, big data processing, etc. Artificial intelligence software technology mainly includes computer vision technology, speech recognition technology, natural language processing technology, and machine learning / deep learning, big data processing technology, knowledge graph technology, etc. several directions.

[0003] Human-computer interaction is a way for humans to interact with machines using natural language. With the continuous development of artificial intelligence technology, it has been realized that machines can understand the information output by humans, understand the inherent meaning in the information, and make corresponding feedback. In these operations, the accurate understanding of semantics, the rapid degree of feedback, and the corresponding opinions or suggestions given, all become factors that affect the smoothness of human-computer interaction.

[0004] The methods described in this section can not necessarily be the methods previously conceived or employed. Unless otherwise indicated, nothing in this section should be assumed to be prior art merely because it is included in this section. Similarly, unless otherwise indicated, matters discussed in this section should not be assumed to be prior to the application. SUMMARY

[0005] The present disclosure provides a memory processing method and device of a large language model, an electronic device, a computer readable storage medium and a computer program product.

[0006] According to an aspect of the present disclosure, a memory processing method of a large language model is provided, comprising: in response to receiving first dialogue information of a user with a first language model, extracting first memory information related to the user based on the first dialogue information; obtaining one or more pieces of second memory information in a memory book related to the user; performing conflict detection on the first memory information and the one or more pieces of second memory information; and in response to determining that the first memory information and a corresponding piece of second memory information among the one or more pieces of second memory information exist in conflict, deleting the corresponding piece of second memory information in the memory book and storing the first memory information as a new piece of second memory information in the memory book.

[0007] According to another aspect of the present disclosure, a memory processing device for a large language model is provided, comprising: a memory extraction unit configured to, in response to receiving first conversation information between a user and a first language model, extract first memory information related to the user based on the first conversation information; an acquisition unit configured to acquire one or more second memory information in a memory book related to the user; a conflict detection unit configured to perform conflict detection on the first memory information and the one or more second memory information; and a memory update unit configured to, in response to determining that the first memory information conflicts with corresponding second memory information in the one or more second memory information, delete the corresponding second memory information in the memory book and store the first memory information as new second memory information in the memory book.

[0008] According to another aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; the memory storing instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to execute the method described in the present disclosure.

[0009] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided. The computer instructions are used to cause a computer to execute the method described in the present disclosure.

[0010] According to another aspect of the present disclosure, a computer program product is provided, comprising a computer program, which implements the method described in the present disclosure when executed by a processor.

[0011] According to one or more embodiments of the present disclosure, a memory extraction function is triggered during a conversation between a user and a large language model, and a memory conflict detection is performed before the extracted memory is stored in a memory book. If a memory conflict occurs, the corresponding memory in the memory book is updated, thereby ensuring the accuracy and effectiveness of the memory in the memory book, greatly improving the user's interactive experience, and reducing the troubles caused by memory conflicts.

[0012] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] The accompanying drawings illustrate exemplary embodiments and constitute a part of the specification. Together with the description of the specification, they serve to explain exemplary implementation of the embodiments. The illustrated embodiments are for illustrative purposes only and do not limit the scope of the claims. Throughout the drawings, the same reference numerals designate similar, but not necessarily identical, elements.

[0014] Figure 1 A schematic diagram illustrating an exemplary system in which the various methods described herein may be implemented according to an embodiment of the present disclosure;

[0015] Figure 2 A flowchart of a method for memorizing a large language model according to an embodiment of the present disclosure is shown;

[0016] Figure 3 A flowchart of a memory processing method for a large language model according to an embodiment of the present disclosure is shown;

[0017] Figure 4 A flowchart of a memory processing method for a large language model according to another embodiment of the present disclosure is shown;

[0018] Figure 5 A structural block diagram of a memory processing device for a large language model according to an embodiment of the present disclosure is shown; and

[0019] Figure 6 A structural block diagram of an exemplary electronic device that can be used to implement the embodiments of the present disclosure is shown. DETAILED DESCRIPTION

[0020] The following description of exemplary embodiments of the present disclosure is made in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be appreciated by those skilled in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0021] In this disclosure, unless otherwise specified, the use of terms such as "first" and "second" to describe various elements is not intended to limit the positional relationship, temporal relationship, or importance relationship of these elements. Such terms are only used to distinguish one element from another. In some examples, the first element and the second element may refer to the same instance of the element, while in some cases, based on the context of the description, they may also refer to different instances.

[0022] The terms used in the descriptions of the various examples described in this disclosure are for the purpose of describing specific examples only and are not intended to be limiting. Unless the context clearly indicates otherwise, if the number of elements is not specifically limited, the element may be one or more. In addition, the term "and / or" used in this disclosure encompasses any one and all possible combinations of the listed items.

[0023] The embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings.

[0024] Figure 1 FIG2 is a schematic diagram of an exemplary system 100 in which the various methods and apparatuses described herein may be implemented according to an embodiment of the present disclosure. Figure 1 , the system 100 includes one or more client devices 101, 102, 103, 104, 105, and 106, a server 120, and one or more communication networks 110 coupling the one or more client devices to the server 120. The client devices 101, 102, 103, 104, 105, and 106 can be configured to execute one or more applications.

[0025] In an embodiment of the present disclosure, the server 120 may run one or more services or software applications that enable the method of memorizing a large language model to be performed.

[0026] In some embodiments, server 120 may also provide other services or software applications, which may include non-virtualized environments and virtualized environments. In some embodiments, these services may be provided as web-based services or cloud services, such as provided to users of client devices 101, 102, 103, 104, 105, and / or 106 under a software as a service (SaaS) model.

[0027] exist Figure 1 In the configuration shown, the server 120 may include one or more components that implement the functions performed by the server 120. These components may include software components, hardware components, or a combination thereof that can be executed by one or more processors. Users operating client devices 101, 102, 103, 104, 105, and / or 106 may, in turn, utilize one or more client applications to interact with the server 120 to utilize the services provided by these components. It should be understood that a variety of different system configurations are possible, which may differ from the system 100. Therefore, Figure 1 is one example of a system for implementing the various methods described herein and is not intended to be limiting.

[0028] The user can use the client device 101, 102, 103, 104, 105 and / or 106 to input the corresponding dialogue information. The client device can provide an interface that enables the user of the client device to interact with the client device. The client device can also output information to the user via the interface. Figure 1 Only six client devices are depicted, but one skilled in the art will appreciate that the present disclosure can support any number of client devices.

[0029] Client devices 101, 102, 103, 104, 105, and / or 106 may include various types of computer devices, such as portable handheld devices, general-purpose computers (such as personal computers and laptops), workstation computers, wearable devices, smart screen devices, self-service terminal devices, service robots, gaming systems, thin clients, various messaging devices, sensors or other sensing devices, etc. These computer devices may run various types and versions of software applications and operating systems, such as Microsoft Windows, Apple iOS, UNIX-like operating systems, Linux, or Linux-like operating systems (such as Google Chrome OS); or include various mobile operating systems, such as Microsoft Windows Mobile OS, iOS, Windows Phone, and Android. Portable handheld devices may include cellular phones, smartphones, tablet computers, personal digital assistants (PDAs), etc. Wearable devices may include head-mounted displays (such as smart glasses) and other devices. Gaming systems may include various handheld gaming devices, internet-enabled gaming devices, etc. Client devices are capable of executing a variety of different applications, such as various internet-related applications, communication applications (such as email applications), and short message service (SMS) applications, and may use various communication protocols.

[0030] The network 110 may be any type of network known to those skilled in the art that can support data communications using any of a variety of available protocols, including but not limited to TCP / IP, SNA, IPX, etc. By way of example only, the one or more networks 110 may be a local area network (LAN), an Ethernet-based network, a token ring, a wide area network (WAN), the Internet, a virtual network, a virtual private network (VPN), an intranet, an extranet, a blockchain network, a public switched telephone network (PSTN), an infrared network, a wireless network (e.g., Bluetooth, WIFI), and / or any combination of these and / or other networks.

[0031] Server 120 may include one or more general-purpose computers, specialized server computers (e.g., PC (personal computer) servers, UNIX servers, mid-range servers), blade servers, mainframe computers, server clusters, or any other suitable arrangement and / or combination. Server 120 may include one or more virtual machines running virtual operating systems, or other computing architectures involving virtualization (e.g., one or more flexible pools of logical storage devices that may be virtualized to maintain a server's virtual storage device). In various embodiments, server 120 may run one or more services or software applications that provide the functionality described below.

[0032] The computing units in the server 120 may run one or more operating systems including any of the operating systems described above as well as any commercially available server operating systems. The server 120 may also run any of a variety of additional server applications and / or middle-tier applications, including HTTP servers, FTP servers, CGI servers, JAVA servers, database servers, and the like.

[0033] In some implementations, server 120 may include one or more applications to analyze and consolidate data feeds and / or event updates received from users of client devices 101, 102, 103, 104, 105, and 106. Server 120 may also include one or more applications to display the data feeds and / or real-time events via one or more display devices of client devices 101, 102, 103, 104, 105, and 106.

[0034] In some embodiments, server 120 may be a distributed system server or a server integrated with blockchain. Server 120 may also be a cloud server, or an intelligent cloud computing server or intelligent cloud host equipped with artificial intelligence technology. A cloud server is a host product within the cloud computing service system that addresses the management difficulties and poor scalability of traditional physical hosts and virtual private servers (VPS) services.

[0035] System 100 may also include one or more databases 130. In some embodiments, these databases may be used to store data and other information. For example, one or more of databases 130 may be used to store information such as memory cards and conversation information. Databases 130 may reside in a variety of locations. For example, the database used by server 120 may be local to server 120, or remote from server 120 and communicate with server 120 via a network-based or dedicated connection. Databases 130 may be of various types. In some embodiments, the database used by server 120 may be, for example, a relational database. One or more of these databases may store, update, and retrieve data to and from the database in response to commands.

[0036] In some embodiments, one or more of the databases 130 may also be used by applications to store application data. The databases used by the applications may be different types of databases, such as a key-value store, an object store, or a conventional store backed by a file system.

[0037] Figure 1The system 100 may be configured and operated in various ways to enable application of the various methods and apparatuses described in accordance with the present disclosure.

[0038] The Large Language Model (LLM) is a generative neural network-based technology that generates responses based on user input. However, the LLM itself lacks memory, meaning each user conversation is treated as a separate process by the model. To ensure conversational continuity and support multiple rounds of interaction, the contextual conversation must be provided as input to the LLM. Loss of context, excessive length, conflicting conversations, and other factors can lead to suboptimal model performance.

[0039] To solve this problem, a memory mechanism can be introduced. Therefore, according to an embodiment of the present disclosure, a memory processing method for a large language model is provided.

[0040] Figure 2 FIG. 4 shows a flow chart of a memory processing method for a large language model according to an embodiment of the present disclosure, as shown in FIG. Figure 2 As shown, method 200 includes: in response to receiving first dialogue information between a user and a first language model, extracting first memory information related to the user based on the first dialogue information (step 210); obtaining one or more second memory information in a memory book related to the user (step 220); performing conflict detection between the first memory information and the one or more second memory information (step 230); and in response to determining that the first memory information conflicts with corresponding second memory information in the one or more second memory information, deleting the corresponding second memory information in the memory book and storing the first memory information as new second memory information in the memory book (step 240).

[0041] According to an embodiment of the present disclosure, the memory extraction function is triggered during a conversation between a user and a large language model, and a memory conflict detection is performed before the extracted memory is stored in a memory book. If a memory conflict occurs, the corresponding memory in the memory book is updated, thereby ensuring the accuracy and effectiveness of the memory in the memory book, greatly improving the user's interactive experience, and reducing the troubles caused by memory conflicts.

[0042] In some embodiments, the first dialogue information may be input by the user in the form of text, voice, etc. When input in the form of voice, the voice may be converted into text using voice recognition technology to obtain the first dialogue information.

[0043] According to some embodiments, extracting first memory information related to the user based on the first conversation information includes: inputting the first conversation information and a first preset instruction into a second language model to obtain the first memory information generated by the second language model, wherein the first preset instruction is used to guide the generation process of the first memory information.

[0044] Specifically, in some examples, the large language model can be used to extract the corresponding memory information from the first conversation information. It is understood that the second language model used to implement memory extraction and the first language model used for the conversation with the user can be the same model or different models, without limitation.

[0045] In some examples, the first preset instruction is used to guide the generation process of the first memory information.

[0046] Therefore, when the first dialogue information for the first language model is obtained, at least one first preset instruction (prompt) can be introduced to guide the second language model to extract memory information related to the user's facts, preferences, etc. in the first dialogue information, thereby realizing automatic extraction of memory information and improving user experience.

[0047] In some examples, the extracted memory information can be information related to the user's facts, preferences, etc. Here, "facts" can refer to the user's own attributes, such as age, place of origin, gender, and education level; "preferences" can indicate the user's preference or orientation towards things, representing the user's inclination towards a certain type or category of things, such as food preferences, hobbies, etc.

[0048] In some examples, the first preset instruction may include at least one of the following items: background knowledge to indicate that the current task is to extract user-related memories in the current conversation information; information to guide the generation of memories that are more in line with user expectations or in a more structured form, for example, "multiple memories can be extracted at the same time", "the extracted memories should be concise and rich in information", etc.

[0049] For example, the first preset instruction may be as follows:

[0050] #YourPersonality: You are an expert at retrieving memories. You can easily infer facts, preferences, and memories from the text provided, and return them concisely.

[0051] #Core task: Infer user facts and preferences based on {conversation information}:

[0052] #Core Requirements:

[0053] -Facts, preferences, and memories should be concise and informative;

[0054] -Don't start with "This person likes xx". Instead, start with "Users like xx";

[0055] -Do not remember provided user / agent details. Only remember facts, preferences and memories;

[0056] -Multiple memories can be retrieved simultaneously.

[0057] #Details: {dialogue information}

[0058] #Reply example: {Extracted memory}".

[0059] Through the above-mentioned first preset instruction, for example, when the dialogue information of “remember that I like to eat strawberries” is input, the extracted memory of “the user likes to eat strawberries” can be obtained.

[0060] It is understandable that corresponding memory information can also be obtained based on the conversation information through any other suitable method, including but not limited to semantic analysis, and other methods based on deep learning or machine learning.

[0061] In this disclosure, "conflict detection" refers to knowledge conflict detection, which is used to detect semantic inconsistencies or contradictions between multiple memories. For example, if one memory indicates that the user is 18 years old, while another memory indicates that the user is 19 years old, it can be seen that there is an inconsistency or contradiction between the two memories. Conflict detection can automatically determine whether there is a conflict between the two memories.

[0062] According to some embodiments, performing conflict detection on the first memory information and the one or more second memory information includes: inputting the first memory information, the one or more second memory information, and a second preset instruction into a third language model to obtain a conflict detection result generated by the third language model, wherein the conflict detection result is used to indicate whether there is a conflict between the first memory information and the corresponding second memory information in the one or more second memory information, wherein the at least one preset instruction is used to guide the generation process of the conflict detection result.

[0063] In some examples, the conflict detection result can be used to indicate which of the one or more second memory information items the first memory information conflicts with. In some cases, the conflict detection result can also include the reason why the first memory information conflicts with the second memory information. Using this conflict detection result, the system can accurately update the memory book.

[0064] In some examples, the conflict detection result can be new memory book data formed by a new set of second memory information. For example, this new memory book data includes: the second memory information remaining in the original memory book after deleting the second memory information that conflicts with the first memory information, and the new second memory information generated from the first memory information. In this case, the original memory book data can be directly replaced by the new memory book data. This enables the memory book to be updated, modified, and maintained based on the newly extracted memories using a large language model.

[0065] In some examples, the second preset instruction may include at least one of the following items: background knowledge to indicate that the current task is to detect conflicts between new memories and existing memories; information to guide the generation of conflict detection results that are more in line with user expectations or in a more structured form, for example, "construct a JSON object that meets the requirements to represent the new memory book data", etc.

[0066] For example, the second preset instruction may be as follows:

[0067] #YourPersonality: You are an expert at merging, updating, and organizing memories. As you gain access to existing memories and new information, your task is to merge and update your memory lists to reflect the most accurate and up-to-date information. You are also given a score for each existing memory's match with the new information. Be sure to use this information to make informed decisions about which memories to update or merge.

[0068] #Core task: Calculate the fused memory based on {existing memory} and {new memory}.

[0069] #Core Requirements:

[0070] - Eliminate duplicate memories and merge related memories to keep lists concise and up-to-date.

[0071] If new information directly contradicts several memories, carefully evaluate these three pieces of information:

[0072] -If the new memory conflicts with multiple old memories, please refer to the first old memory;

[0073] - Update the old memory with the new one if the new one provides newer or more accurate updated content

[0074] Remember and update as_id at the same time;

[0075] -If the new memory seems inaccurate or not detailed enough, keep the original memory and discard the new one.

[0076] -Maintain a consistent, clear style across all memories, ensuring each entry is concise and informative.

[0077] -If the new memory is a variation or extension of an existing memory, update the existing memory to reflect the new information.

[0078] Here are the task details:

[0079] -Existing memory: {Existing memory}

[0080] -New Memory: {New Memory}

[0081] #Output format:

[0082] - Output in JSON format. This JSON object contains the following properties

[0083] -The type of the attribute name "id" is Integer, which means the second memory identifier.

[0084] -The type of the attribute name "content" is String, and its meaning is [user memory].

[0085] -The attribute name "as_id" is of type String and means [first memory identifier].

[0086] #Notice:

[0087] - No need to explain the reason, just output in the output format.

[0088] -Build a JSON object that meets the requirements".

[0089] It is understandable that the above second preset instruction is merely exemplary and is not intended to be limiting.

[0090] In some embodiments, any one of the first language model, the second language model, and the third language model can be a knowledge-enhanced large language model for conversation (e.g., ERNIE bot, etc.). The first language model is trained using massive knowledge resources and conversation data (e.g., more than trillions of web page data, billions of search data, hundreds of millions of image data, billions of voice request data, more than 50 billion text request data, and more than 550 billion pieces of factual knowledge).

[0091] Therefore, by applying this type of model, in addition to directly processing small talk conversation information, it can also directly generate reply information for logical reasoning, common sense, and image generation conversation information, which can further improve generation efficiency while generating higher quality reply information.

[0092] According to some embodiments, the method further includes: in response to determining that there is no conflict between the first memory information and the one or more second memory information, storing the first memory information as new second memory information in the memory book.

[0093] Through the above embodiments, by capturing the latest conversation information and updating the long-term memory in real time, a more human-like memory mechanism is provided to ensure the timeliness and accuracy of the long-term memory.

[0094] According to some embodiments, the extracted first memory information includes a corresponding first memory identifier.

[0095] Specifically, the first memory identifier can be used to uniquely identify the first memory information. In the above-mentioned embodiment of obtaining the first memory information based on the second language model, the first memory information output by the second language model may include the corresponding first memory identifier. Alternatively, after obtaining the first memory information returned by the second language model, a first memory identifier for uniquely identifying the first memory information may be generated.

[0096] Therefore, according to some embodiments, the new second memory information includes a second memory identifier corresponding to the first memory identifier. That is, after the first memory information is updated as the new second memory information to the memory book, the new second memory information is assigned the second memory identifier corresponding to the first memory identifier.

[0097] In some examples, "the new second memory information includes a second memory identifier corresponding to the first memory identifier" may mean that the second memory identifier of the new second memory information may be the first memory identifier of the corresponding first memory information. For example, after obtaining the extracted first memory information, the memory extraction ID (as-id) corresponding to the first memory information is obtained; after the first memory information is updated as the new second memory information in the memory book, the second memory information can also be uniquely identified by the memory extraction ID (as-id).

[0098] In some examples, "the new second memory information includes a second memory identifier corresponding to the first memory identifier" may also mean: after generating the new second memory information in the memory book, generating a second memory identifier for uniquely identifying the second memory information, and storing the second memory identifier in association with the first memory identifier of the corresponding first memory information. For example, after obtaining the extracted first memory information, obtaining the memory extraction ID (as-id) corresponding to the first memory information; after updating the first memory information as the new second memory information to the memory book, generating a second memory identifier (m-id) for uniquely identifying the new second memory information, and storing the memory extraction ID (as-id) in association with the second memory identifier (m-id) (such as: as-id—m-id).

[0099] In the above embodiment, by using the second memory identifier corresponding to the first memory identifier to represent the new second memory information, it is possible to easily determine which first memory information (i.e., the first conversation information) the corresponding second memory information in the memory book originates from. Thus, the memories stored in the memory book are associated with the conversation information, making it easier for the user to retrieve memories.

[0100] According to some embodiments, each of the one or more pieces of second memory information includes a corresponding second memory identifier. Deleting the corresponding second memory information and storing the first memory information as new second memory information in the memory book includes: associating and storing the second memory identifier of the deleted corresponding second memory information with the second memory identifier of the new second memory information.

[0101] Specifically, for example, if the second memory information that conflicts with the first memory information includes the memory identifier as-id1, the first memory information used to replace the conflicting memory (i.e., the new second memory information) includes the memory identifier as-id2. After the conflicting memory is deleted from the memory book, its memory identifier is associated with the memory identifier of the new replacement memory, that is, as-id1 and as-id2 are associated and stored.

[0102] Through the above embodiment, the memory identifier of the deleted memory and the memory identifier of the new memory in the memory book are associated and stored, so that the deleted memory (i.e., the old memory) can be recorded as to which new memory replaced it. This makes it easier for subsequent users to recall memories and facilitates subsequent viewing and management.

[0103] According to some embodiments, Figure 3 As shown, the method according to the present disclosure may also include (method 300): displaying the extracted first memory information (step 310); in response to receiving a first operation, determining whether second memory information corresponding to the first memory information already exists in the memory book, wherein the first operation is used to update the first memory information to the memory book (step 320); in response to determining that second memory information corresponding to the first memory information exists in the memory book, generating a first prompt information (step 330); and in response to determining that second memory information corresponding to the first memory information does not exist in the memory book, storing the first memory information as new second memory information in the memory book (step 340).

[0104] In some examples, displaying the extracted first memory information may include displaying the extracted first memory information via a user interface. Specifically, the extracted memory may be displayed to the user. The user may anchor the displayed memory to a memory book, and if a corresponding memory already exists in the memory book, the user may be prompted, for example, by a prompt stating, "This memory already exists in the memory book."

[0105] In some examples, after the extracted first memory information is obtained, conflict detection and display operations of the first memory information can be performed in parallel.

[0106] Through the above embodiments, the user experience level is further improved and memory loss can be effectively prevented.

[0107] According to some embodiments, the method further includes: in response to receiving a second operation, deleting second memory information corresponding to the second operation in the memory book, wherein the second operation is used to delete the second memory information.

[0108] Through the above embodiment, the user can delete the corresponding memory in the memory book through corresponding operations, so that the user can manage and maintain the relevant memories in the memory book by himself, which greatly improves the user's interactive experience and reduces the troubles caused by memory conflicts.

[0109] According to some embodiments, Figure 4 As shown, the method according to the present disclosure may also include (method 400): in response to receiving a third operation, obtaining a first memory identifier of the first memory information corresponding to the third operation (step 410); determining a second memory identifier corresponding to the first memory identifier (step 420); in response to the existence of a second memory identifier corresponding to the first memory identifier, querying the memory book for the second memory information corresponding to the second memory identifier (step 430); in response to querying the second memory information corresponding to the second memory identifier, locating and displaying the second memory information corresponding to the second memory identifier in the memory book (step 440), wherein the third operation is used to view the second memory information corresponding to the first memory information.

[0110] In this embodiment, the third operation is used to view the second memory information corresponding to the first memory information.

[0111] In some examples, the extracted first memory information can be displayed in response to a user operation (e.g., a user's operation of a browser on the multi-turn dialogue information with the model), for example, when the user browses to the corresponding dialogue information, the extracted first memory information corresponding to the dialogue information is displayed near the dialogue information (e.g., in the form of a pop-up window). At this time, the user can initiate a third operation related to the first memory information, for example, by clicking on the first memory information, to implement an operation of viewing the corresponding second memory information in the memory book. Through the above operation, the position of the corresponding second memory information in the memory book can be automatically located and the second memory information can be displayed.

[0112] In some examples, the user can view the multi-turn dialogue information (i.e., context information) with the large language model, for example, by clicking on the corresponding dialogue information, the user can initiate a third operation related to the first memory information extracted through the dialogue information. At this time, the first memory identifier of the first memory information corresponding to the dialogue information can be obtained, and then the position of the corresponding second memory information in the memory book can be automatically located and the second memory information can be displayed.

[0113] According to some embodiments, the method according to the present disclosure further comprises: in response to not querying the second memory information corresponding to the second memory identifier, determining whether there is a second memory identifier associated with the second memory identifier; in response to there being the associated second memory identifier, querying the second memory information corresponding to the associated second memory identifier in the memory book; in response to querying the second memory information corresponding to the associated second memory identifier, locating and displaying the second memory information corresponding to the associated second memory identifier in the memory book.

[0114] In some examples, the second memory information associated with the corresponding dialogue information (first memory information) is viewed through the third operation. When the second memory information associated with the dialogue information (i.e., old memory) has been updated or deleted, the position of the new memory in the memory book can be further automatically located and the new memory can be displayed based on the associated second memory identifier.

[0115] According to some embodiments, the method according to the present disclosure further comprises: in response to there being no associated second memory identifier, generating second prompt information.

[0116] In some examples, a third operation is used to view the second memory information associated with the corresponding conversation information (first memory information). When the second memory information associated with the conversation information (i.e., the old memory) has been updated or deleted, the new memory in the memory book can be automatically located based on the associated second memory identifier and displayed. If the associated second memory identifier is not found, that is, there is no new memory to update the old memory, the user can be prompted that the memory has been deleted.

[0117] According to some embodiments, the method according to the present disclosure may further include: in response to obtaining second dialogue information input by the user, inputting the second dialogue information and the corresponding second memory information in the memory book into the first language model to generate reply information for replying to the second dialogue information.

[0118] In some embodiments, the second conversation information is a new round of conversation between the user and the large language model. The second conversation information can be input by the user in the form of text, voice, etc. If the input is in the form of voice, the voice can be converted into text using voice recognition technology to obtain the second conversation information.

[0119] Through the above embodiment, when conducting question-and-answer sessions based on the first language model, the user's memories in the memory book are also input into the first language model, ensuring that the memories in the memory book are effectively utilized in the conversation, thereby improving the coherence and intelligence of the conversation between the user and the first language model. Therefore, even in complex and changing multi-round conversation scenarios, the first language model can more efficiently answer user questions with its excellent memory retention and conversational focus, ensuring that every communication is accurate and correct.

[0120] According to the embodiments of the present disclosure, Figure 5 As shown, a memory processing device 500 for a large language model is also provided, including: a memory extraction unit 510, configured to, in response to receiving first dialogue information between a user and a first language model, extract first memory information related to the user based on the first dialogue information; an acquisition unit 520, configured to acquire one or more second memory information in a memory book related to the user; a conflict detection unit 530, configured to perform conflict detection on the first memory information and the one or more second memory information; and a memory update unit 540, configured to, in response to determining that the first memory information conflicts with corresponding second memory information in the one or more second memory information, delete the corresponding second memory information in the memory book and store the first memory information as new second memory information in the memory book.

[0121] Here, the operations of the above-mentioned units 50 to 540 of the memory processing device 500 for a large language model are similar to the operations of steps 210 to 240 described above, and are not repeated here.

[0122] In the technical solutions disclosed herein, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0123] According to an embodiment of the present disclosure, an electronic device, a readable storage medium, and a computer program product are also provided.

[0124] refer to Figure 6 , a block diagram of an electronic device 600 that can serve as a server or client of the present disclosure will now be described, which is an example of a hardware device that can be applied to various aspects of the present disclosure. The electronic device is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0125] like Figure 6 As shown, the electronic device 600 includes a computing unit 601, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 602 or a computer program loaded from a storage unit 608 into a random access memory (RAM) 603. Various programs and data required for the operation of the electronic device 600 can also be stored in the RAM 603. The computing unit 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0126] Multiple components within electronic device 600 are connected to I / O interface 605, including an input unit 606, an output unit 607, a storage unit 608, and a communication unit 609. Input unit 606 can be any type of device capable of inputting information into electronic device 600. Input unit 606 can receive input numeric or character information and generate key signal input related to user settings and / or function control of the electronic device. It may include, but is not limited to, a mouse, keyboard, touch screen, trackpad, trackball, joystick, microphone, and / or remote control. Output unit 607 can be any type of device capable of presenting information, and may include, but is not limited to, a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. Storage unit 608 may include, but is not limited to, a magnetic disk or an optical disk. Communication unit 609 allows electronic device 600 to exchange information / data with other devices via computer networks such as the Internet and / or various telecommunication networks. It may include, but is not limited to, a modem, a network card, an infrared communication device, a wireless communication transceiver, and / or a chipset, such as a Bluetooth device, an 802.11 device, a WiFi device, a WiMax device, a cellular communication device, and / or the like.

[0127] The computing unit 601 can be a variety of general-purpose and / or specialized processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units that run machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The computing unit 601 performs the various methods and processes described above, such as method 200. For example, in some embodiments, method 200 can be implemented as a computer software program that is tangibly contained in a machine-readable medium, such as a storage unit 608. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 600 via ROM 602 and / or communication unit 609. When the computer program is loaded into RAM 603 and executed by the computing unit 601, one or more steps of the method 200 described above can be performed. Alternatively, in other embodiments, the computing unit 601 can be configured to perform method 200 in any other appropriate manner (e.g., by means of firmware).

[0128] Various embodiments of the systems and techniques described above can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0129] The program code for implementing the method of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device so that when the program code is executed by the processor or controller, the functions / operations specified in the flow chart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0130] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0131] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0132] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), the Internet, and a blockchain network.

[0133] A computer system may include a client and a server. The client and server are generally remote from each other and typically interact through a communication network. The client-server relationship arises through computer programs running on the respective computers and having a client-server relationship with each other. The server may be a cloud server, a server in a distributed system, or a server integrated with a blockchain.

[0134] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved. This is not limited herein.

[0135] Although the embodiments or examples of the present disclosure have been described with reference to the accompanying drawings, it should be understood that the above-mentioned methods, systems and devices are merely exemplary embodiments or examples, and the scope of the present invention is not limited by these embodiments or examples, but is only limited by the claims after authorization and their equivalents. Various elements in the embodiments or examples may be omitted or replaced by their equivalents. In addition, the steps may be performed in an order different from that described in this disclosure. Further, the various elements in the embodiments or examples may be combined in various ways. It is important that as technology evolves, many of the elements described herein may be replaced by equivalent elements that appear after this disclosure.

Claims

1. A memory processing method for a large language model, comprising: In response to receiving first conversation information between a user and a first language model, extracting first memory information related to the user based on the first conversation information, wherein the extracted first memory information includes a corresponding first memory identifier; Acquire one or more pieces of second memory information in a memory book related to the user, wherein each piece of second memory information in the one or more pieces of second memory information includes a corresponding second memory identifier; Performing conflict detection on the first memory information and the one or more second memory information; and In response to determining that the first memory information conflicts with corresponding second memory information in the one or more pieces of second memory information, deleting the corresponding second memory information in the memory book and storing the first memory information as new second memory information in the memory book, wherein the new second memory information includes a second memory identifier corresponding to the first memory identifier, and wherein deleting the corresponding second memory information and storing the first memory information as new second memory information in the memory book comprises: storing the deleted second memory identifier of the corresponding second memory information in association with the second memory identifier of the new second memory information; In response to receiving a third operation, obtaining a first memory identifier of first memory information corresponding to the third operation, wherein the third operation is used to view second memory information corresponding to the first memory information; Determining a second memory identifier corresponding to the first memory identifier; In response to the existence of a second memory identifier corresponding to the first memory identifier, querying the memory book for second memory information corresponding to the second memory identifier; In response to not finding the second memory information corresponding to the second memory identifier, determining whether there is a second memory identifier associated with the second memory identifier, so as to query the second memory information in the memory book based on the associated second memory identifier.

2. The method of claim 1, further comprising: Displaying the extracted first memory information; In response to receiving a first operation, determining whether second memory information corresponding to the first memory information already exists in the memory book, wherein the first operation is used to update the first memory information to the memory book; generating first prompt information in response to determining that second memory information corresponding to the first memory information exists in the memory book; and In response to determining that second memory information corresponding to the first memory information does not exist in the memory book, the first memory information is stored in the memory book as new second memory information.

3. The method of claim 1 , further comprising: In response to receiving a second operation, deleting second memory information corresponding to the second operation in the memory book, wherein the second operation is used to delete the second memory information.

4. The method of claim 1 , further comprising: In response to finding the second memory information corresponding to the second memory identifier, the second memory information corresponding to the second memory identifier in the memory book is located and displayed.

5. The method of claim 1, further comprising: In response to the existence of the associated second memory identifier, querying the memory book for second memory information corresponding to the associated second memory identifier; as well as In response to querying the second memory information corresponding to the associated second memory identifier, the second memory information corresponding to the associated second memory identifier in the memory book is located and displayed.

6. The method of claim 5, further comprising: In response to the absence of a second memory identifier associated with the second memory identifier, second prompt information is generated.

7. The method of claim 1 , further comprising: In response to obtaining second dialogue information input by the user, the second dialogue information and corresponding second memory information in the memory book are input into the first language model to generate reply information for replying to the second dialogue information.

8. The method of claim 1, wherein: Extracting first memory information related to the user based on the first conversation information includes: The first dialogue information and the first preset instruction are input into a second language model to obtain the first memory information generated by the second language model, wherein the first preset instruction is used to guide the generation process of the first memory information.

9. The method of claim 1 , further comprising: In response to determining that there is no conflict between the first memory information and the one or more second memory information, the first memory information is stored in the memory book as new second memory information.

10. The method according to claim 1 or 9, wherein Performing conflict detection on the first memory information and the one or more second memory information includes: inputting the first memory information, the one or more second memory information, and a second preset instruction into a third language model to obtain a conflict detection result generated by the third language model, wherein the conflict detection result is used to indicate whether the first memory information conflicts with corresponding second memory information in the one or more second memory information; The at least one preset instruction is used to guide the generation process of the conflict detection result.

11. A memory processing device for a large language model, comprising: a memory extraction unit configured to, in response to receiving first conversation information between a user and a first language model, extract first memory information related to the user based on the first conversation information, wherein the extracted first memory information includes a corresponding first memory identifier; an acquiring unit configured to acquire one or more pieces of second memory information from a memory book associated with the user, wherein each piece of the one or more pieces of second memory information includes a corresponding second memory identifier; a conflict detection unit, configured to perform conflict detection on the first memory information and the one or more second memory information; and a memory updating unit configured to, in response to determining that the first memory information conflicts with corresponding second memory information in the one or more pieces of second memory information, delete the corresponding second memory information in the memory book and store the first memory information as new second memory information in the memory book, wherein the new second memory information includes a second memory identifier corresponding to the first memory identifier, and wherein deleting the corresponding second memory information and storing the first memory information as new second memory information in the memory book comprises: storing the deleted second memory identifier of the corresponding second memory information in association with the second memory identifier of the new second memory information; a unit configured to, in response to receiving a third operation, obtain a first memory identifier of first memory information corresponding to the third operation, wherein the third operation is used to view second memory information corresponding to the first memory information; a unit for determining a second memory identifier corresponding to the first memory identifier; a unit configured to query the memory book for second memory information corresponding to the second memory identifier in response to the presence of the second memory identifier corresponding to the first memory identifier; A unit for determining whether there is a second memory identifier associated with the second memory identifier in response to not finding the second memory information corresponding to the second memory identifier, and querying the second memory information in the memory book based on the associated second memory identifier.

12. The apparatus of claim 11, further comprising: a unit for displaying the extracted first memory information; a unit for determining, in response to receiving a first operation, whether second memory information corresponding to the first memory information already exists in the memory book, wherein the first operation is for updating the first memory information to the memory book; a unit for generating first prompt information in response to determining that second memory information corresponding to the first memory information exists in the memory book; and A unit for storing the first memory information as new second memory information in the memory book in response to determining that the second memory information corresponding to the first memory information does not exist in the memory book.

13. The apparatus of claim 11, further comprising: A unit for deleting second memory information corresponding to the second operation in the memory book in response to receiving the second operation, wherein the second operation is for deleting the second memory information.

14. The apparatus of claim 11, further comprising: A unit for locating and displaying the second memory information corresponding to the second memory identifier in the memory book in response to querying the second memory information corresponding to the second memory identifier.

15. The apparatus of claim 11, further comprising: a unit for querying the memory book for second memory information corresponding to the associated second memory identifier in response to the presence of the associated second memory identifier; A unit for locating and displaying the second memory information corresponding to the associated second memory identifier in the memory book in response to querying the second memory information corresponding to the associated second memory identifier.

16. The apparatus of claim 15, further comprising: A unit for generating second prompt information in response to the absence of a second memory identifier associated with the second memory identifier.

17. The apparatus of claim 11, further comprising: A unit for inputting the second dialogue information and the corresponding second memory information in the memory book into the first language model in response to obtaining the second dialogue information input by the user, so as to generate reply information for replying to the second dialogue information.

18. The apparatus of claim 11, wherein: The memory extraction unit comprises: A unit for inputting the first dialogue information and a first preset instruction into a second language model to obtain the first memory information generated by the second language model, wherein the first preset instruction is used to guide the generation process of the first memory information.

19. The apparatus of claim 11, further comprising: In response to determining that there is no conflict between the first memory information and the one or more second memory information, the first memory information is stored as new second memory information in the memory book.

20. The device according to claim 11 or 19, wherein The conflict detection unit includes: a unit for inputting the first memory information, the one or more second memory information, and a second preset instruction into a third language model to obtain a conflict detection result generated by the third language model, wherein the conflict detection result is used to indicate whether the first memory information conflicts with corresponding second memory information in the one or more second memory information; The at least one preset instruction is used to guide the generation process of the conflict detection result.

21. An electronic device comprising: at least one processor; as well as a memory communicatively coupled to the at least one processor; in The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 10.

22. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-10.

23. A computer program product comprising a computer program, wherein When the computer program is executed by a processor, the method according to any one of claims 1 to 10 is implemented.

Citation Information

Patent Citations

  • Conversation memory storage and extraction method and electronic equipment

    CN117216180A

  • Information storage method and device, electronic equipment and storage medium

    CN118012328A