D iffus E mp: A Diffusion Model-Based Framework with Multi-Grained Control for Empathetic Response Generation (2023)

Abstract: Empathy is a crucial factor in open-domain conversations, which naturally shows one’s caring and understanding to others. Though several methods have been proposed to generate empathetic responses, existing works often lead to monotonous empathy that refers to generic and safe expressions. In this paper, we propose to use explicit control to guide the empathy expression and design a framework DiffusEmp based on conditional diffusion language model to unify the utilization of dialogue context and attribute-oriented control signals. Specifically, communication mechanism, intent, and semantic frame are imported as multi-grained signals that control the empathy realization from coarse to fine levels. We then design a specific masking strategy to reflect the relationship between multi-grained signals and response tokens, and integrate it into the diffusion model to influence the generative process. Experimental results on a benchmark dataset EmpatheticDialogue show that our framework outperforms competitive baselines in terms of controllability, informativeness, and diversity without the loss of context-relatedness.

## introduction empathetic response generation, as a conditional text generation task, aims to endow agents with the ability to understand interlocutors and accurately express empathy in their communication @xcite @xcite . however, the generated responses tend to be generic and monotonous @xcite , i.e., showing shallow empathy and few connections to the context. as shown in the upper part of figure 1 , "i'm sorry to hear that." is used as a reaction to different contexts with negative feelings. to alleviate the problem, existing works mainly incorporate emotion or knowledge modules into the encoder-decoder framework and train their models and an informative empathetic response (lower). "cm", "it", and "sf" are abbreviations for "communication mechanism", "intent", and "semantic frame", which represent control signals at the utterance, sentence, and token level respectively. recently, diffusion models @xcite have emerged as a brand-new and promising paradigm for generative models. a few prior works that explored using diffusion models on text data are mainly designed for unconditional text generation @xcite @xcite . for text generation with extra conditions (control signals or contexts), diffusion-lm @xcite applies extra-trained classifiers to make the generated text satisfy input signals like sentiment and syntactic structure. diffuseq @xcite is proposed as a classifier-free diffusion model that uses "partial noising" in the forward process to distinguish the input and output text. in this paper, we add control signals to empathetic response generation and propose a diffusion model-based framework, diffusemp, to solve the aforementioned monotonous empathy problem. first, since empathy is a multi-dimensional factor @xcite , i.e., several factors affect the realization of empathy, we use explicit control sig-nals at different levels to guide response generation. at the utterance level, communication mechanism (cm) @xcite ) divides text-based empathy into emotional reaction, interpretation, and exploration to describe the high-level functionality. then, we use intent (it) @xcite to reflect the behaviors of an agent in each sentence † , such as questioning (e.g., what happened to you?). finally, the fine-grained signal semantic frame (sf) @xcite is imposed on each token, which represents their universal categories of events, concepts, and relationships. an example of how multi-grained control signals work is illustrated in the lower part of figure 1 . to have exact guidance over responses, these signals are extracted from golden responses in the training process, while during inference, an emotion-enhanced matching method is used to obtain response candidates as the source of control signals. we then design a diffusion model to make the generated responses not only relevant to dialogue contexts but also express specific empathy under the multi-grained control. the dialogue context, multi-grained control, and response are considered as the model input. for the forward diffusion process, we apply the partial noising @xcite strategy so that both the context and control signals are unchanged, and only the response is noised. to fulfill the reverse diffusion process, we use the transformer architecture @xcite and introduce a masking strategy to indicate the control range of each signal on response tokens. specifically, each cm/it controls all tokens in an utterance/sentence, while an sf term corresponds to exactly one token. tokens out of the control range are masked in the self-attention layer. finally, we conduct experiments on a benchmark dataset empatheticdialogue to demonstrate the effectiveness of diffusemp. the main contribution of this paper is threefold: (1) we introduce explicit multi-grained control signals to solve the monotonous empathy problem, and convert the empathetic response generation into a controllable setting. (2) we propose dif-fusemp, a novel diffusion model-based framework, to unify the utilization of dialogue context and control signals, achieve elaborate control with a specific masking strategy, and integrate an emotionenhanced matching method to produce diverse re-sponses for a given context. (3) experimental results show that our method outperforms competitive baselines in generating informative and empathetic responses. the first is to detect and utilize the user's emotion with diverse structures @xcite @xcite . the second is to consider cognition-based factors other than emotions (em), such as dialogue act (da) @xcite , communication mechanism (cm) @xcite , emotion cause @xcite , psychological skill @xcite @xcite . @xcite propose a framework comae to model the relationship among cm, da, and em at the utterance level. the differences between co-mae and diffusemp are: (1) instead of predicting each factor based on the context representation, diffusemp explicitly uses control signals that are highly related to a response as task input. (2) we achieve the elaborate control with multi-grained signals, i.e., tokens in response are influenced by different signals, while comae applies the same combined factor to all decoding positions. ## diffusemp in this paper, we perform empathetic response generation in a controllable setting. the dialogue context is an alternating sequence of utterances from a speaker and a listener, i.e. w @xmath0, u 2 , . . . , u n }. here, we aim to generate an empathetic and context-related response w @xmath1, y 2 , . . . , y n } conditioned on the given context w u and a set of control signals w c obtained in advance (section 3.1). then, the context, control signals, and response are concatenated and fed into a diffusion model with control-range masking (section 3.2). in the training process, golden responses are used to extract control signals, while during inference, we integrate an emotion-enhanced matching method to get proper response candidates (section 3.3). the framework of diffusemp is illustrated in figure 2 . ## conclusion and future work we propose diffusemp, a diffusion model-based framework, for empathetic response generation. to better model multi-dimensional empathy and improve its expression, we utilize multi-grained control signals at utterance, sentence, and token levels. these control signals are directly extracted from golden responses in the training process, while response candidates obtained from an emotionenhanced matching method are used as the signal source. then we also design a control-range masking strategy and integrate it into the diffusion language model to fulfill elaborate control on the generation of response tokens. experimental results on a benchmark dataset empatheticdia-logue show that our method outperforms compet-itive baselines in generating more context-related, informative, and empathetic responses. our framework is scalable for more control signal types and can also be extended to other controllable conditional text generation tasks. in future work, we will extend diffusemp to more empathetic control signals, and improve the performance of annotators and retrieval tools. besides, it is interesting to explore diffusemp on various controllable text generation tasks.