Message reply method and device, electronic equipment and computer readable medium

By obtaining and analyzing historical dialogue content and role information, and using a large language model to generate multiple replies and suggestions, the problem of low message replies in the existing technology is solved and more efficient message replies are achieved.

CN119474300APending Publication Date: 2025-02-18BEIJING QIYI CENTURY SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411425076.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-12
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

In the prior art, message reply efficiency is low, and users need to spend a lot of time and energy on the conception of messages.

Method used

By obtaining the historical dialogue content between the first user and the second user, based on the role information, historical dialogue content, messages and preset model output requirements of the second user, model input information is generated and input it to a pre-trained large language Model, get multiple replies and suggestions, and finally send these replies to the first user.

Benefits of technology

Provide diverse response suggestions, eliminating the process of users in conceiving messages and improving the efficiency of message replies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119474300A_ABST
    Figure CN119474300A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a message reply method and device, electronic equipment and a computer readable medium. The method comprises the steps that when a first user receives a message sent by a second user, historical dialogue content of the first user and the second user is acquired; generating model input information based on the role information of the second user, the historical dialogue content, the message and a preset model output requirement; inputting the model input information into a pre-trained large language model to obtain a plurality of reply suggestions for the message; and sending the plurality of reply suggestions to the first user. According to the embodiment, diversified reply suggestions can be provided for the user in the conversation process of the user, and the message reply efficiency of the user in the conversation process is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computer technology, and specifically to a message reply method, device, electronic device, and computer-readable medium. Background Art

[0002] With the development of large language model related technologies, interacting with AI (Artificial Intelligence) characters has gradually become a new user experience. For example, in video games or interactive story applications, it is common to communicate and interact with NPC (Non-Player Character) characters.

[0003] In the prior art, when an AI character actively sends a message to a user based on the current scenario, or replies to a user's message, the user needs to reply to the message sent by the AI ​​character so that the conversation can continue. However, some users do not know how to continue the conversation, and need to spend a lot of time and energy to conceive messages, resulting in low efficiency in message replies. Summary of the invention

[0004] The embodiments of the present application propose a message reply method, device, electronic device and computer-readable medium to solve the technical problem of low message reply efficiency in the prior art.

[0005] In a first aspect, an embodiment of the present application provides a message reply method, the method comprising: when a first user receives a message sent by a second user, obtaining historical conversation content between the first user and the second user; generating model input information based on the role information of the second user, the historical conversation content, the message and preset model output requirements; inputting the model input information into a pre-trained large language model to obtain multiple reply suggestions for the message; and sending the multiple reply suggestions to the first user.

[0006] In the second aspect, an embodiment of the present application provides a message reply device, which includes: an acquisition unit, used to obtain the historical conversation content between the first user and the second user when the first user receives a message sent by the second user; a generation unit, used to generate model input information based on the role information of the second user, the historical conversation content, the message and preset model output requirements; a processing unit, used to input the model input information into a pre-trained large language model to obtain multiple reply suggestions for the message; and a sending unit, used to send the multiple reply suggestions to the first user.

[0007] In a third aspect, an embodiment of the present application provides an electronic device, comprising: one or more processors; a storage device on which one or more programs are stored, and when the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any embodiment of the first aspect.

[0008] In a fourth aspect, an embodiment of the present application provides a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the method described in any embodiment of the first aspect.

[0009] The message reply method, device, electronic device and computer-readable medium provided in the embodiments of the present application obtain the historical conversation content between the first user and the second user when the first user receives the message sent by the second user; then generate model input information based on the role information of the second user, the historical conversation content, the message and the preset model output requirements; then input the model input information into the pre-trained large language model to obtain multiple reply suggestions for the message; finally, send multiple reply suggestions to the first user. As a result, when the first user receives the message sent by the second user, a variety of reply suggestions can be provided to the first user for the first user to choose from, eliminating the process of the user's message conception and improving the efficiency of message reply. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] Other features, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings:

[0011] Figure 1 is a flow chart of an embodiment of the message reply method of the present application;

[0012] Figure 2 It is a schematic diagram of an application scenario of the message reply method of the present application;

[0013] Figure 3 is a structural diagram of an embodiment of a message reply device according to the present application;

