1 Introduction
Training or programming agents to act intelligently in unstructured and sequential environments is a difficult and central challenge in the field of artificial intelligence. Imitation learning provides an avenue to tackle this challenge by allowing agents to learn from human teachers, which constitutes a natural way for experts to describe the desired behavior and provides an efficient learning signal for the agent. It is thus no surprise that imitation learning has enabled great successes on robotic
(Chernova and Thomaz, 2014) as well as software domains (e.g. Aytar et al. (2018)). Yet, key challenges in the field are diverse and include questions such as how to learn from observations alone (e.g. Aytar et al. (2018)), learning the correspondence between the expert’s demonstrations and the agent’s observations (e.g. Sermanet et al. (2017)) as well as the question of how to integrate imitation learning with other approaches such as reinforcement learning (e.g.
Vecerik et al. (2017)). However, at the core of the imitation learning problems lies the challenge of utilizing a given set of demonstrations to match the expert’s behavior as closely as possible. In this paper, we approach this problem considering the setting where the set of expert demonstrations is given upfront and the dynamics of the environment can only be observed through interaction.In principle, imitation learning could be seen as a supervised learning problem, where the demonstrations are used to learn a mapping from observed states to actions. This solution approach is known as behavioral cloning. However, it has long been known that the sequential structure of the task admits more effective solutions. In particular, the assumptions made in supervised learning are restrictive and don’t allow the agent to reason about the effect of its actions on it’s future inputs. As a result, errors and deviations from demonstrated behavior tend to accumulate over time as small mistakes lead the agent to parts of the observation space that the expert has not explored
(Ross and Bagnell, 2010). In this work, we propose a novel imitation learning algorithm, Generative Predecessor Models for Imitation Learning (GPRIL), based on a simple core insight: Augmenting the training set with stateaction pairs that are likely to eventually lead the agent to states demonstrated by the expert is an effective way to train corrective behavior and to prevent accumulating errors.Recent advances in generative modeling, such as Goodfellow et al. (2014); Kingma and Welling (2013); Van Den Oord et al. (2016b, a); Dinh et al. (2016), have shown great promise at modeling complex distributions and can be used to reason probabilistically about such stateaction pairs. Specifically, we propose to utilize Masked Autoregressive Flows (Papamakarios et al., 2017) to model longterm predecessor distributions, i.e. distributions over stateaction pairs which are conditioned on a state that the agent will see in the future. Predecessor models have a long history in reinforcement learning (e.g. Peng and Williams (1993)) with recent approaches using deep networks to generate offpolicy transitions (Edwards et al., 2018; Pan et al., 2018) or to reinforce behavior leading to highvalue states (Goyal et al., 2018). Here, we use predecessor models to derive a principled approach to statedistribution matching and propose the following imitation learning loop:

Interact with the environment and observe state, action as well as a future state. To encode longterm corrective behavior, these states should be multiple steps apart.

Train a conditional generative model to produce samples like the observed stateaction pair when conditioned on the observed future state.

