Evaluation theory and emotion support strategy-based common-situation reply generation method and system

Through a method based on evaluation theory and emotional support strategy, combining large language models and emotional palettes, a rich empathy response database was generated, which solved the problem of relying on artificial emotional dictionary and single response methods in the existing technology, and achieved efficient and diverse emotional support.

CN119862251APending Publication Date: 2025-04-22SHENZHEN MSU-BIT UNIVERSITY +1
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411636574.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-15
Publication Date
2025-04-22

AI Technical Summary

Technical Problem

In the prior art, the artificial emotion dictionary is highly dependent and the expression of empathetic replies is single, so it cannot effectively adapt to diverse emotional scenarios.

Method used

The empathetic replies generation method based on evaluation theory and emotional support strategy is adopted, and the original replies are generated through a large language model, and combined with emotion palette and semantic retrieval enhancement, a rich empathetic replies database is generated, and the response is adjusted using emotional support strategy to achieve higher empathy ability and expression richness.

Benefits of technology

Get rid of the dependence on artificial emotional dictionary, the generated replies are semantically coherent and rich in expression, adapting to diverse emotional scenarios, significantly improving the empathy ability of the large language model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119862251A_ABST
    Figure CN119862251A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, and discloses a common-situation reply generation method and system based on an evaluation theory and an emotion support strategy. The method specifically comprises the steps of generating a common-situation reply database based on an evaluation theory and a large language model; generating an original reply by using the large language model, and performing retrieval from a common-condition reply database according to the original reply to obtain a target dialogue history and a corresponding target common-condition reply; processing the dialogue history by using a pre-trained model to obtain an emotion support strategy; and based on an emotion support strategy, adjusting the target common-situation reply by using a large language model to obtain a final reply. According to the method, the large language model is combined into the field of common-situation reply generation, the dependency on an artificial emotion dictionary is eliminated by constructing a common-situation reply database, retrieving and introducing an emotion support strategy, and replies which are coherent in content semantics and rich in expression mode can be generated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method and system for generating empathetic responses based on evaluation theory and emotional support strategies. Background Art

[0002] In today's society, people's demand for emotional support and psychological comfort is growing. To meet this demand, AI dialogue systems that can conduct compassionate conversations have become an important way. These systems can understand emotions and situations given the context of the conversation and generate rich responses. They aim to deeply understand the user's emotional state and inner feelings, and help users overcome emotional challenges by providing appropriate feedback, while creating psychological comfort and support.

[0003] Traditional empathy response systems mainly rely on dialogue templates and rules. This method manually designs a series of dialogue response templates or rules in advance. When the system receives the user's dialogue information, it selects the most suitable template or rule based on the characteristics of the information (such as emotional state) and combines it with the user's information to generate the final response. However, this method relies heavily on carefully designed templates or rules, which not only limits the model's ability to create novel sentences, but also reduces its adaptability to new dialogue environments. At the same time, the process of designing these templates or rules is complex, time-consuming, and very costly.

[0004] In recent years, with the rapid development of deep learning technology and the widespread popularity of social media, humans have accumulated a huge amount of conversation data resources. In this context, deep learning-based conversation technology has gradually emerged, and has begun to surpass and replace traditional methods based on conversation rules and templates, such as methods based on sequence-to-sequence models and methods based on large language models.

[0005] Sequence-to-sequence model-based methods can automatically learn features in conversations by building a neural network model with an encoder-decoder framework. However, since the input of this type of method is only the conversation message, it is easy to generate meaningless "safe replies", resulting in insufficient output information and poor semantic coherence. In addition, when it is necessary to generate emotional replies, the model often relies on additional artificial sentiment dictionaries, which not only limits its generalization ability, but also increases its dependence on emotional expression, reducing its performance in diverse emotional scenarios.

[0006] The method based on the large language model uses fine-tuning or prompt learning to stimulate the large language model's knowledge about empathy, thereby generating more coherent responses with higher empathy. Compared with the sequence-to-sequence model, the large language model method has a large amount of knowledge in various fields in addition to dialogue messages, so the responses generated by the model are more innovative and coherent. The main problem with this type of method is that the knowledge that the large language model is exposed to includes a lot of suggestive knowledge, which has poor scalability and few types, resulting in the large language model being limited to the way of making suggestions in the empathy response task, and the response method is relatively single, which is not suitable for real-world applications. Summary of the invention

[0007] The present application provides an empathy response generation method based on evaluation theory and emotional support strategy to solve the problems in the prior art of high reliance on artificial emotional dictionaries and single expression of response sentences.

[0008] Correspondingly, the present application also provides an empathic response generation system based on evaluation theory and emotional support strategy, an electronic device, and a computer-readable storage medium to ensure the implementation and application of the above method.

[0009] In order to solve the above technical problems, the present application discloses a method for generating empathic responses based on evaluation theory and emotional support strategy, the method comprising:

[0010] Generate an empathic response database based on appraisal theory and large language models;

[0011] Generate original responses using a large language model, and retrieve from the empathy response database based on the original responses to obtain the target conversation history and the corresponding target empathy response;

[0012] Use the pre-trained model to process the conversation history and obtain the emotional support strategy;

[0013] Based on the emotional support strategy, the target empathic response is adjusted using the large language model to obtain the final response.

