Improving Empathetic Dialogue Generation by Dynamically Infusing Commonsense Knowledge
Year: 2023

Abstract:
In empathetic conversations, individuals express their empathy towards others. Previous work has mainly focused on generating empathetic responses by utilizing the speaker’s emotion. Besides, external commonsense knowledge has been applied to enhance the system’s understandings of the speaker’s situation. However, given an event, commonsense knowledge base contains various relations, potentially leading to confusion for the dialogue system. Consequently, inconsistencies arise among the emotion, generated response and speaker’s contextual information. To this end, we propose a novel approach for empathetic response generation, which incorporates an adaptive module for commonsense knowledge selection to ensure consistency between the generated empathetic responses and the speaker’s situation. This selected knowledge is used to refine the commonsense cognition and empathy expression for generated responses. Experimental results show that our approach significantly outperforms baseline models in both automatic and human evaluations, exhibiting the generation of more coherent and empathetic responses. Moreover, case studies highlight the interpretability of knowledge selection in the responses and the effectiveness of adaptive module in our model. Code: https://github.com/Hanscal/DCKS.

heading: 1 Introduction
text: Empathy is a desirable human ability in our daily conversations. It is known as a complex multidimensional construct encompassing social, cognitive, and emotional processes, which enables us to experience the emotion of others through various emotional stimuli and to understand the implicit mental states of others (Davis, 1983; Zheng et al., 2021). Previous research (Rashkin et al., 2019; Lin et al., 2019; Majumder et al., 2020; Li et al., 2021b) has been conducted on dialogue systems to enhance
∗These authors contributed equally to this work. †Corresponding author: Hua Cai (hua.cai@unidt.com)
its empathy ability in open-domain. In order to generate empathetic responses, one line of growing interests is incorporating commonsense knowledge into conversation modeling (Ghosal et al., 2020; Zhou et al., 2021; Sabour et al., 2021).
Yet, understanding speaker’s emotion and showing the contextually appropriate comprehension of her/his situation are still challenges in empathetic conversations. When interacting with a dialogue system, the speakers are not expected to explicitly share all the information about their situation and how they may feel. As humans, we use our commonsense knowledge to make connections between what is explicitly mentioned and what is implied. Hence, to address above issues, some prior works (Zhou et al., 2018b; Wu et al., 2020) implement external knowledge to identify the speaker’s situation, to acknowledge the speaker’s status and to bring diversity for generated response.
However, straightforward knowledge merging method confuses the system and the response consistency would be deteriorated. This is demonstrated in Figure 1, where the irrelevant knowledge (Need) may potentially form empathetic responses, which conflicts with the information about speaker’s emotion (content). Accordingly, the speaker displays the satisfaction of her/his expe-
7858
rience, which provides potential informative cognitions based on one unified commonsense. We can assume that if the most appropriate commonsense cognition (Intent) is selected with respect to emotion status, the generated response shows better consistency and empathy. Therefore, we believe dialogue systems with rectified knowledge, which aims at unifying the contextual emotion, lead to more consistent and empathetic responses.
In this paper, we address the task of empathetic dialogue generation by dynamically infusing commonsense knowledge. Such additional commonsense knowledge is used to improve the cognitive understanding about the speaker’s situation and feelings, thus enhance the empathy expression in the generated responses. Meanwhile, the dynamical selection stage avoids the confusion of knowledge in dialogue system and enhance the response consistency with context history. In general, our main contributions are summarized as follows:
• We introduce a novel approach that incorporates the inferred commonsense knowledge to enhance empathetic response generation.
• We propose an effective knowledge selecting paradigm that could dynamically select the commonsense knowledge, which is most relevant to speaker’s cognitive empathy. To the best of our knowledge, it is the first work to study commonsense knowledge dynamical selection for empathetic dialogue generation.
• Experiments show that with incorporating the selected commonsense, our model is able to generate more empathetic and interpretable responses compared with the previous methods.

heading: 2 Related Works

