CARE: Commonsense-Aware Emotional Response Generation with Latent Concepts

Rationality and emotion are two fundamental elements of humans. Endowing agents with rationality and emotion has been one of the major milestones in AI. However, in the field of conversational AI, most existing models only specialize in one aspect and neglect the other, which often leads to dull or unrelated responses. In this paper, we hypothesize that combining rationality and emotion into conversational agents can improve response quality. To test the hypothesis, we focus on one fundamental aspect of rationality, i.e., commonsense, and propose CARE, a novel model for commonsense-aware emotional response generation. Specifically, we first propose a framework to learn and construct commonsense-aware emotional latent concepts of the response given an input message and a desired emotion. We then propose three methods to collaboratively incorporate the latent concepts into response generation. Experimental results on two large-scale datasets support our hypothesis and show that our model can produce more accurate and commonsense-aware emotional responses and achieve better human ratings than state-of-the-art models that only specialize in one aspect.


Introduction
Rationality and emotion are two fundamental elements of humans and indispensable to our social interactions (Keltner and Haidt 1999;Colman 2003). Endowing agents with rationality and emotion has been one of the major milestones in AI. In recent studies of conversational AI, there is an emerging research trend in endowing conversational models with rationality (Zhou et al. 2018b;Zhang et al. 2020) or emotion (Zhou et al. 2018a;Song et al. 2019). Rational conversational models can leverage commonsense knowledge to reason and have been shown to produce more appropriate and informative responses (Zhou et al. 2018b). Emotional conversational models can generate appropriate emotional responses, leading to improved user satisfaction (Prendinger and Ishizuka 2005;Zhou et al. 2018a) and long-term relationships with users (Zhou et al. 2018c).
Rationality and emotion are not independent for humans (De Sousa 1990). In fact, emotions are often rational in social interactions (Pham 2007). However, most existing  (Song et al. 2019) and our model. EmoDS generates generic or unrelated emotional responses. Our model extracts the message concept "starbucks", and generates more commonsense-aware emotional responses by referring to our constructed relational (in bold) and emotional (in italic) latent concepts, e.g., company, coffee and bitter.
conversational models only specialize in one aspect and neglect the other 1 , which often leads to dull or unrelated responses. For example, as shown in Table 1, the stateof-the-art emotional conversational model (EmoDS) (Song et al. 2019) produces generic or unrelated emotional responses due to the lack of specific modelling of rationality. In addition, existing rational conversational models, e.g., the commonsense-aware conversational model (CCM) (Zhou et al. 2018b), are not able to generate emotional responses, rendering them difficult to build long-term relationships with users (Zhou et al. 2018c).
A recent work (Roller et al. 2020) proposed to blend several human skills such as knowledge, personality, and empathy into a conversational agent and obtained the stateof-the-art performance in human evaluations. Their experimental analysis suggests that blending these skills is critical for achieving good human ratings. Motivated by the facts that 1) rationality and emotion are two fundamental qualities of humans and that 2) empirical performance improvement has been achieved via combining several human qualities (Roller et al. 2020), we hypothesize that combining rationality and emotion into conversational agents can improve response quality and their human ratings.
In this paper, we narrow the scope of rationality and emotion to specific settings for easier implementation and evaluation. Specifically, we focus on one fundamental aspect of rationality, i.e., commonsense, and the discrete representation of emotion. Commonsense is an important foundation of rationality and the basis of rational human conversations (Ross 1978). The discrete representation of emotion categorizes emotions into discrete basic emotions, e.g., joy, anger, etc., and is a well-established emotion theory in Psychology (Ekman 1992). To test our hypothesis, we propose a novel model for Commonsense-Aware Response generation with specified Emotions (CARE) and assess its empirical performance. Two major challenges to this task are 1) the lack of relevant datasets or resources that can provide such supervision and 2) how to generate appropriate commonsenseaware emotional words. We tackle the first challenge by building an emotion-aware commonsense knowledge graph (EA-CKG) to integrate commonsense and emotion knowledge. We tackle the second challenge by incorporating both relational and emotional latent concepts constructed from EA-CKG into response generation. Specifically, we build EA-CKG by augmenting an external CKG with emotional triplets extracted from emotional conversations. We then construct latent concepts using learned EA-CKG embeddings, endowing the response with commonsense and emotion by reasoning over the EA-CKG. Finally, we propose three methods to sequentially and collaboratively incorporate the latent concepts during attention, optimization, and sampling. CARE is illustrated in Figure 1.
In summary, our contributions are as follows: • We identify the problem of lacking either rationality or emotion in existing conversational models, which often leads to dull or unrelated responses. We hypothesize that combining rationality and emotion into conversational agents can improve response quality.
• We focus on one fundamental aspect of rationality, i.e., commonsense, and propose CARE, the first commonsense-aware emotional response generation model, to address the aforementioned problem.
• We conduct extensive automatic and human evaluations and show that CARE can produce better commonsenseaware emotional responses than state-of-the-art models that only specialize in one aspect. The experimental results support our hypothesis.

