Emp-RFT: Empathetic Response Generation via Recognizing Feature Transitions between Utterances
Abstract
Each utterance in multi-turn empathetic dialogues has features such as emotion, keywords, and utterance-level meaning.
Feature transitions between utterances occur naturally.
However, existing approaches fail to perceive the transitions because they extract features for the context at the coarse-grained level.
To solve the above issue, we propose a novel approach of recognizing feature transitions between utterances, which helps understand the dialogue flow and better grasp the features of utterance that needs attention.
Also, we introduce a response generation strategy to help focus on emotion and keywords related to appropriate features when generating responses.
Experimental results show that our approach outperforms baselines and especially, achieves significant improvements on multi-turn dialogues.
Introduction
Humans have empathy which is the ability to understand situations others have experienced and emotions they have felt from the situations (Eisenberg and Strayer, 1987).
That ability also enables to interest and console others while sharing a conversation.
Thus, empathetic response generation task has been considered noteworthy.
Figure 1 shows an example of a multi-turn empathetic dialogue dataset,
EmpatheticDialogues (Rashkin et al., 2019) constructed to solve the task.
A speaker talks about one of 32 emotion labels and a situation related to the emotion label and a listener empathizes, responding to the speaker.
Existing approaches (Rashkin et al., 2019; Lin et al., 2019; Majumder et al., 2020; Li et al., 2020; Kim et al., 2021) for the task achieve promising results but show limitations when dialogues become long because they extract features from the concatenation of all tokens in the context at the coarse-grained level.
However, at the fine-grained level, each utterance in multi-turn empathetic dialogues has features such as emotion, keywords that each denote
[Table]
[Figure]
what an interlocutor feels and primarily says, and utterance-level meaning that can be known when looking at the entire utterance.
In addition, it is a natural phenomenon that features of each utterance differ from the previous, as the dialogue is prolonged.
Hence, we humans instinctively recognize these feature transitions, which helps us understand how the dialogue flows and grasp the features of utterance that needs attention.
Also, humans respond to others, focusing on emotion and keywords related to appropriate features.
Take the example in
Figure 1.
In the first turn, the speaker is excited to see the speaker’s sister in a long time by mentioning keywords (e.g., ‘sister’, ‘visit’, ‘decade’), and the listener reacts to the excitement and asks about her by mentioning keywords (e.g., ‘exciting’, ‘see’, ‘live’).
However, in the second speaker utterance, the speaker becomes embarrassed because of the speaker’s boyfriend’s bad table manners by mentioning keywords (e.g., ‘boyfriend’, ‘loud’, ‘eater’).
We humans recognize that the features of second speaker utterance have changed compared to those of previous utterances, and usually decide to be attentive to the features of the second utterance.
Then, by focusing on information such as keywords of that utterance and emotion and keywords (e.g., ‘bad’, ‘impression’) related to the features of that utterance, humans generate empathetic, coherent, and non-generic responses like response A.
However, the model which produces non-empathetic and incoherent response like response B, considers that the features of the first speaker utterance represent the context from the coarse-grained view.
In this paper, we first propose to annotate features on each utterance at the fine-grained level (§4).
Then, we introduce a novel Emp athetic response generator based on R ecognizing F eature
T ransitions (Emp-RFT), which has two essential parts: Feature Transition Recognizer and Response
Generation Strategy.
The first part recognizes feature transitions between utterances, utilizing comparison functions of Wang and Jiang (2017), which makes Emp-RFT understand the dialogue flow and grasp appropriate features of utterance that needs attention.
The second part helps EmpRFT focus on emotion and keywords related to appropriate features.
Specifically, by fusing context with keywords, such keywords are emphasized within each utterance and get more attention when generating responses.
Then, Emp-RFT detects next emotion and keywords that denote emotion and keywords of the response, which helps figure out proper emotion and keywords for generation.
Lastly, inspired by Dathathri et al.
; Chen et al.
(2020), a new mechanism of Plug and Play
Language Model(PPLM), contrastive PPLM using contrastive loss, is introduced, which controls EmpRFT to actively use the keywords detected to be next keywords when generating responses.
We conduct experiments on EmpatheticDialogues.
Emp-RFT outperforms strong baselines, particularly, when dialogues are multi-turn.
Our main contributions are as follows.
(1) We introduce a novel approach that recognizes feature transitions between utterances, which results in understanding how the dialogue flows and grasping the features of utterance that the model should be attentive to.
(2) We propose a response generation strategy including fusing context with keywords, next emotion and keywords detection, and contrastive PPLM.
The strategy makes our model focus on emotion and keywords related to appropriate features when generating responses.
In the experiments, Emp-RFT outperforms baselines, especially, when dialogues are prolonged.
Related Work
Since Rashkin et al.
(2019) release EmpatheticDialogues, many approaches have been proposed to generate empathetic responses.
Lin et al.
(2019) propose mixture of emotional experts.
Majumder et al.
(2020) propose emotion grouping, emotion mimicry, and stochastic sampling.
Li et al.
(2020) extract emotional words through lexicon and propose an adversarial generative model.
Shen et al.
(2021) apply dual-learning with unpaired data for the bidirectional empathy.
Gao et al.
(2021) integrate emotion cause into response generation process through gated mechanism.
Sabour et al.
; Li et al.
(2022) use implicit commonsense for context modelling.
Kim et al.
(2021) train a model to extract words that cause the speaker’s emotion and attach RSA Framework (Frank and
Goodman, 2012) to any generative models to generate responses, focusing on emotion cause words.
Recently, many studies have shown remarkable improvements through recognizing transitions of features between utterances in open-domain multiturn dialogues.
Qiu et al.
(2020) perceive transitions of emotion states for context modelling.
Zou et al.
(2021) propose a module to manage keyword transitions.
Zhan et al.
(2021) model external knowledge transitions to select a knowledge used for generation.
In multi-turn empathetic dialogues, we consider emotions, keywords, and utterancelevel meaning (Gu et al., 2021) as important features of each utterance and propose a novel approach of recognizing feature transitions between utterances.
Task Formulation
Given context con =
[ u 1 , . . . ,
u n − 1 ] , where an utterance u i =
[ u i 1 , . .
, u i | u i | ] consists of | u i | words, we can obtain e =
[ e 1 , . .
, e n − 1 ] and k =
[ k 1 , ..., k n − 1 ] , where e i and k i =
[ k i 1 , ..., k i | k
i | ] each denote emotion and | k i | keywords of u i through data preparation (§4).
To conduct next keywords detection, we construct keyword pairs kps (§4.2) whose each pair has two keywords each from keywords of the speaker utterance and keywords of the listener utterance in the same turn.
Finally, given con, e, k , and kps , we detect next emotion
e y and next keywords
k y =
[ k y 1 , . . .
, k y | k y | ] , and generate an empathetic response y =
[ y 1 , . . .
, y m ] .
Data Preparataion
In this section, we introduce feature annotation in the speaker and listener utterances.
[Table]
4. Feature Annotation in Speaker Utterances Emotion and Keywords of Speaker Utterance
(EofSU/KofSU).
Speakers try to say an emotional experience that causes a certain emotion in the utterance.
Thus, we leverage a model (Kim et al., 2021) which is trained to jointly detect an emotion and emotion cause words of the speaker utterance, using EmpatheticDialogues.
We regard top-6 emotion cause words as keywords and remove stopwords and punctuations in keywords.
4. Feature Annotation in Listener Utterances
Emotion of Listener Utterance (EofLU).
We finetune RoBERTa
(Liu et al., 2019) to detect an emotion given a situation description in EmpatheticDialogues.
Then, the model predicts an emotion of the listener utterance.
Keywords
of Listener Utterance (KofLU).
Listeners express empathy in the utterance through three Communication Mechanisms (CMs) (Sharma et al., 2020) including emotional reaction, interpretation, and exploration.
Thus, three models are leveraged, where each model is trained to detect words that cause one of three CMs, using another dialogue dataset for mental health support 1 .
Then, three models predict such words in the listener utterance.
Since predicted words take up slightly a lot in the listener utterance, these words are filtered out in the keyword pairs construction.
Keyword Pairs Construction.
Inspired by Zou et al.
(2021), keyword pairs kps are constructed not only to filter out above predicted words, but also to conduct next keyword detection.
Given a dialogue
[Figure]
corpus, all pairs are extracted, where each pair has a head word and a tail word each from keywords in the speaker utterance and predicted words in the listener utterance in the same turn.
Then, all pairs are filtered out to obtain high-frequency pairs through pointwise mutual information (PMI) 2 (Church and
Hanks, 1990) which can measure the association between two words in a corpus.
Filtered pairs become kps .
A tail word of a kp is regarded as a keyword of the listener utterances joined to extract that keyword pair.
Performances of feature annotations are summarized in Table 1 and show reliable results.
However, test sets for KofLU based on EmpatheticDialogues, don’t exist.
Thus, we randomly sample 100 test dialogues in EmpatheticDialogues and ask 3 human workers to annotate whether each word plays important role for empathizing in the listener utterances.
By majority voting, the final verdict on each annotation is decided.
We compute the inter-annotator agreement on annotation of test sets for KofLU through Fleiss’ kappa ( κ ) (Fleiss and Cohen, 1973), and result in 0.55, where 0 .
4 < κ < 0 .
6 indicates moderate agreement.
The Emp-RFT Model
In this section, we detail Emp-RFT whose overall architecture is shown in Figure 2.
5. Context Encoding
Word-Level Encoder.
Emp-RFT contains an encoder f θ ( · ) which has the six-layer encoder of
BART (Lewis et al., 2020) as the backbone and extracts feature vectors of each u i .
Inspired by BERT (Devlin et al., 2019), we prefix each utterance with a [ SEN ] token, so u i
=
[ SEN ] .
Then, each token is represented as emb ij , the sum of the following four embeddings: word embedding, position embedding, role embedding and emotion embedding
M e ∈ R n emo × d 3 .
Then, the encoder transforms each utterance into a list of output hidden states:
[Equation]
where ˆ h ij ∈ R d .
For each utterance, we can obtain utterance-level
meaning vector
ˆ h i 0 derived from the token [ SEN ] , concatenated keyword vectors ˆ k i ∈ R
| k i |× d derived from the tokens corresponding to k ip ( p is the index for keywords.), and emotion vector
ˆ e i =
M e ˆ h
i 0 .
Feature Transition Recognizer.
Emp-RFT has a component that operates as the process illustrated in Figure 3.
The component computes feature transition information between feature vectors, utilizing two comparison functions, subtraction and multiplication of Wang and Jiang (2017).
Each feature vector is compared to previous two feature vectors 4 .
First, emotion transition information eti i is computed:
[Equation]
where f com and ⊙ each denote our transition information computing function and Hadamar product, and
W eti ∈ R
d × 4 n emo .
Next, utterance-level meaning transition information uti i is computed: uti
[Equation]
ReLU [Equation] h
[Equation] [Equation] ) where W uti ∈ R d × 4 d .
We then obtain enhanced utterance vector of each utterance by integrating utterance-level meaning vector, and emotion and utterance-level meaning transition information:
[Equation]
where F C utt is a fully-connected layer with size of d .
In addition, keyword transition information
… … h 0 i h 0 i !"
h 0 i !
# $ e i !
A L i n ea r L a y e r w it
h R e L
U uti
i
F u ll yC onn ec t e d
L a y e r hi fcom
A Linear Layer with ReLU
Fully-Connected Layer
A L i n ea r L a y e r w it
h R e L
U Enhancing keyword vectors : Concatenation ei !"
ei eti i # ki !
$ # ki !"
# ki % kpi …
Cross Encoding ki ci !"
ci !
# ktii kti i is computed between concatenated keyword vectors and cross-encoded vectors c t , where t ∈ { i − 1 , i − 2 } : kti
[Equation]
= ReLU( W
[Equation]
( f [Equation] [Equation] k
[Equation]
c
[Equation] c [Equation] − 2 )) T ) , (6) c t = softmax
[Equation]
where W kti ∈ R d × 4 d , W Q and W K ∈ R d × d .
We can obtain enhanced keyword vector of each keyword by integrating keyword vector, and keyword transition information:
[Equation]
where F C key is a fully-connected layer with size of d .
Consequently, the enhanced feature vectors guide Emp-RFT to accurately grasp the features of utterance that the model should be attentive to when given feature transition information.
Utterance-Level Encoder.
Emp-RFT contains another encoder g ϕ ( · ) which has the six-layer encoder of BART, and transforms enhanced utterance vectors with global position embeddings (GPE) into a context representation to capture relationships between utterances (Gu et al., 2021):
[Equation]
Emp-RFT consists of hierarchical structures of encoders through word-level and utterance-level encoders.
This structure makes Emp-RFT comprehend each utterance at the fine-grained level, and understand the context by integrating information based on comprehension of each utterance.
Fusing Context with Keywords.
Emp-RFT fuses context with keywords as the process illustrated in Figure 4.
We first dynamically build keyword graph for each context.
Keywords in each context become nodes and are initialized by corresponding enhanced keyword vectors with GPE.
Edges are built across the below cases: (1) between two keywords from the same utterance and (2) between a keyword from a certain utterance and another keyword from the previous two utterances.
Also, a tail word in a kp whose head word is k n − 1 p is appended as a node and connected with k n − 1 p node.
Appended nodes ( ANs ) are initialized through BART decoder whose parameters are frozen with GPE, and used for next keywords detection.
To obtain keyword representation ˆ v io from the keyword graph( o is the index for nodes.), nodes are updated based on multi-head graph-attention mechanism (Veliˇckovi´c et al., 2018; Li et al., 2022).
This mechanism makes Emp-RFT not only capture relationships between nodes but also manage influences of each appended node through attention architecture:
[Equation]
where v io , ∥ , A io , and α i,mhoz each denote a node representation, the concatenation of MH attention heads, the neighbours of v io in the adjacency matrix A , and self-attention weight and W mhv ,
[Equation]
d/MH ).
Lastly, we can obtain the fused context representation
H =
[ h 1 , ..., h n − 1 ] by fusing the context representation with the sum of keyword representations:
[Equation] [Equation]
where F C fuse is a fully-connected layer with size of d .
Consequently, keywords are emphasized within each utterance and get greater attention when generating responses.
Next Emotion and Keywords Detection.
EmpRFT detects next emotion
e y and keywords k y , which helps figure out proper emotion and keywords for generation.
First, based on the maxpooled fused context representation, next emotion
[Figure]
Attention Network
[Figure]
Representation
[Figure]
distribution is predicted:
[Equation]
where MP denotes maxpooling.
We use the emotion with the highest probability ( ˆ e y ) for generation.
Also, Emp-RFT predicts whether the word of each
AN belongs to the next keywords through the binary classification, where the true label denotes the word belongs to:
[Equation]
where W AN ∈ R 2 × 2 d .
We consider the words of
ANs whose probabilities for the true label ≥ 0 .as
the keywords ( ˆ k y ) for generation.
5. Response Generation
Response Generator.
Emp-RFT includes a response generator (RG) which has the six-layer decoder of BART as the backbone.
Through the four embeddings with ˆ e y , explained previously, we can obtain the input sequence embedding for RG.
We prefix it with the sum of node representations corresponding to ˆ k y .
Then, RG is fed to predict probability distribution on each next token y t based on the fused context representation:
[Equation]
Training.
We apply cross-entropy loss to three objectives (eq. 14, 15, 16), and train parameters of
Emp-RFT in end-to-end manner through the sum of all losses .
Contrastive PPLM.
Analysis on the generated responses of the trained Emp-RFT shows that an active reflection of ˆ k y is demanded.
Thus, inspired by
Dathathri et al.
; Chen et al.
, we propose Contrastive PPLM with a discriminator using contrastive loss.
Existing discriminators (Dathathri et al., 2020; Majumder et al., 2021) are trained to predict whether a sentence contains a certain attribute, using cross-entropy loss.
Then, the gradient of the loss is passed to the generative model to generate a sentence containing such attribute during inference.
However, since keywords are not attributes but objects, we train a discriminator to predict whether a response in EmpatheticDialogues is more similar to the keyword set of the response(positive sample) than the keyword sets of another responses(negative samples) in the same batch, using contrastive loss based on the similarity between objects:
[Equation]
where r , ks , τ and B each denote response and keyword set representations, a temperature parameter and batchsize.
During inference, we repeatedly sample three random ANs except for nodes of ˆ k y , and consider the sum of such AN representations as one of negative samples and the sum of node representations corresponding to ˆ k y as a positive sample.
Then, the gradient of the contrastive loss is passed to Emp-RFT.
Experiments 6. Dataset and Baselines
Dataset.
Experiments were conducted on EmpatheticDialogues (Rashkin et al., 2019) which contains 24,850 multi-turn dialogues.
For each dialogue, we can extract a certain number of instances corresponding to the number of turns within the dialogue.
This totals to 47,611 instances, where 22,761 are multi-turn.
In one turn of a dialogue, a speaker talks about one of 32 evenly distributed emotion labels and a situation related to the emotion label and a listener empathizes by responding to the speaker.
Following the instructions of the dataset, we use 8:1:1 train/valid/test split.
Baselines.
We compared Emp-RFT to the following five baseline models: (1) MoEL (Lin et al., 2019) is a transformer-based generative model, which has decoders for each emotion and integrates outputs of the decoders according to predicted emotion distribution.
(2) EmpDG (Li et al., 2020) uses emotional words and consists of an adversarial framework including a generator and discriminators which reflect the user feedback.
(3) MIME (Majumder et al., 2020) is also a transformer-based generative model which mimics user emotion based on emotion grouping and uses stochastic sampling for varied responses.
(4) MIME+Focused S1 and (5) Blender+Focused S1 (Kim et al., 2021) attach
RSA Framework to MIME and Blender (Roller et al., 2021).
Blender is a pretrained model with 90M parameters size, using an immense number of dialogues.
It is finetuned on EmpatheticDialogues.
Using distractors and Bayes’ Rules, RSA Framework makes the models focus on certain parts of the post, such as emotion cause words when generating responses in the single-turn dialogues 5 .
Implementation details about Emp-RFT and baselines are covered in Appendix A.1.
6. Evaluation Metrics
Automatic Evaluation.
We evaluated the models, using the following three metrics: (1) Perplexity ( PPL ) (Vinyals and Le, 2015) measures how highly likely tokens are generated, which evaluates the overall quality of the model.
(2) Distinct-n ( Dist-n ) (Li et al., 2016) measures how diverse the generated response is via the unique words within its n-gram.
We use BERTscore ( F BERT ) (Zhang et al., 2019) which measures token-level semantic similarities between the generated response and the gold response based on embeddings from BERT (Devlin et al., 2019).
Human Ratings.
Human evaluations for the dialogues models are essential because of insufficient reliability on automatic metrics.
We randomly sampled 100 test dialogues and asked 3 human workers to score models’ generated responses on 1 topoint scale, following the four metrics (Rashkin et al., 2019): (1) Empathy measures whether the generated response understands the speaker’s emotion and situation.
(2) Relevance measures whether the generated response is coherent to the context.
(3) Fluency measures whether the generated response is grammatically correct and readable.
Since we conclude that models generating generic responses are not empathizing to the speaker, we
[Table] [Table]
use Diversity to measure whether the generated response is non-generic.
Human A/B Test.
We further conducted a human A/B test which provides stronger intuitions and higher agreements than human ratings, because this is carried with 3 human workers selecting the better response when given two generated responses (Sabour et al., 2021).
6. Analysis of Response Generation
We abbreviate feature transition recognizer, contrastive PPLM, next emotion and keywords detection, and fusing context with keywords as FTR, CP,
NEKD, and FCK, respectively.
Automatic Evaluation Results.
The overall automatic evaluation results are shown in the left part of Table 2.
Emp-RFT performed exceedingly on all metrics except for PPL, which was nearly the same as Blender+Focused S1.
The improvements on other metrics indicated that our approach was effective for generating generally high quality and non-generic responses which were also semantically similar with the gold response.
While the utilization of pretrained models yielded significant improvements compared to models only trained on EmpatheticDialogues, EmpRFT showed even greater performance when compared to Blender+Focused S1 endowed with more significant number of dialogues.
In addition, due to utilization of FTR, Emp-RFT obtained remarkable results even on multi-turn instances, whereas, other models suffered due to their means of utilizing features for the context at the coarse-grained level.
Human Evaluation Results.
In the right part of Table 2, Emp-RFT acquired the highest scores on all metrics, which demonstrated that all components of Emp-RFT helped generate responses that are empathetic, coherent to the context, and non-generic.
Also, utilizing pretrained models showed significant improvements, especially on
Fluency and Diversity scores.
In Table 3, the generated responses from Emp-RFT were more preferred, which indicated Emp-RFT consistently outperformed other methods in various experiments.
When observing at the models’ performance difference between multi-turn instances and all instances, only Emp-RFT continued to perform consistently, whereas other models showed significant perfor-
[Table]
in mance drops under multi-turn instances.
From this, we concluded that Emp-RFT continuously understood the dialogue flow.
Ablation Study.
To better understand effects of each component in Emp-RFT, we conducted the ablation study.
We gradually ablated each component within the response generation strategy in a hierarchical manner.
(1) w/o FTR :
Feature transition recognizer was disabled, which resulted in considerable drops on all metrics, especially on
PPL, F BERT , Empathy, and Relevance scores on multi-turn instances, because Emp-RFT could not grasp the attention-needed features of utterance within multi-turn instances through FTR.
(2) w/o
CP : Contrastive PPLM was removed, which caused lower Dist-n and Diversity scores, because EmpRFT could not actively use various ˆ k y when generating responses through CP.
(3) w/o (CP+NEKD) :
Next emotion and keywords detection were disabled, which interfered with Emp-RFT’s utilization of the next emotion and keyword.
It droped not only Dist-n and Diversity scores but also other metrics.
(4) w/o (CP+NEKD+FCK) : Fusing the context representation with keyword representations was disregarded.
Since keywords were no longer emphasized for context modelling, such information could not get more attention when generating responses.
It caused drops on all metrics, particularly on F BERT , Dist-n, and Diversity.
6. Analysis of Next Emotion and Keywords
We report the results in terms of NEKD in Table 4.
Since all baselines have not conducted NEKD, we trained models showing promising results such as CoMAE (Zheng et al., 2021), ConceptFlow (Zhang et al., 2020) and CG-nAR (Zou et al., 2021) with EmpatheticDialogues.
(More details are covered in Appendix A.2).
Then, we compared EmpRFT to those models.
Emp-RFT outperformed other models on all metrics, which proved EmpRFT figured out which emotion and keywords were proper for generation.
[Table]
6. Case Study
The cases from the models are shown in Table 5.
In the first case, MoEL and MIME expressed regret, which was emotionally inappropriate to the context.
All baselines except for MoEL failed to grasp the proper features within the context, and therefore generated incoherent responses.
Especially,
Blender+Focused S1 ignored the features of u 3 .
Since Emp-RFT understood the dialogue flow, it became attentive to not only the features of u 3 but also those of u 1 , u 2 , mentioning (‘procrastinate’, ‘foods’, ‘safety’), which led to empathy and coherence.
In the second case, all baselines couldn’t understand the longer context, which resulted in im- proper empathy.
Also, Blender+Focused S1 disregarded the features of u 5 , and therefore overlooked the speaker’s sadness.
Emp-RFT fully comprehended why the speaker’s happiness changed to the sadness.
In both cases, without FTR, the responses of Emp-RFT were non-empathetic and incoherent because of dismissing appropriate features.
In the third case, we report the case in terms of the response generation strategy.
Without CP, NEKD, and FCK, Emp-RFT produced a generic response.
With the utilization of FCK, Emp-RFT perceived the word ‘cancer’ in u 3 but expressed excessive emotion by mentioning ‘scary’.
When Emp-RFT additionally conducted NEKD, Emp-RFT generated emotionally appropriate responses by mentioning ‘sorry’ and ‘hard’, and utilized the keyword ‘lost’.
Lastly, with CP, Emp-RFT generated a diverse response, actively using ˆ k y .
Conclusion
We proposed a novel approach that recognizes feature transitions between utterances, which led to understanding the dialogue flow and grasping the features of utterance that needs attention.
Also, to make our model focus on emotion and keywords related to appropriate features, we introduced a response generation strategy including fusing context with keywords, next emotion and keywords detection, and contrastive PPLM.
Experimental results showed that our model outperformed baselines, and especially, achieved significant improvements on multi-turn instances, which proved our approach was effective for empathetic, coherent, and nongeneric response generation.
Ethical Considerations
We expect that our proposed approach does not suffer from ethical problems.
The dataset we use in our work is EmpatheticDialogues which is Englishbased.
The dataset is constructed by crowdsourcing with Amazon Mechanical Turk, which protects private user information (Rashkin et al., 2019).
In addition, the dialogue dataset is anticipated not to have responses which include discrimination, abuse, bias, etc, because the robust collection procedure of EmpatheticDialogues ensures the quality of the dataset.
Thus, we expect that models trained using the dataset, do not generate inappropriate responses which harm the users.
However, we inform that our model utilizes a pretrained language model, which may produce inappropriate responses.
Lastly, we anticipate our model make potential users be interested and consoled by generating empathetic responses.
Acknowledgements
We thank all anonymous reviewers for their meaningful comments and Hyungjoon Yang, Chanhee Lee and Sunwoo Kang of Yonsei University for their discussion and feedback about our work.
This work was supported by the National Research Foundation of Korea(NRF) grant funded by the Korea government(MSIP; Ministry of Science, ICT & Future Planning)
(No. NRF2022R1A2B5B01001835).
Also, this work was partly supported by the Institute of Information and
Communications Technology Planning and Evaluation(IITP) grant funded by the Korean government(MSIT)
(No. 2020-0-01361-003, Artificial
Intelligence Graduate School Program (Yonsei University)).
Kyong-Ho Lee is the corresponding author.
A Implementation Details A. Empathetic Response Generation Models
We use the official codes of all baselines, and follow the implementations (MoEL 6 , EmpDG 7 , MIME 8 , MIME+Focused S1 and Blender Focused S1 9 ).
Our model is implemented by Pytorch 10 , and based on two encoders of BART-base and a decoder of
BART-base 11 .
Hidden size d is 768 and the number of emotion classes n emo is 32.
MH and the number of layers of graph attention network are each 4.
Using Adam optimization (Kingma and Ba, 2015), our model is trained on single RTX 3090 GPU with a batch size of 4.
We apply early-stopping and select a model showing the best performance through perplexity on the valid set.
For contrastive PPLM, we utilize the official code of PPLM 12 .
We set a temperature parameter τ and batch size to 0.5 and 64, respectively.
Through represenations derived from the last token of BART decoder whose parameters are frozen, we can obtain each response representation r a and each keyword set representation ks a , where the keyword set corresponds to the response.
Thus, ks a becomes a positive sample for r a , and keyword set representations for other responses in the same batch become negative samples.
A. Next Emotion and Keywords Detection
We utilize the repositories and follow implemetation details of CoMAE 13 , ConceptFlow 14 , and
CG-nAR 15 .
We train three models, using EmpatheticDialogues instead of originally used datasets.