heading: 2.1 Empathetic Dialogue Generation
text: In recent years, research on implementing empathy in open domain dialogue systems and generating empathetic responses has gained considerable attention. Rashkin et al. (2019) consider a richer and evenly distributed set of emotions and release a dataset EmpatheticDialogues, where a listener responds to a speaker who is under an emotional situation in an empathetic way. Ghosal et al. (2020) demonstrate that detecting the speaker’s emotion is an essential part of generating empathetic responses. Prior studies on emotion-related conversational systems mainly focused on rule-based systems, which heavily rely on hand-craft features
(Zhou and Wang, 2018; Zhou et al., 2018a). Recently, many neural emotional dialogue generation approaches have been explored to control the emotional expression in the target response (Lin et al., 2019; Majumder et al., 2020). However, Li et al. (2021a) reveal that conventional empathetic conversation systems face an emotional inconsistency problem as they strive to produce emotionally rich responses based on predefined user-input emotions.

heading: 2.2 Connecting Knowledge and Dialogue
text: Leveraging knowledge from commonsense knowledge base has been demonstrated for gaining a better understanding of the implied emotions within the context (Tu et al., 2022; Lee et al., 2022). ConceptNet (Speer et al., 2017) and ATOMIC (Sap et al., 2019) are commonsense knowledge bases. ConceptNet consists of 36 relations focusing mostly on taxonomic, lexical and physical commonsense knowledge. Distinguished from ConceptNet, ATOMIC consists 9 relations that cover social commonsense knowledge including event-centered causes and effects as well as personrelated mental states. Both Zhou et al. (2018b) and Zhang et al. (2019) introduce knowledge triplets from ConceptNet into open-domain response generation. Recently, Li et al. (2022) and Zhong et al. (2021) exploit ConceptNet to enhance emotion reasoning for response generation. Ghosal et al. (2020) utilizes ATOMIC in emotional dialogue modeling for emotion identification. Sabour et al. (2021) leverages commonsense from ATOMIC to improve the understanding of speaker’s situations and feelings.
Therefore, enabling dialogue systems to leverage commonsense and driving implications from the speaker’s explicit statements are highly beneficial for more empathetic responses. In this work, we focus on the task of empathetic dialogue generation on EmpatheticDialogues dataset, and pay attention to addressing social related commonsense knowledge from ATOMIC. For each event, we use the social relations in ATOMIC to infer the commonsense knowledge about the person involved in the event. We adopt COMET (Bosselut et al., 2019) to generate commonsense sentences for the given events. This model is pre-trained on triplets from ATOMIC and then fine tuned on ATOMIC2020 (Hwang et al., 2021), so that is more suitable for inferring knowledge regarding unseen events in the original ATOMIC daily basis dataset.

heading: 3 Methodology
text: Our proposed model is built upon the Transformerbased pre-trained language model to generate listener’s utterance. Each conversation process of the model is mainly divided into three stages: contextual probing, contextual unification workspace and knowledge-aware decoder. The overview of our model is illustrated in Figure 2.

heading: 3.1 Task Formulation
text: The task requires a dialogue model to play the role of the listener and generate empathetic responses. Formally, let U = [u1, u2, ..., un−1] denote a dialogue history of n−1 utterances, where ui = [w i 1, w i 2, ..., w i Mi
] is the i-th utterance that consists of Mi words. Let K = {ki} denote the commonsense knowledge generated from COMET, where ki is the empathetic commonsense inference knowledge. Our goal is to generate a response Y using historical utterance U and commonsense knowledge K as input. A dialogue history encoder to encode U , a knowledge encoder to encoder K, and a decoder to incorporate dialog history, dynamically select knowledge and generate response.

heading: 3.2 Contextual Probing
text: To obtain semantic representations of the dialog history and the knowledge from ATOMIC, we divide the context probing part into context encoding
and knowledge acquisition.

heading: 3.2.1 Context Encoding
text: We concatenate the utterances in the dialogue history and prepend a special token [CLS] to obtain the dialogue historical context input U = [CLS] ⊕ u1 ⊕ u2 ⊕ ... ⊕ un−1, where ⊕ is the concatenation operation. Then, we use the final hidden representation of [CLS] as the representation of the whole sequence.
We use BART encoder part to acquire the contextual representation. The sequence U is fed into the encoder, and the hidden state of the encoder token:
zctx = Encctx(U), (1)
where zctx ∈ RL×d, L is the length of the sequence, and d is the hidden size of the context encoder.