[0014] Preferably, based on the emotional support strategy, the empathy response is processed using a large language model, and after obtaining the final response, the method further includes:

[0015] According to the preset empathy-related indicators, GPT-4 is used to score each round of responses of the large language model to obtain the score of the large language model.

[0016] Preferably, the empathy response database is generated based on the evaluation theory and the large language model, including:

[0017] Generate an emotional palette based on appraisal theory;

[0018] Use the large language model to generate influencing emotional factors and contexts for all emotions in the emotional palette in turn;

[0019] Using the emotion palette, factors influencing emotion, and context, the large language model is prompted to generate conversation histories and empathetic replies that include empathetic responses;

[0020] An empathy response database is formed based on the empathy responses and the corresponding conversation history.

[0021] Preferably, the emotional palette, factors affecting the emotion, and context are used to prompt the large language model to generate a conversation history and empathetic replies containing empathetic responses, including:

[0022] Using the emotional palette, emotional factors, and context, the large language model is prompted to generate the first utterance of the person seeking help;

[0023] Based on the first round of speech by the help seeker, prompt the large language model to generate a dialogue history; wherein the dialogue history includes multiple rounds of dialogue between the help seeker and the supporter;

[0024] Use a large language model to analyze the sentiment, sentiment-influencing factors, and context of the conversation history to obtain empathetic responses from supporters in the last round of conversation.

[0025] Preferably, the original response is generated by using a large language model, and the target conversation history and the corresponding target empathy response are obtained by searching from the empathy response database according to the original response, including:

[0026] Generate original responses using a large language model;

[0027] The semantic similarity between the original reply and the empathetic replies in the empathetic replies database is calculated using the pre-trained retrieval model;

[0028] According to the order of semantic similarity from large to small, a target number of empathy responses are obtained as target empathy responses;

[0029] The conversation history corresponding to the target empathy response in the empathy response database is obtained as the target conversation history.

[0030] Preferably, the conversation history is processed using a pre-trained model to obtain an emotional support strategy, including:

[0031] Set fine-tuning definition prompts; fine-tuning definition prompts include policy definition, task definition, and conversation history;

[0032] Based on the fine-tuning definition prompts, the pre-trained model is guided to process the conversation history and obtain the emotional support strategy.

[0033] Preferably, the empathy-related indicators include primary evaluation indicators and auxiliary evaluation indicators;

[0034] The main assessment indicator is empathy;

[0035] Auxiliary evaluation indicators include coherence, information content, identification, comfort and suggestions.

[0036] The present application also discloses an empathy response generation system based on evaluation theory and emotional support strategy, the system comprising:

[0037] A database generation module, used to generate an empathy response database based on evaluation theory and large language models;

[0038] The semantic retrieval enhancement module is used to generate original responses using a large language model, and to retrieve the target conversation history and the corresponding target empathetic response from the empathetic response database based on the original response;

[0039] The emotional support strategy fusion module is used to process the conversation history using the pre-trained model to obtain the emotional support strategy;

[0040] The emotional support strategy fusion module is also used to adjust the target empathy response based on the emotional support strategy using a large language model to obtain the final response.

[0041] The present application also discloses an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, one or more methods described in the present application are implemented.

[0042] The present application also discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, one or more methods described in the present application are implemented.

[0043] In this application, an empathy response database is generated based on evaluation theory and a large language model to obtain rich external resources related to empathy responses. The large language model is used to generate the original response, and the target conversation history and the corresponding target empathy response are retrieved from the empathy response database according to the original response, which greatly enriches the empathy ability and response richness of the responses generated by the large language model. The conversation history is processed using a pre-trained model to obtain an emotional support strategy; based on the emotional support strategy, the target empathy response is adjusted using a large language model to obtain the final response. The knowledge of conversation skills in the large language model can be stimulated, thereby comprehensively enhancing the empathy ability of the large language model and further enriching the response methods. Therefore, the method in this application combines the large language model with the field of empathy response generation, gets rid of the dependence on artificial sentiment dictionaries, and is able to generate responses that are coherent in content and semantics and rich in expression.

[0044] This application also has the following beneficial effects:

[0045] 1. This application proposes for the first time an emotional palette based on evaluation theory, which is used to decompose emotions, decompose emotions according to the direction of emotions, factors affecting emotions, and context, and combines the large language model and the way of thinking chain to generate a comprehensive empathy response database. Subsequently, combined with semantic retrieval enhancement, it is possible to obtain a wealth of external resources related to empathy responses, which greatly enriches the empathy ability and response richness of the responses generated by the model.

[0046] 2. The empathic response generation method based on evaluation theory and emotional support strategy proposed in this application can combine the large language model GPT-4 to automatically evaluate the empathy ability of the large language model and better evaluate the rationality of empathy.

[0047] 3. The method proposed in this application is not limited to the field of empathic response. Its core idea is to combine emotional support strategies with the generation and retrieval of external emotional databases. Faced with different emotional dialogue generation tasks and different emotional dialogue data sets, the method only needs simple modifications to obtain external resources in different contexts, so this method has broad application prospects.

[0048] Additional aspects and advantages of the present application will be given in the following description, which will become apparent from the following description, or will be understood through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:

[0050] Figure 1 A flowchart of a method for generating empathic responses based on evaluation theory and emotional support strategies provided in an embodiment of the present application;