Related Work
Rational Response Generation: Existing rational response generation models usually rely on knowledge bases, such as open-domain response generation (Han et al. 2015;Young et al. 2018;Ghazvininejad et al. 2018;Liu et al. 2018;Tuan, Chen, and Lee 2019;Moon et al. 2019), task-oriented response generation (Madotto, Wu, and Fung 2018;Wu, Socher, and Xiong 2019) and question answering Banerjee et al. 2019). Zhou et al. (2018b) proposed CCM to incorporate commonsense knowledge by applying attention mechanisms on 1-hop knowledge triplets for  Figure 1: Illustration of CARE. Given the message "Do you wanna have beer tonight?" (beer is a message concept) and the learned EA-CKG embeddings, CARE first constructs latent concepts depending on the specified emotions of the response. For example, tasty is constructed for "joy" and soda is constructed for "sadness", because tasty is linked to beer via the "joy" relation, and soda is linked to beer via a composite of "sadness" and "IsA" relations. Then CARE leverages the proposed three methods to incorporate the latent concepts, e.g., tasty, into response generation.
open-domain response generation. Zhang et al. (2020) (Ghosh et al. 2017) and Seq2Seq models Xu et al. 2019). Keskar et al. (2019) trained a Transformer-based conditional language model on a large collection of corpora with control codes that govern style, content, and task-specific behavior. Li and Sun (2018) and Peng et al. (2019) proposed topic-aware emotional response generation models. In contrast, we focus on commonsense, i.e., the semantic network of words, instead of topics, i.e., word clusters.

Our CARE Model
In this section, we introduce the task definition and our CARE model, which includes a framework for constructing latent concepts and three methods to incorporate the latent concepts.

Task Definition
We denote {X i , Y i , e i }, i = 1, ..., N , as a collection of {message, response, emotion} tuples, where e i is chosen from a predefined set of emotions and denotes the emotion category of Y i , and N denotes the number of conversations in the training dataset. Our task can be formulated as follows: given a new message X new and an emotion category e, generate a natural and commonsense-aware response Y new that has emotion e.

