A method for generating emotional support dialogue based on multi-cue learning
By extracting and utilizing multi-perspective clues in the emotional support dialogue system and constructing semantic enhancement and constraint prompts, the problem of existing systems ignoring important clues is solved, the accuracy and diversity of emotional responses are improved, and the understanding and understanding of the dialogue system are enhanced. Responsiveness.
Patent Information
- Application Number
- CN202410879337.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-02
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2044-07-02
AI Technical Summary
Existing emotional support dialogue systems ignore other important clues, resulting in low accuracy of emotional responses, and treat clues from different sources equally, failing to accurately understand the user's emotional reasons.
This paper proposes an emotionally supportive dialogue generation method based on multi-cue prompt learning. By extracting multi-perspective clues from the user's emotional reasons and historical conversations, it constructs semantic enhancement prompts and semantic constraint prompts to guide the generation of emotionally supportive responses and improve the diversity of emotional responses. ization and accuracy.
By extracting and utilizing multi-perspective clues, more attractive and accurate emotional support responses are generated, which improves the diversity and accuracy of emotional responses and enhances the understanding ability and response quality of the emotional support dialogue system.
Smart Images

Figure CN118410131B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a method for generating emotional support dialogue based on multi-cue prompt learning. Background Art
[0002] The emotional support dialog task was proposed by Siyang Liu, Chujie Zheng, Orianna Demasi, Sahand Sabour, Yu Li, Zhou Yu, Yong Jiang, and Minlie Huang. Towards emotional support dialog systems. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 3469–3483, 2021, aiming to help people who are experiencing emotional problems relieve emotional stress. In recent years, building an effective emotional support dialog system has attracted more and more researchers' attention.
[0003] Quan Tu, Yanran Li, Jianwei Cui, Bin Wang, Ji-Rong Wen, and Rui Yan.Misc: A mixed strategy-aware model integrating comet for emotional support conversation. In Proceedings of the 60th Annual Meeting of the Associationfor Computational Linguistics (Volume 1: Long Papers), pages 308–319, 2022 (Quan Tu, Yanran Li, Jianwei Cui, Bin Wang, Ji-Rong Wen, and Rui Yan, Misc: A mixed strategy-aware model integrating comet for emotional support conversation. In Proceedings of the 60th Annual Meeting of the Associationfor Computational Linguistics (Volume 1: Long Papers), pages 308–319, 2022) Use the commonsense reasoning model COMET to extract the user's mental state implicit in the conversation history, so as to better understand the meaning of the user's expression and the current situation.
[0004] Wei Peng, Yue Hu, Luxi Xing, Yuqiang Xie, Yajing Sun, and Yunpeng Li.Control globally, understand locally: A global-to-local hierarchical graphnetwork for emotional support conversation. In Proceedings of the Thirty-First International Joint Conference on Artificial Intelligence, IJCAI 2022,Vienna, Austria, 23-29 July 2022, pages 4324–4330, 2022. COMET is also used to extract user intent and a hierarchical network is used to model the relationship between user intent, global reasons, and conversation history.
[0005] Weixiang Zhao, Yanyan Zhao, Shilong Wang, and Bing Qin. Transesc: Smoothing emotional support conversation via turn-level state transition. (Weixiang Zhao, Yanyan Zhao, Shilong Wang, and Bing Qin, Transesc: Smoothing emotional support conversation via turn-level state transition) considers the semantic conversion, strategy conversion and emotional conversion between conversations to generate smoother responses.
[0006] There are two notable problems with the above methods: first, they ignore some other clues that are crucial to generating effective emotional support responses. Second, they treat clues from different sources equally; thus, they cannot accurately understand the user's emotional reasons, resulting in low accuracy of the generated emotional responses. Summary of the invention
[0007] Based on the technical problems existing in the background technology, the present invention proposes a method for generating emotional support dialogue based on multi-cue prompt learning, which improves the diversity and accuracy of emotional responses.
[0008] The present invention proposes a method for generating emotional support dialogue based on multi-cue prompt learning, which inputs the user's emotional reasons into the emotional model to obtain the emotional response result;
[0009] The training process of the emotion model is as follows:
[0010] S1: constructing a training set, wherein the training set includes multiple groups of historical dialogues and emotional reasons corresponding to the multiple groups of historical dialogues, and inputting the historical dialogues and emotional reasons into the emotional model in sequence;
[0011] S2: Extract clues corresponding to historical dialogues and emotional reasons;
[0012] S21: Extract noun phrases in historical conversations and sentiment reasons as candidate words, and calculate the point mutual information value between each candidate word and the user’s last sentence in the historical conversation , and the point mutual information value Arrange in descending order and select the mutual information values of the first K points The corresponding candidate words serve as the theme clues of this historical dialogue , for topic clues After the mean pooling operation, the topic clue representation is obtained ;
[0013] S22: Content encoder based and question encoder The retriever DPR searches for sentiment responses in similar scenarios from the training set as prior knowledge clues , prior knowledge clues Each piece of knowledge in is averaged after the mean pooling operation to obtain the prior knowledge clue representation ;
[0014] S23: Set user-related and listener-related relationship sets , focus the relationship Relationship After being connected with the last sentence of the user in the historical conversation, it is input into the COMET model, and the hidden state of the last layer of the COMET model is used as the first Vector representation of the relationship, to obtain clues about the psychological state of the user and the listener , , Represents the total number of relations in the relation set;
[0015] S24: Send the emotional reason and the last sentence of the user in the historical conversation to the context encoder to obtain the emotional clues And dialogue clues , emotional cues And dialogue clues After performing mean pooling operations, we get the emotional clue representation. And the dialogue clues indicate ;
[0016] S3: Based on clues of the psychological state of the user and the listener , emotional clues And the dialogue clues indicate Constructing semantically enhanced hints , the semantic enhancement hint After being combined with historical conversations, it is used as the input of the reply generator module, and the reply generator module is used to enhance the semantics of the prompts. Encoding historical conversations to obtain clues about emotional support strategies , based on topic clues representation , dialogue clues , prior knowledge clue representation , clues to the psychological state of the user and the listener and clues to emotional support strategies Constructing semantic constraint hints , based on semantic constraint hints Guide the generation of emotionally supportive responses.
[0017] Furthermore, in step S3, generating an emotional support response is specifically as follows:
[0018] Coding Phase
[0019]
[0020]
[0021] in, For the connection operation, is a learnable linear mapping matrix, Indicates the first The user's psychological state clues are obtained by extracting relationships. Indicates the first The user's psychological state clues are obtained by extracting relationships. , represents the user's emotional process parameters, Multilayer Perceptron representing the encoder input port of the encoding stage;
[0022] Semantic enhancement hint Combined with historical conversations as input to the encoder ;
[0023]
[0024] in, For the encoder of Blender-Bot, is the start character, It is the separator between two sentences in the historical dialogue. It is the first in the historical dialogue Sentences;
[0025] according to The vector representation of the corresponding characters predicts the probability distribution of the emotional support strategy used:
[0026]
[0027] in, represents the probability distribution of emotional support strategies, is a multi-layer perceptron, For input middle The vector representation of the corresponding character;
[0028] Using a mixed strategy approach, based on the probability distribution of emotional support strategies , and obtain mixed strategies as clues to emotional support strategies :
[0029]
[0030] in is a trainable embedding layer that contains The vector representation of emotional support strategies, Represents the dimension of the embedding layer vector.
[0031] Furthermore, in step S3, generating an emotional support response is specifically as follows:
[0032] Decoding stage
[0033] Based on the topic clues , dialogue clues , prior knowledge clue representation , clues to the psychological state of the user and the listener and clues to emotional support strategies Constructing semantic constraint hints , semantic constraint hint The generation process is as follows:
[0034]
[0035]
[0036] in, For the connection operation, is a learnable linear mapping matrix, Indicates the first The listener's psychological state clues are extracted from the relationship. Indicates the first The listener's psychological state clues are extracted from the relationship. Indicates the first The listener's psychological state clues are extracted from the relationship. , Represents the listener's emotional process parameter Multilayer Perceptron for the decoder input port in the decoding stage;
[0037] Using semantic constraint hints To guide the generation of emotionally supportive responses:
[0038]
[0039] in, It is The probability distribution of the word at position , Represents a decoder, Is the start character of the reply. Is the reply The word in position, Is the reply The word in position, .
[0040] Furthermore, the cross entropy loss function is used to train the support strategy prediction of the sentiment model, and the negative logarithmic loss function is used to calculate the generated response of the sentiment model. The final loss function is as follows:
[0041]
[0042]
[0043]
[0044] in, is the length of the reply, is a historical dialogue, S is an emotional reason, Is the first in the reply words, It is the front of the reply words, It is an emotional support strategy adopted by real responses. is the probability distribution of emotional support strategies, and They are the loss for supporting policy prediction and the loss for generating responses, respectively. is the joint loss that needs to be minimized.
[0045] The advantages of the method for generating emotional support dialogue based on multi-cue prompt learning provided by the present invention are: the method for generating emotional support dialogue based on multi-cue prompt learning provided in the structure of the present invention extracts multi-perspective clues from the user's emotional reasons and the system's historical dialogue content, and defines them as semantic enhancement clues and semantic constraint clues according to their impact on the emotional support dialogue system. Subsequently, corresponding prompts are constructed based on these clues to induce the model to generate more attractive replies, thereby improving the diversity and accuracy of emotional replies. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 It is a schematic diagram of the structure flow of the present invention;
[0047] Figure 2 This is the training flow chart of the sentiment model;
[0048] Figure 3 A graph showing the effect of the length of the semantic enhancement cue on the performance of the sentiment model;
[0049] Figure 4 A graph showing the effect of the length of the semantic constraint hint on the performance of the sentiment model. DETAILED DESCRIPTION
[0050] Below, the technical solution of the present invention is described in detail through specific embodiments. Many specific details are set forth in the following description to facilitate a full understanding of the present invention. However, the present invention can be implemented in many other ways different from those described herein, and those skilled in the art can make similar improvements without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific implementation disclosed below.
[0051] like Figures 1 to 4 As shown, the present invention proposes a method for generating emotional support dialogue based on multi-cue prompt learning, which inputs the user's emotional reasons into the emotional model to obtain an emotional response result;
[0052] In this embodiment, the sentiment model consists of three modules: (1) the clue capture module extracts relevant clues from the historical conversation content, (2) the prompt constructor module constructs corresponding prompts according to different clues, including semantic enhancement prompts and semantic constraint prompts, and (3) the reply generator module understands the user's current situation and generates appropriate replies based on historical conversations and carefully constructed prompts.
[0053] The training process of the emotion model is as follows:
[0054] S1: constructing a training set, wherein the training set includes multiple groups of historical dialogues and emotional reasons corresponding to the multiple groups of historical dialogues, and inputting the historical dialogues and emotional reasons into the emotional model in sequence;
[0055] S2: Extract clues corresponding to historical conversations and emotional reasons based on the clue capture module;
[0056] S3: Based on clues of the psychological state of the user and the listener , emotional clues And the dialogue clues indicate Constructing semantically enhanced hints , the semantic enhancement hint After being combined with historical conversations, it is used as the input of the reply generator module, and the reply generator module is used to enhance the semantics of the prompts. Encoding historical conversations to obtain clues about emotional support strategies , based on topic clues representation , dialogue clues , prior knowledge clue representation , clues to the psychological state of the user and the listener and clues to emotional support strategies Constructing semantic constraint hints , based on semantic constraint hints Guide the generation of emotionally supportive responses.
[0057] The clue capture module, prompt builder module, and reply generator module are described below respectively.
[0058] (A) Clue Capture Module: Mainly used to extract the following clues;
[0059] (a1) Theme clues
[0060] First, use the Stanford CoreNLP toolkit, which is a set of natural language analysis tools written in Java.<NN.*|JJ> *<NN.*> Regular expressions are used to extract noun phrases in historical conversations and sentiment reasons as candidate words. Next, the point mutual information value between each candidate word and the user’s last sentence in the historical conversation is calculated. :
[0061]
[0062] in, Represents the last sentence of the user in the historical conversation. Represents candidate words, is the number of words in the user's last sentence, The last sentence of the user words, Indicates the candidate word and the first The probability of words appearing at the same time, represents the probability of the candidate word appearing, Indicates the last sentence of the user. The probability of a word appearing.
[0063] Point-to-point mutual information Arrange in descending order and select the mutual information values of the first K points Corresponding candidate words, use the GloVe model to obtain the word vector representation of these candidate words as the topic clues of this historical conversation ;
[0064]
[0065] in, Previously selected Candidate words.
[0066] (a2) Prior knowledge clues
[0067] In the emotional support dialogue system, the experience responses of similar scenes are of great reference significance for generating responses for the target dialogue. and question encoder ) Search for responses in similar scenarios from the training set as prior knowledge clues. Specifically, use the content encoder Get historical dialogue The vector representation of Get candidate responses in the training set The vector representation of the two is then calculated by the dot product of the two:
[0068]
[0069] in, For historical dialogue, The candidate replies in the training set are the actual replies corresponding to each set of historical dialogues and emotional reasons in the construction of the training set, which serve as the true reply labels for the sentiment model to optimize the sentiment model parameters through the cross entropy loss.
[0070] Arrange the similarities in descending order and finally select the one with the highest similarity. l (first in descending order) l The reply is used as the input of the context encoder, and the obtained vector representation is used as a prior knowledge clue ;
[0071]
[0072] in, The most similar l Replies, represents a context encoder.
[0073] (a3) Clues to the psychological state of users and listeners
[0074] The psychological state of the user and the listener plays a key role in the emotional support dialogue system. The psychological state of the user can help the emotional model understand their current situation, and the psychological state of the listener can imitate human-like behavior and guide the generation of the dialogue. The COMET model is used to extract the psychological state of the user and the listener, and it is used in the subsequent prompt builder module. The COMET model is a common sense knowledge reasoning model that can generate common sense knowledge hidden in an event, such as the reason why something happened; therefore, in this embodiment, the steps for extracting clues to the psychological state of the user and the listener are as follows:
[0075] Set up user-related and listener-related relationship sets , relationship set It can be set according to actual needs. For example, Represents one of the nine relationships, see Table 1 for detailed explanation. It is connected with the last sentence of the user in the historical conversation and fed into the COMET model. After that, the hidden state of the last layer of COMET is obtained as the vector representation of the jth relationship to obtain clues about the psychological state of the user and the listener. , , Represents the total number of relations in the relation set. In this embodiment :
[0076]
[0077] in, is the word sequence of the user's last sentence, It is kind of relationship.
[0078] Table 1 Nine relationships in the COMET model
[0079]
[0080] (a4) Other clues. The emotional reasons and the last sentence of the user in the historical conversation also need to be considered and sent to the context encoder to obtain their own clues, which are recorded as emotional clues. And dialogue clues ,In addition, the emotional support strategy (detailed in the ,Response Generator Module), which determines the helping skill used in generating ,responses, was also considered as an effective cue.
[0081] (B) Prompt Builder Module: used to construct prompts
[0082] Different clues play different roles in the emotion-supported dialogue system. For example, the user's mental state clues can reveal their current situation and help the system better understand the conversation; while the listener's mental state clues express the emotions and behaviors that need to be conveyed to the user, which in turn affects the content and style of the generated response. Based on this, clues from different sources are divided into two categories: semantic enhancement clues and semantic constraint clues, which are used to construct semantic enhancement prompts and semantic constraint prompts respectively.
[0083] Specifically, for emotional cues , use the mean pooling operation to get the emotional clue representation representing the entire sequence :
[0084]
[0085] in, Represents a mean pooling operation.
[0086] A conversation thread representing the user's last sentence The mean pooling operation is also used to obtain the corresponding dialogue clue representation .
[0087] Prior knowledge clues Each piece of knowledge in is represented by the mean operation. , the final mean represents the prior knowledge clue representation of the prior knowledge clue :
[0088]
[0089] in, l is the number of prior knowledge, It is the representation obtained by the mean pooling operation for each piece of prior knowledge.
[0090] As with prior knowledge clues, topic clues Use the mean operation to get the corresponding representation of the topic clues :
[0091]
[0092] in, is the number of candidate words in the topic clue, Representative The word vector representation of the candidate words.
[0093] Finally, according to the representations obtained from the above clues, semantic enhancement hints are constructed respectively. and semantic constraint hints :
[0094] Semantic enhancement hints The generation formula is as follows:
[0095]
[0096]
[0097] Semantic Constraint Hints The generation process is as follows:
[0098]
[0099]
[0100] in, For the connection operation, is a learnable linear mapping matrix, Indicates the first The user's psychological state clues are obtained by extracting relationships. Indicates the first The user's psychological state clues are obtained by extracting relationships. , Indicates the first The listener's psychological state clues are extracted from the relationship. Indicates the first The listener's psychological state clues are extracted from the relationship. Indicates the first The listener's psychological state clues are extracted from the relationship. , represents the user's emotional process parameters, represents the listener's emotional process parameter, and are the multilayer perceptrons with encoder input ports in the encoding phase and decoder input ports in the decoding phase, respectively. Indicates emotional support strategy cues representation.
[0101] For this embodiment, set Represents one of the nine relationships. Corresponding to Table 1, set relationships 1-6 as user psychological state clues, and set relationships 7, 8, and 9 as listener psychological state clues. and Corresponds to:
[0102]
[0103]
[0104] in, Represents 6 clues of user psychological state, They represent three clues of the listener's psychological state.
[0105] (C) Response generator module: used to generate sentiment responses
[0106] (c1) Encoding stage
[0107] Blender-Bot is used as the skeleton of the encoder in the reply generator module. In order to enhance the ability of the sentiment model to understand the conversation content, semantic enhancement prompts The generation process is as follows:
[0108]
[0109]
[0110] in, For the connection operation, is a learnable linear mapping matrix, Indicates the first The user's psychological state clues are obtained by extracting relationships. Indicates the first The user's psychological state clues are obtained by extracting relationships. , represents the user's emotional process parameters, Multilayer Perceptron representing the encoder input port of the encoding stage;
[0111] Semantic enhancement hint Combined with historical conversation content as the input of the encoder :
[0112]
[0113] in, For the encoder of Blender-Bot, is the start character, It is the separator between two sentences in the historical dialogue. It is the first in the historical dialogue sentence.
[0114] according to The vector representation of the corresponding characters predicts the probability distribution of the emotional support strategy used:
[0115]
[0116] in, represents the probability distribution of emotional support strategies, is a multi-layer perceptron, For input middle The vector representation of the corresponding character;
[0117] Using a mixed strategy approach, based on the probability distribution of emotional support strategies , and obtain mixed strategies as clues to emotional support strategies :
[0118]
[0119] in is a trainable embedding layer that contains The vector representation of emotional support strategies, Represents the dimension of the embedding layer vector.
[0120] (c2) Decoding stage
[0121] Semantic Constraint Hints The generation process is as follows:
[0122]
[0123]
[0124] in, For the connection operation, is a learnable linear mapping matrix, Indicates the first The listener's psychological state clues are extracted from the relationship. Indicates the first The listener's psychological state clues are extracted from the relationship. Indicates the first The listener's psychological state clues are extracted from the relationship. , Represents the listener's emotional process parameter Multilayer Perceptron for the decoder input port in the decoding stage;
[0125] Using semantic constraint hints To guide the generation of emotionally supportive responses:
[0126]
[0127] in, It is The probability distribution of the word at position , Represents a decoder, Is the start character of the reply. Is the reply The word in position, Is the reply The word in position, .
[0128] (D) Loss of sentiment model
[0129] The support strategy prediction of the sentiment model is trained using the cross entropy loss function, and the generated response of the sentiment model is calculated using the negative logarithmic loss function. The final loss function as follows:
[0130]
[0131]
[0132]
[0133] in, is the length of the reply, is a historical dialogue, S is an emotional reason, Is the first in the reply words, It is the front of the reply words, It is an emotional support strategy adopted by real responses. is the probability distribution of emotional support strategies, and They are the loss for supporting policy prediction and the loss for generating responses, respectively. is the joint loss that needs to be minimized.
[0134] Through (A) to (D), multi-perspective clues are extracted from the user's emotional reasons and the system's historical dialogue content, and they are defined as semantic enhancement clues and semantic constraint clues based on their impact on the emotional support dialogue system. Subsequently, corresponding prompts are constructed based on these clues to induce the model to generate more attractive responses, thereby improving the diversity and accuracy of emotional responses.
[0135] Compared with the traditional practice of ignoring some other clues, this embodiment takes into account topic clues, prior knowledge clues, user and listener psychological state clues, and emotional support strategies. This embodiment believes that different clues will have different effects on the ESC system. For example, clues related to the user's psychological state reveal their situation, which helps to understand the content of the conversation and the problems the user is currently facing. On the contrary, clues related to the listener's psychological state represent the emotions and behaviors to be conveyed to the user, thereby affecting the content and style of the generated reply, so that a more accurate reply is obtained based on the fusion of different clues.
[0136] (E) After the emotion model is trained and tested, in the actual execution process, the user's emotional reasons are input into the emotion model. The specific processing process of the emotion model is as follows:
[0137] 1) The system saves the previous input of each user and the previous response of the sentiment model as historical dialogue;
[0138] For example, the first time, the user inputs a sentence "Hello", and then the model replies "Hello!". The user says, "I feel unhappy." At this time, the system will save "Hello", "Hello", and "I feel unhappy" as the historical dialogue that needs to generate a reply next time. The same is true for the third round. In other words, when the model generates the next reply, it will use the previous user input and the previous reply generated by the model as the historical dialogue! )
[0139] 2) Extract clues corresponding to historical dialogues and emotional reasons
[0140] This step is the same as the emotion model training process S2.
[0141] 3) Construct semantic enhancement hints , the semantic enhancement hint After being combined with historical conversations, it is used as the input of the reply generator module, based on semantic constraint prompts guide the generation of emotionally supportive responses;
[0142] This step refers to the emotion model training process S3, except that this step does not involve the emotion model training adjustment process.
[0143] (F) Verify the effectiveness of the emotional support dialogue generation method
[0144] In the emotional support dialogue dataset ESConv (the construction of this dataset can refer to Siyang Liu, Chujie Zheng, Orianna Demasi, Sahand Sabour, Yu Li, Zhou Yu, Yong Jiang, and Minlie Huang. Towards emotional support dialog systems. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 3469–3483, 2021) (Siyang Liu, Chujie Zheng, Orianna Demasi, Sahand Sabour, Yu Li, Zhou Yu, Yong Jiang, and Minlie Huang, Towards an Emotion-Support Dialogue System. Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Vol. 1: Long Papers), pp. 3469–3483, 2021. The experimental results show that the emotion-support dialogue generation method of this embodiment can achieve satisfactory results in both automatic and manual evaluation indicators, proving the effectiveness of this embodiment.
[0145] Automatic evaluation: (1) Use the accuracy of the emotional support strategy ACC (Accuracy) as the evaluation indicator, which can reflect the model's ability to understand the conversation; (2) Use PPL, BLEU-n and ROUGE-L as evaluation indicators, which can measure the generation quality of the model. The evaluation indicator PPL is perplexity, which is used to measure the effect of the model in predicting text. Specifically, PPL reflects the average uncertainty of the model for the test data. The lower the PPL, the more accurate the model's prediction of the test data; the evaluation indicator BLEU-n measures the generation quality of the model based on precision, while the evaluation indicator ROUGE-L measures the generation quality of the model based on recall. B-1, B-2, B-3, and B-4 in the following Tables 2 to 4 correspond to the specific evaluation indicators when n1 in BLEU-n is 1, 2, 3, and 4, and RL corresponds to ROUGE-L; (3) Distinct-1 and Distinct-3 are used as evaluation indicators. These indicators can measure the diversity of responses generated by the model; the evaluation indicator Distinct-1 is a simple but effective indicator for measuring the diversity of generated text. It reflects the richness of the text by calculating the proportion of non-repeated words; the evaluation indicator Distinct-3 is a more advanced indicator for measuring the diversity of generated text. It reflects the richness of the text by calculating the proportion of non-repeated triplets. D-1 in the following Tables 2 to 4 corresponds to Distinct-1, and D-3 corresponds to Distinct-3.
[0146] Manual evaluation: In the manual evaluation stage, other methods are compared with the method proposed in this embodiment. Three experts with language and psychology backgrounds are hired to evaluate 100 randomly selected responses. The evaluators need to choose a winner or a tie. The evaluation includes the following five aspects: (1) Fluency: Which model generates more fluent responses? (2) Comprehension ability: Which model can more effectively understand your problem? (3) Comfort ability: Which model can comfort you more? (4) Suggestion ability: Which model can provide more effective suggestions? (5) Comprehensive ability: Overall, which model provides emotional support do you prefer?
[0147] Table 2 Automatic evaluation indicators
[0148]
[0149] As shown in Table 2, GPT-2, DialoGPT, BlenderBot, KEMI, MISC, and TransESC are all existing models, among which GPT-2 is a general natural language generation model, DialoGPT is optimized and trained specifically for the emotion support dialogue generation task based on GPT-2, BlenderBot is a dialogue model based on the Transformer architecture, KEMI (Knowledge-enhanced Mixed-initiative Dialogue System) is a dialogue model that integrates knowledge enhancement and mixed initiative analysis; MISC (MIxed Srategy-aware model integratingCOMET) is an emotion support dialogue model that integrates multiple emotion support strategies and uses COMET to infer the user's emotional state, and TransESC (TransESC: Smoothing Emotional Support Conversation via Turn-Level State Transition) is a fine-grained emotion support dialogue framework that includes three types of semantic conversion, strategy conversion, and emotion conversion.
[0150] It can be concluded from Table 2 that the method proposed in this embodiment achieves the best results in almost all automatic evaluation indicators. The high accuracy of the prediction of the emotional support strategy proves the excellent performance of the emotional model in understanding the user's current situation. The optimal results on the BLEU-n and ROUGE-L indicators show that the emotional model can generate high-quality replies, and the improvement on the Distinct-n indicator proves that the emotional model can generate more diverse replies. These improvements show that the emotional model of this embodiment can make full use of multi-perspective clues to enhance the competitiveness of the model.
[0151] Table 3 Manual evaluation indicators
[0152]
[0153] The manual evaluation results in Table 3 are consistent with the automatic evaluation results. The method of this embodiment showed satisfactory results in almost all aspects. Specifically, the method of this embodiment achieved a huge improvement in fluency, which may be attributed to the capabilities of the Blender-Bot model and the use of adaptive prompts. As for the improvement in comfort ability, understanding ability and suggestion ability, as well as comprehensive ability, it benefited from the reasonable use of multiple clues, thereby enhancing the model's understanding ability and emotional support response ability.
[0154] (G) Effect of cue length on sentiment model performance
[0155] In prompt learning, a suitable prompt is of great significance to the improvement of model performance. Based on this, through experiments, the most reasonable prompt length is selected as the hyperparameter of the emotion model of this embodiment. The experimental results are as follows: Figure 3 and 4 shown.
[0156] like Figure 3 The effect of the length of the semantic enhancement prompt on the performance of the sentiment model is described when the length of the semantic constraint prompt is fixed at 20. It can be seen that when the length of the semantic enhancement prompt is 20, the sentiment model achieves the best results in terms of RL and D-2 indicators. Figure 4 The effect of the length of the semantic constraint cue on the performance of the sentiment model is described when the length of the semantic enhancement cue is 20. Similarly, when the length of the semantic constraint cue is 20, both RL and D-2 achieve the best results. Therefore, during the experiment, the lengths of both are set to 20 as the hyperparameters of the sentiment model, which ultimately produces satisfactory results.
[0157] In order to verify the role of each module of the model, an ablation experiment was carried out. The experimental results are shown in Table 4.
[0158] Table 4 Ablation experiment
[0159]
[0160] It can be seen from Table 4 that whether the cues (listener status cues, topic cues, prior knowledge cues) or the prompts (semantic enhancement prompts, semantic constraint prompts) are deleted, the performance of the emotion model of this embodiment is greatly reduced. Therefore, each module of the emotion model of this embodiment plays a vital role in the performance of the entire emotion model.
[0161] As an example:
[0162]
[0163] First, key clues are extracted from emotional reasons and historical conversations, such as topic clues (friends, charities, Christmas, presidents...), user psychological state clues (users feel guilty and want to feel better), listeners' psychological state clues (listeners feel angry and hope he can feel better), prior knowledge clues (there is no need to feel ashamed because you didn't do as well as you hoped.), etc. These clues are then divided into semantic enhancement clues (user psychological state clues, etc.) and semantic constraint clues (listener psychological state clues, prior knowledge clues, etc.), and semantic enhancement prompts and semantic constraint prompts are constructed respectively. Finally, the semantic enhancement prompts are applied to the encoder part of the emotion model to enhance the understanding ability of the emotion model. The semantic constraint prompts are applied to the decoder part of the emotion model to induce the emotion model to generate relevant responses with emotional support capabilities.
[0164] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical scheme and inventive concept of the present invention within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.
Claims
1. A method for generating emotional support dialogue based on multi-cue prompt learning, characterized in that: Input the user's emotional reasons into the emotional model to obtain the emotional response result; The training process of the emotion model is as follows: S1: constructing a training set, wherein the training set includes multiple groups of historical dialogues and emotional reasons corresponding to the multiple groups of historical dialogues, and inputting the historical dialogues and emotional reasons into the emotional model in sequence; S2: Extract clues corresponding to historical dialogues and emotional reasons; S21: Extract noun phrases in historical conversations and sentiment reasons as candidate words, and calculate the point mutual information value between each candidate word and the user’s last sentence in the historical conversation , and the point mutual information value Arrange in descending order and select the mutual information values of the first K points The corresponding candidate words serve as the theme clues of this historical dialogue , for the topic clues After the mean pooling operation, the topic clue representation is obtained ; S22: Content encoder based and question encoder The retriever DPR searches for sentiment responses in similar scenarios from the training set as prior knowledge clues , prior knowledge clues Each piece of knowledge in is averaged after the mean pooling operation to obtain the prior knowledge clue representation ; S23: Set user-related and listener-related relationship sets , focus the relationship Relationship After being connected with the last sentence of the user in the historical conversation, it is input into the COMET model, and the hidden state of the last layer of the COMET model is used as the first Vector representation of the relationship, to obtain clues about the psychological state of the user and the listener , , Represents the total number of relations in the relation set; S24: Send the emotional reason and the last sentence of the user in the historical conversation to the context encoder to obtain the emotional clues And dialogue clues , emotional cues And dialogue clues After performing mean pooling operations, we get the emotional clue representation. And the dialogue clues indicate ; S3: Based on clues of the psychological state of the user and the listener , emotional clues And the dialogue clues indicate Constructing semantically enhanced hints , the semantic enhancement hint After being combined with historical conversations, it is used as the input of the reply generator module, and the reply generator module is used to enhance the semantics of the prompts. Encoding historical conversations to obtain clues about emotional support strategies , based on topic clues representation , dialogue clues , prior knowledge clue representation , clues to the psychological state of the user and the listener and clues to emotional support strategies Constructing semantic constraint hints , based on semantic constraint hints The generation of emotional support replies is guided, and the emotional model is trained and adjusted based on the generated emotional support replies until the emotional model converges.
2. The method for generating emotional support dialogue based on multi-cue prompt learning according to claim 1, characterized in that: In step S3, the emotional support response is generated as follows: Coding Phase Semantic enhancement hints The generation process is as follows: in, For the connection operation, is a learnable linear mapping matrix, Indicates the first The user's psychological state clues are obtained by extracting the relationship. Indicates the first The user's psychological state clues are obtained by extracting the relationship. , represents the user's emotional process parameters, Multilayer Perceptron representing the encoder input port of the encoding stage; Semantic enhancement hint Combined with historical conversations as input to the encoder ; in, For the encoder of Blender-Bot, is the start character, It is the separator between two sentences in the historical dialogue. It is the first in the historical dialogue Sentences; according to The vector representation of the corresponding characters predicts the probability distribution of the emotional support strategy used: in, represents the probability distribution of emotional support strategies, is a multi-layer perceptron, For input middle The vector representation of the corresponding character; Using a mixed strategy approach, based on the probability distribution of emotional support strategies , and obtain mixed strategies as clues to emotional support strategies : in is a trainable embedding layer that contains The vector representation of emotional support strategies, Represents the dimension of the embedding layer vector.
3. The method for generating emotional support dialogue based on multi-cue prompt learning according to claim 1, characterized in that: In step S3, the emotional support response is generated as follows: Decoding stage Semantic Constraint Hints The generation process is as follows: in, For the connection operation, is a learnable linear mapping matrix, Indicates the first The listener's psychological state clues are extracted from the relationship. Indicates the first The listener's psychological state clues are extracted from the relationship. Indicates the first The listener's psychological state clues are extracted from the relationship. , Represents the listener's emotional process parameter Multilayer Perceptron for the decoder input port in the decoding stage; Using semantic constraint hints To guide the generation of emotionally supportive responses: in, It is The probability distribution of the word at position , Represents a decoder, Is the start character of the reply. Is the reply The word in position, Is the reply The word in position, .
4. The method for generating emotional support dialogue based on multi-cue prompt learning according to claim 1, characterized in that: The support strategy prediction of the sentiment model is trained using the cross entropy loss function, and the generated response of the sentiment model is calculated using the negative logarithmic loss function. The final loss function as follows: in, is the length of the reply, is a historical dialogue, S is an emotional reason, Is the first in the reply words, It is the front of the reply words, is an emotional support strategy adopted by real responses. is the probability distribution of emotional support strategies, and are the loss of supporting policy prediction and the loss of generating responses, is the joint loss that needs to be minimized.
Citation Information
Cited By
Psychological state authenticity detection and intervention system based on EEG and psychological orthogonal basis group mapping
CN122392952A