[0051] Figure 2 A schematic diagram of the architecture of the model provided in the embodiment of the present application;

[0052] Figure 3 A schematic diagram of the structure of an empathy response generation system based on evaluation theory and emotional support strategy provided in an embodiment of the present application;

[0053] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0054] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and cannot be interpreted as limiting the present application.

[0055] It will be understood by those skilled in the art that, unless expressly stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present application refers to the presence of features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof. It should be understood that when we refer to an element as being "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may be an intermediate element. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein includes all or any unit and all combinations of one or more associated listed items.

[0056] Those skilled in the art will appreciate that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as those generally understood by those skilled in the art in the field to which the present invention belongs. It should also be understood that terms such as those defined in general dictionaries should be understood to have meanings consistent with the meanings in the context of the prior art, and will not be interpreted with idealized or overly formal meanings unless specifically defined as here.

[0057] The solution provided in the embodiments of the present application can be executed by any electronic device, such as a terminal device or a server, wherein the server can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services. The terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, etc., but is not limited to this. The terminal and the server can be directly or indirectly connected via wired or wireless communication, and the present application does not limit this. With respect to the technical problems existing in the prior art, the empathy response generation method and system based on evaluation theory and emotional support strategy provided in the present application are intended to solve at least one of the technical problems of the prior art.

[0058] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0059] The embodiment of the present application provides a possible implementation method, and provides a method for generating empathetic responses based on evaluation theory and emotional support strategy. The solution can be executed by any electronic device, and optionally, can be executed on a server or terminal device.

[0060] like Figure 1 As shown in , the method may include the following steps:

[0061] Step 101, generating an empathy response database based on evaluation theory and a large language model (LLM).

[0062] In the embodiment of the present application, given a conversation history containing alternating speeches between help seekers and supporters, it is defined as C = {S1, L1, S2, L2, ..., S Ni-1 ,L Ni -1,S Ni}, a total of 2N i -1 speech, including S i and L i represent the speech of the person seeking help for the i-th time and the speech of the supporter, respectively, and N i Indicates the total number of speeches of a party in the conversation i. The goal of the embodiment of the present application is to target the last speech of the supporter L Ni , providing an empathetic response, denoted by R.

[0063] In an embodiment of the present application, a large language model is used to generate conversation histories and corresponding empathic responses. Through a certain number of conversation histories and empathic responses, an empathic response database with comprehensive emotions and diverse responses is generated, thereby providing rich external resources for the large language model.

[0064] Step 102, using the large language model to generate an original response, and searching from the empathy response database based on the original response to obtain the target conversation history and the corresponding target empathy response.

[0065] In an embodiment of the present application, a target empathic response is retrieved from an empathic response database by a semantic retrieval enhancement method, and is then combined into a large language model to enhance the final empathic response, making the response more diverse and the empathic ability stronger.

[0066] Step 103: Use the pre-trained model to process the conversation history to obtain the emotional support strategy.

[0067] Step 104, based on the emotional support strategy, the target empathy response is adjusted using the large language model to obtain a final response.

[0068] Emotional support strategies represent different conversational skills used at various stages of a conversation, and incorporating these strategies can effectively guide the model to generate empathetic responses. Emotional support strategies cover a wide range of techniques. These strategies can be mainly divided into strategies that aim to understand the emotions and context of the help-seeker, and strategies that focus on providing empathetic assistance. Therefore, incorporating emotional support strategies can help large language models activate knowledge related to conversational skills, thereby enhancing their empathy capabilities.

[0069] In the embodiment of the present application, an empathy reply database is generated based on evaluation theory and a large language model to obtain a wealth of external resources related to empathy replies. The original reply is generated using a large language model, and the target conversation history and the corresponding target empathy reply are retrieved from the empathy reply database according to the original reply, which greatly enriches the empathy ability and reply richness of the reply generated by the large language model. The conversation history is processed using a pre-trained model to obtain an emotional support strategy; based on the emotional support strategy, the target empathy reply is adjusted using a large language model to obtain the final reply. It can stimulate the knowledge of conversation skills in the large language model, thereby comprehensively enhancing the empathy ability of the large language model, effectively solving the problems of insufficient reply information and single reply method generated by the existing empathy reply generation model, and further enriching the reply method. Therefore, the method in the embodiment of the present application combines the large language model with the field of empathy reply generation, gets rid of the dependence on artificial emotional dictionaries, and is able to generate replies that are coherent in content semantics and rich in expression. The method proposed in the embodiment of the present application has achieved performance advantages over other models on public data sets.

[0070] In an optional embodiment, an empathy response database is generated based on evaluation theory and a large language model, including:

[0071] Generate an emotional palette based on appraisal theory;

[0072] Use the large language model to generate influencing emotional factors and contexts for all emotions in the emotional palette in turn;

[0073] Using the emotion palette, factors influencing emotion, and context, the large language model is prompted to generate conversation histories and empathetic replies that include empathetic responses;

[0074] An empathy response database is formed based on the empathy responses and the corresponding conversation history.

[0075] In order to ensure the diversity and comprehensive coverage of emotions in the empathy response database, the empathy response database should contain a wide range of emotions. Therefore, the embodiment of the present application develops a comprehensive emotion palette, which exemplarily includes 7 main categories and 23 subcategories.