heading: 3.2.2 Knowledge Acquisition
text: In ATOMIC, six relations could be inferred for the person X involved in the event: the effect of the event on X (xEffect), X’s reaction to the event (xReact), X’s intent before the event (xIntent), what X need in order for the event to happen (xNeed), what X would want after the event(xWant), and an inferred attribute of X’s characteristics (xAttr). Since predicting a person’s attributes involves judging the other person, which is not included in the empathetic process, we ignore xAttr in our approach and use the remaining five relations.
For input sequence U , we respectively append five special relation tokens ([xReact], [xWant], [xNeed], [xIntent], [xEffect]) to the last utterance in the dialogue history and then use COMET to generate k commonsense inferences Sr = [csr1, cs r 2, ... , cs r k] per relation r, where r ∈ {xReact, xWant, xNeed, xIntent, xEffect}. For each relation, we concatenate the generated commonsense inferences to obtain its commonsense sequence CSr = csr1 ⊕ csr2 ⊕ ... ⊕ csrk, which demonstrates the knowledge regarding the speaker’s dialogue state (i.e. emotion and situation). Accordingly, similar to the previous section, we prepend [CLS] to the sequences denoted as ECSr , which then are fed to five separate commonsense knowledge encoders, as shown in the contextual probing part of Figure 2:
Zr = EncKno(ECSr), (2)
where Zr ∈ Rlr×d, lr is the lengths of the commonsense inference sequences.
Then, we utilize the hidden vector of [CLS] as the representation for each relation, and through average operation we obtain the fused representation zr = Average(Zr[0]) ∈ Rd for all relations.

heading: 3.3 Contextual Unification Workspace
text: To better leverage the hidden representation from knowledge acquisition and context encoding, we apply the workspace module for unifying contextual information according to emotion label. The workspace consists of two parts: emotion classification for identifying speaker’s status, and adaptive knowledge selection for excluding irrelevant knowledge representation.

heading: 3.3.1 Emotion Classification
text: In contrast to concatenating the representations at a sequence level, we use point-wise addition to fuse the additional knowledge in the sequence, i.e., the fusing of knowledge and the context representation:
zf = zr + zctx. (3)
In order to acquire a more accurate prediction of the speaker’s emotion, given that we are provided with an emotion label e for each conversation, we use the infused representation of knowledge and context representation to perform emotion classification. We also pass zf through a linear layer gθ, followed by a softmax operation to produce the emotion category distribution Pemo ∈ Rq, where q is the number of available emotion categories:
Pemo = Softmax(gθ(zf )), (4)
where θ ∈ Rd×q is the weight vector for the linear layer. During training, we optimize these weights by minimizing the Cross-Entropy (CE) loss between the emotion category distribution Pemo and the ground truth label e:
Lemo = − log(Pemo(e)). (5)

heading: 3.3.2 Adaptive Knowledge Selection
text: We present a knowledge selection method that the decoder can adaptively choose the commonsense representations based on the emotion classification results. Given the set of knowledge representation Z = {Zr[0]}, the goal is to choose the most appropriate knowledge relations that satisfy the consistency with the context representation vector zctx. By this selection paradigm, the irrelevant relations, which would potentially confused the generated
response, will be eliminated, so as to boost the performance of dialogue system.
Inspired by Global Workspace Theory in cognitive science (Blum and Blum, 2022; Baars, 1993) , the process of contextual coordination is realized by eliminating irrelevant cognition. We therefore implement the label of emotion as the coordination of context and the Lemo(gθ(z), gθ(zctx)) from the supervised evaluation to eliminate irrelevant cognition. The knowledge selection mechanism is divided into two stages, competition and broadcasting:
• During the competition stage, we recursively exclude the irrelevant information of knowledge representation based on the emotion status. Specifically, at iteration m, we choose the maxz∈Z{Lemo(gθ(z), gθ(zctx))} as the most irrelevant knowledge representation. In order to model the influence of knowledge exclusion, we leverage nonlinear regression method (Xu and Xuan, 2019; Shen et al., 2022) to calculate the dynamics G = ∇θf ∈ Rd×q of the aforementioned max loss. Please refer to the Appendix for the technical details. After the last iteration, the remaining knowledge representation, as the winner of competition, is applied for acknowledging the unified speaker’s emotion status.
• In the broadcasting stage, the winner of competition stage will be applied for unifying the combined representation in decoder. Specifically, we realize this stage by adding the dynamics of the selecting process to rectify the knowledge representation. Thus, the generated response will less affected by the unrelated information from knowledge encoder in contextual probing module.
We provide Algorithm 1 in Appendix to show the exclusion method. Figure 3 displays how the workspace process refine the knowledge representation.

