Retrieve, Discriminate and Rewrite: A Simple and Effective Framework for Obtaining Affective Response in Retrieval-Based Chatbots (2021)

Abstract: Obtaining affective response is a key step in building empathetic dialogue systems. This task has been studied a lot in generation-based chatbots, but the related research in retrieval-based chatbots is still in the early stage. Existing works in retrieval-based chatbots are based on Retrieve-and-Rerank framework, which have a common problem of satisfying affect label at the expense of response quality. To address this problem, we propose a simple and effective Retrieve-Discriminate-Rewrite framework. The framework replaces the reranking mechanism with a new discriminate-and-rewrite mechanism, which predicts the affect label of the retrieved high-quality response via discrimination module and further rewrites the affect unsatisfied response via rewriting module. This can not only guarantee the quality of the response, but also satisfy the given affect label. In addition, another challenge for this line of research is the lack of an off-the-shelf affective response dataset. To address this problem and test our proposed framework, we annotate a Sentimental Douban Conversation Corpus based on the original Douban Conversation Corpus. Experimental results show that our proposed framework is effective and outperforms competitive baselines.

## introduction expressing affect is a key factor to build humanlike dialogue systems, which can significantly promote affective communication and enhance user satisfaction @xcite during human-computer interactions. this problem has been studied a lot in generation-based chatbots @xcite @xcite , which is usually defined as obtaining an affective response given an affect label and the context of a conversation @xcite . however, the related research in retrieval-based chatbots is still in the early stage @xcite . retrieval-based chatbots have an advantage over generation-based chatbots in obtaining diverse and informative responses, which is also widely used. therefore, research on obtaining affective response in retrieval-based chatbots is meaningful. in existing studies, affect is regarded as the term that subsumes emotion, feeling and sentiment @xcite . in this paper, we focus on sentiment and study how to obtain a specific polarity (positive or negative) response in retrieval-based chatbots. different from generation-based chatbots that can generate new responses, retrieval-based chatbots must obtain responses based on the candidates retrieved from a response repository. therefore, under the objective of obtaining affective response, how to effectively use the candidates is an important issue. existing works in retrieval-based chatbots are based on retrieve-and-rerank framework @xcite , which employs a reranking mechanism to the retrieved candidates. specifically, the framework firstly obtains the candidates via retrieval module, then adjusts ranking or matching score according to the given affect label, and finally outputs a response that is appropriate in both affect and content. however, the retrieve-and-rerank framework is not sufficient since it satisfies given affect label at the expense of response quality @xcite . this means that high-quality but affect unsatisfied responses will be discarded, which directly reduces the core advantage of retrieval-based chatbots. for example, in figure 1 (a), when affect label is not considered, high-quality candidate 2 should be the best one, but since the affect label is given, only candidate 3 with ordinary quality can be selected. to guarantee content and affect at the same time, we propose a simple and effective retrieve-discriminate-rewrite framework. the framework replaces the reranking mechanism with a new discriminate-and-rewrite mechanism, which preferentially selects high-quality candidate response and rewrites the response whose affect is discriminated to be unsatisfied. for example, in figure 1(b) , our new framework preferentially selects high-quality candidate 2, then discriminates that the affect of the candidate 2 is unsatisfied, and finally makes the affect of the candidate 2 satisfied with a small amount of modification. this shows that the framework can not only guarantee the quality of response, but also satisfy the given affect label. in addition, another challenge for this line of research is the lack of an off-the-shelf affective dataset. such a dataset can not only be used in our framework, but also necessary for existing methods which employs the reranking mechanism. to address this problem and test our framework, we annotate a sentimental douban conversation corpus based on the original douban conversation corpus which is widely used by many previous works in retrieval-based chatbots. we conduct experiments on this dataset, and experimental results show that our framework with a simple architecture is effective and outperforms competitive baselines. the contributions of this work are summarized as follows: ## related work existing works for obtaining affective response in dialogue systems can be categorized into two branches. the first category is the generation-based method, which generates affective response for given conversation context based on the seq2seq model @xcite . the generation-based method has the advantage of generating new responses and has been studied a lot @xcite @xcite . the second category is the retrieval-based method, which obtains affective response for given conversation context based on the candidates retrieved from the response repository. the retrieval-based method has the advantage of obtaining diverse and informative responses @xcite , which is still competitive compared to the generation-based method. this paper focuses on the second category. different from the generation-based method, the related research on the retrieval-based method for obtaining affective response is still in the early stage. @xcite proposed a reranking strategy for positive emotion elicitation whose method can also be applied to obtain affective response. @xcite presented an emotionaware matching network, which incorporated emotional factors and realized emotional control. from the perspective of using candidates, these methods are all based on retrieve-and-rerank framework. although these methods can already obtain affective responses, @xcite observed that these methods prefer responses that satisfied given affect label, even if they are not relevant to the context, discrimination module retrieval module rewriting module context and repository 1 retrieved response 2 3 t arget polarity retrieved response 4a retrieved response and target polarity 4b branch 2: target polarity is unsatisfied. branch 1: target polarity is satisfied. rewritten response 5b input output context, target polarity and repository affective response figure 2 : overview of the retrieve-discriminate-rewrite framework. we use digital numbers to show the processing flow of our framework. the framework includes three components: retrieval module, discrimination module and rewriting module. the retrieval module is used to retrieve a high-quality response, the discrimination module is used to discriminate the polarity of the response, and the rewriting module is used to correct the polarity of the response from unsatisfied to satisfied. these modules work together to obtain affective responses. another branch of research touched in our work is style transfer in natural language processing. the rewriting mechanism in our framework will modify the polarity of the response, which has been studied in some style transfer works. some existing works @xcite @xcite focus on how to get style independent sentence representation and then generate a sentence with target style. these works have certain effectiveness, but they usually lack fine-grained control and cause poor content preservation, which is inconsistent with our goal of fine-grained control of polarities. meanwhile, some existing works @xcite focus on how to remove style-related words in the sentence and then generate a sentence with target style. inspired by these works, we also regard the polarity rewriting as a similar two-stage process. but different from these works, our polarity rewriting will involve a large number of situations from neutral expression to affective expression, not just the transfer between different affective expressions. lack of processing neutral expression will lead to poor performance in our task, and our handling of this problem is different from these works. in addition, some other existing works @xcite @xcite have realized style transfer from other different perspectives. these works aim at more general style transfer issues and also lack fine-grained control of polarities, which does not match the goal of our work. ## sentimental douban conversation corpus in this paper, to solve the problem of no off-theshelf dataset, we annotate the douban conversation corpus @xcite in terms of sentiment polarity to support the research of obtaining affective response in retrieval-based chatbots. ## conclusion in this paper, we propose a retrieve-discriminate-rewrite framework for obtaining affective response in retrieval-based chatbots, which solves the problem of low-quality responses in the retrieve-and-rerank framework. our framework contains three components: retrieval module, discrimination module and rewriting module, which can preferentially select high-quality candidate response and rewrite the response whose affect is discriminated to be unsatisfied. considering the lack of necessary dataset in this field, we further annotate and publish a sentimental douban conversation corpus. the empir-ical studies show that our framework outperforms competitive baselines, and extensive analyses further proves the effectiveness of our framework.