[0076] By analyzing the empathy dialogues in the empathy response dataset, it can be seen that in short conversations, such as conversations with only two rounds, supporters often provide empathy responses in the last round. Therefore, the embodiment of the present application uses short conversations to assist in generating empathy responses. In the embodiment of the present application, the large language model ChatGPT is used to construct the empathy response database in two stages.

[0077] In the first stage, based on a small number of sample examples in a large model empathy evaluation theory (EmotionBench), the large language model ChatGPT is used to generate influencing emotional factors and contexts for all emotions in the emotion palette in turn.

[0078] Among them, the large language model is used to generate factors affecting emotions, including:

[0079] Set prompts for factors that influence emotions and situations to generate prompts;

[0080] Based on the prompts for influencing emotional factors and context generation prompts, the large language model is guided to generate influencing emotional factors and contexts respectively.

[0081] Exemplarily, the factors influencing emotion generation prompts are as follows:

[0082] This is an empathic response task: The help seeker tells his story in a conversation with another supporter (the listener). During the conversation, the supporter should recognize and acknowledge the other person's feelings as much as possible.

[0083] Now imagine you are in the emotion '{emotion}' and generate the corresponding empathy dialogues of the factors that influence the emotion. You should generate as many as possible.

[0084] The scenario generation prompts are as follows:

[0085] This is an empathic response task: the help seeker tells his story in a conversation with another supporter.

[0086] During the conversation, supporters should recognize and acknowledge the other person’s feelings as much as possible.

[0087] Please generate scenarios for empathy dialogue based on emotions and factors that influence them. You will see some examples:

[0088] Now imagine that you are in an emotion "{emotion}" and the factors that influence the emotion "{factors}". You should generate as many as possible.

[0089] In the second stage, the emotion palette and the generated emotion factors and contexts are used to prompt the large language model ChatGPT to generate a short conversation containing empathetic responses as the conversation history, and based on the emotion, emotion factors and context of the conversation history, the final empathetic response is generated. During the generation process, the problem of repeated generation occurs when ChatGPT is repeatedly prompted to generate empathetic dialogues.

[0090] In an optional embodiment, using the emotional palette, factors affecting the emotion, and context, the large language model is prompted to generate a conversation history and empathetic replies containing empathetic responses, including:

[0091] Using the emotional palette, emotional factors, and context, the large language model is prompted to generate the first utterance of the person seeking help;

[0092] Based on the first round of speech by the help seeker, prompt the large language model to generate a dialogue history; wherein the dialogue history includes multiple rounds of dialogue between the help seeker and the supporter;

[0093] Use a large language model to analyze the sentiment, sentiment-influencing factors, and context of the conversation history to obtain empathetic responses from supporters in the last round of conversation.

[0094] Among them, the process of emotion decomposition reflects how humans generate empathy in daily life: first consider the emotions of the person seeking help, then reflect on the factors that affect these emotions, and take into account the individual's situation before forming a reply. This process is consistent with a large model empathy ability evaluation theory (EmotionBench) method for evaluating the empathy ability of a large language model. Therefore, the embodiment of this application believes that in order to better imitate human understanding ability when generating empathetic replies, large language models must incorporate this emotion decomposition process when dealing with different situations. Therefore, inspired by the important role of thought chains in the reasoning of large language models, the method of allowing ChatGPT to gradually generate dialogues is adopted:

[0095] First, set the first sentence generation prompt. Use the first sentence generation prompt to guide the large language model to generate the first round of speech (i.e., the first sentence) of the person seeking help.

[0096] For example, the first sentence generation prompt is as follows:

[0097] Empathic dialogue: The help seeker tells his story in a dialogue with another supporter. During the conversation, the supporter should recognize and acknowledge the other person's feelings as much as possible. Now, you need to generate an empathic dialogue. The emotion of the dialogue is "{emotion}", the factors that affect the emotion are "{factors}", and the situation is "{situation}".

[0098] You need to generate four different first sentences for people seeking help. "1. People seeking help:" "2. People seeking help:" "3. People seeking help:" "4. People seeking help".

[0099] Then, set the dialogue generation prompts and use them to guide the large language model to generate a complete empathetic dialogue.

[0100] Exemplarily, the dialogue generation prompt is as follows:

[0101] Empathy dialogue: The help seeker tells his story in a dialogue with another supporter. During the conversation, the supporter should recognize and acknowledge the feelings of the other person as much as possible. Now, you need to generate an empathy dialogue based on the speaker's first sentence {first_sentence}. The emotion of the dialogue is "{emotion}", the factors that affect the emotion are "{factors}", and the context is "{context}". Make sure to provide two rounds of empathy dialogue, and only two rounds.

[0102] Finally, we set a reply generation prompt. Under the guidance of the reply generation prompt, the large language model rethinks the emotions of the conversation, the factors and situations that affect the emotions, and generates the final round of empathetic responses from supporters.

[0103] Exemplarily, the reply generation prompt is as follows:

[0104] This is an empathic response dialogue task: the help seeker tells his story in a dialogue with another supporter (listener). In the conversation, the supporter should recognize and acknowledge the feelings of others as much as possible. Now you play the role of the supporter, imagine that you are in the emotion "{emotion}", the factors affecting the emotion "{factors}" and the situation "{situation}", please give a corresponding response based on the existing situation. You only need to provide the supporter's next round of response.