Latent Concepts Construction Framework
In this framework, we first build an emotion-aware commonsense knowledge graph (EA-CKG) and then construct latent concepts from EA-CKG.
EA-CKG We extract emotional triplets from emotional conversations and augment them into an external CKG to obtain EA-CKG. We use ConceptNet (Speer, Chin, and Havasi 2017) as our CKG 2 . Each triplet in ConceptNet follows the {head, relation, tail} format, e.g., {beer, AtLocation, bar}. Note that we use n-gram matching with Concept-Net to extract concepts from utterances, and ignore stopwords and n-grams that are formed entirely by stopwords.
We define an emotional triplet as in the {msg concept, emotion, res concept} format, representing an emotional link from a message concept to a response concept. For example, given a message "I heard there is a bar nearby with nice beer." and its response "I love tasty beer." with joy emotion, the triplet {beer, joy, tasty} is a valid emotional triplet because there is a commonly expressed emotional link, i.e., joy, from beer in the message to tasty in the response. We propose a two-step approach based on the pointwise mutual information (PMI) (Church and Hanks 1990) to extract such emotional triplets from emotional conversations. PMI can measure the association between two words in a corpus. We extend the smoothed positive PMI, i.e., PPMI α (Levy, Goldberg, and Dagan 2015), as follows: where (w 1 , w 2 ) denotes the word pair, P α (w) = count(w) α x count(x) α denotes the smoothed probability of w, and α denotes a smoothing factor set to 0.75 (Levy, Goldberg, and Dagan 2015) to alleviate the bias towards rare words.
In our two-step approach, we first construct a PPMI matrix between concepts in messages and in the corresponding responses to extract strongly associated concept pairs in conversations 3 , denoted as conversational concept pairs 2 We remove non-English and rare concepts. 3 We consider concept pairs whose frequency ≥ 5 and PPMI ≥ 1 as strongly associated pairs (CCP).  (CCP). Note that in this case, w 1 refers to a message concept and w 2 refers to a response concept in Equation 1. We then construct a second PPMI matrix between CCP and their expressed emotions and extract CCP that statistically express certain emotions more often than other emotions 4 . Note that in this case, w 1 refers to a CCP and w 2 refers to its expressed emotion in Equation 1. We do not smooth P (w 2 ). By using this two-step approach, we can effectively extract conversational triplets that are commonly expressed with certain emotions. The statistics of EA-CKG are presented in Table 2. Our approach shares similarities with commonsense knowledge base completion methods (Li et al. 2016c;Saito et al. 2018;Bosselut et al. 2019); however, they cannot be trivially adapted to extract emotional CCP.

Latent Concepts Construction
During training and inference, given a message X i and a desired emotion e i , we construct the latent concepts of the response based on EA-CKG embeddings. Specifically, we first train a well-established knowledge embedding model, i.e., TransE (Bordes et al. 2013) 5 , on the entire EA-CKG to learn global concept and relation embeddings. The embeddings in TransE are learned such that the score -||h + r − t|| 2 for a correct triplet (h, r, t) is much higher than a corrupted one, where h, r, t denote the TransE embeddings of h, r, t, respectively, and ||h|| 2 = 1 and ||t|| 2 = 1 (Bordes et al. 2013). Hence, given a message concept h, a relation r and a response concept t, we can estimate the relatedness between h and t via r as follows: We then obtain the top m related latent concepts of the response from EA-CKG, i.e., {t} m 1 , as follows: where h ∈ C Xi , r ∈ R ∪ {e i }, C Xi denotes all concepts in X i , R denotes all 36 relations in ConceptNet, and t is searched over the concept vocabulary of EA-CKG. For messages without any concepts 6 , we use a null message concept whose embedding is the average of all concept embeddings.
Framework Analysis Our framework constructs plausible relational (r ∈ R) and emotional (r = e i ) concepts for the response. By leveraging the EA-CKG embeddings, our framework inherits the ideas from knowledge base completion and has two major advantages over the graph search methods used in existing models (Zhou et al. 2018b;Zhang et al. 2020) to find related concepts: 1) our framework can find concepts that are both commonsense-aware and emotional due to the incorporation of emotional triplets in EA-CKG, e.g., tasty is found given beer and joy whereas bland is found given beer and sadness; and 2) our framework can not only traverse through the EA-CKG to find related concepts in a multi-hop neighborhood but also discover an arbitrary number of novel related concepts using Equation 3, without being limited by the CKG coverage (see Result Analysis).

