Stochastic Language Generation in Dialogue using Recurrent Neural Networks with Convolutional Sentence Reranking
Tsung-Hsien Wen, Milica Gasic, Dongho Kim, Nikola Mrksic, Pei-Hao Su, David Vandyke, Steve Young
Introduction
Conventional spoken dialogue systems (SDS) are expensive to build because many of the processing components require a substantial amount of handcrafting [Ward and Issar, 1994, Bohus and Rudnicky, 2009]. In the past decade, significant progress has been made in applying statistical methods to automate the speech understanding and dialogue management components of an SDS, including making them more easily extensible to other application domains [Young et al., 2013, Gašić et al., 2014, Henderson et al., 2014]. However, due to the difficulty of collecting semantically-annotated corpora, the use of data-driven NLG for SDS remains relatively unexplored and rule-based generation remains the norm for most systems [Cheyer and Guzzoni, 2007, Mirkovic and Cavedon, 2011].
The goal of the NLG component of an SDS is to map an abstract dialogue act consisting of an act type and a set of attribute-value pairs Here and elsewhere, attributes are frequently referred to as slots. into an appropriate surface text (see Table 1 below for some examples). An early example of a statistical NLG system is HALOGEN by ?) which uses an n-gram language model (LM) to rerank a set of candidates generated by a handcrafted generator. In order to reduce the amount of handcrafting and make the approach more useful in SDS, ?) replaced the handcrafted generator with a set of word-based n-gram LM-based generators, one for each dialogue type and then reranked the generator outputs using a set of rules to produce the final response. Although ?)’s approach limits the amount of handcrafting to a small set of post-processing rules, their system incurs a large computational cost in the over-generation phase and it is difficult to ensure that all of the required semantics are covered by the selected output. More recently, a phrase-based NLG system called BAGEL trained from utterances aligned with coarse-grained semantic concepts has been described [Mairesse et al., 2010, Mairesse and Young, 2014]. By implicitly modelling paraphrases, Bagel can generate linguistically varied utterances. However, collecting semantically-aligned corpora is expensive and time consuming, which limits Bagel’s scalability to new domains.
This paper presents a neural network based NLG system that can be fully trained from dialog act-utterance pairs without any semantic alignments between the two. We start in Section 3 by presenting a generator based on a recurrent neural network language model (RNNLM) [Mikolov et al., 2010, Mikolov et al., 2011a] which is trained on a delexicalised corpus [Henderson et al., 2014] whereby each value has been replaced by a symbol representing its corresponding slot. In a final post-processing phase, these slot symbols are converted back to the corresponding slot values.
While generating, the RNN generator is conditioned on an auxiliary dialogue act feature and a controlling gate to over-generate candidate utterances for subsequent reranking. In order to account for arbitrary slot-value pairs that cannot be routinely delexicalized in our corpus, Section 3.1 describes a convolutional neural network (CNN) [Collobert and Weston, 2008, Kalchbrenner et al., 2014] sentence model which is used to validate the semantic consistency of candidate utterances during reranking. Finally, by adding a backward RNNLM reranker into the model in Section 3.2, output fluency is further improved. Training and decoding details of the proposed system are described in Section 3.3 and 3.4.
Section 4 presents an evaluation of the proposed system in the context of an application providing information about restaurants in the San Francisco area. In Section 4.2, we first show that new generator outperforms ?)’s utterance class LM approach using objective metrics, whilst at the same time being more computationally efficient. In order to assess the subjective performance of our system, pairwise preference tests are presented in Section 4.3. The results show that our approach can produce high quality utterances that are considered to be more natural than a rule-based generator. Moreover, by sampling utterances from the top reranked output, our system can also generate linguistically varied utterances. Section 4.4 provides a more detailed analysis of the contribution of each component of the system to the final performance. We conclude with a brief summary and future work in Section 5.
Related Work
Conventional approaches to NLG typically divide the task into sentence planning, and surface realisation. Sentence planning maps input semantic symbols into an intermediary tree-like or template structure representing the utterance, then surface realisation converts the intermediate structure into the final text [Walker et al., 2002, Stent et al., 2004, Dethlefs et al., 2013]. As noted above, one of the first statistical NLG methods that requires almost no handcrafting or semantic alignments was an n-gram based approach by ?). ?) later addressed the limitations of n-gram LMs in the over-generation phase by using a more sophisticated generator based on a syntactic dependency tree.
Statistical approaches have also been studied for sentence planning, for example, generating the most likely context-free derivations given a corpus [Belz, 2008] or maximising the expected reward using reinforcement learning [Rieser and Lemon, 2010]. ?) train a set of log-linear models to predict individual generation decisions given the previous ones, using only domain-independent features. Along similar lines, by casting NLG as a template extraction and reranking problem, ?) show that outputs produced by an SVM reranker are comparable to human-authored texts.
The use of neural network-based approaches to NLG is relatively unexplored. The stock reporter system ANA by ?) is a network based NLG system, in which the generation task is divided into a sememe-to-morpheme network followed by a morpheme-to-phrase network. Recent advances in recurrent neural network-based language models (RNNLM) [Mikolov et al., 2010, Mikolov et al., 2011a] have demonstrated the value of distributed representations and the ability to model arbitrarily long dependencies for both speech recognition and machine translation tasks. ?) describes a simple variant of the RNN that can generate meaningful sentences by learning from a character-level corpus. More recently, ?) have demonstrated that an RNNLM is capable of generating image descriptions by conditioning the network model on a pre-trained convolutional image feature representation. This work provides a key inspiration for the system described here. ?) describes interesting work using RNNs to generate Chinese poetry.
A specific requirement of NLG for dialogue systems is that the concepts encoded in the abstract system dialogue act must be conveyed accurately by the generated surface utterance, and simple unconstrained RNNLMs which rely on embedding at the word level [Mikolov et al., 2013, Pennington et al., 2014] are rather poor at this. As a consequence, new methods have been investigated to learn distributed representations for phrases and even sentences by training models using different structures [Collobert and Weston, 2008, Socher et al., 2013]. Convolutional Neural Networks (CNNs) were first studied in computer vision for object recognition [Lecun et al., 1998]. By stacking several convolutional-pooling layers followed by a fully connected feed-forward network, CNNs are claimed to be able to extract several levels of translational-invariant features that are useful in classification tasks. The convolutional sentence model [Kalchbrenner et al., 2014, Kim, 2014] adopts the same methodology but collapses the two dimensional convolution and pooling process into a single dimension. The resulting model is claimed to represent the state-of-the-art for many speech and NLP related tasks [Kalchbrenner et al., 2014, Sainath et al., 2013].
Recurrent Generation Model
In detail, the recurrent generator shown in Figure 1 is defined as follows:
The tokenisation resulting from delexicalising slots and values does not work for all cases. For example, some slot-value pairs such as food=dont_care or kids_allowed=false cannot be directly modelled using this technique because there is no explicit value to delexicalise in the training corpus. As a consequence, the model is prone to errors when these slot-value pairs are required. A further problem is that the RNNLM generator selects words based only on the preceding history, whereas some sentence forms depend on the backward context.
To deal with these issues, candidates generated by the RNNLM are reranked using two models. Firstly, a convolutional neural network (CNN) sentence model [Kalchbrenner et al., 2014, Kim, 2014] is used to ensure that the required dialogue act and slot-value pairs are represented in the generated utterance, including the non-standard cases. Secondly, a backward RNNLM is used to rerank utterances presented in reverse order.
A set of convolutional mappings are then applied to the utterance to form a set of feature detectors. The outputs of these detectors are combined and fed into a fully-connected feed-forward network to classify the action type and whether each required slot is mentioned or not.
2 Backward RNN reranking
As noted earlier, the quality of an RNN language model may be improved if both forward and backward contexts are considered. Previously, bidirectional RNNs [Schuster and Paliwal, 1997] have been shown to be effective for handwriting recognition [Graves et al., 2008], speech recognition [Graves et al., 2013], and machine translation [Sundermeyer et al., 2014]. However, applying a bidirectional RNN directly in our generator is not straightforward since the generation process is sequential in time. Hence instead of integrating the bidirectional information into a single unified network, the forward and backward contexts are utilised separately by firstly generating candidates using the forward RNN generator, then using the log-likelihood computed by a backward RNNLM to rerank the candidates.
3 Training
Overall the proposed generation architecture requires three models to be trained: a forward RNN generator, a CNN reranker, and a backward RNN reranker. The objective functions for training the two RNN models are the cross entropy errors between the predicted word distribution and the actual word distribution in the training corpus, whilst the objective for the CNN model is the cross entropy error between the predicted dialogue act and the actual dialogue act, summed over the act type and each slot. An regularisation term is added to the objective function for every 10 training examples as suggested in ?). The three networks share the same set of word embeddings, initialised with pre-trained word vectors provided by ?). All costs and gradients are computed and stochastic gradient descent is used to optimise the parameters. Both RNNs were trained with back propagation through time [Werbos, 1990]. In order to prevent overfitting, early stopping was implemented using a held-out validation set.
4 Decoding
The decoding procedure is split into two phases: (a) over-generation, and (b) reranking. In the over-generation phase, the forward RNN generator conditioned on the given dialogue act, is used to sequentially generate utterances by random sampling of the predicted next word distributions. In the reranking phase, the hamming loss of each candidate is computed using the CNN sentence model and the log-likelihood is computed using the backward RNN. Together with the log-likelihood from the forward RNN, the reranking score is computed as:
This is the reranking criterion used to analyse each individual model in Section 4.4.
In order to severely penalise nonsensical utterances, is set to 100 for both the proposed RNN system and our implementation of ?)’s n-gram based system. This reranking criterion is used for both the automatic evaluation in Section 4.2 and the human evaluation in Section 4.3.
Experiments
The target application area for our generation system is a spoken dialogue system providing information about restaurants in San Francisco. There are 8 system dialogue act types such as inform to present information about restaurants, confirm to check that a slot value has been recognised correctly, and reject to advise that the user’s constraints cannot be met (Table 1 gives the full list with examples); and there are 12 attributes (slots): name, count, food, near, price, pricerange, postcode, phone, address, area, goodformeal, and kidsallowed, in which all slots are categorical except kidsallowed which is binary.
To form a training corpus, dialogues from a set of 3577 dialogues collected in a user trial of a statistical dialogue manager proposed by ?) were randomly sampled and shown to workers recruited via the Amazon Mechanical Turk service. Workers were shown each dialogue turn by turn and asked to enter an appropriate system response in natural English corresponding to each system dialogue act. The resulting corpus contains 5193 hand-crafted system utterances from 1006 randomly sampled dialogues. Each categorical value was replaced by a token representing its slot, and slots that appeared multiple times in a dialogue act were merged into one. This resulted in 228 distinct dialogue acts.
The system was implemented using the Theano library [Bergstra et al., 2010, Bastien et al., 2012]. The system was trained by partitioning the 5193 utterances into a training set, validation set, and testing set in the ratio 3:1:1, respectively. The frequency of each action type and slot-value pair differs quite markedly across the corpus, hence up-sampling was used to make the corpus more uniform. Since our generator works stochastically and the trained networks can differ depending on the initialisation, all the results shown belowExcept human evaluation, in which only one set of network was used. were averaged over 10 randomly initialised networks. The BLEU-4 metric was used for the objective evaluation [Papineni et al., 2002]. Multiple references for each test dialogue act were obtained by mapping them back to the 228 distinct dialogue acts, merging those delexicalised templates that have the same dialogue act specification, and then lexicalising those templates back to form utterances. In addition, the slot error (ERR) as described in Section 3.4, out of 1848 slots in 1039 testing examples, was computed alongside the BLEU score.
2 Empirical Comparison
As can be seen in Table 2, we compare our proposed RNN-based method with three baselines: a handcrafted generator, a k-nearest neighbour method (kNN), and ?)’s n-gram based approach (O&R). The handcrafted generator was tuned over a long period of time and has been used frequently to interact with real users. We found its performance is reliable and robust. The kNN was performed by computing the similarity of the testing dialogue act 1-hot vector against all training examples. The most similar template in the training set was then selected and lexicalised as the testing realisation. We found our RNN generator significantly outperforms these two approaches. While comparing with the O&R system, we found that by partitioning the corpus into more and more utterance classes, the O&R system can also reach a BLEU score of 0.76. However, the slot error cannot be efficiently reduced to zero even when using the error itself as a reranking criterion. This problem is also noted in ?).
In contrast, the RNN system produces utterances without slot errors when reranking using the same number of candidates, and it achieves the highest BLEU score. Figure 3 compares the RNN system with O&R’s system when randomly selecting from the top-5 ranked results in order to introduce linguistic diversity. Results suggest that although O&R’s approach improves as the selection beam increases, the RNN-based system is still better in both metrics. Furthermore, the slot error of the RNN system drops to zero when the selection beam is around 50. This indicates that the RNN system is capable of generating paraphrases by simply increasing the number of candidates during the over-generation phase.
3 Human Evaluation
Whilst automated metrics provide useful information for comparing different systems, human testing is needed to assess subjective quality. To do this, about 60 judges were recruited using Amazon Mechanical Turk and system responses were generated for the remaining 2571 unseen dialogues mentioned in Section 4.1. Each judge was then shown a randomly selected dialogue, turn by turn. At each turn, two utterances were generated from two different systems and presented to the judge who was asked to score each utterance in terms of informativeness and naturalness (rating out of 5), and also asked to state a preference between the two taking account of the given dialogue act and the dialogue context. Here informativeness is defined as whether the utterance contains all the information specified in the dialogue act, and naturalness is defined as whether the utterance could have been produced by a human. The trial was run pairwise across four systems: the RNN system using 1-best utterance RNN1, the RNN system sampling from the top 5 utterances RNN5, the O&R approach sampling from top 5 utterances O&R5, and a handcrafted baseline.
The result is shown in Table 3. As can be seen, the human judges preferred both RNN1 and RNN5 compared to the rule-based generator and the preference is statistically significant. Furthermore, the RNN systems scored higher in both informativeness and naturalness metrics, though the difference for informativeness is not statistically significant. When comparing RNN1 with RNN5, RNN1 was judged to produce higher quality utterances but overall the diversity of output offered by RNN5 made it the preferred system. Even though the preference is not statistically significant, it echoes previous findings [Pon-Barry et al., 2006, Mairesse and Young, 2014] that showed that language variability by paraphrasing in dialogue systems is generally beneficial. Lastly, RNN5 was thought to be significantly better than O&R in terms of informativeness. This result verified our findings in Section 4.2 that O&R suffers from high slot error rates compared to the RNN system.
4 Analysis
In order to better understand the relative contribution of each component in the RNN-based generation process, a system was built in stages training first only the forward RNN generator, then adding the CNN reranker, and finally the whole model including the backward RNN reranker. Utterance candidates were reranked using Equation (8) rather than (9) to minimise manual intervention. As previously, the BLEU score and slot error (ERR) were measured.
Gate The forward RNN generator was trained first with different feature gating factors . Using a selection beam of 20 and selecting the top 5 utterances, the result is shown in Figure 6 for =1 is (equivalent to not using the gate), =0.7, and =0 (equivalent to turning off the feature immediately its corresponding slot has been generated). As can be seen, use of the feature gating substantially improves both BLEU score and slot error, and the best performance is achieved by setting =0.
CNN The feature-gated forward RNN generator was then extended by adding a single convolutional-pooling layer CNN reranker. As shown in Figure 6, evaluation was performed on both the original dataset (all) and the dataset containing only binary slots and don’t care values (hard). We found that the CNN reranker can better handle slots and values that cannot be explicitly delexicalised (1.5% improvement on hard comparing to 1% less on all).
Backward RNN Lastly, the backward RNN reranker was added and trained to give the full generation model. The selection beam was fixed at 100 and the -best top results from which to select the output utterance was varied as , and , trading accuracy for linguistic diversity. In each case, the BLEU score was computed with and without the backward RNN reranker. The results shown in Figure 6 are consistent with Section 4.2, in which BLEU score degraded as more -best utterances were chosen. As can be seen, the backward RNN reranker provides a stable improvement no matter which value is.
Training corpus size Finally, Figure 7 shows the effect of varying the size of the training corpus. As can be seen, if only the 1-best utterance is offered to the user, then around 50% of the data (2000 utterances) is sufficient. However, if the linguistic variability provided by sampling from the top-5 utterances is required, then the figure suggest that more than 4156 utterances in the current training set are required.
Conclusion and Future Work
In this paper a neural network-based natural language generator has been presented in which a forward RNN generator, a CNN reranker, and backward RNN reranker are jointly optimised to generate utterances conditioned by the required dialogue act. The model can be trained on any corpus of dialogue act-utterance pairs without any semantic alignment and heavy feature engineering or handcrafting. The RNN-based generator is compared with an -gram based generator which uses similar information. The -gram generator can achieve similar BLEU scores but it is less efficient and prone to making errors in rendering all of the information contained in the input dialogue act.
An evaluation by human judges indicated that our system can produce not only high quality but linguistically varied utterances. The latter is particularly important in spoken dialogue systems where frequent repetition of identical output forms t.
The work reported in this paper is part of a larger programme to develop techniques for implementing open domain spoken dialogue. A key potential advantage of neural network based language processing is the implicit use of distributed representations for words and a single compact parameter encoding of a wide range of syntactic/semantic forms. This suggests that it should be possible to transfer a well-trained generator of the form proposed here to a new domain using a much smaller set of adaptation data. This will be the focus of our future work in this area.
Acknowledgements
Tsung-Hsien Wen and David Vandyke are supported by Toshiba Research Europe Ltd, Cambridge Research Laboratory.