For task-oriented dialog systems, training a Reinforcement Learning (RL) based Dialog Management module suffers from low sample efficiency and slow convergence speed due to the sparse rewards in RL. To solve this problem, many strategies have been proposed to give proper rewards when training RL, but their rewards lack interpretability and cannot accurately estimate the distribution of state-action pairs in real dialogs. In this paper, we propose a multi-level reward modeling approach that factorizes a reward into a three-level hierarchy: domain, act, and slot. Based on inverse adversarial reinforcement learning, our designed reward model can provide more accurate and explainable reward signals for state-action pairs. Extensive evaluations show that our approach can be applied to a wide range of reinforcement learning-based dialog systems and significantly improves both the performance and the speed of convergence. I would like to leave on Wednesday from Stevenage. I show a train leaving Stevenage new street at 17:40 and arriving at 20:23 on Wednesday. Will this work? Train Inform Leave 17:40 Train Inform Day Weds That will. Please make a booking for 5 people please. Okay, your reference number is A9NH Cool, I am also looking for restaurant with 4 stars and has free wifi. Train Inform Arrive 20:23 Train Inform Day Weds Train Inform People 5 Train Book RefA9NH Hotel InformInternetyes Hotel InformStars4 I would like to leave on Wednesday from Stevenage. Task-oriented dialog systems have become a focal point in both academic and industrial research and have been playing a key role in conversational assistants such as Amazon Alexa and Ap-ple's Siri. (Budzianowski et al., 2018; Wei et al., 2018; Chen et al., 2019b) Existing research on task-oriented dialog systems mainly includes pipeline and end-to-end methods (Zhang et al., 2020). For pipeline-based systems, usually could be divided into four components: Natural Language Understanding (NLU), Dialog State Tracking (DST), Dialog Management (DM), and Natural Language Generation (NLG). The modular structure makes the systems more interpretable and stable than end-to-end systems, which directly take natural language context as input and output a response. rent belief state (structured information about the current situation) and deciding the next action. Due to its non-differentiable nature, many researchers resort to Reinforcement Learning (RL) to learn a DM (Peng et al., 2017; Casanueva et al., 2018; Chen et al., 2019a; Vu, 2019). However, RL suffers from the problems of low data efficiency and slow convergence speed in dialog management due to reward sparsity and huge action space (Takanobu et al., 2019; Liu and Lane, 2018; Fang et al., 2019). To solve these problems, existing research designs reward models to estimate how similar a state-action pair is to an expert trajectory. Liu and Lane (2018) and Takanobu et al. (2019) combines a Generative Adversarial Network (GAN) with RL to acquire a reward model which could give rewards in turn/dialog level. However, introducing GAN will bring other problems like model instability. To solve this, Li et al. (2020) proposed to train a discriminator and directly use it as a fixed reward estimator during RL training. However, there is no thorough evaluation to analyze the performance of their reward estimator. Besides, researchers ignore the huge action space of RL that has a huge impact on RL's converging speed. In this paper, we propose to interpret a state-action pair from a multi-level and sequential perspective, instead of simply classifying them as right or wrong. Fig. 1 shows an example of multi-domain (Train and Hotel) task-oriented dialog to illustrate our idea. For each utterance, we infer the domain, act, and slot of it to form a three-level hierarchy, leading to more accurate and interpretable modeling of the dialog agent's actions. For example, for the utterance Okay, your reference number is A9NH, the RL agent books a train ticket of A9NH. We infer the domain of the action book is train, and the slot is Ref (reference number) with slot value A9NH. An RL agent will get rewards from the action only if it belongs to an appropriate domain, and will get slot rewards only if it takes suitable action. For example, if the RL agent in Fig. 1 chooses the wrong action Train-Book-Ref: A9NH at the first turn (i.e., direct booking without confirmation from the user), it will only receive rewards for domain, since it should take the action inform instead of book. To construct a multi-level reward model, we propose the following designs. First, we utilize a disentangled autoencoder to factorize and encode a dialog state into three independent latent sub-states, characterizing domain, act, and slot, respectively. Correspondingly, we also design an action decomposer to decompose an action into three sub-actions, taking the first user action in Figure 1 as an example, the decomposer will decompose action "Train-Inform-Day:Weds" into "Train", "In-form" and "Day". Second, we learn a multi-level generator-discriminator framework. The generator generates sub-states and sub-actions from noises, and the discriminator learns to classify whether a sub state-action pair is real or generated. In this way, the learned discriminator can give rewards to a state-action pair in terms of domain, act, and slot. Lastly, we impose Markov property to our multi-level rewards by only rewarding an act/slot if the prior domain/act is appropriate. Such design also alleviates the problem of huge action decision space in RL, as the domain-act-slot hierarchy restricts the choice of act/slot when the domain/act has been decided. We run extensive evaluations to test our multilevel sequential reward model by incorporating it into a variety of RL-based agents. The experimental results demonstrate that our reward model can significantly improve the performance of RL agents and accelerate the speed of convergence. Dialog reward modeling aims to give a proper reward to the action made by an RL agent. Traditional hand-crafted rule-based reward modeling requires expert knowledge and cannot handle unseen actions or situations. Su et al. (2015) proposes a reward shaping method to speed up online policy learning, which models the sum of all rewards in turn level. After that, most researchers tend to exploit GAN by considering an RL agent as a generator and a reward function as a discriminator. Liu and Lane (2018) first introduces the adversarial method for reward computation. It learns a discriminator which can give the probability of authenticity in the dialog level. Takanobu et al. (2019) further expands the adversarial method by inferring a user's goal and giving a proper reward in turn level. However, adding adversarial training to RL will bring potential drawbacks, as training RL is different from normal GAN training whose dataset is fixed, which needs training with the environment and simulated user which is changing all the time. Thus RL and discriminator are training with a moving target rather than a fixed object. It is hard to supervise the adversarial training of generator and discriminator due to no solid feedback. Besides, as claimed in (Li et al., 2020), such adversarial training is only suitable for policy gradient-based methods like Proximal Policy Optimization (PPO), but not working for value-based RL algorithm like Deep Q-Network (DQN). Recently, Li et al. (2020) utilizes a generator to approximate the distribution of expert state-action pairs and trains a discriminator to distinguish them from expert state-action pairs. By introducing a pretraining method, this approach can be extended to both on-policy and off-policy RL methods. However, it is still confused that whether this reward model could give correct rewards. Different from the aforementioned methods, in this paper, our model generates rewards in a more accurate sequential and multi-level manner. We propose a novel multi-level sequential reward estimator and learn it under an Inverse Reinforcement Learning (IRL) framework. IRL aims to learn a reward estimator based on expert data, which are state-action pairs ( S e , A e ) from expert policy. IRL could be formally defined as: E    ( A e |S ) R  ( A e , S )  E   (  A|S ) R  (  A , S ) (1) where the goal is to find an optimal reward function R  , such that based on the same states S , expert dialog policy    will obtain equal or higher rewards than the agent's policy   . We denote expert action and agent action as A e and  A , respectively. Our objective is approximating R  by capturing the distribution of expert dialog f e and estimating how likely a state-action pair is from f e as the reward. To accurately model the expert distribution f e , we disentangle f e into three levels: domain distribution f ed , action distribution f ea , and slot distribution f es . Fig. 2 shows the framework of our multi-level reward estimator. Given a state-action pair from the input and output of a DM module in a pipeline-based system, we combine three components to estimate its quality. First, we acquire sub-states and sub-actions by utilizing a Disentangled Auto-Encoder (DAE) to encode states and a rule-based decomposer to decompose actions. Second, we learn different sub-generators to generate sub-states and sub-actions from noises. Third, we train different sub-discriminators to classify whether a state-action pair is from expert data or agent policy. Besides, we sequentially connect the three discriminators, imposing Markov property to the multilevel rewards, as well as alleviating the problem of huge action space in RL. Finally, the discriminators can serve as reward estimators for domian, action, and slot during inference. Algorithm 1 summarizes the training process of our model components. We introduce more details in the following. We first decompose an action into sub-actions and learn to decompose and encode a state into sub-states from domain, act, and slot level. For action decomposition, we decompose an action A by rules based on how the action vector is defined. Such a rule-based decomposer can be easily implemented by first defining an assignment matrix M , then multiply M with A and select three sub-spans of A to form three sub-actions a d , a a and a s , which are all one-hot vectors. For state decomposition and representation, we decompose a discrete state S into sub-states of domain, act, and slot, and learn a continuous representation of them by DAE. As shown in Fig. 2, the DAE contains three encoders E d , E a and E s to extract and encode the sub-states from S : [ h d ; h a ; h s ] = Encoder ( S ) . To enforce each encoder learn the sub-state corresponding to domain, act and slot respectively, we adopt three auxilary classifiers ( C d , C a and C s ) which classify each sub-state representation ( s d , s a and s s ) with the corresponding sub-action ( a d , a a and a s ) as label. To enhance model generalization, we inject data-dependent noises into latent variables h d , h a and h s . In particular, a noise variance  2 is obtained via the Multilayer Perceptron (MLP) transformation from state S : log  2 = MLP ( S ) . Then we sample noise z from a Gaussian distribution N ( h,  2 I ) . The reparameterization trick (Kingma and Welling, 2013) is further exploited to achieve end-to-end training: [ s d ; s a ; s s ] = h + (cid:15), (cid:15)  N (0 , I ) . In this way, the sub-state representations are different for every training time of input state S , and thus the model is provided with additional flexibil-ity to explore various trade-offs between noise and environment. Next, we reconstruct the state via a decoder:  S = Decoder ([ s d ; s a ; s s ]) . After that, since the state S is a discrete vector, we can learn DAE by minimizing a binary cross entropy loss: The loss for the auxilary classifiers are: where W i  { W d , W a , W s } is the learnable parameters of the classifiers and A i is the action space of the corresponding action level. Therefore, the overall loss for training DAE is given by: LDAE = L dec + (cid:88) i  [ d,a,s ] L ienc . Different from previous adversarial training methods in which generator (policy) and discriminator (reward estimator) are trained alternatively when interacting with a simulated user, our GAN network (Goodfellow et al., 2014) is trained offline without the need of simulated users. As shown in Fig. 2, our discriminator D is composed of Algorithm 1 Reward Estimator Training Require: Expert dialog [ S e : A e ] repeat Training DAE by Eq. three sub-discriminators { D d , D a , D s } , our generator G consists a set of parallel sub-generators { G d , G a , G s , G act } with the same Gaussian noise Z as input to generate sub-states { s zd , s za , s zs } and actioin  A . Then  A is decomposed into { a zd , a za , a zs } by the same rule-based decomposer we described in Sec. 3.1. As a true action A is discrete, we use Straight-Through Gumbel Softmax (Jang et al., 2016) to approximate the sampling process. The generators aim to approximate the distribution of expert dialog ( S e , A e ) by learning distributions { f ed , f ea , f es } of sub state-actions with { G d , G a , G s } and G act . We train the generators by the following loss: LG (  ) = E z  p ( z ) (log(1  D ( G ( z )))) , (8) where  represents the parameters of generator G . For discriminator, it consists of three paralleled and independent MLP networks with a sigmoid output layer. The discriminator outputs three scores { y d , y a , y s } that respectively denote the probability a sub state-action pair is from a true expert distribution. The traininig loss could be written as: LD i =  [ E ( s i ,a i )  f ei log D  i ( s i , a i ) + E z  p ( z ) (1  log D  i ( s zi , a zi ))] , i  [ d, a, s ] . Reward shaping provides an RL agent with extra rewards in addition to the original sparse rewards r ori in a task to alleviate the problem of reward sparsity. We follow the same assumption of (Liu and Lane, 2018; Paek and Pieraccini, 2008), in which state-action pairs similar to expert data will receive higher rewards. The rewards from our discriminators are calculated as: R d = y d , R a = y a  Sigmoid (  ( R d + b )) , R s = y s  Sigmoid (  ( R a + b )) , (10) where { y d , y a , y s } are the outputs of discriminators { D d , D a , D s } in Fig. 2. Note that we impose Markov property into multi-level reward calculation by taking the reward of domain/act level into account when calculating the reward of act/slot level. An agent will receive a low reward when it chooses a wrong domain even if y a or y s is high. We accomplish this by the sigmoid functions in Eq. 10. and b are two hyper-parameters controlling the shape of the sigmoid function. A smaller  will introduce a softer penalty given by prior-level reward. After getting the three-level rewards, we propose two reward integration strategies. The first strategy we denote as R SeqPrd is simply using RS from Eq. 10 as the combined reward. This strategy will bring reward to nearly 1 or 0. The second strategy we denote as R SeqAvg is computing the mean of the three rewards { R d , R a , R s } as the final reward. Finally, we augment the original reward r ori by adding R SeqPrd or R SeqAvg for reward shaping. For the Disentangled Auto-Encoder, the input of its encoder is binary states S . We use three paralleled MLP layers with same hidden size 64 as the sub-encoders to get hidden states { h d , h a , h s } , which are the same with the architecture of the MLP network for generating noise variance  2 . We train the encoder, decoder, and classifier network simultaneously. For the generator part, we utilize four independent and parallel MLP layers. All layers share the same gaussian noise as input. The first three aim to capture the distribution in the field of d , a , s with output size = 64. The output size of G 4 is 300 with an output layer of ST-Gumbel Softmax. To make the output of generators be similar to the encoding representation of DAE and bring noise to the discriminator as well, we further add two MLP networks separately after generation layer to simulate the sampling process of mean and variance. We add weight regularization in a form of l 2 norm to avoid overfitting. In our experiments, the generator is weaker compared to the discriminator, therefore we set the training frequency ratio of generator and discriminator to be 5:1. For the discriminator part, we utilize three parallel MLP layers followed by a sigmoid function as the output layer. Training a multi adversarial network is not easy. Three discriminators will be insensitive to their own field if training all G and D jointly. Thus, we train G and D in the following way. D takes all outputs from G as input, but only chosen sub-generator and sub-discriminator pairs have gradient backpropagation, and others are frozen. During the experiment, we found start training from one pair to two pairs than to all pairs brings good results. Dataset We run evaluations based on the Mul-tiWOZ dataset (Budzianowski et al., 2018) 1 . It is a multi-domain dialog dataset that constructed from human dialog records, mainly ranging from restaurant booking to hotel recommending scenarios. There are 3,406 single-domain dialogs and 7,032 multi-domain dialogs in total. The average number of turns is 8 . 93 and 15 . 39 for single and multi-domain dialogs, respectively. Platform We implement our methods and baselines based on the Convlab platform (Lee et al., 2019) 2 . It is a multi-domain dialog system platform supporting end-to-end system evaluation, which integrates several RL algorithms. Implementation Details For fair comparisons, we follow the same experiment settings in (Li et al., 2020). Specifically, an agenda-based user simulator (Schatzmann et al., 2007) is embedded and exploited to interact with dialog agent. We set the training environment to a dialog-act to dialog-act (DA-to-DA) level, where the agent interacts with a simulated user in a dialog act way rather than an utterance way. We use a rule-based dialog state 1 https://github.com/budzianowski/multiwoz 2 https://github.com/sherlock1987/SeqReward tracker (DST) to track 100% of the user goals. We train on millions of frames (user-system turn pairs) with 392 -dimensional state vectors as inputs and 300 -dimensional action vectors as outputs. For all the RL networks, we use a hidden layer of 100 dimensions and ReLU activation function. Evaluation metrics During the evaluation, the simulated user will generate a random goal first for each conversation and then complete the session successfully if the dialog agent has accomplished all user requirements. We exploit average turn , success rate and reward score to evaluate the efficiency of proposed reward model. In particular, the reward score metric is defined as reward score = (cid:26)  T + 80 , if success  T  40 , if fail (11) where T denotes the number of system-user turns in each conversation session. The performances averaged over 10 times with different random seeds are reported as the final results. Besides, we evaluate our RL models in every 1 , 000 frame (system-user turn) by using 1 , 000 dialogs interacting with a simulated user. We evaluate the proposed reward estimator via two classical RL algorithms: i) Deep Q-Network (DQN) (Mnih et al., 2015), which is a value-based RL algorithm; ii) Proximal Policy Optimization (PPO) (Mnih et al., 2015), which is a policy-based RL algorithm. In terms of the DQN-based methods, we compare our method DQN SeqAvg and DQN SeqPrd (corresponding to R SeqAvg and R SeqPrd , respectively) with DQN vanilla , whose reward function is defined in Eq. 11, and DQN offgan (Li et al., 2020), which also pretrains an reward function to achieve performance gains. Similarly, we also evaluate on Warm-up DQN (WDQN) with different reward function, named WDQN vanilla , WDQN offgan , WDQN SeqAvg and WDQN SeqPrd , respectively. For the implementation details of DQN-based agents, we use (cid:15)  greedy action exploration and set a linear decay from 0 . 1 in the beginning to 0.01 after 500 k frames. We train DQN on 500 batches of size 16 every 200 frames. Besides, we use a relay buffer of size 50 , 000 to stabilize training. In terms of the PPO-based methods, we pick up two adversarial methods: Learning (AIRL) (Takanobu et al., 2019); and ii) Generative Adversarial Imitation Learning (GAIL) (Ho and Ermon, 2016). AIRL works on turn level and gives reward scores based on state-action-state triple ( s t , a t , s t +1 ) . For GAIL, it works on dialog level and gives rewards after dialog ends. Similar to DQNs, we also compare our methods with PPO vanilla and PPO offgan (Li et al., 2020). There is one extra hyperparameter named training epoch for GAIL and AIRL, which represents the training ratio of discriminator and PPO models. Here we set it to 4 . Apart from these, all the other hyperparameters stay the same. Different from the settings for DQN, the (cid:15)  greedy stays 0 . 001 without decay. Besides, we set val-loss-coef to be 1 , meaning no discount for value loss. We also set the training frequency to be 500 frames. From Fig. 3 (a), DQN SeqPrd achieves the best performance with a success rate of 0.990 and converges after 130K, which speeds up the training process by almost 300 % compared to DQN vanilla . Compared with DQN vanilla , the methods using pre-trained reward functions R offgan , R SeqArg , R SeqPrd are better than vanilla in terms of both convergence speed and success rate. This phenomenon suggests that these three reward estimators could speed up dialog policy training. Different from DQN offgan , whose reward function is also learned by adversarial training, we further apply disentangled learning and multi-view discriminator to obtain fine-grained rewards. The performance of DQN SeqPrd and WDQN SeqPrd gains received in convergence speed and final performance of our methods confirm the superiority of the hierarchical reward. For WDQN agent, since first warmed up with human dialogs, the WDQN-based methods share a similar success rate (around 6%) before training and consistently converge faster than DQN-based models. However, the usage of warm-up operation will mislead the model to local optimum and deteriorate the final success rate. This phenomenon can be found in the last 100 frames, the performances of WDQN vanilla and WDQN offgan drop significantly. Another attractive property of our method, compared with WDQN vanilla and WDQN offgan , is the variance of success rate is obviously small, which strongly supports the remarkable benefit of exploiting disentangled representation to learn prof For the policy gradient-based agents, we compare our models with two other strong baselines, i.e., GAIL and AIRL, whose reward functions are updated during RL training. Similar to DQN-based methods, we employ PPO algorithms to train dialog agents with different reward functions. Before training a PPO agent, we perform imitation learning with human dialogs to warm-up PPO agents, achieving around 33% success rate. For fair comparisons, we also pretrain the discriminator in GAIL and reward model in AIRL by feeding positive samples and negative samples from pretrain process of dialog agents. As demonstrated in Fig. 3 (c), although AIRL rises faster than others during the first 50 frames, it converges to a worse result, compared with PPO SeqAvg . An interesting observation is that PPO vanilla even performs better than AIRL. This Model Acc Prec Rec F1 JSR offgan 0.79 0.84 0.76 0.80 1.39 R d 0.86 0.97 0.80 0.88 0.69 R a 0.71 0.91 0.65 0.76 0.14 R s 0.77 0.95 0.69 0.80 0.33 R SeqAvg 0.87 0.91 0.85 0.88 1.00 R SeqPrd 0.87 0.87 0.87 0.87 3.73 Table 2: The accuracy, precision, recall, F1 and JS divergence scores on test dataset with equal number of positive and negative samples. may be due to the fact that adversarial learning is extremely unstable in RL. Therefore, we aim to learn an off-line reward function to guide the evolution of agents, as we motivate in the introduction. In the comparison between PPO offgan and PPO SeqAvg , the performance gains obtained by our model verifies the advantage of exploiting multi-level reward signals. Moreover, it can be seen that, in the PPO-based RL algorithm, the performance of the agent with the reward function R SeqPrd is worse than that of R SeqAvg , but the opposite is true in the DQN and WDQN-based methods. This may be caused by that the multiplicative reward ( i.e., R SeqPrd ) may cause the gradient to be very steep, which makes the training of the policy gradient-based model unstable. However, in the value-based RL method, an average reward ( i.e., R SeqAvg ) might degenerate the performance, as a hierarchical reward is more general and intuitive, which has access to precise intermediate reward signals. The performances of the last frame in terms of success rate , reward score and average turn are shown in Table 1, in which we could claim again that our method PPO SeqAvg outperforms all baseline models by a substantial margin. To visualize the model performance and what benefits a sequential reward will bring, we view the evaluation as a binary classification and distribution distance problem. we use accuracy, precision, recall, and F1 to find out how good this binary model is, and use JS divergence to evaluate the ability of the reward model to divide positive and negative distributions, the larger the better. We construct a test dataset with equal numbers ( 7 , 372 ) of positive and negative samples from the test dataset. All positive samples are original state-action pairs. For negative samples, we fix states and randomly pick actions from those with different domains. We evaluate three reward models separately in Table 2. R d is the best one among the three with the highest five scores. This is pretty straightforward since domain is the first identity to divide action space into groups. And for R a and R s , the JS divergence is lower, this is because some actions could have different domains with the same action-slot. For example, action Train-Inform-Arrive and Hotel-Inform-Arrive have the same action-slot with different domains. Thus, R a and R s will only give an ambiguous decision boundary. But from a sequential view, we make a new combination of R SeqAvg and R SeqPrd , which gives good results. R offgan could give the right rewards to some extent, but from Fig. 4 (c), there is a large intersection between fake and real distributions among three, which means it wrongly classifies fake action as right. And this is the reason why its F1 score is lower. Besides, this reward model is a biased model, its ratio of true negative and true positive samples is 0.89 thus it tends to give fake results. For both of our model, there is little bias, R SeqPrd is 0.99 and R SeqAvg is 0.98, which benefits from sequential combination. For R SeqPrd , R SeqAvg and R offgan , R SeqPrd perform the best, no matter from the view of binary classification or JS divergence. And the distribution is much sharper than R SeqAvg with prediction score centering at 0 or 1. For R SeqAvg , the distribution is softer than R SeqPrd as shown in Fig. 4. Although there is no exact evaluation to say how bad one action is, from the good results of PPO SeqAvg , nearly the same binary classification score with R SeqPrd as well as lower JS divergence, we could get the conclusion that it is the most accurate rewards among the three. We propose a multi-level and sequential reward modeling mechanism that models expert state-action pairs in terms of domain, act, and slot. Our approach combines a disentangled auto-encoder and a generator-discriminator framework to model the distribution of expert state-action pairs. The learned discriminators can thereby serve as a multilevel reward estimator. Experimental results show that our three-level modeling mechanism gives more accurate and explainable reward estimations and significantly boosts the performance of a variety of RL-based dialog agents, as well as accelerating the convergence speed of training. This work was supported by the Tencent Jarvis Lab. We thank Ziming Li, Zhanpeng Huang for the helpful discussions and insightful comments. Thank Kallirroi for leading me into the field of dialogue systems.
abstain abstain objective method result abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain objective result method abstain abstain abstain abstain objective objective objective abstain abstain abstain abstain abstain abstain objective other other other other other other other other other other other other other other method method abstain abstain method method method method method method method method method abstain method method method method abstain method abstain method abstain method abstain method abstain abstain method method abstain abstain abstain method method method method method abstain method abstain abstain abstain abstain method method abstain method abstain abstain abstain method method abstain abstain method method abstain method method method abstain abstain abstain method method method method abstain abstain method abstain method method abstain abstain abstain abstain abstain method abstain method abstain method other method method abstain method abstain abstain method abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain result abstain abstain abstain abstain abstain abstain abstain result abstain abstain abstain abstain abstain abstain abstain result abstain abstain abstain result abstain result abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain abstain result objective method abstain result other other other