[0014] Figure 4 It is a schematic diagram of the structure of an electronic device used to implement an embodiment of the present application. DETAILED DESCRIPTION

[0015] All actions to obtain signals, information or data in this application are carried out in compliance with the relevant data protection laws and policies of the country where they are located, and with the authorization given by the owner of the corresponding device.

[0016] The present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the relevant invention, rather than to limit the invention. It is also necessary to explain that, for ease of description, only the parts related to the relevant invention are shown in the accompanying drawings.

[0017] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0018] Please refer to Figure 1 , which shows a process 100 according to an embodiment of a message reply method of the present application. The message reply method can be applied to various electronic devices with data processing functions. The execution subject of the message reply method can be a processor in the above-mentioned electronic device. The application scenarios of the message reply method may include scenarios of dialogue with AI (Artificial Intelligence) characters, which may specifically include but are not limited to text chat, online video games, interactive plots, AI customer service, intelligent voice assistants and other scenarios.

[0019] The message reply method comprises the following steps:

[0020] Step 101, when a first user receives a message sent by a second user, the historical conversation content between the first user and the second user is obtained.

[0021] In this embodiment, the first user and the second user may be any different users. When the first user receives a message sent by the second user, the historical conversation content between the first user and the second user is obtained. The historical conversation content may include other messages in the current conversation process except the above-mentioned message.

[0022] In some optional implementations of this embodiment, the first user may be a real user, and the second user may be a virtual user, for example, a non-player character (NPC).

[0023] As an example, see Figure 2 , the first user is user A, and the second user is an NPC with the character name "Chukong". After user A receives the message sent by the NPC, "That battle has been over for 30,000 years. I only remember that I tried my best to destroy the witch Canghai, but I have forgotten the specific scene", the above-mentioned execution subject can obtain the historical conversation content between the first user and the second user. The historical conversation content may include the message sent by user A: "User A: You were seriously injured in the battle of Cangri, your soul was severely damaged, and you lost some of your memory. Do you still remember the scene of that battle now?".

[0024] Step 102: Generate model input information based on the role information of the second user, the historical conversation content, the above message and the preset model output requirements.

[0025] In this embodiment, the role information may be information related to the user role, for example, it may include but is not limited to attribute information such as name, gender, age, occupation, personality, hobbies, etc., and may also include relationship information between the second user's user role and other roles, background information associated with the second user's user role, etc.

[0026] In some scenarios, role information of multiple roles may be pre-stored, and the role information of the second user may be obtained from the stored role information based on the role name or identifier of the second user. The role information of the multiple roles may be pre-set by an operator, or extracted from the relevant information of the roles through an algorithm.

[0027] In other scenarios, the role information of the second user may be preset by the first user. For example, before this session, the first user may pre-customize the role of the second user and upload the role information of the role. The message sent by the second user to the first user may be generated based on the role information through an existing language model. For another example, before this session, multiple roles and role information of the second user may be provided to the first user for selection by the first user.

[0028] In this embodiment, the model output requirement can be pre-set and stored. The model output requirement can be used to instruct the large language model to generate a reply suggestion for the above message based on the role information and historical conversation content of the second user. For example, the model output requirement can be: "Please generate a reply suggestion for the current message based on the above role information and historical conversation content." The model input information can be a prompt of the model. The model input information can include the role information of the second user, the historical conversation content, the above message and the model output requirement, and the above content can be arranged in a set format.

[0029] In some optional implementations of this embodiment, a prompt word template may be first obtained, and the prompt word template includes a preset model output requirement. Then, the role information, historical conversation content, and the above message of the second user may be input into the prompt word template to obtain model input information. The prompt word template is a template for generating prompt words of the model, which specifies the format of the role information, historical conversation content, the above message, and the model output requirement of the second user.

[0030] For example, the prompt word template can be seen as follows:

[0031] <system>#Task

[0032] Generate multiple user response suggestions.

[0033] ##Character Information

[0034] ##Historical dialogue content

[0035] ##Model output requirements

[0036] <user>Current News

[0037] The current message is the message from the second user received by the first user in step 101. <system> #”、" <user>" are all identifiers, "##" is used to indicate that the following content is a title, and a line break is inserted after the title to insert specific content.