Train the agent in a supervised way, augmenting the training set using data drawn from the model conditioned on demonstrated states. The additional training data shows the agent how to reach demonstrated states, enabling it to recover after deviating from expert behavior.
In the above, we laid out the sketch of an algorithm that intuitively learns to reason about the states it will observe in the future. In section 3, we derive this algorithm from first principles as a maximum likelihood approach to matching the stateaction distribution of the agent to the expert’s distribution. In section 4, we compare our approach to a stateoftheart imitation learning method (Ho and Ermon, 2016) and show that it matches or outperforms this baseline on our domains while being significantly more sample efficient. Furthermore, we show that GPRIL can learn using demonstrated states alone, allowing for a wider variety of methods to be used to record demonstrations. Together these properties are sufficient to allow GPRIL to be applied in realworld settings, which we demonstrate in section 4.3. To our knowledge this is the first instance of dynamic, contactrich and adaptive behavior being taught solely using the kinestheticteaching interface of a collaborative robot, without resorting to teleoperation, auxiliary reward signals, or manual taskdecomposition.
2 Background
2.1 Markov decision processes without rewards
As is usual, we model the problem as a Markov decision process without reward. That is, given state and action sets
, the agent is observing states and taking actions . In this work, we use and to refer to states and actions observed during selfsupervision and and to refer to target and demonstration states and actions. We furthermore use superscripts to refer to specific instances, e.g. specific demonstrated stateaction pairs, and subscripts, e.g., to indicate temporal sequences. The observed transitions are guided by the Markovian dynamics of the environment and the probability of transitioning from state
to state by taking action is denoted as . The agent’s behavior is defined by a stationary parametric policy while the expert’s behavior is modeled by a stationary distribution . We denote as the probability of observing state at timestep when following policy . Under the usual ergodicity assumptions, each such policy induces a unique stationary distribution of observed states as well as a stationary joint stateaction distribution . Furthermore, we useto refer to the dynamics of the time reversed Markov chain induced by a particular policy
at timestep t(1) 
and define . For the purposes of this work, we handle the episodic case with clear termination conditions by adding artificial transitions from terminal states to initial states. This creates a modified, ergodic MDP with identical statedistribution and allows us to assume arbitrarily large such that . Finally, we extend this notation to multistep transitions by writing .
2.2 Imitation learning
In this work, we are considering two settings of imitation learning. In the first setting, the agent is given a set of observed states and observed corresponding actions as expert demonstrations. The goal in this setting is to learn a policy that matches the expert’s behavior as closely as possible. In the second setting, the agent is given the states observed by the expert but is not aware of the actions the expert has taken. Recent years have seen heightened interest in a related setting where to goal is to track expert state trajectories (Zhu et al., 2018; Peng et al., 2018; Pathak et al., 2018). These approaches do not learn general policies that can adapt to unseen situations. A straightforward approach to train general policies in the first setting, usually referred to as behavioral cloning, is to treat the task as a supervised learning problem (e.g. Pomerleau (1989)). However, as outlined in section 1, predictions made by influence future observations thus violating a key assumption of supervised learning, which states that inputs are drawn from an i.i.d. distribution. This has formally been analyzed by Ross et al. who introduce a family of algorithms (e.g. Ross and Bagnell (2010); Ross et al. (2011)) that provably avoid this issue. However, these approaches require the expert to continuously provide demonstrations and thus are not applicable when the set of demonstrations is assumed to be fixed. A popular avenue of research that considers this setting is inverse reinforcement learning (IRL). Inverse reinforcement learning (Ng and Russell, 2000) aims to learn a reward function for which is optimal and thus captures the intent of the expert. The arguably most successful approach to IRL aims to match the stateaction distribution to that of the demonstrations (Ziebart et al., 2008) with recent approaches extending these ideas to the model free case (Boularias et al., 2011; Finn et al., 2016; Fu et al., 2018).
However, inverse reinforcement learning is indirect and illdefined as many reward functions induce the same behavior. Recently, methods have been proposed that aim to match stateaction distributions directly and achieve stateoftheart result without learning a reward function first. Generative Adversarial Imitation Learning (GAIL) (Ho and Ermon, 2016) uses an adversarial objective, training a discriminator to identify demonstrations and using TRPO to train a policy that fools the discriminator. While GAIL is able to achieve impressive results, the adversarial objective can make the learning procedure unstable and unpredictable. This is especially true when parts of the statespace are not under the agent’s control, yielding a setting resembling a conditional GAN (Mirza and Osindero, 2014), which are prone to issues such mode collapse (Odena et al., 2017). We compare our approach with GAIL in section 4. State Aware Imitation Learning (SAIL) (Schroecker and Isbell, 2017)
is an alternative method that aims to learn the gradient of the stateaction distribution using a temporaldifference update rule. This approach is able to avoid instabilities prompted by the adversarial learning rule but is only applicable to policies with a small number of parameters where learning a representation of the gradient is feasible. In this work, we follow a gradient descent approach similar to SAIL but estimate the gradient without representing it explicitly by a neural network. These methods can also be used to match statedistributions without actions. While the order of states is unspecified and the induced policy is therefore not unique, including transition information such as velocities can allow the agent to learn solely from expert state trajectories nonetheless.
2.3 Generative models
Recent years have seen great advances in deep generative models. A variety of approaches such as Generative Adversarial Networks (Goodfellow et al., 2014), Variational Auto Encoders (Kingma and Welling, 2013), autoregressive networks (e.g. Germain et al. (2015); Van Den Oord et al. (2016b, a) and normalizing flows (Dinh et al., 2016) have been proposed which enable us to learn complex distributions and efficiently generate samples. In this work, we use generative models to model the distribution of longterm predecessor stateaction pairs. While the approach we propose is model agnostic, we choose to model this distribution using masked autoregressive flows (Papamakarios et al., 2017)
(MAF). MAFs are trained using a maximum likelihood objective, which allows for a stable and straightforward training procedure. Autoregressive models are capable of representing complex distributions
by factoring the distribution and learning a model for each . In this paper, we model each to be distributed by where each and is a function of. Masked autoencoders
(Germain et al., 2015)provide a straightforward approach to parameter sharing and allow representing these functions using a single network. MAFs stack multiple autoregressive models with different orderings and thus avoid the strong inductive bias imposed by the order of variables. Using the reparameterization trick, the autoregressive model can be seen as a deterministic and invertible transformation of a random variable:
. The change of variable formula then allows us to calculate the density of :(2) 
Where the autoregressive nature of in eq. 2 allows for tractable computation of the second term. MAFs chain multiple such transformations to derive highly expressive explicit density models able to model complex dynamics between target states and longterm predecessor stateaction pairs.
3 Gpril
In section 1, we provided an intuitive framework for using predecessor models to augment our training set and achieve robust imitation learning from few samples. In this section, we will derive this algorithm based on stateaction distribution matching. To this end, we first derive the gradient of the logarithmic state distribution based on samples from a longterm predecessor distribution that we will define below. In section 3.2, we describe how to train a generative model of the predecessor distribution, which will allow us to evaluate this gradient. Ascending on this gradient evaluated at demonstrated states leads the agent to stick to those states and thus provides a corrective measure (Schroecker and Isbell, 2017). Furthermore, reproducing the states of the expert can be sufficient to achieve the correct behavior if the statespace is chosen appropriately as we will show in section 4. We will show how to use this gradient to match stateactiondistributions in section 3.3.
3.1 Estimating the gradient of the state distribution
Here, we will show that the samples drawn from a longterm predecessor distribution conditioned on enable us to estimate the gradient of the logarithmic state distribution and, later, to match the agent’s stateactiondistribution to that of the expert. To achieve this goal, we can utilize the fact that the stationary state distribution of a policy can be defined recursively in terms of the state distribution at the previous time step, similar to Morimura et al. (2010):
(3) 
Taking the derivative shows that this notion extends to the gradient as well as its logarithm:
(4)  
(5) 
The recursive nature of this gradient then allows us to unroll the gradient indefinitely. However, this process is cumbersome and will be left for appendix A. We arrive at the following equality:
(6) 
The derivation of our approach now rests on two key insights: First, in ergodic Markov chains, such as the ones considered in our setting, decisions that are made at time affect the probability of seeing state at time more strongly if is small. In the limit, as , the expectation of the gradient vanishes and the decision at time
only adds variance to the gradient estimate. Introducing a discount factor
similar to common practice in reinforcement learning (Sutton and Barto, 1998) places more emphasis on decisions that are closer in time and can thus greatly reduce variance. We explore this interpretation further in appendix C. Second, by introducing a discount factor, the effective timehorizon is now finite. This allows us to replace the sum over all states and actions in each trajectory with a scaled expectation over stateaction pairs. Formally, we can write this as follows and arrive at our main result:(7)  
where corresponds to the longterm predecessor distribution modeling the distribution of states and actions that, under the current policy , will eventually lead to the given target state :
(8) 
3.2 Longterm generative predecessor models
In the previous section, we derived the gradient of the logarithm of the stationary state distribution as approximately proportional to the expected gradient of the log policy, evaluated at samples obtained from the longterm predecessor distribution . In this work, we propose to train a model to represent and use its samples to estimate
. However, rather than unrolling a timereversed Markov model in time, which is prone to accumulated errors, we propose to use a generative model to directly generate jumpy predictions. We have furthermore found that imposing a sensible order on autoregressive models achieves good results and thus propose to use two conditional MAFs
(Papamakarios et al., 2017) in a factored representation:(9) 
To train this model, we collect training data using selfsupervised rollouts: We sample states, actions and targetstates where the separation in time between the state and targetstate is selected randomly based on the geometric distribution parameterized by
as a training set for .Training data for are obtained by executing the current policy to obtain a sequence , which we store in a replay buffer. In practice, we store data from multiple iterations in this buffer in order to decrease the variance of the gradient. While our algorithm does not explicitly account for offpolicy samples, we found empirically that a short replay buffer does not degrade final performance while significantly improving sample efficiency. To obtain a training sample, we first pick and for a random . We now select a future state from that sequence. For any particular we now have . Note that in the episodic case, we can add transitions from terminal to initial states and pick to be arbitrarily large such that the approximate equality becomes exact (as outlined in section 2.1). In nonepisodic domains, we find the approximation error to be small for most . Finally, we choose at random according to a geometric distribution and have a training triple that can be used to train and as it obeys
(10) 
3.3 Matching stateaction distributions with GPRIL
Stateaction distribution matching has been a promising approach to sampleefficient and robust imitation learning (see section 2.2
). While each policy induces a unique distribution of states and behavioral cloning would therefore be sufficient in the limit, it is suboptimal the case of limited data. Matching the jointdistribution directly ensures that we minimize discrepancies between everything we observed from the expert and the behavior the agent exhibits. In this work, we propose a maximum likelihood based approach, ascending on the estimated gradient of the joint distribution:
(11) 
where can be computed directly by taking the gradient of the policy using the demonstrated stateaction pairs and can be evaluated using samples drawn from according to equation 7. We introduce scaling factors and
to allow for finer control, interpolating between matching states only (
) and behavioral cloning () and have:(12) 
Here, higher values of provide more supervised guidance while lower values aim to prevent accumulating errors. This gives rise to the fullalgorithm: We fill the replay buffer by asynchronously collecting experience using the current policy. Simultaneously, we repeatedly draw samples from the replay buffer to update the predecessor models and use expert samples in combination with an equal number of artificial samples to update the policy. This procedure is described fully in algorithm 1.
4 Experiments
To evaluate our approach, we use a range of robotic insertion tasks similar to the domains introduced by Vecerik et al. (2017) but without access to a reward signal or, in some cases, expert actions. We choose these domains both for their practical use, and because they highlight challenges faced when applying imitation learning to the real world. Specifically, collecting experience using a robot arm is costly and demands efficient use of both demonstrations and autonomously gathered data. Furthermore, insertion tasks typically require complex searching behavior and cannot be solved by openloop tracking of a given demonstration trajectory when the socket position is variable. We first compare against stateoftheart imitation learning methods on a simulated clip insertion task, then explore the case of extremely sparse demonstrations on a simulated peg insertion task and finally, demonstrate realworld applicability on its physical counterpart.

Average success rate and 95% confidence interval of GAIL with 25 demonstrations across 10 runs (evaluated over 100 rollouts).
c) Average success rate of GPRIL across 5 seeds. Unlike GAIL, the performance of GPRIL doesn’t drop off when provided with only final states. d) Average success rate and confidence interval of GPRIL. Final performance after iterations increases steadily as the number of demonstrated trajectory increases but is unaffected by dropping steps from each demonstration. e) Median length and IQR of trajectories that are successfully inserting the peg. Providing only final states is significantly faster. f) Best seed performance on both variations of peg insertion on the real robot.4.1 Clip insertion
In the first task, a simulated robot arm has to insert an elastic clip into a plug, which requires the robot to first flex the clip in order to be able to insert it (see figure 0(a)). In realworld insertion tasks, the pose of the robot, the socket, or the grasped object may vary. We capture this variability by mounting the socket on a pantilt unit, which is randomized by (pan) and radians (tilt). To perform this behavior, the robot observes proprioceptive features, specifically joint position, velocity and torques as well as the position of the endeffector and the socket orientation as a unit quaternion. The task terminates when the robot leaves the workspace, reaches the goal, or after 50 seconds.
For comparative evaluation, we train a policy network to predict mean and variance, modelling a multivariate normal distribution over target velocities and train it using GPRIL, GAIL as well as behavioral cloning. We record expert demonstrations using teleoperation and normalize observations based on the recorded demonstrations. We then train GPRIL using a single asynchronous simulation and compare against the open source implementation of GAIL
^{1}^{1}1https://github.com/openai/baselines/tree/master/baselines/gailfor which we use 16 parallel simulations. We select the best hyper parameters for GAIL found on a grid around the hyperparameters used by
Ho and Ermon (2016) but lower the batch size to 256 as it increases the learning speed and accounts for the significantly slower simulation of the task. We furthermore enable bootstrapping regardless of whether or not the episode terminated. As all discriminator rewards are positive, handling terminal transitions explicitly can induce a bias towards longer episodes. This is beneficial in the domains used by Ho and Ermon but harmful in domains such as ours where the task terminates on success. A detailed list of hyperparameters can be found in appendix B.We report final results after convergence and can see in figure 0(b) that both GAIL and GPRIL outperform behavioral cloning, indicating that generalizing over stateaction trajectories requires fewer demonstrations than generalizing over actions alone. Furthermore, we observe a higher success rate using GPRIL and find that policies trained using GPRIL are more likely to retry insertion if the robot slides the clip past the insertion point. To compare sample efficiency of GPRIL to GAIL, we limit the rate at which the asynchronous actor is collecting data. While sample efficiency of GAIL could be increased by decreasing batch size or increasing various learning rates, we found that this can lead to unstable learning performance while reducing the amount of samples required by only a small amount. As can be seen in figure 0(c), GPRIL requires several orders of magnitudes fewer environment interactions to learn this task. Finally, we evaluate the case where the expert’s actions are unknown. Since the statespace includes information about joint velocities as well as positions, we find that matching the statedistribution is sufficient to solve the task. GPRIL can achieve this by setting and . As can be seen in figure 0(d), performance deteriorates only marginally with a similar difference in performance between both methods.
4.2 Peg insertion with partial demonstrations
The second task is a simulated version of the peginsertion task depicted in figure 1(a). In this task, the robot has to insert the peg into the hole, which is again mounted on a pantilt that randomly assumes pan and tilt angles varying by 0.4 and 0.1 respectively. Hyperparameters are largely identical and we report minor differences in appendix B. Observation and action space are identical with the exception of the omission of torques from the observation space as they are not necessary to solve this task. We use this task to evaluate the performance of GAIL and GPRIL when learning from only a very limited set of demonstrated states. To this end, we compare three different scenarios in which the demonstrations are sparsified to varying degrees: In the first case, the agent has access to the full statetrajectories of the expert, in the second only every tenth state is available and in the third the agent sees only the final state of each of the 25 trajectories. Being able to learn from only partial demonstrations is a useful benchmark for the effectiveness of imitation learning methods but can also provide a convenient way of providing demonstrations and can free the agent to find more optimal trajectories between states (see for example Akgun et al. (2012); Schroecker et al. (2016)). As can be seen in figures 1(d) and 1(e), GPRIL achieves similar final success rates in all three scenarios while being able to learn a significantly faster insertion policy when learning from final states alone. We find that in the first two scenarios, this holds for GAIL as well as can been in figure 1(b) while in the third case, GAIL becomes highly unstable and the resulting performance can vary wildly, leading to a low average success rate. We hypothesize that these instabilities are a result of the discriminator overfitting to the very small amount of negative samples in its training data.
4.3 Peg insertion on a physical system
In previous sections we demonstrated sampleefficiency that indicates applicability of GPRIL to realworld physical systems. To test this, we evaluate our approach on two variations of the physical peginsertion task depicted in figure 1(a), involving a physical pantilt unit which is fixed in one scenario and has pan and tilt angles varying by and radians in the second scenario. For each scenario, we provide 20 demonstrations using kinesthetic teaching, which constitutes a natural way of recording demonstrations but provides statetrajectories only (Chernova and Thomaz, 2014). Hyperparameters are altered from section 4.2 to trade off a small margin of accuracy for higher learning speeds and are reported in appendix B. Note, however, that tuning hyperparameters precisely is very difficult on a physical system. As can be seen in figure 1(f), GPRIL is able to learn a successful insertion policy that generalizes to unseen insertion angles using just a few hours of environment interactions^{2}^{2}2Total time to collect and train on 2000 rollouts was 18.5 and 16.5 hours on the fixed and changing versions of the task respectively. However, GPRIL converged to good policies significantly sooner.. We report bestseed performance as we observe a high amount of variability due to factors outside the agent’s control, such as the pantilt unit not reporting accurate information after physical contact with the robot. However, we wish to point out that the increased difficulty due to less predictable control is also likely to introduce additional variance that could be reduced further with careful design of exploration noise and other hyperparameters. We furthermore provide a video of the training procedure and final policy to highlight the efficiency of our method^{3}^{3}3https://youtu.be/Dm0OCNujEmE.
5 Conclusion
We introduced GPRIL, a novel algorithm for imitation learning which uses generative models to model multistep predecessor distributions and to perform stateaction distribution matching. We show that the algorithm compares favorably with stateoftheart imitation learning methods, achieving higher or equivalent performance while requiring several orders of magnitude fewer environment samples. Importantly, stability and sampleefficiency of GPRIL are sufficient to enable experiments on a real robot, which we demonstrated on a peginsertion task with a variableposition socket.
References

