Emotion Conditioned Creative Dialog Generation (2022)

Abstract: We present a DialGPT based model for generating creative dialog responses that are conditioned based on one of the following emotions: anger, disgust, fear, happiness, pain, sadness and surprise. Our model is capable of producing a contextually apt response given an input sentence and a desired emotion label. Our model is capable of expressing the desired emotion with an accuracy of 0.6. The best performing emotions are neutral, fear and disgust. When measuring the strength of the expressed emotion, we find that anger, fear and disgust are expressed in the most strong fashion by the model.

## introduction dialog systems and different kinds of natural language interfaces are all around us. when we seek information or contact customer support, we are increasingly more often first greeted by a bot rather than a person. bots are typically stiff and not lifelike making communication with them an awkward experience. this is because their goal oriented nature typically sets some constraints in terms of how creative a system can be. we can perceive a gap between dialog systems that are designed to convey a certain message in a goal oriented fashion and dialog systems that generate chit-chat. chit-chat can be generated rather freely because any topical response is valid, where as a certain degree of factual correctness is to be expected from a goal oriented system. in this paper, we seek to bring the two lines of dialog generation research closer together. we implement a system that can generate topical responses (in the sense of chit-chat) with a fixed emotional content. thus the goal of the system is to convey a desired emotion in its response, no matter what the actual textual content ended up being. this means that part of the semantics of the out is fixed, while a part as to how to contextually adapt the emotional content. is still up to computational creativity. we base our experiments on a recently published dialog dataset that contains sentiment annotations foot_0 . the dataset is based on a video game called fallout new vegas and it has dialog where each line of the dialog is annotated as containing one of the following emotions: anger, disgust, fear, happiness, neutral, pain, sadness or surprise. this dataset makes for an optimal training data for the task we seek to solve. ## related work in terms of computational creativity and natural language generation, there are several papers out there that present work conducted on a variety of different creative language generation tasks such as poem generation @xcite , humor generation @xcite , news generation @xcite and story generation @xcite . in this section, we will take a closer look at the work conducted on dialog generation. @xcite present work on generating empathetic dialog. their model deals with the following categories of empathetic intent: questioning, agreeing, acknowledging, sympathizing, encouraging, consoling, suggesting and wishing. they base their model on the transformer architecture and they use roberta for input encoding. in addition, they train a classifier that predicts the salient empathetic intent. dialog generation has also been tackled in a context-controlled and topic-aware manner @xcite . their model consists of four parts: a hierarchical context encoder, a contex dependent topic representation module, a context guided topic anger disgust fear happy neutral pained sad surprised sentences 3 335 932 1 620 4 029 8 802 994 1 055 1 649 dialog adaptation has been studied before in the context of video games @xcite . the authors use an lstm model to paraphrase the syntax of existing dialog to introduce diversity and a word2vec model to adapt the meaning of the sentence towards a desired player attribute. ## creativity and emotion there are several takes on creativity in a computational setting. in this section, we cover some of these theoretical ways of understanding computational creativity. theoretical foundation has been, for a long time, at the very core of computational creativity to combat systems that do mere generation. that is generation for the sake of outputting something by any means necessary. a computationally creative system should exhibit skill, imagination and appreciation according to @xcite . he argues that all of these three components are a strict requirement for creativity to exist in a system. skill refers to the system's capability of producing a creative artifact whereas appreciation means that the system should also know why its creation is good. imagination requires the system to be capable of garnering a lot of diverse output for one input. creativity can also be modeled through the face theory @xcite . this theory states creativity comes from the interplay between framing, aesthetics, concept and expression. expressions are the creative output produced by the system. the system itself is called concept. aesthetics is similar to appreciation in the previous theory; it means that the system should be able to appreciate the creative value of its output. framing highlights the fact that creativity does not take place in a vacuum but is presented in a context. in our case, framing would be the entire dialog between a human user and the machine. boden (1998) identifies three types of creativity; exploratory creativity, transformational creativity and combinatory creativity. in combinatory creativity, a system forms new artifacts by combining old ones in novel ways. in exploratory creativity, a system is conducing a search in a conceptual space discovering new creative artifacts. a system that can achieve transformational creativity can change its search space. a system is considered to be autonomously creative if it can change its own standards without being explicitly told to do so jennings (2010). the change cannot occur at random either because a simple random change at random intervals would otherwise be enough to satisfy the criterion. emotion is considered as a higher level cognitive phenomenon than a feeling (see @xcite . feelings are seen to be universally felt in a similar fashion as a response to some external or internal stimulus. emotions, on the other hand, are culturally and socially represented and their existence in all cultures in a similar way is not a given thing (see @xcite . one way of seeing emotions is that they rely on affect (see @xcite , which is a state our mind is continuously in. an affect can move across two axes: positive-negative and arousal-relaxed. the affect we feel is contextually resolved to a higher level emotion based on the context we find ourselves in. for instance, a high arousal and negativity could be interpreted either as anger or disgust among others. @xcite has identified six basic emotions: anger, disgust, fear, happiness, sadness and surprise. these emotions are also present in our dataset, which makes this theory optimal to build upon. the basic emotions are considered to be universal across cultures based on studies conducted on facial expressions. ## data our dataset consists of dialog in english where each line is annotated with an emotion label. the game dialog consists mostly of player prompts that result in a response by an npc (nonplayer character). in fallout new vegas is a relatively large video game because it is an open world rpg (roleplaying game) where the player can roam freely from one place to another. as a result of this, the game has a variety of different scripted characters which means that there is no bias in terms of having the same characters speaking with each other all the time. there is, however, a bias in the topic of conversations given that they take place in a fictional world. many of the dialogs deal with fictional places, characters, items and so on. ## dialog generation in this section, we outline our approach to emotionally conditioned dialog generation. we conduct our experiment using transformers @xcite and datasets @xcite python libraries. we base our model on a pretrained model called dialogpt medium 3 . dialogpt @xcite is based on the gpt-2 @xcite architecture, which in turn is based on the generic transformer language model @xcite . the transformer model leverages a stack of masked multihead self-attention layers to train on large datasets. dialogpt employs a maximum mutual information scoring function @xcite during the training phase optimizing the reward with a policy gradient (williams, 1992) with a sample averaged baseline @xcite . we changed the format of the data to be as "emotion 1 : sentence 1 . emotion 2 : sentence 2 [eos]", where emotion n indicates the emotion of the nth sentence in the conversation. this way, the model is exposed to emotional knowledge regarding the preceding locution of the response, as well. we use 90% of the data for training and 10% for validation. we train the model for 5 epochs. ## results and evaluation in order to evaluate our model, we sample dialog from an unrelated open-world rpg called the witcher 3: wild hunt foot_3 by cd projekt. the dialog is extracted using a w3strings decoder tool foot_4 . by using dialog from a different video game, we can see whether our model works in a different domain. the witcher 3 is set to a medieval fantasy world inhabited by magical creatures. some of the generated output can be seen in we sample randomly 15 sentences for each emotion, and produce emotion conditioned replies. in the input, "emotion 1 :" was not present as the dialogs in the witcher did not include emotion labels. these are then evaluated by crowd-workers on a crowd-sourcing platform called appen foot_5 . for every output we evaluate, we show the input sentence and the output to the user and ask them if the output expresses the desired emotion as a simple yes/no question. in case, the user selected "yes", we also asked how strongly the line expressed the desired emotion on a 5-point scale (the stronger, the higher), the scale is 0-based from 0 to 4. each generated output was evaluated by 5 different judges. all in all, the judges agreement with the emotion label was 0.6. in figure 1 , we can see the judges' agreement per emotion label. the worst performing emotion is pained and the best performing ones are neutral, fear and disgust. sad, surprise and prompt emotion output doesn't look like the talkative type. anger what the fuck are you looking at? wait a minute! i ain't done nothin' to you! fear i don't want any trouble, okay? asked you a question. how many? sad i'm sorry, but i don't have the time to talk right now. need coin, fast? those blasted nonhumans at the vivaldi bank say your credit's no good? come see me! surprise i've never heard of that before. all in all, based on the results, it seems that the model is capable of producing emotional responses in a suitably strong manner. ## conclusions emotion conditioned dialog generation remains a challenge. in this paper, we have shown the vi-ability of using a dialogpt model for this task. the results are promising especially given that the evaluation was run on out-of-the-domain data. the video game that was used in this paper also comes with audio files for each line of dialog. this is an interesting direction for future research because we could generate emotion conditioned dialog with audio as well. the same sentence can be said with multiple different tones and intonations to express different emotions. building a system that can express emotion in generated speech as well would have great application potentials in speech oriented dialog systems.