[0105] Your conversation history:

[0106] {dialogue}

[0107] Based on the above, the present application embodiment provides a database generation module based on evaluation theory for generating conversation history and empathy responses. The overall steps are as follows: Figure 2 As shown:

[0108] Step 1: Generate emotional influencing factors; specifically, use the large language model to generate emotional influencing factors for all emotions in the emotional palette (emotional disk);

[0109] Step 2: Context generation: Specifically, a large language model is used to generate contexts for all emotions in the emotion palette;

[0110] Step 3: Generate the first sentence, that is, generate the first round of speech of the person seeking help;

[0111] Step 4: Dialogue generation: Specifically, based on the first round of speech by the person seeking help, prompt the large language model to generate a dialogue history;

[0112] Step 5: Generate empathic responses. Specifically, use the large language model to analyze the emotions, emotional factors, and context of the conversation history to generate empathic responses from supporters in the last round of conversation.

[0113] The above method gradually generates a comprehensive empathy response database by decomposing emotions, providing rich external resources for the large language model.

[0114] In an optional embodiment, the original response is generated using a large language model, and the target conversation history and the corresponding target empathy response are obtained by searching from an empathy response database according to the original response, including:

[0115] Generate original responses using a large language model;

[0116] The semantic similarity between the original reply and the empathetic replies in the empathetic replies database is calculated using the pre-trained retrieval model;

[0117] According to the order of semantic similarity from large to small, a target number of empathy responses are obtained as target empathy responses;

[0118] The conversation history corresponding to the target empathy response in the empathy response database is obtained as the target conversation history.

[0119] The embodiment of the present application aims to enhance the empathetic response capability of the large language model by utilizing the constructed empathetic response database. By utilizing this comprehensive external resource, the empathetic capability of the large language model and the rich response expression methods can be stimulated. The embodiment of the present application adopts a vectorized semantic retrieval method, which can generate empathetic responses that resonate with similar emotions and situations. This method helps the large language model acquire empathetic knowledge, thereby improving its ability to provide meaningful and empathetic responses. Specifically, Figure 2 As shown in the "Improving Empathy through Retrieval Enhancement" section:

[0120] The original reply G1 generated by the large language model is used as a keyword and retrieved using a retrieval model trained on a large amount of text data. The model uses contrastive learning to map the sentences corresponding to the original reply and the sentences corresponding to the empathetic replies in the empathetic reply database to the vector space to generate an empathy vector library. The semantic similarity between the two replies is calculated by comparing their respective vector representations. This method can accurately measure the semantic proximity between different replies, thereby promoting more effective empathetic response retrieval (Raw Retrieval Responses). In the embodiment of the present application, Enc is used to represent the sentence encoding of the reply, and TopK selects the K empathetic replies R1, R2, R3, ..., R with the highest similarity between the two sentence vectors. K .

[0121] G11=LLM(C)

[0122]

[0123] E Database =Enc(Database)

[0124]

[0125] Among them, C is the conversation history, and Database represents the empathy response database.

[0126] In an optional embodiment, the conversation history is processed using a pre-trained model to obtain an emotional support strategy, including:

[0127] Set fine-tuning definition prompts (prompt); fine-tuning definition prompts include policy definition, task definition and dialogue history;

[0128] Based on the fine-tuning definition prompts, the pre-trained model is guided to process the conversation history and obtain the emotional support strategy.

[0129] In the embodiment of the present application, the emotional support strategy is used as an external guide for the large language model when generating empathic responses. To achieve this, the embodiment of the present application uses a dataset with emotional support strategy labels to train a low-rank adaptation (LoRA) model for emotional support strategy prediction. During the training process, a fine-tuning (SFT) definition prompt is set for emotional support strategy prediction, which includes three parts: strategy definition, task definition, and conversation history.

[0130] Exemplarily, the fine-tuning definition in the embodiments of the present application is as follows:

[0131] Keep in mind that typical strategies for responding to emotional support in a conversation are as follows:

[0132] 1. Reflective statements: Repeat or paraphrase what the other person said to show that you are actively listening.

[0133] 2. Clarification: Seek clarification to ensure a clear understanding of the person’s emotions and experiences.

[0134] 3. Emotional validation: Acknowledge and validate the other person’s emotions without judgment.

[0135] 4. Empathetic statements: Express understanding and sympathy for another person’s experience.

[0136] 5. Affirmation: Provide positive reinforcement and encouragement to lift the other person’s spirits.

[0137] 6. Provide hope: Share optimistic perspectives or possibilities to instill hope.

[0138] 7. Avoid judgment and criticism: It is important to create a non-judgmental and safe space for people to express their emotions without fear of criticism. Do not judge or overly criticize their experiences or choices.

[0139] 8. Suggest options: Provide practical suggestions or alternative perspectives for solving the problem at hand.

[0140] A more typical strategy...

[0141] You are a trained emotional support language model that can analyze the emotional support strategy of supporters' replies. Your task is to give supporters' replies and judge the emotional support strategy of supporters' replies based on the conversation history:

[0142] {dialogue}

[0143] In an optional embodiment, based on the emotional support strategy, the target empathy response is adjusted using a large language model to obtain a final response, including:

[0144] Set up final response generation prompts, including task definition, emotional support strategies, and target empathic responses;

[0145] Generate prompts based on the final response, and guide the large language model to adjust the target empathetic response to obtain the final response.

[0146] For example, the content of the final reply generation prompt is as follows:

[0147] Design an empathetic response for the help seeker that reflects on the help seeker’s last words and the entire history of the conversation. Make sure the response is:

[0148] Responsive: Directly acknowledges the speaker's most recent statement or emotion.

[0149] Empathy: Showing sympathy and understanding for the speaker’s emotional state.

[0150] Conciseness: Give a concise and focused answer, avoiding redundancy.

[0151] [Strategy Start]

[0152] {Strategy}

[0153] [Strategy End]

[0154] [Reply starts]

[0155] {reply}

[0156] [END OF REPLY]

[0157] [dialogue context begins]

[0158] {dialogue}

[0159] [End of conversation context]

[0160] Generate an empathetic, strategic response for the help seeker based on the conversation context, response information, and emotional support strategies provided.

[0161] The generated response should be contained within [Final response begins] and [Final response ends].

[0162] In the embodiment of the present application, the emotional support strategy is incorporated only when necessary; when it is not necessary, the large language model can generate the final response according to its own process.

[0163] In an optional embodiment, based on the emotional support strategy, the empathy response is processed using a large language model, and after obtaining the final response, the method further includes:

[0164] According to the preset empathy-related indicators, GPT-4 is used to score each round of responses of the large language model to obtain the score of the large language model.

[0165] In the field of empathetic response generation, the evaluation of large language models still relies on traditional metrics such as BLEU-n and Dist-1 / 2. These methods for evaluating large language models have certain limitations because the complexity of the responses generated by large language models may deviate significantly from the actual labels. Therefore, empathetic response generation without the participation of human experts is a challenge.

[0166] To address this problem, in an embodiment of the present application, an automatic evaluation module of a large language model based on rounds is used to evaluate the empathy ability of the large language model.

[0167] The empathy-related indicators in the embodiments of the present application include main evaluation indicators and auxiliary evaluation indicators. The main evaluation indicator is empathy (evaluating the extent to which the response understands and appropriately expresses the recognition of the emotions and experiences of the help seeker), and the auxiliary evaluation indicators include coherence (evaluating the relevance and logical connection of the response to the conversation context), information volume (determining the richness and value of the information provided in the response), identification (evaluating the depth of the response to the help seeker's situation and its ability to effectively identify problems), comfort (evaluating the proficiency of the response in providing comfort and support) and suggestions (evaluating the quality of suggestions provided to solve the help seeker's problems). A 7-point scoring system consistent with empathy research is adopted. In order to automatically obtain reliable results, GPT-4 is used to score responses according to this standard.

[0168] In the embodiment of the present application, a round-based empathy response evaluation method is adopted. Specifically, for each segment containing N i The conversation history of the turn-based conversation C i , add all the conversation histories up to the jth round to the query of the person seeking help (i.e. the last statement of the person seeking help), and record the conversation history with the query of the person seeking help as C ij , the response R is generated by a large language model ij When scoring, GPT-4 will use the conversation history C ij Reply R ij The scoring process is represented by a function score. Then, all the scores obtained in a complete conversation are averaged as the score of the entire conversation. Finally, the scores of all conversations are averaged to get the final score SC, and the equation is as follows:

[0169]

[0170] Among them, N i is the number of rounds in the i-th dialogue, and N is the total number of dialogues.

[0171] Exemplarily, in the embodiment of the present application, by setting evaluation prompts, GPT-4 is guided to score the large language model, and the evaluation prompts are as follows:

[0172] You are an AI evaluator tasked with scoring responses based on the quality of empathetic conversations.

[0173] The speaker is sharing their story with the listener, and the listener should recognize and understand the speaker's feelings throughout the conversation. Rate each of the following criteria from 1 to 7: Empathy, Identification, Comfort, Suggestion, Informativeness, Coherence.

[0174] Empathy (1-7): Assessing the extent to which the respondent understands and appropriately expresses the speaker's feelings and experiences.

[0175] More evaluation metrics....

[0176] [dialogue context begins]

[0177] {Conversation Context}

[0178] [End of conversation context]

[0179] [Generated response begins]

[0180] {reply}

[0181] [END OF GENERATED REPLY]

[0182] Provide your assessment in JSON format, as shown in the following example.

[0183] Example evaluation output:

[0184] ```json

[0185] {{"empathy":4,"recognition":6,"comfort":2,"suggestion":5,"informativeness":1,"coherence":7}}```

[0186] In the embodiment of the present application, according to the empathy response related indicators, GPT-4 is used to score each round of responses of the large language model, so as to more scientifically and reasonably evaluate the empathy ability of the large language model and reduce the manpower and time costs of manual participation.

[0187] In order to verify the effectiveness and advancement of the method proposed in the embodiment of the present application, a large number of experiments were conducted on the widely used EMPATHETICDIALOGUES and ExTES multi-round dialogue datasets using the two base models Llama2-7B and Llama3-8B for the proposed empathic response generation model based on evaluation theory and emotional support strategy, and compared with the currently more advanced empathic response generation models. The experiment used automatic evaluation indicators (empathy, identification, comfort, suggestion, informativeness, coherence), and used an automatic evaluation framework based on the number of dialogue turns and GPT-4 for evaluation, as shown in Table 1. The experimental results show that the method in the embodiment of the present application is superior to the current best empathic response generation model based on a large language model in terms of automatic evaluation indicators.