Incorporating Latent Concepts
After obtaining the latent concepts, we propose three methods to collaboratively incorporate them into our Transformer-based conversational model (Vaswani et al. 2017), as illustrated in Figure 2. Note that similar to the idea of persona embedding (Li et al. 2016b), we additionally employ an emotion embedding layer in our decoder.
Emotion-Aware Graph Attention We incorporate latent concepts into the decoder using an emotion-aware graph attention (EAGA) prior to the cross-attention layer, inspired by (Zhong, Wang, and Miao 2019b). We assume that important latent concepts are those related to the message concepts and have strong emotional intensity. The relatedness between concepts is obtained from Equation 2. The emotional intensity of a concept is computed based on an emotion lexicon NRC VAD (Mohammad 2018) and an emotional intensity computation method (Zhong, Wang, and Miao 2019b). We expand the size of NRC VAD from 20K to 34K using synonym expansion for better coverage 7 . Formally, let {t 1 , t 2 , ..., t m } be the latent concepts of response Y i obtained from Equation 3, {s 1 , s 2 , ..., s m } be their relatedness scores obtained from Equation 2, and {q 1 , q 2 , ..., q m } be their emotion intensities based on NRC VAD, we compute the latent concept embedding of Y i , i.e., C Yi , as follows: where t i denotes the word embedding of t i and β i is computed as follows: where λ i denotes the trade-off coefficient between relatedness and emotional intensity, and δ 1i , δ 2i denote softmax temperatures. Note that λ i , δ 1i and δ 2i are concept-specific and can be fixed a prior or learned during training. The obtained latent concept embedding C Yi is then averaged with the response representation prior to being fed to the crossattention layer. Compared with the graph attention in CCM (Zhou et al. 2018b), EAGA measures concept relatedness using translation-based distance in TransE instead of MLP and additionally considers the emotion property of concepts.

Dynamic Label Smoothing
Label smoothing is conventionally adopted in the Transformer (Vaswani et al. 2017) to improve translation quality. We propose a simple but effective dynamic label smoothing (DLS) method to explicitly enforce the supervision of latent concepts in producing concept-related responses, as well as to stabilize the learning process. Specifically, starting from the conventional label smoothing, we linearly increase the smoothing values for latent concepts with the training step and decrease the smoothing values for other words in the vocabulary. Note that the smoothing value of the target word remains unchanged. The maximum of the total smoothing value for latent concepts is a hyper-parameter to be tuned in experiments. We optimize model parameters to minimize the Kullback-Leibler (KL) loss (Kullback and Leibler 1951).
Concept-Aware Top-K Decoding During inference, we propose a concept-aware top-K decoding (CATD) method to encourage the generation of words that are more related to the associated latent concepts. Formally, given the conventional top-K unnormalized token probabilities P (w 1 ), ..., P (w k ), our concept-aware token probability P for w i , i = 1, ..., k, is computed as follows: where γ denotes a trade-off hyper-parameter between fluency and relatedness, and P c (w i ) is computed as follows: where C Y denotes the latent concept embedding obtained from Equation 4 during inference. One merit of CATD is that it only reorders top-K tokens by additionally considering their relatedness to latent concepts and thus does not introduce unlikely tokens into the sampling process.

Experimental Settings
In this section, we present the datasets, evaluation metrics, baselines, and model settings.

Datasets
We conduct experiments on two large-scale datasets, namely Reddit and Twitter. The Reddit dataset is obtained from comments on the CasualConversation subreddit 8 discussing a variety of casual topics 9 . The Twitter dataset is obtained from chats on twitter.com 10 . We truncate each sentence to a maximum of 30 tokens and use the most frequent 30K tokens as the vocabulary for each dataset.
To obtain the ground-truth emotion label for each response, similar to (Zhou et al. 2018a;Song et al. 2019), we train an emotion classifier on emotional conversations. Specifically, we use the emotional tweets (Mohammad 2012;Mohammad et al. 2018) to train the classifier. We consider neutral and Ekman's six basic emotions (Ekman 1992): joy, sadness, surprise, fear, and anger, but exclude disgust due to its small amount of training samples in the emotional tweets. We propose an emotion classifier based on DeepMoji embeddings (Felbo et al. 2017) followed by a linear layer and a softmax layer. Our classifier achieves an accuracy of 0.562 on a balanced test dataset, outperforming several competitive baselines such as BiLSTM (0.446), CNN (0.547), BERT (Devlin et al. 2019) (0.530) and XLNet (Yang et al. 2019) (0.522). We then use the trained emotion classifier to annotate the responses in the datasets. The statistics of the annotated datasets are presented in Table 3.