heading: 3.4 Knowledge-Aware Decoder
text: Generally, not all knowledge contributes to the generation of the response, so the model should have the ability to select knowledge. Instead of performing knowledge selection in the encoding phase, we leave it to the decoding phase. As shown in the right part of Figure 2, a knowledge-aware
cross attention block is introduced to select knowledge dynamically. Feed the selected knowledge to the context-knowledge refiner, which assists in response generation. The fused knowledge is taken as the input of this block, and then the output of this block is refined to exploit the knowledge contributions.

heading: 3.4.1 Knowledge Refiner
text: In order to refine the context and knowledge contributions in each layer, we replace the residual addition to a refine gate after the knowledge-aware attention block. Denote hk as output of knowledgeaware attention block and hc as the residual from the previous block, the output of refiner can be expressed by:
Rf (h̃k,hc) = α · LN(h̃k) + (1− α) · hc (6)
h̃k = hk + δm (7)
α = σ(w · [h̃k;hc]) (8) Where LN is a linear layer, h̃k is the rectified knowledge representation, w ∈ R2d is a learnable parameter and σ denotes sigmoid function.

heading: 3.4.2 Response Generation
text: Lastly, the target response Y = [y1, y2, ..., yT ] with length T , which is generated by the decoder token by token by using the embeddings of the tokens that have been generated and the commonsense-refined contextual representation Rf (h̃k,hc), which has fused the information from
both the context and the commonsense inferences. We adopt the standard negative log-likelihood (NLL) loss on the target response Y :
Lnll = − T∑
t=1
log(y|(U,K), y<t). (9)

heading: 3.5 Training Objectives
text: All the parameters for our proposed model are trained and optimized based on the weighted sum of the two mentioned losses:
L = Lnll + γLemo, (10)
where γ is hyper-parameter that we use to control the influence of the these losses. In our experiments, we set γ = 1.

heading: 4 Experiments

heading: 4.1 Datasets
text: We conduct our experiments on the EmpatheticDialogues, a large-scale multi-turn dataset containing 25k empathetic conversations between crowd sourcing workers. The dataset also provides an emotion label for each conversation from the total 32 available emotions.

heading: 4.2 Baselines
text: We select the following baseline models for comparison on EmpatheticDialogues: (1) Transformer (Vaswani et al., 2017): An original Transformer, which is trained to optimize the NLL loss. (2) Multi-TRS (Rashkin et al., 2019): A variation of the Transformer for multitask that trained to jointly optimize an additional cross-entropy loss for emotion classification with the NLL loss. (3) MoEL (Lin et al., 2019): A Transformer-based model that uses 32 emotion-specific decoders to generate a response. Therefore, each decoder is optimized to respond appropriately for each emotion. (4) MIME (Majumder et al., 2020): Another Transformer-based model that mimics the context emotion to a varying degree considering its negative and positive emotions, and then generates empathetic response based on the blend of these two emotions. (5) EmpDG (Li et al., 2021a): A multi-resolution adversarial framework which applies an empathetic generator to produce empathetic responses and an interactive discriminator to ensure that the generated responses are consistent with the context and are also empathetic. (6) CEM
(Sabour et al., 2021): An empathetic generation approach which leverages commonsense to draw more information about the speaker’s situation and uses this additional information to further enhance the empathy expression in generated responses.