Akgun et al. (2012)
Akgun, B., M. Cakmak, J. W. Yoo, and A. L.
Thomaz
2012. Trajectories and keyframes for kinesthetic teaching: a humanrobot interaction perspective. In International Conference on HumanRobot Interaction, Pp. 391–398. 
Aytar et al. (2018)
Aytar, Y., T. Pfaff, D. Budden, T. L. Paine, Z. Wang, and
N. de Freitas
2018. Playing hard exploration games by watching YouTube. arXiv preprint arXiv:1805.11592. 
Boularias et al. (2011)
Boularias, A., J. Kober, and J. Peters
2011. Relative entropy inverse reinforcement learning. In Proceedings of the Fourteenth International Conference on Artificial Intelligence and Statistics, Pp. 182–189. 
Chernova and Thomaz (2014)
Chernova, S. and A. L. Thomaz
2014. Robot learning from human teachers.Synthesis Lectures on Artificial Intelligence and Machine Learning
, 8(3):1–121. 
Dinh et al. (2016)
Dinh, L., J. SohlDickstein, and S. Bengio
2016. Density estimation using Real NVP. arXiv preprint arXiv:1605.08803. 
Edwards et al. (2018)
Edwards, A. D., L. Downs, and J. C. Davidson
2018. Forwardbackward reinforcement learning. arXiv preprint arXiv:1803.10227. 
Finn et al. (2016)
Finn, C., S. Levine, and P. Abbeel
2016. Guided cost learning: Deep inverse optimal control via policy optimization. In International Conference on Machine Learning, Pp. 49–58. 
Fu et al. (2018)
Fu, J., K. Luo, and S. Levine
2018. Learning robust rewards with adverserial inverse reinforcement learning. In International Conference on Learning Representations. 
Germain et al. (2015)
Germain, M., K. Gregor, I. Murray, and
H. Larochelle
2015. Made: Masked autoencoder for distribution estimation. In International Conference on Machine Learning, Pp. 881–889. 
Goodfellow
et al. (2014)
Goodfellow, I., J. PougetAbadie, M. Mirza, B. Xu, D. WardeFarley, S. Ozair,
A. Courville, and Y. Bengio
2014. Generative adversarial nets. In Advances in Neural Information Processing Systems, Pp. 2672–2680. 
Goyal et al. (2018)
Goyal, A., P. Brakel, W. Fedus, T. Lillicrap, S. Levine, H. Larochelle, and
Y. Bengio
2018. Recall traces: Backtracking models for efficient reinforcement learning. arXiv preprint arXiv:1804.00379. 
Ho and Ermon (2016)
Ho, J. and S. Ermon
2016. Generative adversarial imitation learning. In Advances in Neural Information Processing Systems, Pp. 4565–4573. 
Kingma and Welling (2013)
Kingma, D. P. and M. Welling
2013. Autoencoding variational bayes. CoRR, abs/1312.6114. 
Mirza and Osindero (2014)
Mirza, M. and S. Osindero
2014. Conditional generative adversarial nets. arXiv preprint arXiv:1411.1784. 
Morimura et al. (2010)
Morimura, T., E. Uchibe, J. Yoshimoto, J. Peters, and
K. Doya
2010. Derivatives of logarithmic stationary distributions for policy gradient reinforcement learning. Neural computation, 22(2):342–376. 
Ng and Russell (2000)
Ng, A. and S. Russell
2000. Algorithms for inverse reinforcement learning. In International Conference on Machine Learning, Pp. 663–670. 
Odena et al. (2017)
Odena, A., C. Olah, and J. Shlens
2017.Conditional image synthesis with auxiliary classifier GANs.
In International Conference on Machine Learning, Pp. 2642–2651. 
Pan et al. (2018)
Pan, Y., M. Zaheer, A. White, A. Patterson, and
M. White
2018. Organizing experience: a deeper look at replay mechanisms for samplebased planning in continuous state domains. In International Joint Conference on Artificial Intelligence, Pp. 4794–4800. 
Papamakarios
et al. (2017)
Papamakarios, G., I. Murray, and T. Pavlakou
2017. Masked autoregressive flow for density estimation. In Advances in Neural Information Processing Systems, Pp. 2335–2344. 
Pathak et al. (2018)
Pathak, D., P. Mahmoudieh, G. Luo, P. Agrawal, D. Chen, Y. Shentu,
E. Shelhamer, J. Malik, A. A. Efros, and
T. Darrell
2018. Zeroshot visual imitation. In International Conference on Learning Representations. 
Peng and Williams (1993)
Peng, J. and R. J. Williams
1993. Efficient learning and planning within the dyna framework. Adaptive Behavior, 1(4):437–454. 
Peng et al. (2018)
Peng, X. B., P. Abbeel, S. Levine, and M. van de
Panne
2018. Deepmimic: Exampleguided deep reinforcement learning of physicsbased character skills. arXiv preprint arXiv:1804.02717. 
Pomerleau (1989)
Pomerleau, D. A.
1989. Alvinn: An autonomous land vehicle in a neural network. In Advances in Neural Information Processing Systems, Pp. 305–313. 
Ross and Bagnell (2010)
Ross, S. and D. Bagnell
2010. Efficient reductions for imitation learning. In International Conference on Artificial Intelligence and Statistics, Pp. 661–668. 
Ross et al. (2011)
Ross, S., G. Gordon, and D. Bagnell
2011. A reduction of imitation learning and structured prediction to noregret online learning. In International Conference on Artificial Intelligence and Statistics, Pp. 627–635. 
Schroecker et al. (2016)
Schroecker, Y., H. Ben Amor, and A. Thomaz
2016. Directing policy search with interactively taught viapoints. In International Conference on Autonomous Agents & Multiagent Systems, Pp. 1052–1059. 
Schroecker and Isbell (2017)
Schroecker, Y. and C. L. Isbell
2017. State aware imitation learning. In Advances in Neural Information Processing Systems, Pp. 2915–2924. 
Sermanet et al. (2017)
Sermanet, P., C. Lynch, Y. Chebotar, J. Hsu, E. Jang, S. Schaal, and
S. Levine
2017. Timecontrastive networks: selfsupervised learning from video. arXiv preprint arXiv:1704.06888. 
Sutton and Barto (1998)
Sutton, R. S. and A. G. Barto
1998. Reinforcement learning: An introduction. MIT press. 
Sutton et al. (1999)
Sutton, R. S., D. A. McAllester, S. P. Singh, Y. Mansour, and
Others
1999. Policy Gradient Methods for Reinforcement Learning with Function Approximation. In Advances in Neural Information Processing Systems, Pp. 1057–1063. 
Tsitsiklis and
Van Roy (1997)
Tsitsiklis, J. N. and B. Van Roy
1997. Analysis of temporaldiffference learning with function approximation. In Advances in Neural Information Processing Systems, Pp. 1075–1081. 
Van Den Oord et al. (2016a)
Van Den Oord, A., S. Dieleman, H. Zen, K. Simonyan, O. Vinyals, A. Graves,
N. Kalchbrenner, A. Senior, and K. Kavukcuoglu
2016a. Wavenet: A generative model for raw audio. arXiv preprint arXiv:1609.03499. 
Van Den Oord et al. (2016b)
Van Den Oord, A., N. Kalchbrenner, and
K. Kavukcuoglu
2016b. Pixel recurrent neural networks. arXiv preprint arXiv:1601.06759. 
Vecerik et al. (2017)
Vecerik, M., T. Hester, J. Scholz, F. Wang, O. Pietquin, B. Piot, N. Heess,
T. Rothörl, T. Lampe, and M. A.
Riedmiller
2017. Leveraging demonstrations for deep reinforcement learning on robotics problems with sparse rewards. CoRR, abs/1707.08817. 
Zhu et al. (2018)
Zhu, Y., Z. Wang, J. Merel, A. Rusu, T. Erez, S. Cabi, S. Tunyasuvunakool,
J. Kramár, R. Hadsell, N. de Freitas,
et al.
2018. Reinforcement and imitation learning for diverse visuomotor skills. arXiv preprint arXiv:1802.09564. 
Ziebart et al. (2008)
Ziebart, B. D., A. L. Maas, J. A. Bagnell, and A. K.
Dey
2008. Maximum entropy inverse reinforcement learning. In AAAI Conference on Artificial Intelligence, Pp. 1433–1438.
Appendix A Derivation of equation 6
Here, we derive equation 6 which unrolls the recursive definition of and rewrites it such that it can be replaced by an expectation over states and actions along trajectories leading to the state . In section 3.1, we derive a recursive definition of which we will restate in more detail:
We can now unroll this definition:
(13)  
Note that due to Markov chain mixing and, therefore, the second term of the above sum reduces to 0 as
(14) 
By pulling out the sum, we can now marginalize out most variables and shift indices to arrive at the desired conclusion:
(15)  
Appendix B Hyperparameters