[0038] The following is a specific example:

[0039] The second user can be an NPC, whose role is Chukong. His role information includes: "Name: Chukong; Gender: Male; Personality: Justice." The content of historical dialogues includes: "User A: You were seriously injured in the battle of Cang Ri, your soul was severely damaged, and you lost some of your memory. Do you still remember the scene of that battle?" The model output requirement is "Please generate reply suggestions for the current message based on the above role information and historical dialogue content, from the perspective of the depth, breadth, and topic transfer of the topic." The current message is "Chukong: That battle has been over for 30,000 years. I only remember that I tried my best to destroy the witch Cang Hai, but I have forgotten the specific situation." The model input information is:

[0040] <system>#Task

[0041] Generate multiple user response suggestions.

[0042] ##Character Information

[0043] Name: Chukong

[0044] Gender: Male

[0045] Character: Justice

[0046] ##Historical dialogue content

[0047] User A: You were seriously injured in the battle of Cang Ri, your soul was severely damaged, and you lost some of your memory. Do you still remember the scene of that battle?

[0048] ##Model output requirements

[0049] Please generate reply suggestions for the current message based on the above role information and historical conversation content.

[0050] <user>Chukong: That battle happened thirty thousand years ago. I only remember that I tried my best to destroy the witch Canghai, but I have forgotten the specific circumstances.

[0051] In some optional implementations of this embodiment, the model output requirement may further indicate the angle of the reply suggestion generated by the large language model. For example, the angle of the reply suggestion may include but is not limited to at least one of the following: breadth angle, depth angle, topic change angle, etc. For example, the model output requirement in the above example can be replaced with: "Please generate 3 reply suggestions for the current message from the depth, breadth, and topic change angles based on the above role information and historical conversation content." Therefore, the model input information in the above example can be replaced with:

[0052] <system>#Task

[0053] Generate multiple user response suggestions.

[0054] ##Name: Chukong; Gender: Male; Personality: Justice.

[0055] ##User A: You were seriously injured in the battle of Cang Ri, your soul was severely damaged, and you lost some of your memory. Do you still remember the scene of that battle?

[0056] ##Based on the above character information and historical conversation content, please generate 3 reply suggestions for the current message from the perspectives of topic depth, breadth, and topic diversion.

[0057] <user>Chukong: That battle happened thirty thousand years ago. I only remember that I tried my best to destroy the witch Canghai, but I have forgotten the specific circumstances.

[0058] Step 103: input the model input information into a pre-trained large language model to obtain multiple reply suggestions for the above message.

[0059] In this embodiment, the Large Language Model (LLM) is a deep learning model trained based on massive text data. It can not only generate natural language text, but also deeply understand the meaning of the text and handle various natural language tasks, such as text summarization, question answering, translation, etc. In practical applications, the above-mentioned large language model can be trained based on an existing language model or trained using a self-developed language model, which is not specifically limited here.

[0060] In this embodiment, after the model input information is input into the pre-trained large language model, the large language model can generate multiple reply suggestions for the above message based on the model input information.

[0061] Continuing with the above example, see Figure 2 , in response to the message "Chukong: That battle has been over for 30,000 years. I only remember that I tried my best to destroy the witch Canghai, but I have forgotten the specific circumstances.", multiple reply suggestions may include:

[0062] Response suggestion A: Have you ever tried to recover those lost memories?

[0063] Response suggestion B: How did you discover that your soul was damaged and you had lost your memory?

[0064] Reply suggestion C: How did you and Shenjun Haoxuan meet?

[0065] In some optional implementations of this embodiment, the above model output requirement can be used to instruct the large language model to output multiple reply suggestions. After the model input information is input into the pre-trained large language model, the following steps can be performed by the large language model:

[0066] The first step is to determine the probability of each word in the vocabulary being the first word in the candidate reply suggestion for the above message based on the model input information. Here, the large language model can generate candidate reply suggestions by encoding, feature extraction, decoding, and other processing of the model input information. Each candidate reply suggestion is a word sequence, that is, a token sequence. The words in the word sequence are generated sequentially by the large language model. The token is the smallest text unit processed by the large prediction model. When the large prediction model generates each word in the word sequence, the probability of each word in the vocabulary can be calculated and the word can be selected based on the probability.