heading: 4.3 Implementation Details
text: We implement all the models using PyTorch and use the encoder and decoder from base version of BART in our work. We use Adam optimizer with initial learning rate 0.00005 in 5 epochs. The batch size is 16. The max sequence length in source and target is 256 and 64 respectively. We use the same 8:1:1 train/valid/test split as provided by Rashkin et al. (2019). In each experiment, we apply an early stop mechanism to prevent the model from over fitting, and then report the test results of the optimal model on the test set. All our training and test results were performed on 32GB Tesla V100 GPU.

heading: 4.4 Evaluation Metrics

heading: 4.4.1 Automatic Evaluation
text: We employ Perplexity (PPL), corpus-level BLEU (B-n), sentence-level ROUGE (R-n) and Distinct-n (Dist-n) as our main automatic metrics. Perplexity represents the model’s confidence in its set of candidate responses, with higher confidence resulting in a lower PPL. This can be used to evaluate the general quality of the generated responses. Response with higher BLEU and ROUGE is closer to the ground-truth. Distinct-n measures the proportion of unique n-grams in the generated responses and is commonly used to evaluate generation diversity. In addition, since our proposed model and most baseline models perform emotion classification as part of their training process, we also report the prediction accuracy (Acc).

heading: 4.4.2 Human Evaluation
text: Following the methods in CEM, we conduct an aspect-based pairwise preference test. That is, for a given context, we pair our model’s response with a response from the baselines and ask annotators to give each response a rating score from four aspects: 1) Coherence (Coh.): which response is more coherent in content and relevant to the context; 2) Empathy (Emp.): which response shows more understanding of the speaker’s situation and presents a more appropriate emotion; 3) Informativeness (Inf.): which response conveys more information about the context. 4) Continuity (Con.): which response ignites the speaker’s more desire to continue the conversation. Then, we randomly sample 100 response pairs and totally shuffle the response order in each sample. We assign crowd sourcing workers to annotate each pair on a scale of 1 to 5.

heading: 4.5 Evaluation Results

heading: 4.5.1 Automatic Evaluation Results
text: Table 1 reports the evaluation results on automatic metrics. Ours model achieves the lowest perplexity, which suggests the overall quality of our generated responses is higher than the baselines, approximately 56% lower than CEM. In addition, our model also considerably outperforms the baselines in terms of Dist-n, BLEU-n and ROUGE-n, which highlights the diversity of the responses and the relevance between generated response and speaker’s situation. In terms of emotion classification, our model had a much higher accuracy compared to the baselines, nearly 34% higher than CEM, which suggests the adaptive selection of commonsense knowledge is pivotal for detecting the speaker’s emotion.
Table 2 reports the evaluation results on lowresource training set, and we have the following observations: (1) In the full-data scenario, our model
achieves start-of-the-art performance by infusing commonsense knowledge, which means that the importance of knowledge in dialogue generation. Besides, reducing the number of training samples has effect on model performance, but not that much, for that even the model using 1/4 data still has the approximate values in PPL, BLEU-n, ROUGE-n and Dist-n compared with the model using full data. (2) In the 1/8 training data scenario, our model achieves the comparable performance with baselines even though them leveraged all training data. (3) Responses generated by our model have higher Dist-n in low-resources scenarios, which means that our model can better obtain information from multiple knowledge and generate more diverse texts.

heading: 4.5.2 Ablation Studies
text: We conduct ablation studies to verify the effectiveness of each of the components in emotion classification and the generation performance. Specifically, we design three variants: workspace, knowledge and context. It is worth noting that since workspace depends on knowledge and context, when knowledge or context module is removed, workspace is removed by default:
1. w/o Adapter: the mechanism in workspace that used for adaptive commonsense knowledge selection is removed, and the emotion classification is based on none selected commonsense representation;
2. w/o Knowledge: the commonsense knowledge representation used for emotion classification is removed (Equation 6), and the hidden representation of the [CLS] token from the encoded context is used for emotion classification;
3. w/o Context: the context representation used for emotion classification is neglected (Equation 6), but keep the affective and cognitive commonsense knowledge representations;
The obtained results are shown in Table 1. We observe that reducing the workspace module results in lower classification accuracy as the same as BLEU-n and ROUGE-n. And removing the commonsense knowledge information also impacts the emotion classification accuracy. The above phenomena suggest that information about both the speaker’s emotion and their situation are necessary for correctly identifying their feelings, and
dynamical knowledge selection is leveraging the knowledge contribution to the cognition response. Removing those components leads to lower Dist-n scores but higher perplexity, which indicates the effectiveness of those components in generating more diverse responses.