Appendix C Relation to the Policy Gradient Theorem
In this section, we outline the relation between the policy gradient theorem (Sutton et al., 1999) and the stateactiondistribution gradient derived in section A and show equivalence of the discount factor used in reinforcement learning and the discount factor introduced in this work. We first show that the stateaction distribution gradient is equal to the policy gradient in the average reward case using a specific reward function. We then derive the discounted approximation of the stateactiondistribution gradient presented in section 3.1 from the policy gradient in the discounted reward framework using as a discount factor. While this derivation is more cumbersome than the one presented in the body of the paper, it allows us to gain a better understanding of the meaning of since discounting in the reinforcement learning setting is well understood. For notational simplicity, we assume that the state space and action space are countable. Note that this is a common assumption made in the field (Tsitsiklis and Van Roy, 1997) and considering that any stateaction space is countable and finite when states and actions are represented using a finite number of bits makes it apparent that this assumption does not constitute a simplification in the practical sense.
In this work we propose to follow the gradient evaluated at demonstrated states and actions, consider thus the gradient evaluated at :
(16)  
As we can see, the gradient is equivalent to the policy gradient using the reward function in the average reward framework where corresponds to the parameters of the policy at the current iteration. This reward function is not practical as it can be infinitely sparse and furthermore depends on the unknown stationary distribution. However, it allows us to derive the policy gradient using this reward function in the discounted reward setting which constitutes a well understood approximation of the averagereward scenario. Following the notation in Sutton et al. (1999), we have:
(17) 
We can now replace the expectation over the stationary distribution by an expectation over the path of the agent. This yields a double sum whose order of summation can be changed:
(18)  
After changing the order of summation we can replace the outer sum with the expectation over the stationary distributions and use the special nature of the chosen reward function to write the gradient as a conditional expectation:
(19)  
Finally, we notice that this equation constitutes the discounted version of equation 15, thus we can immediately obtain our estimate of the stateactiondistribution gradient:
(20) 
While this derivation is less direct than the derivation used in section A, it draws a connection between the problem of matching stateactiondistributions and the reinforcement learning problem with a reward that is positive for demonstrated stateaction pairs and 0 otherwise. This indicates that the role of the discount factor is similar in both settings: Lower values of tradeoff accurate matching of distributions for lower variance and as expedience. Agents with low will learn policies that recover and reach demonstrated states quicker over policies that are matching the experts stateaction distribution more accurately longterm. Furthermore, the long history of successes in reinforcement learning validates the use of as an approximation to the true objective which is often more accurately described by the averagereward objective.