[0067] The second step is to select k words from the vocabulary in descending order of probability, where k is a positive integer.

[0068] The third step is to use k words as the first words of the candidate reply suggestions to generate k candidate reply suggestions. Specifically, k words can be used as the first words of the word sequence, and the subsequent words of the word sequence can be determined in sequence based on the model input information, the existing words in the word sequence and the vocabulary to obtain k word sequences; the sentence corresponding to each word sequence in the k word sequence is used as a candidate reply suggestion to obtain k candidate reply suggestions.

[0069] As an example, k=4. The vocabulary includes content words. After calculation by the large language model, it can be known that the top 4 words in probability order are "that", "you", "saying", and "those". Then, "that", "you", "saying", and "those" can be used as the first words of the four word sequences respectively, and the second word and the third word of each word sequence can be calculated step by step until the word sequence calculation is completed, thereby obtaining 4 candidate reply suggestions. For example, the 4 candidate reply suggestions are: Candidate reply suggestion A: Have you tried to recover those lost memories? Candidate reply suggestion B: How did you find out that your soul was damaged and you lost your memory? Candidate reply suggestion C: How did you and Lord Haoxuan meet? Candidate reply suggestion D: Which lost memories have you tried to recall?

[0070] In the fourth step, the k candidate reply suggestions are deduplicated to obtain multiple reply suggestions for the above message. Here, the k candidate reply suggestions can be deduplicated based on similarity calculation or clustering. Continuing with the above example, candidate reply suggestions A and candidate reply suggestions D are highly similar, and the above candidate reply suggestion D can be removed, while candidate reply suggestions A, candidate reply suggestions B, and candidate reply suggestions C are retained.

[0071] Based on the model input information, the probability of each word in the vocabulary being the first word in the candidate reply suggestion is determined, and then k words are selected from the vocabulary in descending order of probability, and then k words are respectively used as the first word of the candidate reply suggestion to generate k candidate reply suggestions, and finally multiple reply suggestions for the above message are selected from the k candidate reply suggestions, thereby obtaining multiple reply suggestions for the above message. Since the first word of the above multiple reply suggestions has a higher probability, the degree of match with the above message is higher. In addition, since the multiple reply suggestions for the above message are obtained after deduplication operation, it can be ensured that each reply suggestion is not similar, so that a variety of different reply suggestions can be provided to the first user for the first user to choose from, thereby improving the diversity of reply suggestions and the convenience of users replying to messages.

[0072] In some optional implementations of this embodiment, the fourth step may be further performed as follows:

[0073] First, based on the k candidate reply suggestions, a candidate reply suggestion set is generated. For example, the candidate reply suggestion set includes the candidate reply suggestion A, candidate reply suggestion B, candidate reply suggestion C, and candidate reply suggestion D mentioned above.

[0074] Afterwards, the following steps are iterated: the candidate reply suggestion with the highest probability of the first word is selected from the first set as the target candidate reply suggestion, the target candidate reply suggestion is deleted from the first set, and stored in the second set; the semantic similarity between the target candidate reply suggestion and each candidate reply suggestion in the first set is determined; and the candidate reply suggestions in the first set whose semantic similarity with the target candidate reply suggestion is greater than a preset threshold are deleted.

[0075] Finally, when there are no candidate reply suggestions in the first set, each candidate reply suggestion in the second set is used as a reply suggestion for the message.

[0076] As an example, the candidate reply suggestion with the highest probability of the first word in the first set is candidate reply suggestion A. Therefore, candidate reply suggestion A can be first used as the target candidate reply suggestion, deleted from the first set, and stored in the second set. At this time, the first set includes candidate reply suggestions B, candidate reply suggestion C, and candidate reply suggestion D, and the second set includes candidate reply suggestion A. Then, the semantic similarity between candidate reply suggestion A and candidate reply suggestions B, candidate reply suggestion C, and candidate reply suggestion D in the first set can be determined respectively. Based on the similarity determination result, it can be seen that the semantic similarity between candidate reply suggestion D and candidate reply suggestion A is greater than the threshold, so candidate reply suggestion D can be deleted from the first set.