heading: 4.5.3 Human Evaluation Results
text: Table 4 reports the evaluation results on human ratings. We observe that responses from our model are more contextually coherent than those from baselines. Besides, with the enhancement of commonsense knowledge, the response from our model are able to convey more specific and informative content. It is worth to note that, for the aspect of continuity, our model significantly outperforms all the baselines, which suggests that the generated responses may increase speaker’s engagement, thus a more intimate emotional expression.

heading: 4.6 Qualitative Studies
text: Case Study Table 3 shows the cases from EmpatheticDialogues, from which we can see that the response of our method outperforms the baselines. We analyze these cases with respect to the four factors evaluated by human. In aspect of Coherence and Informativeness, our response is more coherent in content and consistent to the context information. For instance, in case one, by the awareness of selected knowledge ‘To be home’, our method mentions this phrase in response so that the response better acknowledges speaker’s intention. However, other methods fail to generate consistent response. It can be observed that MoEL and CEM dismiss the implication that the speaker is alone at home. The workspace module improves Empathy and Continuity by selecting the most influential commonsense
with respect to the context. In both cases, the selected knowledge corresponds to the speaker’s situation, which produces a more meaningful response by showing careness for speakers.
Efficacy of Knowledge Selection Selection process illustrates that the most irrelevant knowledge is selected and eliminated at each iteration. By combining dynamics from the selection process in refiner, the generated sentence gradually focuses on speaker’s emotion status, so that our method provides more interpretable knowledge selection process for the dialogue system. Figure 4 provides characteristic of knowledge selection process. It indicates that workspace module tends to select inferred knowledge from the relation xReact. Since xReact reflects speaker’s reaction to context, our adaptive selection method potentially provides the consistency between context and knowledge.

heading: 5 Conclusions
text: In this paper, we improve empathetic dialogue generation by infusing dynamical commonsense knowledge to promote the understanding of the speaker’s situation and feelings, which leads to more consistent and empathetic responses. The automatic and human evaluation demonstrate that the effectiveness of our approach in high-quality empathetic response generation.
Limitations
One limitation in this work is the metrics employed in the automatic evaluation. The metrics mainly focus on the quality of generated response and the accuracy of emotion recognition, while automatic evaluation lacks a comprehensive method to evaluate empathy. Another limitation comes from the utilization of the dataset designed for open-domain dialogue system, so that the generated response from the proposed framework is not task-oriented. In the future, we will build empathetic dialogue generation datasets with diverse and task-oriented response, and develop metrics to evaluate the understanding of the speaker’s situation.
Ethics Statement
The human evaluation is conducted by the employed workers, who does not involve privacy issues. We use public datasets to conduct our experiments. Existing packages involved in this work are displayed in the appendix.

heading: Acknowledgment
text: This work was supported by UniDT’s Cognitive Computing and Few Shot Learning Project.