[0188] Table 1

[0189]

[0190]

[0191] In addition, the embodiments of the present application also conducted comparative experiments without and with databases generated based on evaluation theory, as well as comparative experiments without and with emotion support strategy integration modules. As shown in Table 1, under the condition of introducing a database generated based on evaluation theory, the empathy ability of the model is improved, while the suggestiveness and content richness are reduced. This shows that the introduction of a database generated based on evaluation theory can improve the empathy ability of the model, reduce the didactic nature of the large language model, and enrich the expression of the large language model. Furthermore, under the condition of introducing the emotion support strategy integration module, the empathy ability of the large language model is further improved, and the suggestiveness and content richness are further improved. This shows that the introduction of the emotional support strategy module can improve the empathy ability of the large language model while introducing more dialogue skills, thereby further enriching the expression of the large language model.

[0192] Based on the same principle as the method provided in the embodiment of the present application, the embodiment of the present application also provides an empathy response generation system based on evaluation theory and emotional support strategy, such as Figure 3 As shown, the system comprises:

[0193] A database generation module 301 is used to generate an empathy response database based on evaluation theory and a large language model;

[0194] A semantic search enhancement module 302 is used to generate an original response using a large language model, and to search from an empathy response database based on the original response to obtain a target conversation history and a corresponding target empathy response;

[0195] The emotional support strategy fusion module 303 is used to process the conversation history using the pre-trained model to obtain the emotional support strategy;

[0196] The emotional support strategy fusion module 303 is also used to adjust the target empathy response based on the emotional support strategy using the large language model to obtain a final response.

[0197] In an embodiment of the present application, an empathy response database is generated based on evaluation theory and a large language model to obtain a wealth of external resources related to empathy responses. The large language model is used to generate the original response, and the target conversation history and the corresponding target empathy response are retrieved from the empathy response database based on the original response, which greatly enriches the empathy ability and response richness of the responses generated by the large language model. The conversation history is processed using a pre-trained model to obtain an emotional support strategy; based on the emotional support strategy, the target empathy response is adjusted using a large language model to obtain a final response. The knowledge of conversation skills in the large language model can be stimulated, thereby comprehensively enhancing the empathy ability of the large language model and further enriching the response methods. Therefore, the method in the embodiment of the present application combines the large language model with the field of empathy response generation, gets rid of the dependence on artificial emotional dictionaries, and is able to generate responses that are coherent in content and semantics and rich in expression.

[0198] The empathy response generation system based on evaluation theory and emotional support strategy provided in the embodiment of the present application can achieve Figure 1 to Figure 2 To avoid repetition, the various processes implemented in the method embodiment are not described here.

[0199] The empathy response generation system based on evaluation theory and emotional support strategy of the embodiment of the present application can execute the empathy response generation method based on evaluation theory and emotional support strategy provided in the embodiment of the present application, and the implementation principle is similar. The actions performed by each module and unit in the empathy response generation system based on evaluation theory and emotional support strategy in each embodiment of the present application correspond to the steps in the empathy response generation method based on evaluation theory and emotional support strategy in each embodiment of the present application. For the detailed functional description of each module of the empathy response generation system based on evaluation theory and emotional support strategy, please refer to the description of the corresponding empathy response generation method based on evaluation theory and emotional support strategy shown in the previous text, which will not be repeated here.

[0200] Based on the same principle as the method shown in the embodiment of the present application, the embodiment of the present application also provides an electronic device, which may include but is not limited to: a processor and a memory; a memory for storing a computer program; a processor for executing the empathy response generation method based on evaluation theory and emotional support strategy shown in any optional embodiment of the present application by calling a computer program. Compared with the prior art, the empathy response generation method based on evaluation theory and emotional support strategy provided by the present application combines a large language model into the field of empathy response generation, gets rid of the dependence on artificial sentiment dictionaries, and is able to generate responses that are coherent in content semantics and rich in expression.

[0201] In an optional embodiment, an electronic device is also provided, such as Figure 4 As shown, Figure 4 The electronic device 400 shown may be a server, including: a processor 401 and a memory 403. The processor 401 and the memory 403 are connected, such as through a bus 402. Optionally, the electronic device 400 may further include a transceiver 404. It should be noted that in actual applications, the transceiver 404 is not limited to one, and the structure of the electronic device 400 does not constitute a limitation on the embodiments of the present application.

[0202] Processor 401 may be a CPU (Central Processing Unit), a general purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It may implement or execute various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. Processor 401 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and the like.

[0203] The bus 402 may include a path to transmit information between the above components. The bus 402 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus 402 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0204] The memory 403 can be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited to these.

[0205] The memory 403 is used to store the application code for executing the solution of the present application, and the execution is controlled by the processor 401. The processor 401 is used to execute the application code stored in the memory 403 to implement the contents shown in the above method embodiment.

[0206] Among them, electronic devices include but are not limited to: mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), and fixed terminals such as digital TVs and desktop computers. 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.

