# Dialog CIN: Contextual Inference Networks for Emotional Dialogue Generation
###### Abstract
Subsequently, Speaker A provided suggestions to Speaker B, as seen in Utterances u8 and u10, which were derived from an understanding and inferential learning of the context. Towards the end of the conversation, Speaker A's emotion transitioned from the initial \"sadness\" to \"happiness\". This highlights the significant role of context-based learning and inference in generating appropriate responses. Presently, a number of Chinese dialogue datasets emerged. [PERSON] et al. [11] constructed a short-text dialogue dataset based on Sina Weibo, encompassing a substantial volume of dialogue instances alongside manually annotated data and candidate response pools. [PERSON] et al. [12] curated the Chinese Short Text Conversation Corpus (LCCC) through a meticulous data-cleaning process on Weibo dialogue data. [PERSON] et al. [13] introduced a large-scale dialogue dataset named Pchatbot, comprising two subsets sourced from Weibo and a judicial forum. This dataset provides anonymized user IDs and timestamps for each post and reply. However, it is important to note that the majority of existing Chinese dialogue datasets are primarily acquired through crawling from social media platforms such as Weibo and Zhihu. Consequently, these datasets tend to exhibit higher levels of noise, lower corpus quality, and deviate from the characteristics of real-life conversations. Moreover, these datasets lack annotations pertaining to emotional features, which significantly impedes the progress of research in the domain of generating emotionally driven dialogue in the Chinese language. The technical challenges associated with Chinese emotional dialogue generation can be summarized as follows. Firstly, there is a concern regarding the availability of Chinese corpora. Presently, much of the dialogue generation research is based on English corpora, while existing Chinese datasets lack annotations for emotional features. This poses a significant challenge for models to effectively leverage emotional information for generating emotionally driven responses. Furthermore, the majority of available corpora are derived from social media platforms, introducing substantial noise and deviating from the characteristics of everyday conversations. Thus, constructing a high-quality Chinese emotional dialogue dataset becomes a critical endeavor. Secondly, most existing methods predominantly rely on static memory to learn dialogue context and generate responses. However,this approach often results in insufficient assimilation of the inherent logical information. In human communication, individuals typically engage in reasoning and retrieval processes within the context to deliver contextually appropriate responses. Hence, exploring dynamic reasoning and retrieval mechanisms in dialogue models becomes imperative. To address the aforementioned research problem, this article proposes DialogCIN, a cognitive perspective-based emotional dialogue generation model designed to generate responses by comprehensively understanding the context. Firstly, we integrated dialogue information with emotional cues and employ a multi-head self-attention mechanism to obtain contextual representations at both the global and speaker levels. Secondly, we introduced a multi-turn inference module that iteratively extracts and combines the intrinsic logical cues embedded in the context. This module comprises two processes: the reasoning process and the retrieval process, which simulate the cognitive reasoning process observed in humans. The reasoning process utilizes a bidirectional long short-term memory (BiLSTM) network [14] to learn the intrinsic logical information of the dialogue context and extract contextual cues. The retrieval process leverages an attention mechanism to match relevant contextual cues through the retrieval of static global memories. Finally, utilizing the acquired contextual cue vectors, we employed an emotional classifier to ascertain the emotion label of the response and guide the response generation process.