Evaluation Metrics
We conduct both automatic and human evaluations. Automatic evaluation metrics include 1) Fluency: perplexity (PPL), which measures the confidence of the generated responses; 2) Diversity: distinct-1 (dist-1) and distinct-2 (dist-2) (Li et al. 2016a), which measure the percentage of unique unigrams and bigrams in the generated responses, respectively; 3) Emotion Accuracy (EA): the emotion accuracy of the generated responses measured by our trained emotion classifier; and 4) Commonsense Awareness (CA): the average number of commonsense triplets in one pair of message and generated response, measured by ConceptNet.
Following (Zhou et al. 2018a), we conduct human evaluations to measure both content quality (rating scale in {0, 1, 2}) and emotion quality (rating scale in {0, 1}) of the generated responses. Content quality measures whether the response is natural and related to the message, as well as how commonsense-aware the response is. Emotion quality measures whether the response expresses the desired emotion appropriately and accurately. We randomly sample 200 test messages and emotions to generate 200 responses for each model. Each response is evaluated by three annotators.

Baselines
We compare CARE with the following baselines: Vanilla Models: Seq2Seq (Vinyals and Le 2015) and Transformer (Vaswani et al. 2017). Commonsense-Aware Models: CCM (Zhou et al. 2018b) and ConceptFlow (Zhang et al. 2020). ConceptFlow leverages multi-hop knowledge triplets and is a state-of-the-art model for commonsense-aware response generation. Emotional Models: ECM (Zhou et al. 2018a) and EmoDS (Song et al. 2019). EmoDS is a state-of-the-art model for emotional response generation. Pre-trained Model: CTRL (Keskar et al. 2019). CTRL is a large pre-trained conditional language model with 1.6 billion parameters trained on 140GB of text. We fine-tune CTRL on our training conversations such that it is able to produce emotional responses. CTRL has also been shown to contain commonsense knowledge (Petroni et al. 2019;Bosselut et al. 2019).

Model Settings
We use the same hyper-parameters for both datasets. Our TransE embeddings have a dimension of 100 and achieve an accuracy of 0.89 for triplet classification on EA-CKG. Our Transformer model has 1 layer and 4 attention heads. We initialize the word embedding layer with pre-trained GloVe embeddings (Pennington, Socher, and Manning 2014) of size 300. The emotion embedding and feedforward layers have sizes of 50 and 512, respectively. We train our model using Adam (Kingma and Ba 2014) with learning rate of 1, batch size of 64, and dropout of 0.1 for 80K steps, including 6K steps for warmup. We empirically construct 30 relational latent concepts and 10 emotional latent concepts for each response using Equation 3. We use label smoothing of 0.1, total smoothing value of 0.08 for latent concepts in DLS, and top-10 decoding with γ = 1 in CATD.

Result Analysis
In this section, we discuss our evaluation results, model analysis, case study, error analysis and limitation.