heading: A The Details of Cognition Dynamics
text: Our goal is to calculate the effect of knowledge representation on the predictions of the linear transformation function gθ in the workspace module. The influence of excluding irrelevant knowledge representation can be interpreted as the change of θ with respect to Lemo, which is ∇θLemo(gθ(z), gθ(zctx)), z ∈ Z. Here, Z = {Zr[0]},Zr[0] ∈ Rd. In order to eliminate the most irrelevant knowledge representation, we take the max(·) on loss function with respect to z ∈ Z. However, it is challenging to calculate the gradient when we implement max(·) on the groups of loss functions, because the above function is non-differentiable. Thus, we first bring differentiability for maxz∈Z{Lemo(gθ(z), gθ(zctx))}. To simplify notation, objective function is set as Φ(θ) = max1≤j≤J fj(θ), fj(θ) = Lemo(gθ(zj), gθ(zctx)). Here, fj denotes the loss function with respect to knowledge representation zj and each fj is differentiable. gθ is the parametric linear layer. Then, calculating the gradient of θ turns into the following discrete mini-max problem:
min θ∈Rd max 1≤j≤J fj(θ). (11)
In order to smooth objective function Φ during the iteration m, we linearize fj at θm and obtain the convex approximation of Φ as
Φ̂(θ) = max 1≤j≤J {fj(θm) + ⟨∇fj(θm),θ − θm⟩}︸ ︷︷ ︸ linearization term .
(12) The linearization term smooths max(·) function. Next step is to find descent direction, which minimizes Φ̂. However, Φ̂ is not strictly convex with respect to θ, the algorithm may not reach global minimum. So a regularization term ∥θ − θm∥2 is added for finding stable descent direction. Denote the descent direction δ = θ − θm, the discrete mini-max problem now is equivalent to
min δ,ν
∥δ∥2 + ν (13a)
s.t. fj(θm) + ⟨∇fj(θm), δ⟩ ≤ ν, ∀1 ≤ j ≤ J. (13b)
Problem (13) is a semi-definite quadratic programming (QP) problem since we choose ℓ2 norm as the regularization term. When the number of datapoints in subgroup is large, widely-used QP algorithms, such as active-set method, are timeconsuming. Thus we turn to the dual problem.
Consider the Lagrange multiplier for problem (13),
L(δ, ν;λ) = 1
2 ∥δ∥2 + ν
+ J∑
j=1
λj(fj(θm) + ⟨∇fj(θm), δ⟩ − ν).
(14)
By strong duality theorem, the minimum of original problem is equal to the maximum of dual problem under specific constrains:
min δ,ν max λ≥0 L(δ, ν;λ) = max λ≥0 min δ,ν L(δ, ν;λ) (15)
Let f = (f1, · · ·, fJ)T and G = ∇θf ∈ Rd×q. By setting e = 1, the above problem is equivalent to
max λ≥0 min δ,ν (1 2 ∥δ∥2 + ν + λT (f +Gδ − νe) ) .
(16)
Note that 1
2 ∥δ∥2 + ν + λT (f +Gδ − νe)
= 1
2 ∥δ∥2 + λT (f +Gδ) + ν(1− λTe).
(17)
If 1 − λTe ̸= 0, the objective function will be −∞. Thus, we must have 1− λTe = 0 when the maximum is attained. The problem is converted to
max λi≥0, ∑J i=1 λi=1 min δ
1 2 ∥δ∥2 + λTGδ + λT f .
(18)
Let the gradient of the inner minimization term to be zero, we have solution δ = −GTλ. By changing the sign of (18), the maximization term is reduced to
min λ
( 1
2 λTGGTλ− λT f) (19a)
s.t. J∑
i=1
λi = 1, λi ≥ 0. (19b)
Suppose λ is the solution of the QP problem (13), then δ = −GTλ is the solution of problem above. Thus, we have the δ as the change of eliminating irrelevant knowledge representation z. By adding δ to the refiner in decoder module, the final generated response would be less affected by the irrelevant knowledge. The effect of δ is demonstrated by the generated responses in Table 5, and we also display how the elimination of irrelevant knowledge boost the performance.
Algorithm 1 Adaptive Knowledge Selection Method. Input: The set of knowledge representation Z = {Zr[0]},Zr[0] ∈ Rd, linear layer gθ, θ ∈ Rd×q, the context representation vector zctx ∈ Rd from dialogue history encoder, the objective function of emotion classification Lemo. • Competition Stage: while len(Z) > 1 do m = 1 I = maxz∈Z{Lemo(gθ(z), gθ(zctx))} f = {Lemo(gθ(z), gθ(zctx)), z ∈ Z} Gm = ∇θf ∈ Rd×q Solve Lagrange multiplier λ: min λ (12λ TGmG T mλ− fTλ)
s.t. ∑J
i=1 λi = 1, λi ≥ 0. if m = 1 then δm = −GTmλ else δm = δm−1 −GTmλ end if Z = Z−I m = m+ 1
end while • Broadcasting Stage: h̃k = hk + δm
B Involved Existing Packages
Existing packages involved in this work include: 1) the open source codes, models weights and generated outcomes of Transformer (Vaswani et al., 2017), Multi-TRS (Rashkin et al., 2019), MoEL (Lin et al., 2019), MIME (Majumder et al., 2021), EmpDG (Li et al., 2021a), CEM (Sabour et al., 2021), and 2) the evaluation metrics from Natural Language Toolkit (Bird et al., 2009).