[0077] Next, continue to select the candidate reply suggestion B with the highest probability of the first word from the first set, take the candidate reply suggestion B as the target candidate reply suggestion, delete the candidate reply suggestion B from the first set, and store the candidate reply suggestion B in the second set. At this time, the first set includes the candidate reply suggestion C, and the second set includes the candidate reply suggestion A and the candidate reply suggestion B. Then, the semantic similarity between the candidate reply suggestion B and the candidate reply suggestion C in the first set can be determined. Based on the result of the semantic similarity determination, it can be seen that the semantic similarity between the candidate reply suggestion B and the candidate reply suggestion C is less than the threshold, so no operation can be performed.

[0078] Next, continue to select the candidate reply suggestion C with the highest probability of the first word from the first set, use the candidate reply suggestion C as the target candidate reply suggestion, delete the candidate reply suggestion C from the first set, and store the candidate reply suggestion C in the second set. At this time, there is no candidate reply suggestion in the first set, and the second set includes candidate reply suggestion A, candidate reply suggestion B, and candidate reply suggestion C. The candidate reply suggestion A, candidate reply suggestion B, and candidate reply suggestion C in the second set can be used as reply suggestions for the above message.

[0079] Through the above method, k candidate reply suggestions can be easily and quickly deduplicated, so that the obtained multiple reply suggestions have lower semantic similarity, thereby providing users with diverse reply suggestions.

[0080] In some optional implementations of this embodiment, the large language model can be trained through the following steps:

[0081] The first step is to obtain role information samples of multiple roles and historical conversation content samples between each of the multiple roles and the user. The role information samples of the multiple roles can be collected from websites or film and television drama related content. The historical conversation content samples can be obtained by simulating the chat conversation between the user and the role based on the historical role information using an existing language model.

[0082] In the second step, for each of the multiple roles, based on the historical conversation content samples between the role and the user, a sample of messages to be replied and a sample of reply suggestions are determined. Here, data cleaning can be performed first to delete invalid data in the above historical conversation content samples, such as garbled characters, emoticons, etc.

[0083] In the third step, the role information samples, historical conversation content samples, to-be-replied message samples and reply suggestion samples of each of the multiple roles are input into the preset format template to generate the target format information, wherein the reply suggestion samples can be regarded as the annotations of the target format information.

[0084] As an example, the format of the target format information can be referred to as follows:

[0085] <system>#Task

[0086] Generate multiple user response suggestions.

[0087] ##Character Information Sample

[0088] ## Historical dialogue content sample

[0089] ##Model output requirements

[0090] <user>Sample message to be replied

[0091] <assistant>Sample response suggestion

[0092] Among them, the above-mentioned <system> #”、" <user> ”、" <assistant>" are all identifiers, "##" is used to indicate that the following content is a title, and a line break is inserted after the title to insert specific content.

[0093] The fourth step is to train the basic language model based on the generated target format information to obtain a large language model. Here, the above-mentioned basic language model can be an existing language model or a self-developed language model, which is not specifically limited here. The target format information can be encoded first, and then the encoded content can be input into the basic language model to obtain the reply suggestions output by the basic language model. Then, based on the reply suggestions and reply suggestion samples output by the basic language model, the loss value of the basic language model is determined. The above loss value is the value of the loss function, and the loss function can use the cross entropy loss function. Then, based on the loss value, the parameters of the basic language model can be updated to achieve the training of the basic language model.

[0094] By training the large language model in the above manner, the model can learn the reply methods and reply characteristics for messages from different roles, so that the trained large language model can generate targeted replies for messages from different roles.

[0095] In some optional implementations of the present embodiment, the above-mentioned model output requirements may be used to instruct the large language model to output multiple reply suggestions with different reply angles. At this time, after the model input information is input into the pre-trained large language model, the multiple reply suggestions for the above-mentioned message obtained by the large language model may correspond to different reply angles. Accordingly, when training the large language model, the above-mentioned reply suggestion samples may include multiple reply suggestions with different reply angles. Thus, the large language model can learn the features of reply suggestions at different angles during the training process, so as to be able to output multiple reply suggestions with different reply angles. The above-mentioned reply angles may include, but are not limited to, at least one of the following: breadth angle, depth angle, and topic transfer angle.