Comparison with Baselines
We present the results of automatic evaluations in Table 4. Seq2Seq achieves the lowest perplexity while Transformer achieves slightly better diversity than Seq2Seq. Commonsense-aware models, i.e., CCM and ConceptFlow, obtain slightly better diversity and CA; however, they are    (Fleiss and Cohen 1973), are 0.441 and 0.626 for content and emotion on Reddit, respectively, and 0.479 and 0.673 for content and emotion on Twitter, respectively. Both datasets obtain "moderate agreement" and "substantial agreement" for content and emotion, respectively.
unable to generate responses with specified emotions. Emotional models, i.e., ECM and EmoDS, achieve the highest EA among all baselines but the worst in perplexity and CA, suggesting that they only specialize in emotion and neglect commonsense. CTRL achieves the highest diversity among all models, partially due to its large vocabulary size of 250K. However, it obtains an inferior EA. Our model achieves better EA and CA than all baselines, including CTRL, which is also capable of producing commonsense-aware emotional responses.
We present the results of human evaluations in Table  5. The responses of non-emotional models are generated via top-10 decoding six times. ConceptFlow obtains similar emotion quality but noticeably better content quality than Seq2Seq due to its incorporation of multi-hop triplets. EmoDS achieves comparable content quality but much better emotion quality than Seq2Seq. CTRL obtains the best content quality among all models but only mediocre emotion quality, especially on Reddit. Our model performs best in emotion quality (t-test, p < 0.01). In addition, our model achieves significantly better content quality than EmoDS (ttest, p < 0.01), showing that our model can produce better commonsense-aware emotional responses than EmoDS. Finally, our model outperforms ConceptFlow, a competitive commonsense-aware model, in content quality, possibly because the graph search method in ConceptFlow heavily relies on the coverage of ConceptNet to extract knowledge triplets, but ConceptNet only has an average coverage of 27% on Reddit and Twitter. In contrast, our model has less such restriction and can construct an arbitrary number of latent concepts given any input message.
We report model complexity in the rightmost columns of Table 4. Our model has comparable space and time complexity with vanilla baselines. In contrast, CTRL is around 80x larger and 1,000x slower than our model, rendering it intractable for real-time applications.

Model Analysis
We conduct ablation study, as shown in Table 6. Removing any component except EAGA from our model leads to much worse performance in both EA and CA. In particular, we   observe that 1) our approach of constructing latent concepts performs better than alternatives (-ET+EL and -TransE); and 2) the removal of EAGA leads to significantly higher perplexity, diversity, and CA. The higher perplexity may be attributed to the additional supervisions of DLS on latent concepts, which are not explicitly incorporated into the model due to the lack of EAGA. The higher diversity and CA may be attributed to the untrained λ, δ 1 , and δ 2 (see Equation 5), which sometimes leads to ungrammatical but diverse latent concepts during decoding. Our observation validates the importance of EAGA in attending more related latent concepts. We analyze the impact of model hyper-parameters on EA and CA, as shown in Figure 3. Using m = 40 latent concepts achieves the sweet spot for model complexity. Regarding DLS, increasing the total smoothing values for latent concepts in the [0, 0.08] range improves model performance. However, we do observe degraded fluency when using larger smoothing values, which is expected because the true learning signal is weakened. Increasing γ in CATD consistently improves EA and CA for our model. However, models with larger γ, e.g., 1.5, sometimes produce unfluent long responses due to its overemphasizes on latent concepts.

Case Study and Error Analysis
We present two sample cases in Table 7. Given a message and desired emotions, our model produces commonsenseaware responses with the desired emotions, guided by both relational and emotional latent concepts. For example, given "starbucks" and anger, the relational latent concept "coffee" and emotional latent concept "gross" are constructed and incorporated into response generation. However, we do ob-serve bad cases where the latent concepts overemphasize on emotional intensity, and the response becomes unnatural.

Limitation
One major limitation of our work is the mediocre accuracy of our trained emotion classifier, which can be attributed to the unavailability of large-scale datasets for emotional conversations and sentences. Nevertheless, our proposed lightweight classifier obtains better performance than the best models reported in (Zhou et al. 2018a;Song et al. 2019) and BERT. A potential solution to this limitation is to leverage few-shot learning on BERT-like models.

Conclusion
We propose CARE as the first attempt to test the hypothesis that combing rationality (commonsense) and emotion into conversational agents can improve response quality and human ratings. Specifically, we build an EA-CKG and leverage its TransE embeddings to allow CARE to reason over the EA-CKG and construct both relational and emotional latent concepts. We further propose three methods to collaboratively incorporate the latent concepts into response generation. Extensive ablation studies show that our methods of constructing and incorporating latent concepts outperform alternative methods. In addition, both automatic and human evaluations show that CARE can produce more accurate and commonsense-aware emotional responses than state-of-theart commonsense-aware models and emotional models. Finally, our work provides empirical evidence for our hypothesis. In the future, we plan to extend our work to other aspects of rationality, e.g., logical reasoning.