Adaptive Natural Language Generation for Task-oriented Dialogue via Reinforcement Learning

When a natural language generation (NLG) component is implemented in a real-world task-oriented dialogue system, it is necessary to generate not only natural utterances as learned on training data but also utterances adapted to the dialogue environment (e.g., noise from environmental sounds) and the user (e.g., users with low levels of understanding ability). Inspired by recent advances in reinforcement learning (RL) for language generation tasks, we propose ANTOR, a method for Adaptive Natural language generation for Task-Oriented dialogue via Reinforcement learning. In ANTOR, a natural language understanding (NLU) module, which corresponds to the user’s understanding of system utterances, is incorporated into the objective function of RL. If the NLG’s intentions are correctly conveyed to the NLU, which understands a system’s utterances, the NLG is given a positive reward. We conducted experiments on the MultiWOZ dataset, and we confirmed that ANTOR could generate adaptive utterances against speech recognition errors and the different vocabulary levels of users.


Introduction
In task-oriented dialogue systems, the role of the natural language generation (NLG) component is to convert a system's intentions, called dialogue acts (DAs), into natural language utterances and to convey DAs accurately to users (McTear, 2002;Gao et al., 2019). In recent years, data-driven language generation methods (Wen et al., 2015; using neural networks have been introduced to NLG for task-oriented dialogue systems, enabling natural utterance generation. When such NLG is implemented in a realistic environment, however, it is essential to generate not only natural utterances as learned on training data but also utterances adapted to the dialogue environment and the user. For example, when interacting in a noisy environment, such as in a place with loud background noise or through a telephone, the system needs to use sentences and vocabulary that are less likely to be misrecognized. In addition, if the user is a child or a second language learner, it is necessary to generate utterances in plain terms that the user can easily understand. Therefore, it is essential for the NLG module to adaptively generate utterances for the dialogue environment and the user in real-world situations. However, it is challenging to implement optimal NLG using only supervised learning because it is not practical to create training data for every environment or user. Recently, for many generative tasks, such as machine translation, summary generation, and dialogue generation in open domains, many methods using reinforcement learning (RL) have been proposed. In these studies, non-differentiable objective functions, such as generated text quality and subjective user preferences, are used to optimize the language generation model and achieve high performance.
With this background in mind, this study proposes a method for Adaptive Natural language generation for Task-Oriented dialogue via Reinforcement learning (ANTOR) 1 , which adapts to the dialogue environment and the user. In our method, a reward function using a natural language understanding (NLU) model is set up, and a pretrained NLG model is fine-tuned by using RL. That is, the NLG generates a system utterance for a given DA, and the NLU provides a positive reward if it can successfully recognize the original DA from the utterance. Experiments using the MultiWOZ dataset (Budzianowski et al., 2018) are conducted with multiple environments and users simulating real-world conditions, such as speech recognition errors and the different vocabulary levels of users.
Our contribution is threefold: • We propose ANTOR, a method for fine-tuning NLG for task-oriented dialogue via reinforcement learning. We conducted experiments using MultiWOZ to confirm that ANTOR can generate adaptive utterances for multiple NLUs with different model architectures.
• Experiments were conducted in a noisy environment where speech recognition errors caused by background noise were simulated. The results show that ANTOR could generate utterances with words less likely to cause speech recognition errors.
• Experiments were conducted using NLUs that simulated users with low vocabulary levels.
The results confirmed that ANTOR was able to generate utterances using vocabulary appropriate for each vocabulary level.
2 Related Work 2.1 Natural Language Generation for Task-oriented Dialogue Conventional NLG for task-oriented dialogues had used template-based and rule-based methods (Walker et al., 2002;. There, templates and rules had to be carefully designed manually by experts in each domain. Later, a data-driven method using machine learning was proposed (Oh and Rudnicky, 2002;Angeli et al., 2010;Mairesse and Young, 2014). Kondadadi et al. (2013) proposed a method for statistically generating utterances using k-means clustering and support vector machines. Recently, many generation models based on end-to-end learning have been proposed by using deep learning (Wen et al., 2016;Tran and Nguyen, 2017;Su et al., 2018). Wen et al. (2015) proposed SC-LSTM, which controls utterance generation by using DA feature vectors and reading gates. SC-GPT  is a state-ofthe-art model for MultiWOZ that achieves high performance by fine-tuning the language model GPT-2 (Radford et al., 2019) on a large number of task-oriented dialog datasets. Some end-to-end models (Budzianowski et al., 2018;Chen et al., 2019) generate system utterances directly from a dialogue history instead of using NLG, which is known as a word-level policy. In particular, Zhao et al. (2019) and Mehri et al. (2019) optimize the word-level policy by RL to improve task completion. Although these methods use RL to generate system utterances, they do not deal with the NLG module itself and ways to make it adaptive to environments and users.

Adaptive Natural Language Generation
for Task-oriented Dialogue Methods have been proposed for generating utterances adapted to the user.  used quantitative user modeling for multimodal dialogue to achieve speech production that takes user preferences into account. Janarthanam and Lemon (2010) used RL to create utterances that suit the user's domain knowledge. Dušek and Jurčíček (2016) proposed an NLG that can generate utterances exhibiting entrainment. Furthermore, Mairesse and Walker (2010) proposed PERSONAGE, an NLG that can generate utterances expressing Big Five personality traits. Our study differs from the above studies in that we optimize an existing NLG for the specific objective function of accurately conveying DAs for specific environments and users.

Natural Language Generation with Reinforcement Learning
In recent years, many methods have been proposed that use RL for language generation tasks (Luketina et al., 2019). There are machine translation methods (Wu et al., 2016;Bahdanau et al., 2016) using BLEU as the reward function, summary generation methods (Ranzato et al., 2015;Dong et al., 2018) using ROUGE, and story generation (Tambwekar et al., 2019). In addition, human feedback rather than automatic evaluation metrics is also used in many methods including machine translation (Kreutzer et al., 2018), summary generation (Ziegler et al., 2019;Stiennon et al., 2020), and open-domain dialogue (Hancock et al., 2019;Jaques et al., 2019). Our study examines the applicability of these recent advances to NLG in taskoriented dialogues.
3 Method 3.1 Task Overview Figure 1 shows the overall task performed by NLG in this study. First, NLG takes a reference DA, representing system intentions, converts it into natural language, and outputs a system utterance. The user's NLU then predicts the system's DA (predicted DA) from the system utterance. The goal of ANTOR is to generate utterances such that the pre-  Figure 1: Overview of the task to be performed by NLG. NLG generates system utterance corresponding to reference DA. NLG is evaluated using reference DA and predicted DA, which NLU estimates from system utterance. The ability of User NLU to understand can vary and so can the environment.
dicted DA estimated by the NLU becomes equivalent to the reference DA. Note that this study uses automatic evaluation by comparing the reference DA and predicted DA; more down-to-earth evaluations using user subjective evaluations or user models are left for future work. In the following, the main concepts of the task, namely, DA, system NLG, user NLU, and evaluation, are described.
Dialogue Act The DA is a semantic representation of a system utterance. The reference DA A contains one or more triples consisting of intent I, slot s, and value v: For example, in the restaurant domain, there are intentions such as "inform" and "request" (e.g., "Restaurant-Inform," "Restaurant-Request"). s and v indicate the category (e.g., "Choice" and "Area") and specific information belonging to s, respectively. The first line of the reference DA in Figure  1 indicates the semantics that there are 21 possible restaurants.
System NLG NLG generates a system utterance U on the basis of a given A. In this study, we assume a generative model with neural networks. Using the chain rule, a joint probability over User NLU NLU predicts DA A from U output by NLG. The structure of A is the same as that of A. In this study, we assume a classificationbased prediction model for intent detection and slot tagging. Intent detection performs multi-label classification of an utterance, and slot tagging categorizes each token in an utterance as to which slot it belongs. The training data D for NLG is the same as that for training NLU.
Evaluation The goal of NLG is to generate U such that A = A . Therefore, the rate of concordance between A and A is used to evaluate the NLG. Specifically, we use the F1 score calculated from true positive triples A T P = A∩A , false negative triples A F N = A∩A , and false positive triples A F P = A ∩ A . In addition, following (Wang et al., 2020), Accuracy = |A T P | |A T P |+|A F P |+|A F N | is also used.

Fine-tuning via Reinforcement Learning
ANTOR is optimized by fine-tuning NLG pretrained by MLE in Eq. (2) via RL. We use proximal policy optimization (PPO) (Schulman et al., 2017) for the RL algorithm. We initialize policy π φ by using ρ θ and add a randomly initialized linear layer that outputs a scalar value for a value network. Parameters φ are updated on the basis of the clipped surrogate objective L CLIP (φ). We incorporate an understanding of NLU into the reward for ANTOR. When computing the reward r, each utterance U generated by π φ from A ∼ D is evaluated using A predicted by NLU from U as follows: where idf D (I, s) is the IDF value of (I, s) computed over all intent-slot pairs in D. This weighting of F1 scores compensates for DAs that frequently occur in D (e.g., greetings) and DAs that occur infrequently.
Following Ziegler et al. (2019), to prevent π φ from moving too far from ρ θ , a penalty by Kullback-Leibler (KL) divergence is added to r(A, A ) as the final reward R: where β is the coefficient for the penalty. Algorithm 1 summarizes the fine-tuning process of AN-TOR.
(2) 1: Initialize policy π φ old = ρ θ 2: Randomly initialize value network in π φ old 3: for i = 1, 2, ..., max iteration do We aim to confirm the feasibility of NLG that can robustly respond to the dialogue environment and the user, which does not exist in typical NLG training data. Therefore, we simulate two conditions in the following subsections. Note that D in this section is the same as the data for training NLG in Section 3.1;

Speech Recognition Error
When a dialogue system interacts with a user via voice, it is assumed that background noise makes it difficult for system utterances to be accurately conveyed to the user. Automatic speech recognition (ASR) error simulation is often used to construct a noisy channel between a user and system (Schatzmann et al., 2007;  Word substitution with confusion matrix Figure 2: ASR error simulation to add noise to system utterance et al., 2020). Therefore, we apply perturbations that take the background noise into account to an utterance from NLG by using ASR error simulation. The noisy utterance is then used as input to NLU. Word substitution with a confusion matrix is used in the simulation (Figure 2). The TTS-ASR pipeline (Park et al., 2019) is used to construct the confusion matrix with the following procedure: 1. Convert each U over D to audio data U Audio using a text-to-speech (TTS) system.
2. Create U N oisyAudio by adding background noise to each U Audio .
4. Align words in U and U N oisy with the Levenshtein distance and calculate the frequency of each word substituted and deleted from U to U N oisy , resulting in an N -dimensional confusion matrix M ∈ N 2 . N is the size of vocabulary V = {v 1 , ..., v N } appearing in D or D N oisy . Note that a special token denoting deletion is included in V .
Here, M (i, j) indicates how often a word v i is substituted into v j . When simulating ASR errors, each word w in a system utterance is replaced by a word v j according to the following probability:

Different Vocabulary Levels
In a real environment in which a dialogue system interacts, the users may not have a sufficient vocabulary, such as when they are children or second language learners. Therefore, NLG should use vocabulary and sentences appropriate to the user's vocabulary level. We can simulate the user's vocabulary level by adjusting the training data D for NLU as follows: 1. Prepare a word list L = {v 1 , ..., v |L| } of the desired vocabulary level.

For each
Using the adjusted training data, it is expected that the NLU can understand only the words in L.

Experiments
We wanted to confirm that ANTOR is capable of generating utterances adapted to the dialogue environment and the user. To verify the effectiveness of ANTOR, we conducted experiments using simulations.

Dataset
We used the MultiWOZ dataset (Budzianowski et al., 2018), which is a task-oriented dialogue dataset between a clerk and a tourist at a tourist information center. The dataset contains 10,438 dialogues in seven domains. We used only system utterances annotated with the clerk's DAs. We used a total of 56,750 utterances and DA pairs in the training data of MultiWOZ to train NLG and NLU. In addition, we also used the utterances to construct the confusion matrix used in the ASR error simulation.

Training Setup
ANTOR The 117M parameter version of the GPT-2 language model  was used as a base model. DAs were input to the model as a sequence of intent, slot, and value triples connected by the symbols "+" and "*"; if there were multiple triples, they were connected by commas ", ". In addition, to control generation, special tokens "[ACT]" and " [RSP]" were added at the beginning of the DAs and the system utterance sequences, respectively, in order to indicate the start of each sequence. The following is an example input to the model: [ACT] Inform-Restaurant + Choice * 21, Inform-Restaurant + Area * centre of town [RSP] There are 21 restaurants in the centre of town.
In MLE, GPT-2 was trained on MultiWOZ for five epochs with a batch size of 8, following . We used the Adam optimizer (Kingma and Ba, 2014) with a learning rate of 5e-5, and the learning rate decreased linearly with the number of steps.
For RL, 60 iterations were trained with a batch size of 1,024 (i.e., 1,024 utterances), and each batch was trained in 4 epochs with a minibatch size of 1. The coefficient β of the penalty for the KL divergence was set to 0.1. We use generalized advantage estimation (Schulman et al., 2015) (GAE) with a γ of 1.0 and λ of 0.95. The Adam optimizer was used with a learning rate of 5e-6, and the learning rate decreased linearly with the number of steps.
For fair evaluation, we trained ANTOR with five different random seeds. 7,372 pairs of DAs and system utterances from MultiWOZ test data were used for testing. The average of the five trials was used as the final score. A greedy search was used for utterance generation in a test.
User NLU As NLUs in our experiments, following the work of Liu et al. (2021), who evaluated NLUs with task-oriented dialogues, we used two models, MILU (Hakkani-Tür et al., 2016) and BERT (Devlin et al., 2019). Each model was trained by using pairs of DAs and system utterances from MultiWOZ training data. The learning rates were 1e-3 for MILU and 1e-4 for BERT as in (Liu et al., 2021).

Baselines
To evaluate the performance of ANTOR, we used three comparison models. of task-oriented dialogue datasets and further fine-tuned on MultiWOZ. In fine-tuning, training was done for five epochs with a batch size of 8, as reported in the official repository 3 .
GPT-2  A GPT-2 model fine-tuned on MultiWOZ using only MLE. The hyperparameters and input format were the same as those of ANTOR.

Experimental Procedure
The experiment was conducted in three stages using both MILU and BERT. First, we checked the effectiveness of ANTOR in clean environments with basic task-oriented dialogue. Next, we conducted two experiments: (1) in an ASR error simulation environment and (2) using NLUs trained only with low vocabulary levels. Figure 3 shows the reward and F1 transition of AN-TOR, indicating that the scores increased steadily.  SC-GPT and GPT-2. This BLEU score was calculated by comparing the utterances in MultiWOZ as references and the utterances generated by NLG as hypotheses. This means that ANTOR no longer generated utterances that appear in MultiWOZ in order to generate utterances tailored to NLU.

Conditions for Speech Recognition Error
We trained and evaluated ANTOR in an environment with ASR simulation. Google Cloud Textto-Speech 4 and Speech-to-Text 5 were used for the TTS and ASR in the construction of the confusion matrix (see Section 4.1). The ESC-50 dataset (Piczak, 2015) was used as the background sound source, and it contains a total of 2,000 different sounds in five categories (e.g., natural soundscapes and urban noises). Randomly selected background noise was assigned to each utterance with a signalto-noise ratio (SNR) of 0, 5, 10, and 20 dB. The range was selected so that the word error rate (WER) between original and noisy utterance text would be evenly distributed. Table 2 shows the WER of all of the data generated at each SNR and the percentages of substitution (Sub.), insertion (Ins.), and deletion (Del.) errors. Table 3 shows the evaluation results for each model. Overall, ANTOR showed a higher accuracy and F1 than all three comparison models. These indicate that ANTOR can preferentially generate    Table 5: Percentage of vocabulary levels to which words generated by GPT-2 and ANTOR belong. "w/ MILU" and "w/ BERT" are ANTOR models trained with MILU and BERT, respectively. Note that ANTOR is fine-tuned using NLU trained on data at the CEFR-J level indicated by each column.
words that are less likely to be confused. The above result shows that fine-tuning via RL enabled NLG to generate utterances adapted to the noisy environment, regardless of the noise intensity.

Conditions for Different Vocabulary Levels
We experimented with multiple NLUs trained on data that were gradually filtered along vocabulary levels. For word lists organized by vocabulary level, we used the Common European Framework of Reference (CEFR)'s English Vocabulary Profile 6 . The CEFR defines six levels of language acquisition, from A1 (beginner) to C2 (proficient, comparable to native speakers), with a word list for each level. In our experiment, we used the CEFR-J (Tono and Negishi, 2012) word list for Japanese-English learners 7 . We created four types of training data for NLU by filtering MultiWOZ data with a  focus on the four levels ≤A1, ≤A2, ≤B1, and ≤B2 (see Section 4.2). Note that C1 and C2 were not available in CEFR-J and were not used in our experiment. As a result of the filtering, the number of utterances in the datasets at the ≤A1, ≤A2, ≤B1, and ≤B2 levels was 11,190, 15,538, 24,311, and 28,999 utterances, respectively. ANTOR was trained and evaluated using MILU and BERT trained on each of the four vocabulary levels. Table 4 shows the results. ANTOR outperformed all three comparison models at all vocabulary levels, both with MILU and with BERT. In particular, when using BERT at level ≤A1, the original GPT-2's accuracy and F1 were lower than SC-LSTM and SC-GPT. However, ANTOR had an accuracy and F1 that were significantly improved over the GPT-2 scores by 17.7% and 16.2%, respectively, and it outperformed the scores of SC-LSTM and SC-GPT.
We checked whether the vocabulary in the utterances generated by ANTOR actually changed due to RL. Table 5 shows the percentage of the vocabulary in the utterances that ANTOR had generated during the evaluation when trained with each NLU of each level. Note that stop words and proper nouns were excluded from the calculation. We see that both ANTOR w/ MILU and w/ BERT generated words at each level with a higher frequency than the original GPT-2. From these results, it is considered that the NLG was able to learn utterance generation tailored to the NLU's ability to understand.

Case Study
To see how ANTOR improved the performance of NLU, we analyzed the behavior of ANTOR. In this analysis, we used BERT because we thought that a difference from GPT-2 could be clearly seen since the F1 was improved more by using BERT than MILU as in Table 1. The case studies here are done  in clean environments, but similar behaviors were observed for noisy environments and different user vocabulary levels. First, we listed the intents and slots in the DAs for which the NLU prediction accuracy was considerably improved by the utterances of ANTOR compared with those of GPT-2 (Table 6). Next, we examined the utterances that each model generated from the listed DAs. Table 7 shows examples of utterances generated for (Request-Taxi, Depart) and (Recommend-Restaurant, Price), which have a particularly high occurrence as in Table 6. In case 1, BERT misidentified the train domain instead of the taxi domain from the GPT-2 utterances. In contrast, ANTOR correctly conveyed the DAs by explicitly using the phrase "be picked up." In case 2, the intention of "inform" was conveyed by GPT-2 instead of "recommend." However, ANTOR explicitly used the word "recommend" to correctly convey the DA.
These results suggest that fine-tuning NLG using RL enables NLG to generate utterances adapted to the NLU.
Note that since humans will not have the problems that the NLU had here because humans have a better understanding, we expect ANTOR to adapt differently when interacting with humans.

Summary and Future Work
This paper investigated whether NLG can generate utterances adapted to the dialogue environment and the user via RL. We proposed a method, AN-TOR, and conducted experiments using MultiWOZ to confirm that ANTOR can generate such utterances for multiple NLUs with different model architectures. In addition, we also consistently confirmed the effectiveness of ANTOR for noisy environments and a user's vocabulary levels.
For future work, we plan to evaluate whether ANTOR optimized for NLU is also effective for humans. We are also interested in extending our method for practical use (e.g., real-time adaptation to users in an online dialogue environment). Furthermore, we would like to utilize methods to optimize an entire system with RL, such as (Mehri et al., 2019) and (Ohashi and Higashinaka, 2022), so that all modules of a system can be adapted to users.