[0207] The server provided in this application can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The terminal can be a smart phone, tablet computer, laptop computer, desktop computer, smart speaker, smart watch, etc., but is not limited to this. The terminal and the server can be directly or indirectly connected by wired or wireless communication, and this application does not limit this.

[0208] An embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer-readable storage medium is run on a computer, the computer can execute the corresponding content in the aforementioned method embodiment.

[0209] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.

[0210] It should be noted that the computer-readable storage medium mentioned above in the present application can also be a computer-readable signal medium or a combination of a computer-readable storage medium and a computer-readable storage medium. The computer-readable storage medium can 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 the present application, a computer-readable storage medium can 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 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 can 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.

[0211] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0212] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device executes the method shown in the above embodiment.

[0213] According to one aspect of the present application, a computer program product or computer program is provided, the computer program product or computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the empathy response generation method and system based on evaluation theory and emotional support strategy provided in the above-mentioned various optional implementations.

[0214] Computer program code for performing the operations 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 conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0215] 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.

[0216] The modules involved in the embodiments described in this application can be implemented by software or hardware. The name of the module does not limit the module itself in some cases. For example, the database generation module can also be described as "a database generation module for generating an empathy response database based on evaluation theory and a large language model".

[0217] The above description is only a preferred embodiment of the present application and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present application is not limited to the technical solution formed by a 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 disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in this application (but not limited to) by each other to form a technical solution.

Claims

1. A method for generating empathic responses based on evaluation theory and emotional support strategy, characterized in that: The method comprises: Generate an empathic response database based on appraisal theory and large language models; Generate an original response using a large language model, and retrieve from the empathy response database according to the original response to obtain a target conversation history and a corresponding target empathy response; Processing the conversation history using a pre-trained model to obtain an emotional support strategy; Based on the emotional support strategy, the target empathic response is adjusted using a large language model to obtain a final response.

2. The method for generating empathic responses based on evaluation theory and emotional support strategy according to claim 1, characterized in that: After the empathy response is processed based on the emotional support strategy using a large language model to obtain a final response, the method further includes: According to the preset empathy-related indicators, GPT-4 is used to score each round of responses of the large language model to obtain the score of the large language model.

3. The method for generating empathic responses based on evaluation theory and emotional support strategy according to claim 1, characterized in that: The method of generating an empathy response database based on evaluation theory and a large language model includes: Generate an emotional palette based on appraisal theory; Generate influencing emotion factors and contexts for all emotions in the emotion palette in turn using a large language model; Using the emotion palette, the emotion influencing factors, and the context, prompting the large language model to generate a conversation history and an empathetic reply including an empathetic response; An empathy response database is formed based on the empathy response and the corresponding conversation history.

4. The method for generating empathic responses based on evaluation theory and emotional support strategy according to claim 3, characterized in that: The using of the emotion palette, the factors affecting the emotion, and the context to prompt the large language model to generate a conversation history and empathic response containing empathetic responses includes: Using the emotional palette, emotional factors, and context, the large language model is prompted to generate the first utterance of the person seeking help; Based on the first round of speech of the help seeker, prompting the large language model to generate the dialogue history; wherein the dialogue history includes multiple rounds of dialogue between the help seeker and the supporter; The large language model is used to analyze the sentiment, sentiment influencing factors and context of the conversation history to obtain empathetic responses from supporters in the last round of conversation.

5. The method for generating empathic responses based on evaluation theory and emotional support strategy according to claim 1, characterized in that: The generating an original response by using a large language model, and searching from the empathy response database according to the original response to obtain a target conversation history and a corresponding target empathy response, comprises: Generate original responses using a large language model; Calculating semantic similarity between the original reply and the empathy reply in the empathy reply database using a pre-trained retrieval model; According to the order of the semantic similarity from large to small, obtaining a target number of empathy responses as the target empathy responses; The conversation history corresponding to the target empathy response in the empathy response database is obtained as the target conversation history.

6. The method for generating empathic responses based on evaluation theory and emotional support strategy according to claim 1, characterized in that: The using of the pre-trained model to process the conversation history to obtain the emotional support strategy includes: Setting a fine-tuning definition prompt; the fine-tuning definition prompt includes a policy definition, a task definition, and a conversation history; Based on the fine-tuning definition prompt, the pre-trained model is guided to process the conversation history to obtain the emotional support strategy.

7. The method for generating empathic responses based on evaluation theory and emotional support strategy according to claim 2, characterized in that: The empathy-related indicators include main evaluation indicators and auxiliary evaluation indicators; The main evaluation indicator is empathy; The auxiliary evaluation indicators include coherence, information content, identification, comfort and suggestion.

8. An empathic response generation system based on evaluation theory and emotional support strategy, characterized in that: The system comprises: A database generation module, used to generate an empathy response database based on evaluation theory and large language models; A semantic retrieval enhancement module, for generating an original response using a large language model, and searching from the empathy response database according to the original response to obtain a target conversation history and a corresponding target empathy response; An emotional support strategy fusion module, used to process the conversation history using a pre-trained model to obtain an emotional support strategy; The emotional support strategy fusion module is also used to adjust the target empathy response based on the emotional support strategy using a large language model to obtain a final response.

9. An electronic device, characterized in that: The invention comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Common-situation dialogue generation method and system based on large language model evaluation

    CN120822619A

  • Emotional dialogue generation method and system based on large model

    CN120851041A