Contextual Knowledge Learning for Dialogue Generation (2023)

Abstract: Incorporating conversational context and knowledge into dialogue generation models has been essential for improving the quality of the generated responses. The context, comprising utterances from previous dialogue exchanges, is used as a source of content for response generation and as a means of selecting external knowledge. However, to avoid introducing irrelevant content, it is key to enable fine-grained scoring of context and knowledge. In this paper, we present a novel approach to context and knowledge weighting as an integral part of model training. We guide the model training through a Contextual Knowledge Learning (CKL) process which involves Latent Vectors for context and knowledge, respectively. CKL Latent Vectors capture the relationship between context, knowledge, and responses through weak supervision and enable differential weighting of context utterances and knowledge sentences during the training process. Experiments with two standard datasets and human evaluation demonstrate that CKL leads to a significant improvement compared with the performance of six strong baseline models and shows robustness with regard to reduced sizes of training sets.

## introduction dialogue generation is concerned with conversational settings where participants take turns and the task is to generate a response to previous utterances. in order to generate relevant responses, prior research explored the use of the conversational history, i.e., the utterances already exchanged between the participants, as a context for the new response. it also investigated the use of external knowledge that may be a good source of content and not necessarily present in the conversational history @xcite @xcite ., * qatar computing research institute, doha, qatar 2021a). however, it has been shown that adding knowledge indiscriminately, can hurt performance. thus, the context has been used to select the best knowledge for the response generation. since the context itself consists of multiple utterances, the same concern applies: not all the prior utterances are equally useful for generating the response. therefore, the context needs to be evaluated for its importance in relation to generating the response and identifying the relevant knowledge, separately. in figure 1 , we show an example from the wizard of wikipedia (test seen) dataset, illustrating that the best context segments for response generation may not necessarily be the best context segments for retrieving the best knowledge. furthermore, both the context and the contextual knowledge contribute to the coverage of the target response (blue and purple words). thus, it is important to devise effective learning methods to identify the best context for response generation and for knowledge selection. once the knowledge is selected, there is still a question of whether and how to refine its selection for optimal use. recent studies differentiated between the two context roles by adopting a pipeline approach and training different models for each of them. @xcite proposed a knowledge retrieval model tppa that re-orders retrieved knowledge guided by its relevance to the response and investigated the effects of the resulting knowledge sets in combination with generative models such as ted @xcite and wseq @xcite . @xcite introduced a posteriorguided training to guide the retrieval of the relevant knowledge. a bart-based generative model (a generator) is used to generate responses but the retriever and the generator are trained independently. similarly, @xcite developed a re 2 g model which comprises a retriever, a re-ranker, and a generator. the re-ranker can take as input the outputs of multiple retrieval systems, e.g., annbased retrieval and bm25 method and the content retrieval training is an integral part of the content generation. this approach can differentiate the context roles from knowledge selection and response generation tasks. however, it requires additional training stages, which may incur and accumulate additional errors, and cannot separate the context information used for knowledge selection and response generation within the unified model. in our work we hypothesize that the integrated approach to model training and selection of context and knowledge can be improved through a parallel learning architecture where specific content selection roles (context and knowledge) are clearly differentiated and each learning facet is supervised, controlling for model training. guided by the hypothesis, we propose a contextual knowledge learning (ckl) model in which we introduce latent vectors to capture context roles and knowledge characteristics: the context latent vector for the relationship of context to the responses and to the 'best' knowledge, and the knowledge latent vector for the knowledge to capture the importance of knowledge to the responses. latent weights are then derived from the latent vectors to indicate the importance of context utterances and knowledge sentences. we also extend the notion of the attention operation, where tokens' attention scores are entirely decided by the scaled dot product between two rep-resentations, and devise a latent weight enhanced attention. the attention operation is augmented with the multiplication by the tokens' attention scores and the latent weights (i.e., the context utterance's weight and knowledge sentence weight). by adopting the weak supervision technique, the latent weights for context and knowledge are supervised by the (noisy) pseudo ground truth, removing the need for human annotations. combined with the negative log likelihood loss, the ckl is trained in a unified way, differentiating the context utterances for the knowledge selection and response generation tasks. the performance that our ckl model is superior to six strong baseline approaches, including transformer-based and pre-trained model-based methods, on two publicly available datasets wizard of wikipedia and cm-dog. by experimenting with a 50% smaller training set, our approach still outperforms the baseline methods. figure 1 shows the effectiveness of recognizing relevant context utterances for both the knowledge selection task and dialogue generation task using the ckl model. in summary, the key contributions of our research are through the novel design and clear advantages of the ckl method * : lewis et al. (2020b) propose a rag model by leveraging retrieval techniques to obtain relevant knowledge for enhancing dialogue generation. built on top of the rag, shuster et al. (2021) study various types of architectures with multiple components, including retrievers, rankers, and encoder-decoders. all previously mentioned approaches take the same context information for both the knowledge selection task and the dialogue generation task. to differentiate the functionality of the context for the two tasks, glass et al. (2022); paranjape et al. (2021); zheng et al. (2020) introduce pipelines to achieve multi-stage generative models. commonly, they devise a retriever that takes responsibility of retrieving knowledge units given the context information and follow by a generator that generates the final responses. the limitation is that this multi-stage training may cause error accumulation. motivated by this, we train our ckl model in an end-to-end way by differentiating the context inside the model. ## conclusion past studies on capturing context and knowledge relationships to boost the quality of response generation models were restricted to coarse-grain characterization through context-knowledge crossattention. in this paper, we describe the contextual knowledge learning (ckl) method for response generation. we propose our ckl model by using two latent vectors which are trained to capture the relationship between context, responses, and the 'best knowledge' (identified through a pre-defined default retrieval process by taking the response as the query) as well as the relationship between contextual knowledge and responses. the trained latent vectors are used to generate latent weights that enhance the traditional attention operation by multiplying them with the token-level attention scores. furthermore, we leverage the weak supervision technique to jointly train the latent weights production as well as the response generation. with these two mechanisms, the ckl has the flexibility of influencing the learning process and has demonstrated superior performance against six strong baselines. future work will explore more diverse use of latent vectors and latent weights as part of the learning process.