heading: C Additional Case Study
text: We provide qualitative studies in Section 4.6. It includes 1) Ablation study of our cognition dynamics (Table 5); 2) Additional case study of generated responses from EmpatheticDiaglogues (Table 6); 3) Stackplot of the knowledge selection process for all the emotions in EmpatheticDiaglogues (Figure 5).
ACL 2023 Responsible NLP Checklist

heading: A For every submission:
text: 3 A1. Did you describe the limitations of your work?
In section Limitations.
A2. Did you discuss any potential risks of your work? Not applicable. Left blank.
3 A3. Do the abstract and introduction summarize the paper’s main claims? 1
7 A4. Have you used AI writing assistants when working on this paper? Left blank.
B 7 Did you use or create scientific artifacts? Left blank.
B1. Did you cite the creators of artifacts you used? Not applicable. Left blank.
B2. Did you discuss the license or terms for use and / or distribution of any artifacts? Not applicable. Left blank.
B3. Did you discuss if your use of existing artifact(s) was consistent with their intended use, provided that it was specified? For the artifacts you create, do you specify intended use and whether that is compatible with the original access conditions (in particular, derivatives of data accessed for research purposes should not be used outside of research contexts)? Not applicable. Left blank.
B4. Did you discuss the steps taken to check whether the data that was collected / used contains any information that names or uniquely identifies individual people or offensive content, and the steps taken to protect / anonymize it? Not applicable. Left blank.
B5. Did you provide documentation of the artifacts, e.g., coverage of domains, languages, and linguistic phenomena, demographic groups represented, etc.? Not applicable. Left blank.
B6. Did you report relevant statistics like the number of examples, details of train / test / dev splits, etc. for the data that you used / created? Even for commonly-used benchmark datasets, include the number of examples in train / validation / test splits, as these provide necessary context for a reader to understand experimental results. For example, small differences in accuracy on large test sets may be significant, while on small test sets they may not be. Not applicable. Left blank.
C 3 Did you run computational experiments? 4
3 C1. Did you report the number of parameters in the models used, the total computational budget (e.g., GPU hours), and computing infrastructure used? 4
The Responsible NLP Checklist used at ACL 2023 is adopted from NAACL 2022, with the addition of a question on AI writing assistance.
3 C2. Did you discuss the experimental setup, including hyperparameter search and best-found hyperparameter values? 4
3 C3. Did you report descriptive statistics about your results (e.g., error bars around results, summary statistics from sets of experiments), and is it transparent whether you are reporting the max, mean, etc. or just a single run? 4
3 C4. If you used existing packages (e.g., for preprocessing, for normalization, or for evaluation), did you report the implementation, model, and parameter settings used (e.g., NLTK, Spacy, ROUGE, etc.)? appendix
D 3 Did you use human annotators (e.g., crowdworkers) or research with human participants? 4
3 D1. Did you report the full text of instructions given to participants, including e.g., screenshots, disclaimers of any risks to participants or annotators, etc.? 4
D2. Did you report information about how you recruited (e.g., crowdsourcing platform, students) and paid participants, and discuss if such payment is adequate given the participants’ demographic (e.g., country of residence)? Not applicable. Left blank.
D3. Did you discuss whether and how consent was obtained from people whose data you’re using/curating? For example, if you collected data via crowdsourcing, did your instructions to crowdworkers explain how the data would be used? Not applicable. Left blank.
D4. Was the data collection protocol approved (or determined exempt) by an ethics review board? Not applicable. Left blank.
D5. Did you report the basic demographic and geographic characteristics of the annotator population that is the source of the data? Not applicable. Left blank.

heading: Future Work
text: In the future, we will build empathetic dialogue generation datasets with diverse and task-oriented response, and develop metrics to evaluate the understanding of the speaker’s situation