[0096] Step 104: Send multiple reply suggestions to the first user.

[0097] In some optional implementations of this embodiment, after sending multiple reply suggestions to the first user, a sending request from the first user for a target reply suggestion among the multiple reply suggestions may also be received. In response to the sending request, the target reply suggestion may be used as a reply message of the first user to the message, and the reply message may be sent to the second user. The reply message is used to reply to the message sent by the second user or introduce a topic to the message sent by the second user.

[0098] The method provided by the above embodiment of the present application obtains the historical conversation content between the first user and the second user when the first user receives a message sent by the second user; then generates model input information based on the role information of the second user, the historical conversation content, the above message and the preset model output requirements; then inputs the model input information into the pre-trained large language model to obtain multiple reply suggestions for the message; and finally sends multiple reply suggestions to the first user. As a result, when the first user receives a message sent by the second user, a variety of reply suggestions can be provided to the first user for the first user to choose from, eliminating the process of the user's message conception and improving the efficiency of message reply.

[0099] In addition, the embodiment of the present application does not rely on a fixed dialogue tree or preset replies, but uses a large language model to dynamically generate reply suggestions based on information such as the role information of the second user and the historical dialogue content, thereby lowering the user's dialogue threshold, while reducing the cost of calling other service models and having a faster response speed.

[0100] In addition, by providing a variety of reply suggestions for users to choose from, users can be attracted to continue the conversation, which improves the continuity and fluency of the conversation and enables users to obtain more information through the conversation.

[0101] Further references Figure 3 As an implementation of the methods shown in the above figures, the present application provides an embodiment of a message reply device, which is similar to Figure 1 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.

[0102] like Figure 3 As shown, the message reply device 300 of this embodiment includes: an acquisition unit 301, which is used to acquire the historical conversation content between the first user and the second user when the first user receives a message sent by the second user, and the historical conversation content includes the message; a generation unit 302, which is used to generate model input information based on the role information of the second user, the historical conversation content and the preset model output requirements; a processing unit 303, which is used to input the model input information into a pre-trained large language model to obtain multiple reply suggestions for the message, and the reply angle is at least one of the following: breadth angle, depth angle, and topic change angle; a sending unit 304, which is used to send the multiple reply suggestions to the first user.

[0103] In some optional implementations of the present embodiment, the processing unit 303 is further used to: input the model input information into a pre-trained large language model, and perform the following steps through the large language model: based on the model input information, determine the probability of each word in the vocabulary as the first word in the candidate reply suggestion for the message; select k words from the vocabulary in order of the probability from high to low, where k is a positive integer; use the k words as the first word of the candidate reply suggestion respectively, to generate k candidate reply suggestions; deduplicate the k candidate reply suggestions to obtain multiple reply suggestions for the message.

[0104] In some optional implementations of the present embodiment, the processing unit 303 is further used to: take the k words as the first word of the word sequence, and determine the subsequent words of the word sequence in sequence based on the model input information, the existing words in the word sequence and the vocabulary, to obtain k word sequences; take the sentence corresponding to each word sequence in the k word sequences as a candidate reply suggestion, to obtain k candidate reply suggestions.

[0105] In some optional implementations of the present embodiment, the processing unit 303 is further used to: generate a first set based on the k candidate reply suggestions; iteratively perform the following steps: select the candidate reply suggestion with the highest probability of the first word from the first set as the target candidate reply suggestion, delete the target candidate reply suggestion from the first set, and store it in a second set; determine the semantic similarity between the target candidate reply suggestion and each candidate reply suggestion in the first set; delete the candidate reply suggestions in the first set whose semantic similarity with the target candidate reply suggestion is greater than a preset threshold; when there is no candidate reply suggestion in the first set, use each candidate reply suggestion in the second set as a reply suggestion for the message.

[0106] In some optional implementations of this embodiment, the processing unit 303 is further used to: obtain a prompt word template, the prompt word template including a preset model output requirement; input the role information of the second user, the historical conversation content and the message into the prompt word template to obtain model input information.

