S TATE - ONLY I MITATION WITH T RANSITION D YNAMICS M ISMATCH
Anonymous authors
Paper under double-blind review
A BSTRACT
Imitation Learning (IL) is a popular paradigm for training agents to achieve complicated goals by leveraging expert behavior, rather than dealing with the hardships of designing a correct reward function.
With the environment modeled as a Markov Decision Process (MDP), most of the existing IL algorithms are contingent on the availability of expert demonstrations in the same MDP as the one in which a new imitator policy is to be learned.
This is uncharacteristic of many real-life scenarios where discrepancies between the expert and the imitator MDPs are common, especially in the transition dynamics function.
Furthermore, obtaining expert actions may be costly or infeasible, making the recent trend towards state-only IL (where expert demonstrations constitute only states or observations) ever so promising.
Building on recent adversarial imitation approaches that are motivated by the idea of divergence minimization, we present a new state-only
IL algorithm in this paper.
It divides the overall optimization objective into two sub-problems by introducing an indirection step, and solves the sub-problems iteratively.
We show that our algorithm is particularly effective when there is a transition dynamics mismatch between the expert and imitator MDPs, while the baseline IL methods suffer from performance degradation.
To analyze this, we construct several interesting MDPs by modifying the conﬁguration parameters for the MuJoCo locomotion tasks from OpenAI Gym.
I NTRODUCTION
In the Reinforcement Learning (RL) framework, the objective is to train policies that maximize a certain reward criterion.
Deep-RL, which combines RL with the recent advances in the ﬁeld of deeplearning, has produced algorithms demonstrating remarkable success in areas such as games (Mnih et al., 2015; Silver et al., 2016), continuous control (Lillicrap et al., 2015), and robotics (Levine et al., 2016), to name a few.
However, application of these algorithms beyond controlled simulation environments has been fairly modest; one of the reasons being that manual speciﬁcation of a good reward function is a hard problem.
Imitation Learning (IL) algorithms (Pomerleau, 1991; Ng et al., 2000; Ziebart et al., 2008; Ho & Ermon, 2016) address this issue by replacing reward functions with expert demonstrations, which are easier to collect in most scenarios.
The conventional setting used in most of the IL literature is the availability of state-action trajectories from the expert, τ := { s 0 , a 0 , . . .
s T , a T } , collected in an environment modeled as a Markov decision process (MDP) with transition dynamics T exp .
This dynamics governs the distribution over the next state, given the current state and action.
The IL objective is to leverage τ to train an imitator policy in the same MDP as the expert.
This is a severe requirement that impedes wider applicability of IL algorithms.
In many practical scenarios, the transition dynamics of the environment in which the imitator policy is learned (henceforth denoted by T pol ) is different from the dynamics of the environment used to collect expert behavior, T exp .
Consider self-driving cars as an example, where the goal is to learn autonomous navigation on a vehicle with slightly different gear-transmission characteristics than the vehicle used to obtain human driving demonstrations.
We therefore strive for an IL method that could train agents under a transition dynamics mismatch, T exp (cid:54) =
T pol .
We assume that other MDP attributes are the same for the expert and imitator environments.
Beyond the dynamics equivalence, another assumption commonly used in IL literature is availability of expert actions (along with the states).
A few recent works (Torabi et al., 2018a;b; Sun et al., 2019)
[Figure]
have proposed “state-only” IL algorithms, where expert demonstrations do not include the actions.
This opens up the possibility of employing IL to situations such as kinesthetic teaching in robotics, and learning from weak-supervision sources such as videos.
Moreover, if T exp and T pol differ, then the expert actions, even if available, are not quite useful for imitation anyway, since application of an expert action from any state leads to different next-state distributions for the expert and the imitator.
Hence, our algorithm uses state-only expert demonstrations.
We build on previous IL literature inspired from GAN-based adversarial learning - GAIL (Ho &
Ermon, 2016) and AIRL (Fu et al., 2017).
In both these methods, the objective is to minimize the distance between the visitation distributions ( ρ ) induced by the policy and expert, under some suitable metric d , such as Jensen-Shannon divergence.
We classify GAIL and AIRL as direct imitation methods as they directly reduce d ( ρ π , ρ ∗ ) .
Different from these, we propose an indirect imitation approach which introduces another distribution ˜ ρ as an intermediate or indirection step.
In slight detail, starting with the Max-Entropy Inverse-RL objective (Ziebart et al., 2008), we derive a lower bound which transforms the overall IL problem into two sub-parts which are solved iteratively: the ﬁrst is to train a policy to imitate a distribution ˜ ρ represented by a trajectory buffer, and the second is to move the buffer distribution closer to expert’s ( ρ ∗ ) over the course of training.
The ﬁrst part, which is policy imitation by reducing d ( ρ π , ˜ ρ ) is done with AIRL, while the second part, which is reducing d (˜ ρ, ρ ∗ ) , is achieved using a Wasserstein critic (Arjovsky et al., 2017).
We abbreviate our approach as I2L , for indirect-imitation-learning.
We test the efﬁcacy of our algorithm with continuous-control locomotion tasks from MuJoCo.
Figure 1a depicts one example of the dynamics mismatch which we evaluate in our experiments.
For the Ant agent, an expert walking policy π ∗ e is trained under the default dynamics provided in the
OpenAI Gym, T exp =
Earth.
The dynamics under which to learn the imitator policy are curated by modifying the gravity parameter to half its default value (i.e. 9 . 812 ),
T pol = PlanetX. Figure 1b plots the average episodic returns of π ∗ e in the original and modiﬁed environments, and proves that direct policy transfer is infeasible.
For Figure 1c, we just assume access to state-only expert demonstrations from π ∗ e , and do IL with the GAIL algorithm.
GAIL performs well if the imitator policy is learned in the same environment as the expert ( T exp =
T pol = Earth), but does not succeed under mismatched transition dynamics, ( T exp =
Earth , T pol = PlanetX).
In our experiments section, we consider other sources of dynamics mismatch as well, such as agent-density and joint-friction.
We show that I2L trains much better policies than baseline IL algorithms in these tasks, leading to successful transfer of expert skills to an imitator in an environment dissimilar to the expert.
We start by reviewing the relevant background on Max-Entropy IRL, GAIL and AIRL, since these methods form an integral part of our overall algorithm.
B ACKGROUND
An RL environment modeled as an MDP is characterized by the tuple ( S , A , R , T , γ ), where S is the state-space, and A is the action-space.
Given an action a t ∈ A , the next state is governed by the tran- sition dynamics s t +1 ∼ T ( s t +1 | s t , a t ) , and reward is computed as r t =
R ( r t | s t , a t ) .
The RL objective is to maximie the expected discounted sum of rewards, η ( π θ ) =
E p 0 , T ,π (cid:2) (cid:80) ∞
t =0 γ t r ( s t , a t ) (cid:3) , where γ ∈ (0 , 1] is the discount factor, and p 0 is the initial state distribution.
We deﬁne the unnormalized γ -discounted state-visitation distribution for a policy π by ρ π ( s ) =
(cid:80) ∞ t =0 γ t P ( s t = s | π ) , where P ( s t = s | π ) is the probability of being in state s at time t , when following policy π and starting state s 0 ∼ p 0 .
The expected policy return η ( π θ ) can then be written as E ρ π
( s,a ) [ r ( s, a )] , where ρ π ( s, a ) =
ρ π ( s ) π ( a | s ) is the state-action visitation distribution (also referred to as the occupancy measure).
For any policy π , there is a one-to-one correspondence between π and its occupancy measure (Puterman, 1994).
2. M AXIMUM E NTROPY IRL
Designing reward functions that adequately capture the task intentions is a laborious and error-prone procedure.
An alternative is to train agents to solve a particular task by leveraging demonstrations of that task by experts.
Inverse Reinforcement Learning (IRL) algorithms (Ng et al., 2000; Russell, 1998) aim to infer the reward function from expert demonstrations, and then use it for RL or planning.
The IRL method, however, has an inherent ambiguity, since many expert policies could explain a set of provided demonstrations.
To resolve this, Ziebart et al.
(2008) proposed the
Maximum-Entropy (MaxEnt) IRL framework, where demonstration are assumed to be drawn from the optimal policy that maximizes the entropy-regularized sum of discounted rewards,
[Equation]
It has been shown (Ziebart, 2010; Haarnoja et al., 2017) that the optimal policy π ∗ follows the energy-based distribution π ∗ ( a | s ) =
exp( A ∗ soft ( s, a ) /α ) , where A ∗ soft ( s, a ) =
Q ∗ soft ( s, a ) − V ∗ soft ( s ) is the soft advantage function, and Q ∗ soft and V ∗ soft are the soft value functions.
The objective in IRL is to learn the expert reward from given demonstrations τ demo .
MaxEnt-IRL does this by casting reward learning as a maximum likelihood estimation problem.
Speciﬁcally, let ω parameterize the (soft) advantage function under the optimal policy, i.e. π ∗ ( a | s ) ∝ exp( a ω ( s, a )) .
The trajectory distribution of π ∗ can then be obtained as:
[Equation]
where Z ( ω ) is the normalization constant.
A ∗ soft is estimated by solving the optimization problem:
[Equation]
An imitator policy can then be trained with any RL algorithm, using the learnt advantage a ω ( s, a ) as the reward.
Note that a ω provides shaped rewards, shaped by the MDP dynamics (Fu et al., 2017). Note on the speciﬁc choice of representation .
In our exposition of MaxEnt-IRL, we parameterize the advantage function and represent the optimal policy as π ∗ ( a | s ) ∝ exp( a ω ( s, a )) .
It is also possible to parameterize the reward function r ω ( s, a ) , and write the trajectory distribution as p
[Equation]
t p ( s t +1 | s t , a t ) e γ t r ω ( s t ,a t ) .
For instance, Ziebart et al. (2008) use a linear parameterization on the reward function. Our approach for directly parameterizing advantage is motivated by the fact that we use AIRL (Section 2.2) as our MaxEnt-IRL method; AIRL recovers the advantage function of the expert. We further note that although MaxEnt-IRL resolves one ambiguity in the IRL framework—that many expert policies could explain a set of provided demonstrations—it does not deal with the second ambiguity which is that many reward functions lead to the same optimal policy.
Speciﬁcally, if r ω denotes the expert reward, and v η denotes the parametric state-value function of the expert, then using r ω ( s, a ) + γv η ( s (cid:48) ) − v η ( s ) as the reward results in the same expert policy (Ng et al., 1999).
Hence, for the sake of representation in MaxEnt-IRL algorithms, directly using the advantage is also justiﬁed.
An important implication of casting IRL as maximum likelihood estimation is that it connects IRL to adversarial training.
We now brieﬂy discuss AIRL (Fu et al., 2017) since it forms a component of our proposed algorithm.
AIRL builds on GAIL (Ho & Ermon, 2016), a well-known adversarial imitation learning algorithm.
GAIL frames IL as an occupancy-measure matching (or divergence minimization) problem.
Let ρ π
( s, a ) and ρ E ( s, a ) represent the state-action visitation distributions of the policy and the expert, respectively.
Minimizing the Jenson-Shanon divergence min π D JS [ ρ π ( s, a ) ||
ρ E ( s, a )] recovers a policy with a similar trajectory distribution as the expert.
GAIL iteratively trains a policy ( π θ ) and a discriminator ( D ω : S ×
A → (0 , 1) ) to optimize the min-max objective similar to GANs (Goodfellow et al., 2014):
[Equation]
where H ( π ) :
= E π [ − log π ( a | s )] is the γ -discounted causal entropy.
GAIL attempts to learn a policy that behaves similar to the expert demonstrations, but it bypasses the process of recovering the optimal reward function.
Finn et al.
(2016) showed that imposing a special structure on the discriminator makes the adversarial GAN training equivalent to optimizing the MLE objective (Equation 2).
Furthermore, if trained to optimality, it is proved that the optimal reward (up to a constant) is obtained from the discriminator.
They operate in a trajectory-centric formulation which can be inefﬁcient for high dimensional state- and action-spaces.
Fu et al.
(2017) present AIRL which remedies this by proposing analogous changes to the discriminator, but operating on a single state-action pair:
[Equation]
Similar to GAIL, the discriminator is trained to maximize the objective in Equation 3; f ω is learned, whereas the value of π ( a | s ) is “ﬁlled in”.
The policy is optimized jointly using any RL algorithm with log D ω − log(1 − D ω ) as rewards.
The authors prove that at optimality, exp( f ω ( s, a )) =
π ∗ ( a | s ) =
exp( A ∗ soft ( s, a ) /α ) .
Therefore, f ω recovers the advantage ( A ∗ soft ) of the expert policy.
2. S TATE - ONLY I MITATION
State-only IL algorithms extend the scope of applicability of IL by relieving the need for expert actions in the demonstrations.
The original GAIL approach could be modiﬁed to work in the absence of actions.
Speciﬁcally, Equation 3 could be altered to use a state-dependent discriminator D ω ( s ) , and state-visitation (instead of state-action-visitation) distributions
ρ E ( s ) and ρ π θ ( s ) .
The AIRL algorithm, however, requires expert actions due to the special structure enforced on the discriminator (Equation 4), deeming it incompatible with state-only IL.
This is because, even though f ω could potentially be made a function of only the state s , actions are still needed for the “ﬁlled in” π θ ( a | s ) component.
Inspired by GAIL, Torabi et al.
(2018b) proposed GAIfO for state-only IL.
The motivation is to train the imitator to perform actions that have similar effects in the environment, rather than mimicking the expert action.
Algorithmically, GAIL is modiﬁed to make the discriminator a function of state transitions D ω ( s, s (cid:48) ) , and include state-transition distributions ρ ( s, s (cid:48) ) .
I NDIRECT I MITATION L EARNING (I2L)
We now detail our I2L algorithm which alters the standard IL routine (used by GAIL, AIRL) by introducing an intermediate or indirection step, through a new distribution represented by a trajectory buffer.
For this section, we ignore the properties of the transition dynamics for the expert and the imitator MDPs ( T exp , T pol ); they can be the same or different, I2L has no speciﬁc dependence on this.
τ denotes a trajectory, which is a sequence of state-action pairs, { s 0 , a 0 , . . .
, s T , a T } .
We begin with the expert’s (unknown) trajectory distribution, although our ﬁnal algorithm works with state-only expert demonstrations.
Let the trajectory distribution induced by the expert be p ∗ ( τ ) , and its state-action visitation distribution be ρ ∗ ( s, a ) .
Using the parameterization from Equation 1, the likelihood objective to maximize for reward learning in MaxEnt-IRL (Equation 2) can be written as (ignoring constants w.r.t ω ):
[Equation]
As alluded to in Sections 2.2–2.3, if expert actions were available, one could optimize for ω by solving an equivalent adversarial min-max objective, as done in AIRL.
To handle state-only IL, we proceed to derive a lower bound to this objective and optimize that instead.
Let there be a surrogate policy ˜ π with a state-action distribution ˜ ρ
( s, a ) .
The following proposition provides a lower bound to the likelihood objective in Equation 5.
Proposition.
Under mild assumptions of Lipschitz continuity of the advantage function a ω , we have that for two different state-action distributions ρ ∗ and ˜ ρ ,
[Equation]
where L is the Lipschitz constant, and W 1 ( ρ ∗ , ˜ ρ ) is the 1-Wasserstein (or Earth Mover’s) distance between the state-action distributions.
Proof.
The advantage function is represented by a neural network with parameters ω , and concatenation of state and action as the input, x := s || a .
Under Lipschitz continuity assumption for a ω ( x ) , for any two inputs x ∼ X and x (cid:48) ∼ X (cid:48) , we have
[Equation]
Let µ ( X, X (cid:48) ) be any joint distribution over the random variables representing the two inputs, such that the marginals are ρ ∗ ( X ) and ˜ ρ ( X (cid:48) ) .
Taking expectation w.r.t µ on both sides, we get
[Equation]
Since the above inequality holds for any µ , it also holds for µ ∗ =
arg min µ E µ (cid:107) ( x
[Equation]
− x ) (cid:107) 1 , which gives us the 1-Wasserstein distance
[Equation]
Rearranging terms,
[Equation]
We can therefore lower bound the likelihood objective (Equation 5) as:
[Equation]
where ˜ p ( τ ) is the trajectory distribution induced by the surrogate policy ˜ π .
Since the original optimization (Equation 2) is infeasible under the AIRL framework in the absence of expert actions, we instead maximize the lower bound, which is to solve the surrogate problem:
[Equation]
This objective can be intuitively understood as follows.
Optimizing w.r.t ω recovers the reward (or advantage) function of the surrogate policy ˜ π , in the same spirit as MaxEnt-IRL.
Optimizing w.r.t ˜ ρ brings the state-action distribution of ˜ π close (in 1-Wasserstein metric) to the expert’s, along with a bias term that increases the log-likelihood of trajectories from ˜ π , under the current reward model ω .
We now detail the practical implementation of these optimizations.
Surrogate policy.
We do not use a separate explicit parameterization for ˜ π .
Instead, ˜ π is implicitly represented by a buffer B , with a ﬁxed capacity of k trajectories 1 .
In this way, ˜ π can be viewed as a mixture of deterministic policies, each representing a delta distribution in trajectory space.
B is akin to experience replay (Lin, 1992), in that it is ﬁlled with trajectories generated from the agent’s interaction with the environment during the learning process.
The crucial difference is that inclusion to B is governed by a priority-based protocol (explained below).
Optimization w.r.t ω can now be done using adversarial training (AIRL), since the surrogate policy actions are available in B .
Following Equation 4, the objective for the discriminator is:
[Equation]
where π θ is the learner (imitator) policy that is trained with log D ω − log(1 − D ω ) as rewards.
Optimizing ˜ ρ .
Since ˜ ρ is characterized by the state-action tuples in the buffer B , updating ˜ ρ amounts to refreshing the trajectories in B .
For the sake of simplicity, we only consider the Wasserstein distance objective and ignore the other bias term, when updating for ˜ ρ in Equation 6.
Note that ρ ∗ , ˜
ρ denote the state-action visitation distributions of the expert and the surrogate, respectively.
Since we have state-only demonstrations from the expert (no expert actions), we minimize the Wasserstein distance between state visitations, rather than state-action visitations.
Following the approach in
WGANs (Arjovsky et al., 2017), we estimate W 1 using the Kantorovich-Rubinstein duality, and train a critic network g φ with Lipschitz continuity constraint, [Equation]
[Equation]
The empirical estimate of the ﬁrst expectation term is done with the states in the provided expert demonstrations; for the second term, the states in B are used.
With the trained critic g φ , we obtain a score for each trajectory generated by the agent.
The score is calculated as 1 | τ | (cid:80) s ∈
τ g φ ( s ) , where
[Figure]
[Table] Networks: Policy ( θ ), Discriminator ( ω
Update
| τ | is the length of the trajectory.
Our buffer B is a priority-queue structure of ﬁxed number of trajectories, the priority value being the score of the trajectory.
This way, over the course of training,
B is only updated with trajectories with higher scores, and by construction of the score function, these trajectories are closer to the expert’s in terms of the Wasserstein metric.
Algorithm.
The major steps of the training procedure are outlined in Algorithm 1.
The policy parameters ( θ ) are updated with the clipped-ratio version of PPO (Schulman et al., 2017).
Statevalue function baselines and GAE (Schulman et al., 2015) are used for reducing variance of the estimated policy-gradients.
The priority buffer B uses the heap-queue algorithm.
The Lipschitz constant L in Equation 6 is unknown and task-dependent.
If a ω is fairly smooth, L is a small constant that can be treated as a hyper-parameter and absorbed into the learning rate.
Please see
Appendix 7.2 for details on the hyper-parameters.
R ELATED WORK
There is extensive amount of literature on IL with state-action expert demonstrations, and also on integrating IL and RL to bootstrap learning (Billard et al., 2008; Argall et al., 2009).
Our work is most closely related to state-only IL and adversarial Inverse-RL methods discussed in Section 2.
Here, we mention other related prior literature.
BCO (Torabi et al., 2018a) is a state-only IL approach that learns an inverse dynamics model p ( a | s, s (cid:48) ) by running a random exploration policy.
The inverse model is then applied to infer actions from the state-only demonstrations, which in turn are used for imitation via Behavioral Cloning, making the approach vulnerable to the well-known issue of compounding errors (Ross et al., 2011).
Kimura et al.
(2018) learn an internal model p ( s (cid:48) | s ) on state-only demonstrations; the imitator policy is then trained with RL using rewards derived from the model.
Imitation under a domain shift has been considered in Stadie et al.
; Liu et al.
These methods incorporate raw images as observations and are designed to handle differences in context (such as viewpoints, visual appearance, object positions, surroundings) between the expert and the imitator environments.
Gupta et al.
(2017) propose learning invariant feature mappings to transfer skill from an expert to an imitator with a different morphology.
However, the reward function for such a transfer is contingent on the assumption of time-alignment in episodic tasks.
In our
Algorithm 1, the adversarial training between the policy and buffer trajectories (AIRL, Line 9) bears some resemblance to the adversarial self-imitation approaches in (Guo et al., 2018;
Gangwani et al., 2018).
Those self-imitation methods are applicable for RL from sparse rewards, while our focus is
IL from expert behavior, under transition dynamics mismatch.
E XPERIMENTS
In this section, we compare the performance of I2L to baseline methods for state-only IL from Section 2.3, namely GAIL with state-dependent discriminator, denoted by GAIL-S , and GAIfO (Torabi et al., 2018b).
We do the evaluation by modifying the continuous-control locomotion task from MuJoCo to introduce various types of transition dynamics mismatch between the expert and the imitator
MDPs ( T exp (cid:54) =
T pol ).
It should be noted that other aspects of the MDP ( S , A , R , γ ) are assumed to be the same 2 .
We therefore use dynamics and MDP interchangeably in this section.
While the expert demonstrations are collected under the default conﬁgurations provided in OpenAI Gym, we construct the environments for the imitator by changing some parameters independently: a.) gravity in T pol is 0 .
5 × the gravity in T exp , b.) density of the bot in T pol is 2 × the density in T exp , and c.)
the friction coefﬁcient on all the joints of the bot in T pol is 3 × the coefﬁcient in T exp .
Figure 2 has a visual.
For all our experiments and tasks, we assume a single expert state-only demonstration of length 1000.
We do not assume any access to the expert MDP beyond this.
Performance when T exp = T pol .
Table 1 shows the average episodic returns for a policy trained for 5M timesteps using GAIL-S and I2L in the standard IL setting.
The policy learning curves are included in Appendix 7.1.
All our experiments average 8 independent runs with random seeds.
Both the algorithms work fairly well in this scenario, though I2L achieves higher scores in 3 out oftasks.
These numbers serve as a benchmark when we evaluate performance with transition dynamics mismatch.
The table also contains the expert demonstration score for each task.
Performance when T exp (cid:54) = T pol .
Figures 3, 4 and 5 plot the training progress (mean and standard deviation) with GAIL-S and I2L under mismatched transition dynamics with low gravity, high den- sity and high friction settings, respectively, as described above.
We observe that I2L achieves faster learning and higher ﬁnal scores [Figure] [Table] [Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table] [Figure] [Table] than GAIL-S in most of the situations.
GAIL-S degrades severely in some cases.
For instance, for Half-Cheetah under high density, GAIL-S drops to 923 (compared to 5974 with no dynamics change, Table 1), while I2L attains a score of 3975 (compared to 5240 with no dynamics change).
Similarly, with Hopper under high friction, GAIL-S score reduces to 810 (from 2130 with no dynamics change), and the I2L score is 2084 (2751 with no dynamics change).
The plots also indicate the ﬁnal average performance achieved using the original GAIL (marked as GAIL-SA) and AIRL algorithms.
Both these methods require extra supervision in the form of expert actions.
Even so, they generally perform worse than I2L, which can be attributed to the fact that the expert actions generated in T exp are not very useful when the dynamics shift to T pol .
Comparison with GAIfO (Torabi et al., 2018b) baseline.
GAIfO is a recent state-only IL method which we discuss in Section 2.3.
Table 2 contrasts the performance of I2L with GAIfO for imitation tasks both with and without transition dynamics mismatch.
We ﬁnd GAIfO to be in the same ballpark as GAIL-S. It is able to learn good imitation policies if the dynamics are the same between the expert and the imitator, and loses performance with mismatched dynamics.
Ablation on buffer capacity.
Algorithm 1 uses priority-queue buffer B of ﬁxed number of trajectories to represent the surrogate state-action visitation ˜ ρ .
All our experiments till this point ﬁxed the buffer capacity to 5 trajectories.
To gauge the sensitivity of our approach to the capacity |B| , we ablate on it and report the results in Figure 6.
The experiment is done with the low-gravity HalfCheetah environment.
We observe that the performance of I2L is fairly robust to |B| .
Surprisingly, even a capacity of 1 trajectory works well, and having a large buffer ( |B| = 50 ) also does not hurt performance much.
The GAIL-S baseline on the same task is included for comparison.
C ONCLUSION
In this paper, we presented I2L, an indirect imitation-learning approach that utilizes state-only expert demonstrations collected in the expert MDP, to train an imitator policy in a MDP with a dissimilar transition dynamics function.
We derive a lower bound to the Max-Ent IRL objective that transforms it into two sub-problems.
We then provide a practical algorithm that trains a policy to imitate a distribution represented by a trajectory buffer using AIRL, whilst moving the buffer distribution closer to the expert’s by reducing the Wasserstein metric over the course of training.
Our experiments in a variety of MuJoCo-based MDPs indicate that I2L is an effective mechanism for successful skill transfer from the expert to the imitator, especially under mismatched transition dynamics.
A
[Figure]
[Figure]
7. H YPER - PARAMETERS
[Figure]
3 layers, 64 hidden [Figure] tanh
[Figure]
3 layers, 64 hidden, tanh
[Figure]
3 layers, 64 hidden, tanh
Wasserstein
[Figure]
optimizer
[Figure] lr [Figure] gradient-steps
RMS
[Figure]
Prop
[Figure]
5e
[Figure]
[Figure]
[Figure]
(clipped ratio)
[Figure]
of state
[Figure]
The buffer B is a priority-queue structure, with a ﬁxed capacity of K 3 trajectories. Each trajectory is a set of tuples τ := { s i , a i } Ti =0 .
Denote the trajectories by { τ 1 , . . , τ K } , and let { s ∈ τ i } be the collection of states in trajectory τ i . Buffer B characterizes the surrogate policy ˜ π deﬁned in Section 3.
The state-visitation distribution of ˜ π can then be written as:
[Equation]
where δ denotes the delta measure.
Following Equation 8, our objective for optimizing ˜ ρ is:
[Equation]
The min-max objective is optimized using an iterative algorithm.
The Wasserstein critic g ( φ ) update is done with standard gradient descent using state samples from expert demonstrations and the buffer B .
The update for ˜ ρ is more challenging since ˜ ρ is only available as an empirical measure (Equation 9).
For the current iterate φ , the objective for ˜ ρ then becomes:
[Equation]
Section 3 deﬁnes the quantity 1 T (cid:80) s ∈
τ i g φ ( s ) as the score of the trajectory τ i .
Therefore, the objective in Equation 10 is to update the buffer B such that the average score of the K trajectories in it increases.
Priority-queue with priority = score .
Buffer B is implemented as a priority-queue (PQ) based on Min-Heap.
Let the current PQ be { τ 1 , . .
, τ K } , sorted based on score such that score ( τ i ) ≤ score ( τ j ) , ∀ i < j .
Let { Γ 1 , Γ 2 , . . .
} be the new trajectories rolled out in the environment using the current learner policy π θ (Line 5 in Algorithm 1).
For each of these, PQ is updated using standard protocol: 1 Update scores of { τ 1 , . . .
, τ K } in PQ using the latest critic φ 2 for each Γ i do
Calculate score (Γ i ) using the latest critic φ if score (Γ i ) > score ( τ 1 ) then τ 1 ← Γ i // replace the lowest scoring buffer trajectory with the new trajectory heapify // PQ-library call to maintain the heap-invariant: score ( τ i ) ≤ score ( τ j ) , ∀ i < j end 8 end
It follows from the PQ-protocol that the average score of the K trajectories in the buffer B increases (or remains same), after the update, compared to the average score before.
This aligns the update with the objective in Equation 10.
7. E MPIRICAL CONVERGENCE OF LOWER BOUND
In our main section, we derive the following lower bound which connects the expected value of a ﬁxed function a ω under the expert’s state-action visitation to the expected value under another surrogate distribution, and the 1-Wasserstein distance between the distributions:
[Equation]
In this section, we provide empirical measurements on the gap between the original objective (LHS) and the lower bound (RHS).
This gap depends on the speciﬁc choice of the surrogate distribution ˜
ρ
( s, a ) .
In our algorithm, ˜ ρ is characterized by trajectories in the priority-queue buffer B , and is updated during the course of training based on the protocol detailed in Appendix 7.3.
Figure 8 plots the estimated value of the lower bound for these different ˜ ρ , and shows that the gap generally reduces over time.
To get estimates of LHS and RHS, we need the following:
• ˜ ρ
( s, a ) :
We take snapshots of the buffer B at periodic intervals of the training to obtain the different ˜ ρ distributions.
• ρ ∗ ( s, a ) : This is the expert’s state-action distribution.
We train separate oracle experts in the imitator’s
(learner’s) environment, and use state-action tuples from this expert policy.
Note that these oracle experts are NOT used in I2L (Algorithm 1), and are only for the purpose of measurement.
• W 1 ( ρ ∗ ( s, a ) , ˜ ρ
( s, a )) :
A separate Wasserstein critic is trained using ( s, a ) tuples from the oracle experts described above and the trajectories in buffer B .
This critic is NOT used in I2L since we don’t have access to oracle experts, and is only for the purpose of measurement.
• a ω : We select the AIRL discriminator parameters ω from a particular training iteration.
The same parameters are then used to calculate the LHS, and the RHS for different ˜ ρ distributions.
• L : The Lipschitz constant is unknown and hard to estimate for a complex, non-linear a ω .
We plot the lower bound for a few values: { 0 . 5 , 1 . 0 , 1 . 5 } .
Figure 8 shows the gap between the original objective and the lower bound for all our experimental settings, T exp =
T pol (top row), and T exp (cid:54) =
T pol (next 3 rows).
We observe that the gap generally reduces as ˜ ρ is updated over the iterations of I2L (Algorithm 1).
A better lower bound in turn leads to improved gradients for updating the AIRL discriminator a ω , ultimately resulting in more effective policy gradients for the imitator.
7. E MPIRICAL W ASSERSTEIN D ISTANCES
In each iteration of I2L, we update the Wasserstein critic φ using the states from the state-only expert demonstration, and states in the buffer B (Line 6, Algorithm 1).
The objective is to obtain the 1-Wasserstein distance:
[Equation]
In Figure 9, we plot the empirical estimate ˆ W 1 of this distance over the course of training.
To get the estimate at any time, the current critic parameters φ and buffer trajectories are used to calculate ˆ
E s ∼ ρ ∗ [ g φ ( s )] − ˆ E s ∼B [ g φ ( s )] .
We show the values for all our experimental settings, T exp =
T pol
(top row), and T exp (cid:54) =
T pol (next 3 rows).
It can be seen that ˆ W 1 ( ρ ∗ ( s ) , ˜ ρ ( s )) generally decreases over time in all situations.
This is because our objective for optimizing ˜ ρ (or updating the buffer B ) is to minimize this Wasserstein estimate.
Please see Appendix 7.3 for more details.
The fact that the buffer state-distribution gets closer to the expert’s, together with the availability of actions in the buffer which induce those states in the imitator MDP ( T pol ), enables us to successfully use AIRL for imitation under mismatched transition dynamics.
7. C OMPARISON WITH BCO
Figure 10 compares I2L with BCO (Torabi et al., 2018a) when the expert and imitator dynamics are same (top row) and under mismatched transition dynamics with low gravity, high density and high inverse is
Behavioral Cloning these
We implement since it is shown to be better than vanilla observe the and learn
Similar
7. C OMPARISON WITH GAIFO