Q: Does the model evaluated on NLG datasets or dialog datasets?
Text: Introduction
Natural Language Generation (NLG) plays a critical role in Spoken Dialogue Systems (SDS) with task is to convert a meaning representation produced by the Dialogue Manager into natural language utterances. Conventional approaches still rely on comprehensive hand-tuning templates and rules requiring expert knowledge of linguistic representation, including rule-based BIBREF0 , corpus-based n-gram models BIBREF1 , and a trainable generator BIBREF2 .
Recently, Recurrent Neural Networks (RNNs) based approaches have shown promising performance in tackling the NLG problems. The RNN-based models have been applied for NLG as a joint training model BIBREF3 , BIBREF4 and an end-to-end training model BIBREF5 . A recurring problem in such systems is requiring annotated datasets for particular dialogue acts (DAs). To ensure that the generated utterance representing the intended meaning of the given DA, the previous RNN-based models were further conditioned on a 1-hot vector representation of the DA. BIBREF3 introduced a heuristic gate to ensure that all the slot-value pair was accurately captured during generation. BIBREF4 subsequently proposed a Semantically Conditioned Long Short-term Memory generator (SC-LSTM) which jointly learned the DA gating signal and language model.
More recently, Encoder-Decoder networks BIBREF6 , BIBREF7 , especially the attentional based models BIBREF8 , BIBREF9 have been explored to solve the NLG tasks. The Attentional RNN Encoder-Decoder BIBREF10 (ARED) based approaches have also shown improved performance on a variety of tasks, e.g., image captioning BIBREF11 , BIBREF12 , text summarization BIBREF13 , BIBREF14 .
While the RNN-based generators with DA gating-vector can prevent the undesirable semantic repetitions, the ARED-based generators show signs of better adapting to a new domain. However, none of the models show significant advantage from out-of-domain data. To better analyze model generalization to an unseen, new domain as well as model leveraging the out-of-domain sources, we propose a new architecture which is an extension of the ARED model. In order to better select, aggregate and control the semantic information, a Refinement Adjustment LSTM-based component (RALSTM) is introduced to the decoder side. The proposed model can learn from unaligned data by jointly training the sentence planning and surface realization to produce natural language sentences. We conducted experiments on four different NLG domains and found that the proposed methods significantly outperformed the state-of-the-art methods regarding BLEU BIBREF15 and slot error rate ERR scores BIBREF4 . The results also showed that our generators could scale to new domains by leveraging the out-of-domain data. To sum up, we make three key contributions in this paper:
We review related works in Section "Related Work" . Following a detail of proposed model in Section "Recurrent Neural Language Generator" , Section "Experiments" describes datasets, experimental setups, and evaluation metrics. The resulting analysis is presented in Section "Results and Analysis" . We conclude with a brief summary and future work in Section "Conclusion and Future Work" .
Related Work
Recently, RNNs-based models have shown promising performance in tackling the NLG problems. BIBREF16 proposed a generator using RNNs to create Chinese poetry. BIBREF11 , BIBREF17 , BIBREF18 also used RNNs in a multi-modal setting to solve image captioning tasks. The RNN-based Sequence to Sequence models have applied to solve variety of tasks: conversational modeling BIBREF6 , BIBREF7 , BIBREF19 , machine translation BIBREF20 , BIBREF21
For task-oriented dialogue systems, BIBREF3 combined a forward RNN generator, a CNN reranker, and a backward RNN reranker to generate utterances. BIBREF4 proposed SC-LSTM generator which introduced a control sigmoid gate to the LSTM cell to jointly learn the gating mechanism and language model. A recurring problem in such systems is the lack of sufficient domain-specific annotated data. BIBREF22 proposed an out-of-domain model which was trained on counterfeited data by using semantically similar slots from the target domain instead of the slots belonging to the out-of-domain dataset. The results showed that the model can achieve a satisfactory performance with a small amount of in-domain data by fine tuning the target domain on the out-of-domain trained model.
More recently, RNN encoder-decoder based models with attention mechanism BIBREF10 have shown improved performances in various tasks. BIBREF12 proposed a review network to the image captioning, which reviews all the information encoded by the encoder and produces a compact thought vector. BIBREF9 proposed RNN encoder-decoder-based model by using two attention layers to jointly train content selection and surface realization. More close to our work, BIBREF8 proposed an attentive encoder-decoder based generator which computed the attention mechanism over the slot-value pairs. The model showed a domain scalability when a very limited amount of data is available.
Moving from a limited domain dialogue system to an open domain dialogue system raises some issues. Therefore, it is important to build an open domain dialogue system that can make as much use of existing abilities of functioning from other domains. There have been several works to tackle this problem, such as BIBREF23 using RNN-based networks for multi-domain dialogue state tracking, BIBREF22 using a procedure to train multi-domain via multiple adaptation steps, or BIBREF24 , BIBREF25 adapting of SDS components to new domains.
Recurrent Neural Language Generator
The recurrent language generator proposed in this paper is based on a neural language generator BIBREF8 , which consists of three main components: (i) an Encoder that incorporates the target meaning representation (MR) as the model inputs, (ii) an Aligner that aligns and controls the semantic elements, and (iii) an RNN Decoder that generates output sentences. The generator architecture is shown in Figure 1 . The Encoder first encodes the MR into input semantic elements which are then aggregated and selected by utilizing an attention-based mechanism by the Aligner. The input to the RNN Decoder at each time step is a 1-hot encoding of a token $\textbf {w}_{t}$ and an attentive DA representation $\textbf {d}_{t}$ . At each time step $t$ , RNN Decoder also computes how much the feature value vector $\textbf {s}_{t-1}$ retained for the next computational steps, and adds this information to the RNN output which represents the probability distribution of the next token $\textbf {w}_{t+1}$ . At generation time, we can sample from this conditional distribution to obtain the next token in a generated sentence, and feed it as the next input to the RNN Decoder. This process finishes when an end sign is generated BIBREF17 , or some constraints are reached BIBREF16 . The model can produce a sequence of tokens which can finally be lexicalized to form the required utterance.
Encoder
The slots and values are separated parameters used in the encoder side. This embeds the source information into a vector representation $\textbf {z}_{i}$ which is a concatenation of embedding vector representation of each slot-value pair, and is computed by:
$$\textbf {z}_{i} = \textbf {u}_{i} \oplus \textbf {v}_{i}$$   (Eq. 10)
where $\textbf {u}_{i}$ , $\textbf {v}_{i}$ are the $i$ -th slot and value embedding vectors, respectively, and $\oplus $ is vector concatenation. The i index runs over the $L$ given slot-value pairs. In this work, we use a 1-layer, Bidirectional LSTM (Bi-LSTM) to encode the sequence of slot-value pairs embedding. The Bi-LSTM consists of forward and backward LSTMs which read the sequence of slot-value pairs from left-to-right and right-to-left to produce forward and backward sequence of hidden states ( $\overrightarrow{\textbf {e}_{1}}, .., \overrightarrow{\textbf {e}_{L}}$ ), and ( $\overleftarrow{\textbf {e}_{1}}, .., \overleftarrow{\textbf {e}_{L}}$ ), respectively. We then obtain the sequence of encoded hidden states $\textbf {E}=(\textbf {e}_{1}, \textbf {e}_{2}, .., \textbf {e}_{L})$ where $\textbf {\textbf {e}}_{i}$ is a sum of the forward hidden state $\overrightarrow{\textbf {e}_{i}}$ and the backward one $\textbf {v}_{i}$0 as follows:
$$\textbf {e}_{i}=\overrightarrow{\textbf {e}_{i}} + \overleftarrow{\textbf {e}_{i}}$$   (Eq. 12)
Aligner
The Aligner utilizes attention mechanism to calculate the DA representation as follows:
$$\beta _{t,i} = \frac{\exp e_{t,i} }{\sum \nolimits _{j}\exp e_{t,j}}$$   (Eq. 14)
where
$$e_{t,i}=a(\textbf {e}_{i}, \textbf {h}_{t-1})$$   (Eq. 15)
and $\beta _{t,i}$ is the weight of i-th slot-value pair calculated by the attention mechanism. The alignment model $a$ is computed by:
$$a(\textbf {e}_{i}, \textbf {h}_{t-1}) = \textbf {v}_{a}^{\top }\tanh (\textbf {W}_{a}\textbf {e}_{i} + \textbf {U}_{a}\textbf {h}_{t-1})$$   (Eq. 16)
where $\textbf {v}_{a}, \textbf {W}_{a}, \textbf {U}_{a}$ are the weight matrices to learn. Finally, the Aligner calculates dialogue act embedding $\textbf {d}_{t}$ as follows:
$$\textbf {d}_{t} = \textbf {a} \oplus \sum \nolimits _{i}\beta _{t,i} \textbf {e}_{i}$$   (Eq. 17)
where a is vector embedding of the action type.
RALSTM Decoder
The proposed semantic RALSTM cell applied for Decoder side consists of three components: a Refinement cell, a traditional LSTM cell, and an Adjustment cell:
Firstly, instead of feeding the original input token $\textbf {w}_{t}$ into the RNN cell, the input is recomputed by using a semantic gate as follows:
$$\begin{aligned} \textbf {r}_{t}&=\sigma (\textbf {W}_{rd}\textbf {d}_{t} + \textbf {W}_{rh}\textbf {h}_{t-1})\\ \textbf {x}_{t}&=\textbf {r}_{t} \odot \textbf {w}_{t} \end{aligned}$$   (Eq. 19)
where $\textbf {W}_{rd}$ and $\textbf {W}_{rh}$ are weight matrices. Element-wise multiplication $\odot $ plays a part in word-level matching which not only learns the vector similarity, but also preserves information about the two vectors. $\textbf {W}_{rh}$ acts like a key phrase detector that learns to capture the pattern of generation tokens or the relationship between multiple tokens. In other words, the new input $\textbf {x}_{t}$ consists of information of the original input token $\textbf {w}_{t}$ , the DA representation $\textbf {d}_{t}$ , and the hidden context $\textbf {h}_{t-1}$ . $\textbf {r}_{t}$ is called a Refinement gate because the input tokens are refined by a combination gating information of the attentive DA representation $\textbf {d}_{t}$ and the previous hidden state $\textbf {W}_{rh}$0 . By this way, we can represent the whole sentence based on the refined inputs.
Secondly, the traditional LSTM network proposed by BIBREF26 bahdanau2014neural in which the input gate $\textbf {i}_{i}$ , forget gate $\textbf {f}_{t}$ and output gates $\textbf {o}_{t}$ are introduced to control information flow and computed as follows:
$$\begin{aligned} \begin{pmatrix} \textbf {i}_{t} \\ \textbf {f}_{t} \\ \textbf {o}_{t} \\ \hat{\textbf {c}}_{t} \end{pmatrix} &= \begin{pmatrix}\sigma \\ \sigma \\ \sigma \\ \tanh \end{pmatrix}\textbf {W}_{4n,4n} \begin{pmatrix} \textbf {x}_{t} \\ \textbf {d}_{t} \\ \textbf {h}_{t-1} \end{pmatrix}\\ \end{aligned}$$   (Eq. 20)
where $n$ is hidden layer size, $\textbf {W}_{4n,4n}$ is model parameters. The cell memory value $\textbf {c}_{t}$ is modified to depend on the DA representation as:
$$\begin{aligned} \textbf {c}_{t}&=\textbf {f}_{t}\odot \textbf {c}_{t-1} +\textbf {i}_{t}\odot \hat{\textbf {c}}_{t} + \tanh (\textbf {W}_{cr}\textbf {r}_{t}) \\ \tilde{\textbf {h}}_{t}&= \textbf {o}_{t} \odot \tanh (\textbf {c}_{t}) \end{aligned}$$   (Eq. 21)
where $\tilde{\textbf {h}}_{t}$ is the output.
Thirdly, inspired by work of BIBREF4 in which the generator was further conditioned on a 1-hot representation vector $\textbf {s}$ of given dialogue act, and work of BIBREF27 that proposed a visual sentinel gate to make a decision on whether the model should attend to the image or to the sentinel gate, an additional gating cell is introduced on top of the traditional LSTM to gate another controlling vector $\textbf {s}$ . Figure 6 shows how RALSTM controls the DA vector $\textbf {s}$ . First, starting from the 1-hot vector of the DA $\textbf {s}_{0}$ , at each time step $t$ the proposed cell computes how much the LSTM output $\tilde{\textbf {h}}_{t}$ affects the DA vector, which is computed as follows:
$$\begin{aligned} \textbf {a}_{t}&=\sigma (\textbf {W}_{ax}\textbf {x}_{t} +\textbf {W}_{ah}\tilde{\textbf {h}}_{t})\\ \textbf {s}_{t}&=\textbf {s}_{t-1} \odot \textbf {a}_{t} \end{aligned}$$   (Eq. 22)
where $\textbf {W}_{ax}$ , $\textbf {W}_{ah}$ are weight matrices to be learned. $\textbf {a}_{t}$ is called an $Adjustment$ gate since its task is to control what information of the given DA have been generated and what information should be retained for future time steps. Second, we consider how much the information preserved in the DA $\textbf {s}_{t}$ can be contributed to the output, in which an additional output is computed by applying the output gate $\textbf {o}_{t}$ on the remaining information in $\textbf {s}_{t}$ as follows:
$$\begin{aligned} \textbf {c}_{a}&=\sigma (\textbf {W}_{os}\textbf {s}_{t})\\ \tilde{\textbf {h}}_{a}&= \textbf {o}_{t} \odot \tanh (\textbf {c}_{a}) \end{aligned}$$   (Eq. 23)
where $\textbf {W}_{os}$ is a weight matrix to project the DA presentation into the output space, $\tilde{\textbf {h}}_{a}$ is the Adjustment cell output. Final RALSTM output is a combination of both outputs of the traditional LSTM cell and the Adjustment cell, and computed as follows:
$$\textbf {h}_{t}=\tilde{\textbf {h}}_{t} + \tilde{\textbf {h}}_{a}$$   (Eq. 24)
Finally, the output distribution is computed by applying a softmax function $g$ , and the distribution can be sampled to obtain the next token,
$$\begin{aligned} & P(w_{t+1}\mid w_{t},...w_{0},\textbf {DA})=g(\textbf {W}_{ho}\textbf {h}_{t}) \\ & w_{t+1} \sim P(w_{t+1}\mid w_{t}, w_{t-1},...w_{0},\textbf {DA}) \end{aligned}$$   (Eq. 25)
where $\textbf {DA}=(\textbf {s}, \textbf {z})$ .
Training
The objective function was the negative log-likelihood and computed by:
$$\textbf {F}(\theta ) = -\sum _{t=1}^{T}\textbf {y}_{t}^{\top }\log {\textbf {p}_{t}}$$   (Eq. 27)
where: $\textbf {y}_{t}$ is the ground truth token distribution, $\textbf {p}_{t}$ is the predicted token distribution, $T$ is length of the input sentence. The proposed generators were trained by treating each sentence as a mini-batch with $l_{2}$ regularization added to the objective function for every 5 training examples. The models were initialized with a pretrained Glove word embedding vectors BIBREF28 and optimized by using stochastic gradient descent and back propagation through time BIBREF29 . Early stopping mechanism was implemented to prevent over-fitting by using a validation set as suggested in BIBREF30 .
Decoding
The decoding consists of two phases: (i) over-generation, and (ii) reranking. In the over-generation, the generator conditioned on both representations of the given DA use a beam search to generate a set of candidate responses. In the reranking phase, cost of the generator is computed to form the reranking score $\textbf {R}$ as follows:
$$\textbf {R} = \textbf {F}(\theta ) + \lambda \textbf {ERR}$$   (Eq. 29)
where $\lambda $ is a trade off constant and is set to a large value in order to severely penalize nonsensical outputs. The slot error rate $\textbf {ERR}$ , which is the number of slots generated that is either missing or redundant, and is computed by:
$$\textbf {ERR} = \frac{\textbf {p} + \textbf {q}}{\textbf {N}}$$   (Eq. 30)
where $\textbf {N}$ is the total number of slots in DA, and $\textbf {p}$ , $\textbf {q}$ is the number of missing and redundant slots, respectively.
Experiments
We extensively conducted a set of experiments to assess the effectiveness of the proposed models by using several metrics, datasets, and model architectures, in order to compare to prior methods.
Datasets
We assessed the proposed models on four different NLG domains: finding a restaurant, finding a hotel, buying a laptop, and buying a television. The Restaurant and Hotel were collected in BIBREF4 , while the Laptop and TV datasets have been released by BIBREF22 with a much larger input space but only one training example for each DA so that the system must learn partial realization of concepts and be able to recombine and apply them to unseen DAs. This makes the NLG tasks for the Laptop and TV domains become much harder. The dataset statistics are shown in Table 1 .
Experimental Setups
The generators were implemented using the TensorFlow library BIBREF31 and trained with training, validation and testing ratio as 3:1:1. The hidden layer size, beam size were set to be 80 and 10, respectively, and the generators were trained with a $70\%$ of dropout rate. We performed 5 runs with different random initialization of the network and the training is terminated by using early stopping. We then chose a model that yields the highest BLEU score on the validation set as shown in Table 2 . Since the trained models can differ depending on the initialization, we also report the results which were averaged over 5 randomly initialized networks. Note that, except the results reported in Table 2 , all the results shown were averaged over 5 randomly initialized networks. We set $\lambda $ to 1000 to severely discourage the reranker from selecting utterances which contain either redundant or missing slots. For each DA, we over-generated 20 candidate sentences and selected the top 5 realizations after reranking. Moreover, in order to better understand the effectiveness of our proposed methods, we: (i) performed an ablation experiments to demonstrate the contribution of each proposed cells (Tables 2 , 3 ), (ii) trained the models on the Laptop domain with varied proportion of training data, starting from $10\%$ to $100\%$ (Figure 3 ), (iii) trained general models by merging all the data from four domains together and tested them in each individual domain (Figure 4 ), and (iv) trained adaptation models on merging data from restaurant and hotel domains, then fine tuned the model on laptop domain with varied amount of adaptation data (Figure 5 ).
Evaluation Metrics and Baselines
The generator performance was assessed on the two evaluation metrics: the BLEU and the slot error rate ERR by adopting code from an open source benchmark toolkit for Natural Language Generation. We compared the proposed models against three strong baselines which have been recently published as state-of-the-art NLG benchmarks[]. https://github.com/shawnwun/RNNLG
HLSTM proposed by BIBREF3 thwsjy15 which used a heuristic gate to ensure that all of the slot-value information was accurately captured when generating.
SCLSTM proposed by BIBREF4 wensclstm15 which can jointly learn the gating signal and language model.
Enc-Dec proposed by BIBREF8 wentoward which applied the attention-based encoder-decoder architecture.
Results
We conducted extensive experiments on our models and compared against the previous methods. Overall, the proposed models consistently achieve the better performance regarding both evaluation metrics across all domains in all test cases.
The ablation studies (Tables 2 , 3 ) demonstrate the contribution of different model components in which the models were assessed without Adjustment cell (w/o A), or without Refinement cell (w/o R). It clearly sees that the Adjustment cell contributes to reducing the slot error rate ERR score since it can effectively prevent the undesirable slot-value pair repetitions by gating the DA vector $\textbf {s}$ . A comparison between the ARED-based models (denoted by $^{\sharp }$ in Table 2 ) shows that the proposed models not only have better performance with higher the BLEU score but also significantly reduce the slot error rate ERR score by a large margin about $2\%$ to $4\%$ in every datasets. Moreover, a comparison between the models with gating the DA vector also indicates that the proposed models (w/o R, RALSTM) have significant improved performance on both the evaluation metrics across the four domains compared to the SCLSTM model. The RALSTM cell without the Refinement cell is similar as the SCLSTM cell. However, it obtained the results much better than the SCLSTM baselines. This stipulates the necessary of the LSTM encoder and the Aligner in effectively partial learning the correlated order between slot-value representation in the DAs, especially for the unseen domain where there is only one training example for each DA. Table 3 further demonstrates the stable strength of our models since the results' pattern stays unchanged compared to those in Table 2 .
Figure 3 shows a comparison of three models (Enc-Dec, SCLSTM, and RALSTM) which were trained from scratch on the unseen laptop domain in varied proportion of training data, from $1\%$ to $100\%$ . It clearly shows that the RALSTM outperforms the previous models in all cases, while the Enc-Dec has a much greater ERR score comparing to the two models.
A comparison of top responses generated for some input DAs between different models are shown in Table 4 . While the previous models still produce some errors (missing and misplaced information), the proposed models (RALSTM and the models All2* trained by pooling all datasets together) can generate appropriate sentences. We also found that the proposed models tend to generate more complete and concise sentences than the other models.
All these prove the importance of the proposed components: the Refinement cell in aggregating and selecting the attentive information, and the Adjustment cell in controlling the feature vector (see Examples in Figure 6 ).
Figure 4 shows a comparison performance of general models as described in Section "Experimental Setups" . The results are consistent with the Figure 3 , in which the RALSTM has better performance than the Enc-Dec and SCLSTM on all domains in terms of the BLEU and the ERR scores, while the Enc-Dec has difficulties in reducing the ERR score. This indicates the relevant contribution of the proposed component Refinement and Adjustment cells to the original ARED architecture, in which the Refinement with attentional gating can effectively select and aggregate the information before putting them into the traditional LSTM cell, while the Adjustment with gating DA vector can effectively control the information flow during generation.
Figure 5 shows domain scalability of the three models in which the models were first trained on the merging out-of-domain Restaurant and Hotel datasets, then fine tuned the parameters with varied amount of in-domain training data (laptop domain). The RALSTM model outperforms the previous model in both cases where the sufficient in-domain data is used (as in Figure 5 -left) and the limited in-domain data is used (Figure 5 -right). The Figure 5 -right also indicates that the RALSTM model can adapt to a new, unseen domain faster than the previous models.
Conclusion and Future Work
We present an extension of ARED model, in which an RALSTM component is introduced to select and aggregate semantic elements produced by the Encoder, and to generate the required sentence. We assessed the proposed models on four NLG domains and compared to the state-of-the-art generators. The proposed models empirically show consistent improvement over the previous methods in both the BLEU and ERR evaluation metrics. The proposed models also show an ability to extend to a new, unseen domain no matter how much the in-domain training data was fed. In the future, it would be interesting to apply the proposed model to other tasks that can be modeled based on the encoder-decoder architecture, i.e., image captioning, reading comprehension, and machine translation.
NLG datasets