[0107] In some optional implementations of the present embodiment, the large language model is trained through the following steps: obtaining role information samples of multiple roles and historical conversation content samples between each of the multiple roles and the user; for each of the multiple roles, determining a message sample to be replied and a reply suggestion sample based on the historical conversation content sample between the role and the user; inputting the role information samples, historical conversation content samples, message samples to be replied and reply suggestion samples of each of the multiple roles into a preset format template to generate target format information; based on the generated target format information, training the basic language model to obtain a large language model.

[0108] In some optional implementations of this embodiment, the multiple reply suggestions have different reply angles; the reply suggestion sample includes multiple reply suggestions with different reply angles.

[0109] In some optional implementations of the present embodiment, the device further includes a reply unit, for receiving a sending request from the first user for a target reply suggestion among the multiple reply suggestions; in response to the sending request, taking the target reply suggestion as a reply message of the first user to the message, and sending the reply message to the second user, wherein the reply message is used to reply to the message sent by the second user or to introduce a topic for the message sent by the second user.

[0110] In some optional implementations of this embodiment, the first user is a real user, and the second user is a virtual user.

[0111] The device provided by the above-mentioned embodiment of the present application obtains the historical conversation content between the first user and the second user when the first user receives a message sent by the second user; then generates model input information based on the role information of the second user, the historical conversation content, the message and the preset model output requirements; then inputs the model input information into the pre-trained large language model to obtain multiple reply suggestions for the message; and finally sends multiple reply suggestions to the first user. As a result, when the first user receives a message sent by the second user, a variety of reply suggestions can be provided to the first user for the first user to choose from, eliminating the process of the user conceiving a message and improving the efficiency of message reply.

[0112] Reference below Figure 4 , which shows a schematic structural diagram of an electronic device for implementing some embodiments of the present application. Figure 4 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0113] like Figure 4 As shown, the electronic device 400 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 401, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 402 or a program loaded from a storage device 408 into a random access memory (RAM) 403. In the RAM 403, various programs and data required for the operation of the electronic device 400 are also stored. The processing device 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.

[0114] Typically, the following devices may be connected to the I / O interface 405: an input device 406 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 407 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 408 including, for example, a disk, a hard disk, etc.; and a communication device 409. The communication device 409 may allow the electronic device 400 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 4 The electronic device 400 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead. Figure 4 Each block shown in the figure may represent one device, or may represent multiple devices as required.

[0115] In particular, according to some embodiments of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, some embodiments of the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In some such embodiments, the computer program can be downloaded and installed from the network through the communication device 409, or installed from the storage device 408, or installed from the ROM 402. When the computer program is executed by the processing device 401, the above-mentioned functions defined in the method of some embodiments of the present application are executed.

[0116] It should be noted that the computer-readable medium described in some embodiments of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, 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 above. In some embodiments of the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In some embodiments of the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0117] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with 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"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.

[0118] The computer-readable medium may be included in the electronic device; or it may exist independently without being installed in the electronic device. The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: obtains the historical conversation content between the first user and the second user when the first user receives a message sent by the second user; generates model input information based on the role information of the second user, the historical conversation content, the message and the preset model output requirements; inputs the model input information into the pre-trained large language model to obtain multiple reply suggestions for the message; and sends multiple reply suggestions to the first user.

[0119] Computer program code for performing the operations of some embodiments of the present application may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++; and also conventional procedural programming languages ​​such as "C" language or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, or may be connected to an external computer (e.g., using an Internet service provider to connect through the Internet), including a local area network (LAN) or a wide area network (WAN).

[0120] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0121] The units described in some embodiments of the present application may be implemented by software or hardware. The units described may also be set in a processor, for example, it may be described as: a processor includes a first determination unit, a second determination unit, a selection unit, and a third determination unit. The names of these units do not, in some cases, constitute limitations on the units themselves.

[0122] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0123] The above description is only some preferred embodiments of the present application and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present application is not limited to the technical solutions formed by the specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above invention concept. For example, the above features are replaced with (but not limited to) the technical features with similar functions disclosed in the embodiments of the present application to form a technical solution.< / assistant> < / user> < / system> < / assistant> < / user> < / system> < / user> < / system> < / user> < / system> < / user> < / system> < / user> < / system>

Claims

1. A message reply method, characterized in that: The method comprises: When a first user receives a message sent by a second user, obtaining historical conversation content between the first user and the second user; Generate model input information based on the role information of the second user, the historical conversation content, the message and the preset model output requirements; Inputting the model input information into a pre-trained large language model to obtain a plurality of reply suggestions for the message; The plurality of reply suggestions are sent to the first user.

2. The method according to claim 1, characterized in that The inputting the model input information into a pre-trained large language model to obtain a plurality of reply suggestions for the message includes: The model input information is input into a pre-trained large language model, and the following steps are performed by the large language model: Determining, based on the model input information, a probability of each word in the vocabulary being a first word in a candidate reply suggestion for the message; Select k words from the vocabulary in descending order of probability, where k is a positive integer; Using the k words as the first words of candidate reply suggestions respectively, generating k candidate reply suggestions; The k candidate reply suggestions are deduplicated to obtain multiple reply suggestions for the message.

3. The method according to claim 2, characterized in that The step of using the k words as the first words of the candidate reply suggestions to generate k candidate reply suggestions comprises: Taking the k words as the first words of the word sequence respectively, and determining the subsequent words of the word sequence in sequence based on the model input information, the existing words in the word sequence and the vocabulary, to obtain k word sequences; The sentence corresponding to each word sequence in the k word sequences is taken as a candidate reply suggestion to obtain k candidate reply suggestions.

4. The method according to claim 2, characterized in that: The step of removing duplicates from the k candidate reply suggestions to obtain multiple reply suggestions for the message includes: Based on the k candidate reply suggestions, generate a first set; Iteratively perform the following steps: select the candidate reply suggestion with the highest probability of the first word from the first set as the target candidate reply suggestion, delete the target candidate reply suggestion from the first set, and store it in the second set; determine the semantic similarity between the target candidate reply suggestion and each candidate reply suggestion in the first set; delete the candidate reply suggestion in the first set whose semantic similarity with the target candidate reply suggestion is greater than a preset threshold; When there are no candidate reply suggestions in the first set, each candidate reply suggestion in the second set is used as a reply suggestion for the message.

5. The method according to claim 1, characterized in that The generating model input information based on the role information of the second user, the historical conversation content, the message and the preset model output requirement includes: Acquire a prompt word template, wherein the prompt word template includes a preset model output requirement; The role information of the second user, the historical conversation content and the message are input into the prompt word template to obtain model input information.

6. The method according to claim 1, characterized in that The large language model is trained by the following steps: Acquire role information samples of multiple roles and historical conversation content samples between each of the multiple roles and the user; For each of the multiple roles, based on a sample of historical conversation content between the role and the user, determine a sample of messages to be replied and a sample of reply suggestions; Inputting role information samples, historical conversation content samples, to-be-replied message samples, and reply suggestion samples of each of the multiple roles into a preset format template to generate target format information; Based on the generated target format information, the basic language model is trained to obtain a large language model.

7. The method according to claim 6, characterized in that The multiple reply suggestions have different reply angles; the reply suggestion sample includes multiple reply suggestions with different reply angles.

8. The method according to claim 1, characterized in that: The method further comprises: receiving a request from the first user to send a target reply suggestion among the plurality of reply suggestions; In response to the sending request, the target reply suggestion is used as a reply message of the first user to the message, and the reply message is sent to the second user, wherein the reply message is used to reply to the message sent by the second user or to introduce a topic for the message sent by the second user.

9. The method according to any one of claims 1 to 8, characterized in that: The first user is a real user, and the second user is a virtual user.

10. A message reply device, characterized in that: The device comprises: an acquisition unit, configured to acquire, when the first user receives a message sent by the second user, a historical conversation content between the first user and the second user, wherein the historical conversation content includes the message; A generating unit, configured to generate model input information based on the role information of the second user, the historical conversation content and a preset model output requirement; a processing unit, configured to input the model input information into a pre-trained large language model to obtain a plurality of reply suggestions for the message; A sending unit is used to send the multiple reply suggestions to the first user.

11. An electronic device, characterized in that: include: one or more processors; a storage device having one or more programs stored thereon, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 9.

12. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.