Title: CROSS DOMAIN IMITATION LEARNING

Abstract: We study the question of how to imitate tasks across domains with discrepancies such as embodiment and viewpoint mismatch. Many prior works require paired, aligned demonstrations and an additional RL procedure for the task. However, paired, aligned demonstrations are seldom obtainable and RL procedures are expensive. In this work, we formalize the Cross Domain Imitation Learning (CDIL) problem, which encompasses imitation learning in the presence of viewpoint and embodiment mismatch. Informally, CDIL is the process of learning how to perform a task optimally, given demonstrations of the task in a distinct domain. We propose a two step approach to CDIL: alignment followed by adaptation. In the alignment step we execute a novel unsupervised MDP alignment algorithm, Generative Adversarial MDP Alignment (GAMA), to learn state and action correspondences from unpaired, unaligned demonstrations. In the adaptation step we leverage the correspondences to zero-shot imitate tasks across domains. To describe when CDIL is feasible via alignment and adaptation, we introduce a theory of MDP alignability. We experimentally evaluate GAMA against baselines in both embodiment and viewpoint mismatch scenarios where aligned demonstrations don't exist and show the effectiveness of our approach.

1. INTRODUCTION:

Humans possess an astonishing ability to recognize latent structural similarities between behaviors in related but distinct domains, and learn new skills from cross domain demonstrations alone. Not only are we capable of learning from third person observations that have no obvious correspondence to our internal self representations (Stadie et al., 2017; Liu et al., 2018; Sermanet et al., 2018) , but we also are capable of imitating agents with different embodiments (Gupta et al., 2017; Rizzolatti & Craighero, 2004) as can be observed in an infant's learning of visuomotor skills from adults with different biomechanics and physical capabilities (Jones, 2009) . Previous work in neuroscience (Marshall & Meltzoff, 2015) and robotics (Kuniyoshi & Inoue, 1993; Kuniyoshi et al., 1994) have recognized the pitfalls of exact behavioral cloning in the presence of domain discrepancies and posited that the effectiveness of the human imitation learning mechanism hinges, crucially, on the capability to learn structure preserving domain correspondences. These correspondences enable the learner to internalize the expert demonstrations and produce a reconstruction of the behavior in the self domain. Consider a young child that has learned to associate his internal body map with the limbs of an adult. When the adult demonstrates running, the child is able to imagine himself running, and reproduce the behavior.

Recently, separate solutions have been proposed for imitation learning across two kinds of domain discrepancies: embodiment (Gupta et al., 2017) and viewpoint (Liu et al., 2018; Sermanet et al., 2018) mismatch. These works (Liu et al., 2018; Sermanet et al., 2018; Gupta et al., 2017) require paired, time-aligned demonstrations to obtain state correspondences and an extra RL step with a proxy reward. However, paired, aligned demonstrations are seldom obtainable and RL loops are expensive. In this work we formalize the Cross Domain Imitation Learning (CDIL) problem which encompasses prior work in imitation learning across domains with viewpoint and embodiment mismatch. Informally, CDIL is the process of learning how to perform a task optimally in a self domain, given demonstrations of the task in a distinct expert domain. We propose a two-step approach to CDIL: alignment followed by adaptation. In the alignment step we execute a novel unsupervised MDP alignment algorithm, Generative Adversarial MDP Alignment (GAMA), to learn state, action maps from unpaired, unaligned demonstrations. In the adaptation step we leverage the learned state, action maps to zero-shot imitate tasks across domains without an additional RL step. To shed light on when CDIL can be solved by alignment and adaptation, we first introduce a class of structure preserving maps, called MDP reductions, that adapts optimal policies between MDPs (section 3). We further characterize a family of MDP pairs that share reductions, formally state the MDP alignment problem, and elucidate its connection to CDIL. In section 4, 5 we derive GAMA, Figure 1 : (a). Illustration of paired, aligned vs unpaired, unaligned demonstrations in the alignment task set D x,y (b). Alignment: we learn state, action maps f, g between the self (x) and expert (y) domain from unpaired, unaligned demonstrations by minimizing a distribution matching loss and an imitation loss. (c) Adaptation: adapt the expert domain policy ⇡ y,T or demonstrations to obtain a self domain policy ⇡x,T a simple training algorithm to learn MDP reductions. In section 6, we experimentally evaluate GAMA and find that meaningful state correspondences between various domains are learned from unpaired, unaligned demonstrations. We then compare the CDIL performance of GAMA against several baselines in both embodiment and viewpoint mismatch scenarios and show the effectiveness of our approach.

2. CROSS DOMAIN IMITATION LEARNING PROBLEM STATEMENT:

An infinite horizon Markov Decision Process (MDP) M 2 ⌦ with deterministic dynamics is a tuple (S, A, P, ⌘, R) where ⌦ is the set of all MDPs, S is the state space, A is the action space, P : S ⇥ A ! S is a (deterministic) transition function, R : S ⇥ A ! R is the reward function, and ⌘ is the initial state distribution. A domain is an MDP without the reward, i.e (S, A, P, ⌘). Intuitively, a domain fully characterizes the embodied agent and the environment dynamics, but not the desired behavior. A task T is a label for an MDP corresponding to the high level description of optimal behavior, such as "walking". T is analogous to category labels for images. An MDP with domain x for task T is denoted by M x,T = (S x , A x , P x , ⌘ x , R x,T ), where R x,T is a reward function encapsulating the behavior labeled by T . For example, different reward functions are needed to realize the "walking" behavior in two morphologically different humanoids. A (stationary) policy for M x,T is a map ⇡ x,T : S x ! B(A x ) where B is the set of probability measures on A x and an optimal policy ⇡ ⇤

x,T = arg max ⇡x J(⇡ x ) achieves the highest policy performance

J(⇡ x ) = E ⇡x [ P 1 t=0 t R x,T (s (t)

x , a

x )] where 0 < < 1 is a discount factor. A demonstration of length H is a sequence of state, action tuples ⌧ Mx ,T = {(s

(t)

x , a (t)

x )} H t=1 sampled from an optimal policy and D Mx ,T = {⌧ (k)

Mx ,T } K

k=1 is a set of demonstrations for M x,T Let M x,T , M y ,T be self and expert MDPs for a target task T . Given expert domain demonstrations D My ,T , Cross Domain Imitation Learning (CDIL) aims to determine an optimal self domain policy ⇡ ⇤ x,T without access to the reward function R x,T . In this work we propose to first solve an MDP alignment problem and then leverage the alignments to zero-shot imitate expert domain demonstrations. Like prior work (Gupta et al., 2017; Liu et al., 2018; Sermanet et al., 2018) , we assume the availability of an alignment task set

D x,y = {(D Mx ,T i , D My ,T i

)} N i=1 containing demonstrations for N tasks {T i } N i=1 from both the self and expert domain. D x,y could, for example, contain both robot (x) and human (y) demonstrations for a set primitive tasks such as walking, running, and jumping. Unlike prior work, demonstrations are unpaired and unaligned, i.e (s (t)

x , s (t) y ) may not be a valid state correspondence. (see Figure 1 (a)) Paired, time-aligned cross domain data is expensive and may not even exist when task execution rates differ or there exists systematic embodiment mismatch between the domains. For example, a child can imitate an adult running, but not achieve the same speed. Our set up emulates a natural setting in which humans compare how they perform tasks to how other agents perform the same tasks in order to find structural similarities and identify domain correspondences. We now proceed to introduce a theoretical framework that explains how and when the CDIL problem can be solved by MDP alignment followed by adaptation.

3. ALIGNABLE MDPS:

Let ⇧ ⇤ M be the set of all optimal policies for MDP M. We define an occupancy measure (Syed et al., 2008) q ⇡ : S ⇥ A ! R for policy ⇡ as q ⇡ (s, a) = ⇡(a|s) ) where : S x ! S y , : A x ! A y are maps that preserve:

P 1 t=0 t Pr(s (t) = s; ⇡, P, ⌘). Definition 1. An optimality function O Mx : S x ⇥ A x ! {0, 1} for an MDP M x satisfies: O Mx (s x , a x ) = 1 if 9⇡ ⇤ x 2 ⇧ ⇤ Mx such that (s x , a x ) 2 supp(q ⇡ ⇤ x ) and O Mx (s x , a x ) = 0 otherwise. Definition 2. An MDP reduction from M x = (S x , A x , P x , ⌘ x , R x ) to M y = (S y , A y , P y , ⌘ y , R y ) is a tuple r = ( ,

1. (optimal policy) 8s x 2 S x , a x 2 A x , s y 2 S y , a y 2 A y , O My ( (s x ), (a

x )) = 1 ) O Mx (s x , a x ) = 1 (1)

O My (s y , a y ) = 1 ) 1 (s y ) 6 = ;, 1 (a y ) 6 = ;

(2)

2. (dynamics) 8s y , s 0 y 2 S y , a y 2 A y where O My (s y , a y ) = 1, P y (s y , a y ) = (P x (s x , a x )) 8s x 2 1 (s y ), a x 2 1 (a y )

(3)

where we define

1 (s y ) = {s x | (s x ) = s y }, 1 (a y ) = {a x | (a x ) = a y }.

Furthermore, r is an MDP permutation if and only if , are bijective maps. In words, Eq. 1 states that only optimal state, action pairs in x can be mapped to optimal state, action pairs in y and Eq. 2 states that r must be surjective on the set of optimal state, action pairs in y. Eq. 3 states that a reduction must preserve (deterministic) dynamics. We use the notation M x , M y to denote that ( , ) is a reduction from M x to M y , and the shorthand M x M y to denote that M x reduces to M y . To gain an intuitive understanding of MDP reductions, picture the execution trace of an optimal policy as a directed graph with colored edges in which the nodes correspond to states visited by an optimal policy, and the colored edges correspond to actions taken. An MDP reduction from M x to M y homomorphs the execution graph of an optimal policy in M x to a execution graph of an optimal policy in M y . Figure 2 shows an example of a valid reduction from M x to M y : states 1, 2 in S x are mapped (merged) to state a in S y and the blue, green actions in A x are mapped to the brown action in A y . Intuitively, if M x , M y , then ( , ) compresses M x by merging all optimal state, action pairs that have identical dynamics properties. Definition 3. Two MDPs M x , M y are alignable if and only if M x M y or M y M x .

Definition 3 states that MDPs are alignable if reductions exists between them, meaning that they share structure. We use (M x , M y ) = {( , )|M x , M y } to denote the set of all valid reductions from M x to M y . Reductions have a particularly useful property which is that they adapt policies across alignable MDPs. Consider a state map f : S x ! S y , an inverse action map g : A y ! A x , and a composite policy ⇡x = g ⇡ y f (see Figure 1(b) ). In words, ⇡x maps a self state to an expert state via f , simulates the expert's action choice for the mapped state via ⇡ y , then chooses a self action that corresponds to the simulated expert action with g. The following lemma holds for ⇡x . Lemma 1. Let M x , M y be MDPs satisfying Assumption 1 (see Supp. Materials), M x , M y , and ⇡ y be optimal in M y . 8g : A y ! A x s.t g(a y ) = a y 8a y 2 {a y |9s y 2 S y s.t O My (s y , a y ) = 1}, it holds that ⇡x = g ⇡ y is optimal in M x . Lemma 1 states that the state, action maps (f, g 1 ) chosen to be a reduction can adapt optimal policies between alignable MDPs. Here onwards we interchangeably refer to (f, g) as "alignments". We now show how the CDIL problem can be solved by first solving an MDP alignment problem followed by an adaptation step.

Definition 4. Let (M x , M y ), (M x 0 , M y 0 ) 2 ⌦ 2 be two MDP pairs. Then, (M x , M y ) ⇠ (M x 0 , M y 0 ),

i.e they are joint alignable, if and only if

(M x , M y ) \ (M x 0 , M y 0 ) 6 = ;.

In words, two MDP pairs are joint alignable if there exists a shared reduction. We define an equivalence class

[(M x , M y )] ⇠ = {(M x 0 , M y 0 ) | (M x 0 , M y 0 ) ⇠ (M x , M y )} of MDP pairs that share reductions. Overloading notation, ({(M x i , M y i )} N i=1 ) = {( , ) | ( , ) 2 (M x 1 , M x 1 ) \ • • • \ (M x N , M x N )}.

We now formally state the MDP alignment problem: Let (M x,T , M y ,T ) be an MDP pair for a target task T . Given an alignment task set D

x,y = {(D Mx ,T i , D My ,T i )} N i=1 compris- ing unpaired, unaligned demonstrations for MDP pairs {(M x,T i , M y ,Ti )} N i=1 ✓ [(M x,T , M y ,T )] ⇠ , determine ( , ) 2 ({(M x,T i , M y ,Ti )} N i=1

) such that ( , ) 2 (M x,T , M y ,T ). As shown in Figure 3 , with more MDP pairs, there are likely a smaller the number of joint alignments | ({(M x,T i , M y ,Ti )} N i=1 )| and, as a result, ( , ) 2 ({(M x,T i , M y ,Ti )} N i=1 ) is more likely to "generalize" to an MDP pair for a new target task (M x,T , M y ,T ) in the equivalence class. Analogously, in a standard supervised learning problem, more training data is likely to shrink the set of models performing optimally on the training set but poorly on the test set. We can then use ( , ) for CDIL: given cross domain demonstrations D My ,T for the target task T , learn an expert domain policy ⇡ y,T , and adapt it into the self domain using ( , ) according to Lemma 1.

We can now assess when domains with embodiment and viewpoint mismatch have meaningful state correspondences, i.e MDP reductions, thus allowing for cross domain imitation. The states of a human expert with more degrees of freedom than a robot imitator can be merged into the robot states if the task only requires the robot's degrees of freedom and the execution traces share structure, e.g traces are both cycles. However, if the task requires all degrees of freedom possessed only by the human, the robot cannot find meaningful correspondences, and also cannot imitate the task. Two MDPs for different viewpoints of an agent performing a task are MDP permutations since there is a one-to-one correspondence between state, actions at same timestep in the execution trace of an optimal policy.

4. LEARNING MDP REDUCTIONS:

We now derive objectives that can be optimized to learn MDP reductions. We propose distribution matching and policy performance maximization. We first define the distributions to be matched. Definition 5. Let M x , M y be two MDPs and ⇡x = g ⇡ y f for f : S x ! S y , g : A y ! A x and policy ⇡ y . P = {ŝ (t) y , â(t) y } t 0 is the co-domain policy execution process realized by running ⇡x , i.e:

s (0) x ⇠ ⌘ x , ŝ(t) y = f (s (t) x ), â(t) y ⇠ ⇡ y (•|ŝ (t) y ), a (t) x = g(â (t) y ), s (t+1) x = P x (s (t)

x , a (t)

x ) 8t 0 (4) The target distribution y ⇡y is over transitions uniformly sampled from execution traces of ⇡ y and the proxy distribution x!y ⇡x is over cross domain transitions uniformly sampled from realizations of P. y ⇡y (s y , a y , s 0 y ) = lim

EQUATION

EQUATION

EQUATION

x!y ⇡x (s y , a y , s 0 y ) = lim

EQUATION

We now propose three concrete objectives: 1. ⇡x is optimal, 2. x!y ⇡x = y ⇡y , 3. g is injective. In other words, we seek to learn f, g that matches distributions over transition tuples in domain y while maximizing policy performance in domain x. The former captures the dynamics preservation property from Eq. 3 and the latter captures the optimal policy preservation property from Eq. 1, 2. The following theorem uncovers the connection between our objectives and MDP reductions. Theorem 1. Let M x , M y be MDPs satisfying Assumption 1 (see Supp Materials). If M x M y , then 9f : S x ! S y , g : A y ! A x , and an optimal covering policy ⇡ y (Supp Materials, Def 6) that satisfy objectives 1, 2. Conversely, if 9f : S x ! S y , g : A y ! A x and an optimal covering policy ⇡ y satisfying objectives 1, 2, 3, then M x M y and 9( ,

) 2 (M x , M y ) s.t f = and g(a y ) = a y , 8a y 2 A y .

Theorem 1 states that if two MDP are alignable, then objectives 1, 2 can be satisfied. Conversely, if objectives 1, 2, 3 can be satisfied for two MDPs, then they must be alignable and all solutions (f, g) are MDP reductions. While Theorem 1 requires alignable MDPs to guarantee identifiability, our experiments will also run on MDPs that are not perfectly alignable, i.e. Eq. 1, 2, 3 do not hold exactly, but intuitively share structure. In the next section, we propose a simple algorithm to learn MDP reductions.

5. GENERATIVE ADVERSARIAL MDP ALIGNMENT:

Building on Theorem 1, we propose the following general form training objective for aligning MDPs:

EQUATION

where J(⇡ x ) is the performance of ⇡x , d is a distance metric between distributions, and > 0 is a Lagrange multiplier. In practice, we found that injectivity of g is unnecessary to enforce in continuous domains. We now present an instantiation of this framework: Generative Adversarial MDP Alignment (GAMA). Recall that we are given an alignment task set

D x,y = {(D Mx ,T i , D My ,T i )} N i=1 .

In the alignment step, we learn ⇡ ⇤ y,Ti , 8T i and parameterized state, action maps

f ✓ f : S x ! S y , g ✓g : A y ! A x that compose ⇡x,Ti = g ✓g ⇡ ⇤

y,Ti f ✓ f . To match x!y ⇡x , y ⇡y , we employ adversarial training (Goodfellow et al., 2014) in which separate discriminators D ✓ i D per task are trained to distinguish between "real" transitions (s y , a y , s 0 y ) ⇠ ⇡ ⇤ y,Ti and "fake" transitions (ŝ y , ây , ŝ0 y ) ⇠ ⇡x,Ti , where ŝy = f ✓ f (s x ), ây = ⇡ y (ŝ y ), ŝ0 y = f ✓ f (P x ✓ P (s x , g(â y ))), and P x ✓ P is a fitted model of the x domain dynamics. (see Figure 1(b )) The generator, consisting of f ✓ f , g ✓g , is trained to fool the discriminator while maximizing policy performance. The distribution matching gradients are back propagated through the learned dynamics, ⇡ ⇤ y,Ti is learned by Imitation Learing (IL) on D My ,T i , and the policy performance objective on ⇡x,Ti is achieved by IL on D Mx ,T i . In this work we use behavioral cloning (Pomerleau, 1991) for IL. We thus seek to find a saddle point {f, g}

EQUATION

where D KL is the KL-divergence. We provide the full execution flow of GAMA in Algorithm 1

In the adaptation step, we are given expert demonstrations D My ,T of a new target task T , from which we fit an expert domain policy ⇡ y,T which are composed with the learned alignments to construct an adapted self policy ⇡x,T = g ✓g ⇡ y,T f ✓ f . We also experiment with a demonstration adaptation method which additionally trains an inverse state map f 1 : S y ! S x , adapts demonstrations D My ,T into the self domain via f 1 , g, and applies behavioral cloning on the adapted demonstrations. (see Figure 1(c )) Notably, our entire procedure does not require paired, aligned demonstrations nor an RL step.

Algorithm 1: Generative Adversarial MDP Alignment (GAMA)

input: Alignment task set D x,y = {(D Mx ,T i , D My ,T i )} N i=1 of unpaired trajectories, fitted ⇡ ⇤ y,Ti

while not done do:

for i = 1, ..., N do:

Sample (s x , a x , s 0 x ) ⇠ D Mx ,T i , (s y , a y , s 0 y ) ⇠ D My ,T i and store in buffer B i x , B i y for j = 1, ..., M do: Sample mini-batch j from B i x , B i y Update dynamics model with: Ê⇡ ⇤ x,T i [r ✓ P (P x ✓ P (s x , a x ) s 0 x ) 2 ] Update discriminator: Ê⇡ ⇤ y,T i [r ✓ i D log D ✓ i D (s y , a y , s 0 y )] + Ê⇡ ⇤ x,T i [r ✓ i D log 1 D ✓ i D (ŝ y , ây , ŝ0 y ) ]

Update alignments (f ✓ f , g ✓g ) with gradients:

Ê⇡ ⇤ x,T i [r ✓ f log D ✓ D (ŝ y , ây , ŝ0 y )] + Ê⇡ ⇤ x,T i [r ✓ f (⇡ x,Ti (s x ) a x ) 2 ] Ê⇡ ⇤ x,T i [r ✓g log D ✓ D (ŝ y , ây , ŝ0 y )] + Ê⇡ ⇤ x,T i [r ✓g (⇡ x,Ti (s x ) a x ) 2 ]

Related Works: Closely related to CDIL, the field of cross domain transfer learning in the context of RL has explored approaches to use state maps to exploit cross domain demonstrations in a pretraining procedure for a new target task for which self domain reward function is available. Canonical Correlation Analysis (CCA) (Hotelling, 1936) finds invertible projections into a basis in which data from different domains are maximally correlated. These projections can then be composed to obtain a direct correspondence map between states. Ammar et al. ( 2015); Joshi & Chowdhary (2018) have utilized an unsupervised manifold alignment (UMA) algorithm which finds a linear map between states with similar local geometric properties. UMA assumes the existence of hand crafted features along with a distance metric between them. This family of work commonly uses a linear statemap to define a time-step wise transfer reward and executes an RL step on the new task. Similar to our work, these works use an alignment task set of unpaired, unaligned trajectories to compute the state map. Unlike these works, we learn maps that preserve MDP structure, use deep neural network state, action maps, and achieve zero-shot transfer to the new task without an RL step. More recent work in transfer learning across embodiment (Gupta et al., 2017) and viewpoint (Liu et al., 2018; Sermanet et al., 2018 ) mismatch obtain state correspondences from an alignment task set comprising paired, time-aligned demonstrations and use them to learn a state map or a state encoder to a domain invariant feature space. In contrast to this family of prior work, our approach learns both state, action maps from unpaired, unaligned demonstrations. Also, we remove the need for additional environment interactions and an expensive RL procedure on the target task by leveraging the action map for zero-shot imitation. Stadie et al. (2017) have shown promise in using domain confusion loss and generative adversarial imitation learning (Ho & Ermon, 2016) for learning across small viewpoint mismatch without an alignment task set, but fails in dealing with large viewpoint differences. Unlike Stadie et al. ( 2017), we leverage the alignment task set to succeed in imitating across larger viewpoint mismatch and do not require an RL procedure. MDP homomorphisms (Ravindran & Barto, 2002) have been explored with the aim of compressing state, action spaces to facilitate planning. In similar vein, related works have proposed MDP similarity metrics based on bisimulation methods (Ferns et al., 2004) and Boltzmann machine reconstruction error (Ammar et al., 2014) . While conceptually related to our MDP alignability theory, these works have not proposed scalable procedures to discover the homomorphisms and have not drawn connections to cross domain learning.

6. EXPERIMENTS:

Ours experiments were designed to answer the following questions: (1). Can GAMA uncover MDP reductions? (2). Can the learned alignments (f ✓ f , g ✓g ) be leveraged to succeed at CDIL? Note that we include experiments with MDP pairs that are not perfectly alignable, yet intuitively share structure, to show general applicability of GAMA for CDIL. We propose three metrics to evaluate the effectiveness of GAMA. First, alignment complexity which is the number of MDP pairs, i.e number of tasks, in the alignment task set needed to learn alignments that enable zero-shot imitation, given ample cross domain demonstrations for the target tasks. Second, adaptation complexity which is the amount of cross domain demonstrations for the target tasks needed to successfully imitate tasks in the self domain without querying the target task reward function, given a sufficiently large alignment task set. Finally, transferability, which is the environment sample complexity on the target task when using the alignment procedure as weight initialization then running RL with the target task reward function. While we aim to learn optimal self policies without querying the self domain reward function, this metric measures the usefulness of the alignment step even when MDP pairs in the alignment task set are not in the equivalence class of the target MDP pair. We study two ablations of GAMA and compare against the following baselines:

GAMA -Policy Adapt (GAMA-PA): learns alignments by Algorithm 1, fits an expert policy ⇡ y,T to D My ,T for a new target task T and zero-shot adapts ⇡ y,T to the self domain via ⇡x,T = g ✓g ⇡ y,T f ✓ f .

GAMA -Demonstration Adapt (GAMA-DA): trains f 1 in addition to Algorithm 1, adapts D My ,T into the self domain via (f 1 , g), and fits a self domain policy on the adapted demonstrations.

Self Demonstrations (Self-Demo): We behavioral clone on self domain demonstrations for the target task. This baseline provides an "upper bound" on the adapation complexity of CDIL.

Canonical Correlation Analysis (Hotelling, 1936) (CCA): finds invertible matrices C x , C y to a basis where domain data are maximally correlated from unpaired, unaligned demonstrations.

Unsupervised Manifold Alignment (Ammar et al., 2015) (UMA): finds a map between states that have similar local geometries from unpaired, unaligned demonstrations.

Invariant Features (Gupta et al., 2017) (IF): finds invertible projections onto a feature space given state pairings. Dynamic Time Warping (Muller, 2007) is used to obtain the pairings.

Imitation from Observation (Liu et al., 2018) (IfO): learns a statemap conditioned on a cross domain observation given state pairings. Dynamic Time Warping (Muller, 2007) is used to obtain the pairings.

Third Person Imitation Learning (Stadie et al., 2017) (TPIL): simultaneously learns a domain agnostic feature space and matches distributions in the feature space via GAIL (Ho & Ermon, 2016 ).

We experiment with environments which are extensions of OpenAI Gym (Brockman et al., 2016) . pen, cart, reacher2, reacher3, reach2-tp, snake3, and snake4 denotes the pendulum, cartpole, 2-link reacher, 3-link reacher, third person 2-link reacher, 3-link snake, and 4-link snake environments, respectively. (self domain) $ (expert domain) specify an MDP pair in the alignment task set. Model architectures and environment details are further described in the Supp. Materials, section B, C, D.

6.1. MDP ALIGNMENT EVALUATION:

Figure 4 visualizes the learned state map f ✓ f for several MDP pairs. The pen $ pen alignment task (Figure 4 , Top Left) and reach$reach-tp task task exemplify scenarios where two MDPs are permutations of each other. Similarly, the pen $ cart alignment task (Figure 4 , Top Right) has a reduction that maps the pendulum's angle and angular velocity to those of the pole, as the cart's position and velocity are redundant state dimensions once an optimal policy has been learned. Table 1 presents quantitative evaluations of these simple alignment maps. For pen$pen and reach2$reach2-tp we record the average L2 loss between the learned statemap's outputs and the ground truth permutation map's outputs. As for pen$cart, we do 1.62 ± 0.52 3.31 ± 1.2 >100 reach2$reach2-tp 0.092 ± 0.043 10.14 ± 5.31 >100 12.41 ± 3.12 5.12 ± 2.41 >100

the same on the dimensions that correspond to the angle and angular velocity of the pole. We see from both Figure 4 and Table 1 that GAMA is able to learn simple reductions while baselines fail to do so. The key reason behind this performance gap is that most baselines (Gupta et al., 2017; Liu et al., 2018) obtain state maps from time-aligned demonstration data. However, the considered alignment task set contains unaligned demonstrations with diverse starting states, up to 2x differences in demonstration lengths, and varying task execution rates. We see that GAMA also outperforms baselines that learn from unaligned demonstrations (Hotelling, 1936; Ammar et al., 2015) by learning maps that preserve MDP structure with more flexible neural network function approximators. For pen$cart, UMA learns a statemap that outputs out-of-bounds coordinates mainly because the pendulum demonstrations are concentrated around the pole upright state. The optimal UMA embedding matrix in this case is a zero matrix. Then the UMA state map matrix norm is proportional to the inverse embedding matrix norm which is very large. For snake4 $ snake3 and reach2 $ reach3, the MDPs may not be perfectly alignable, yet intuitively share structure. From Figure 4 (Bottom Left) we see that GAMA identically matches two adjacent joint angles of snake4 to the two joint angles of snake3 and the periodicity of the snake's wiggle is preserved. On reacher2$reacher3, we find that the central pivot angles are matched and further find correspondences between states that have similar extents of contraction. 

Reach2Write (R2W)::

The self domain is reacher2 and the expert domain is reacher2-tp that has a "third person" state space with a 180 camera angle offset. We use the robot's internal state, action representation. The alignment tasks are reaching for goals and the transfer task is writing letters as fast as possible. The transfer task differs from the alignment tasks in two key aspects: the end effector must draw a straight line from a letter's vertex to vertex and not slow down at the vertices in order to trace the letters fast.

Alignment complexity is shown in Figure 5 (Left). GAMA is able to learn alignments that enable zero-shot imitation on the target task, showing clear gains over a simple pretraining procedure on the self domain MDPs in the alignment task set. Other baselines require an additional RL step and cannot achieve zero-shot imitation. Figure 5 (Middle) shows the adaptation complexity. Notably, GAMA-DA (blue, dashed) produces adapted demonstrations of similar usefulness as self demonstrations (olive green).

Other baselines fail to learn useful alignments from unpaired, unaligned demonstrations and as a result fails at CDIL. Finally, Figure 5 (Right) shows that the alignment step is useful as weight initialization to accelerate learning of the target task. GAMA (blue) attains optimal performance around 7⇥ faster than all baselines in the W2C experiment, while immediately attaining optimal performance on the R2W task.

Baselines fail to learn the writing task as an inaccurate proxy reward function harms performance.

6.3. CDIL WITH VISUAL INPUTS:

The non-visual environment experiments in the previous section demonstrate the limitations of the time-alignment assumptions made in prior work without confounding variables such as the difficulty optimization in high-dimensional space. In this section, we also demonstrate that GAMA scales to higher dimensional, visual environments with 64 ⇥ 64 ⇥ 3 image inputs on the W2C and R2W experiments. Specifically, we train a deep spatial autoencoder on the alignment task set to learn an encoder with the architecture from Levine et al. (2016) , then apply GAMA on the (learned) latent space. Comparing the dark blue (image input) and light blue curves (internal state input) in Figure 5 , we see that the adaptation complexity and alignment complexity of GAMA-DA-img, GAMA-PA-img are both similar to that of GAMA-DA, GAMA-PA and better than baselines trained with the robot's internal representation.

7. DISCUSSION AND FUTURE WORK:

We've formalized Cross Domain Imitation Learning which encompasses prior work in transfer learning across embodiment (Gupta et al., 2017 ) and viewpoint differences (Stadie et al., 2017; Liu et al., 2018) along with a practical algorithm that can be applied to both scenarios. We now point out directions future work. Our MDP alignability theory is a first step towards formalizing possible shared structures that enable cross domain imitation. While we've shown that GAMA empirically works well even when MDPs are not perfectly alignable, upcoming works may explore relaxing the conditions for MDP alignability to develop a theory that covers an even wider range of real world MDPs. Future works may also try applying GAMA in the imitation from observations scenario, i.e actions are not available, by aligning observations with GAMA and applying methods from Sermanet et al. (2018) ; Liu et al. (2018) . Finally, we hope to see future works develop principled ways design a minimal alignment task set, which is analogous to designing a minimal training set for supervised learning.

Cross Domain Imitation Learning -Supplementary Materials:

A HIGH-LEVEL COMPARISON TO BASELINES We note that methods such as IF has potential to be applied to the viewpoint mismatch problem and IfO, TCN have the potential to be applied to the embodiment mismatch problem, albeit they were not shown in the paper. TCN has shown interesting mappings between humans and robots can be learned. However they haven't shown that robots can use these mappings to learn from human demonstrations. Below we summarize the key differences between GAMA and the main baselines. 2018) to perform CDIL when action information is unavailable from demonstrations. 2. We remove the need for an expensive RL procedure on a new target task, by leveraging action information for zero-shot imitation. By learning a composite self policy with both state and action maps, we obtain a near-optimal self policy on new tasks without any environment interactions while prior approaches (Gupta et al., 2017; Liu et al., 2018; Sermanet et al., 2018) require an additional RL step that involves self domain environment interactions.

3. We use a single algorithm to address both the viewpoint and embodiment mismatch which have previously been dealt with different solutions.

B GAMA MODEL ARCHITECTURE:

We now describe the model architecture. The state, action map f ✓ f , g ✓g , inverse state map f 1 ✓ f 1 , transition function P x ✓ P , and discriminators {D ✓ i D } N i=1 are neural networks with hidden layers of size (200, 200) . The fitted policies {⇡ y,Ti } N i=1 for GAMA-PA and ⇡ x,T for GAMA-DA all have hidden layers of size (300, 200) . All models are trained with Adam optimizers (Kingma & Ba, 2014) using decay rates 1 = 0.9, 2 = 0.999. For the spatial autoencoders used in GAMA-PA-img and GAMA-DA-img, we use the same architecture as in Finn et al. (2015) We use a learning rate of 1e-4 for the alignment maps and 1e-5 for all other components. These parameters are fixed across all experiments.

C BASELINE IMPLEMENTATION DETAILS:

In this section we describe our implementation details of the baselines.

Obtaining State Correspondences:

We use 5000 sampled trajectories in both expert and self domains to learn the state map for IF and CCA. For UMA, we use 20 sampled trajectories to learn that in pendulum and cartpole environment and 50 trajectories in reacher, reacher-tp environment (much beyond these numbers UMA is computationally intractable). For IF and IfO, we use Dynamic Time Warping (DTW) (Muller, 2007) to obtain state correspondences. For IF, DTW uses the (learned) feature space as a metric space to estimate the domain correspondences. For IfO, DTW is applied on the state space. We follow the implementation procedure in Gupta et al. (2017) .

To visualize and quantitatively evaluate the statemaps learned in prior work, we compose the encoder and decoder for IF and use the Moore-Penrose pseudo inverse of the embedding matrix for UMA and CCA.

Transfer Learning In the transfer learning phase for CCA, UMA, IF, and IfO they define a proxy reward function on the target task by using the state correspondence map. r proxy (s (t) x ) =

1 |T| P ⌧ 2T kf (s (t) y,⌧ ) g(s (t) x )k 2 2

, where s

(t)

x is a self domain state at time t, T is the collection of expert demonstrations, and s

(t)

y,⌧ is the expert domain state at time t in trajectory ⌧ . IfO additionally defines a penalty reward for deviating from states encountered during training. We refer readers to their paper (Liu et al., 2018) for further details. The transferability results of Figure 5 (Right) show the learning curve for training on the ground truth reward for the target task where the policy is pretrained with a training procedure on the proxy reward. All RL steps are performed using the Deep Deterministic Policy Gradient (DDPG) (Lillicrap et al., 2015) algorithm.

Architecture For UMA and CCA, the embedding dimension is the minimum state dimension between the expert and self domains. For UMA, we use one state sample every 5 timesteps to reduce the computational time, and we match the pairwise distance matrix of 3-nearest neighbors.

For IF, we use 2 hidden layer with 64 hidden units each and leaky ReLU non-linearities to parameterize embedding function and decoders, the dimension of common feature space is set to be 64. The optimizer are same with respect to our models and the learning rate is 1e-3.

For IfO, we use the same architecture as the statemap in GAMA for their observation conditioned statemap.

For TPIL, we use 3 hidden layer with 128 hidden units each and ReLU non-linearities to parameterize the feature extractor, classifier and domain classifier. We use Adam Optimizer with default decay rates and learning rate 1e-3 to train the discriminator and use same optimizer and learning rate with respect to our model to train the policy.

D ENVIRONMENTS:

We use the 'Pendulum-v0', 'Cartpole-v0' environments for the pendulum and cartpole tasks which have state space (w, ẇ) and (w, ẇ, x, ẋ), respectively, where w is the angle of the pendulum/pole and x is the position of the cart. The action spaces are (F w ) and (F x ) where F w is the torque applied to the pendulum's pivot and F x is the x-direction force applied to the cart. For snake3, snake4 we use an extension Wang et al. (2018) of the 'Swimmer-v0' environment from Gym Brockman et al. (2016) . A K link snake has a state representation (w 1 , ..., w K , ẇ1 , ..., ẇK ) where w k is the angle of the k th snake joint. The action vector has the form (F w1 , ...F w K ) where F w k is the torque applied to joint k. All reacher environments were extended from the 'Reacher-v0' gym environment. A k link reacher has a state vector of the form (w 1 , ..., w K , ẇ1 , ..., ẇK , x g , y g ) where w k is the angle of the k th reacher joint and (x g , y g ) is the position of the goal. Note the key difference with the original Reacher-v0 environment is that the difference vector between the end effector and the goal coordinate was removed from the state to make the task more challenging. The action vector has the form (F w1 , ...F w K ) where F w k is the torque applied to joint k. The third person reacher environment (reach-tp) has an angle off set of ⇡ such that (w 1 + ⇡, ..., w K + ⇡, ẇ1 , ..., ẇK , x g , y g ) corresponds to the same internal robot state as (w 1 , ..., w K , ẇ1 , ..., ẇK , x g , y g ) in the original reacher domain. Note that the goal coordinates (x g , y g ) have not changed but the joint angles have changed. Thus a proper alignment between the original domain and the third person domain should add an offset of ⇡ to the original state. For the writing task, the vertices of the letters to write are specified sequentially with the goal coordinates. Once the first vertex is reached, the goal coordinates are updated to be the next vertex coordinates. The reward function is defind as follows: R write (s) = ⇢ 100 if state s corresponds to reaching a vertex 1 else Thus the agent must perform a sequential reaching task and accomplish it as fast as possible. The key difference with a normal reaching task is that the reacher must not slow down at each vertex and plan it's path accordingly in order to minimize drastic direction changes. Further more the reward is significantly more sparse than the original reacher reward which gets reward inversely proportional to the distance between the end effector and the goal.

E VIDEOS OF ALIGNMENT MAPS:

We will provide real-time visualizations of the learned alignments in the final version of the submission.

F PROOFS

Definition 1. An optimality function O Mx : S x ⇥ A x ! {0, 1} for an MDP M x satisfies: O Mx (s x , a x ) = 1 if 9⇡ ⇤ x 2 ⇧ ⇤ Mx such that (s x , a x ) 2 supp(q ⇡ ⇤ x ) and O Mx (s x , a x ) = 0 otherwise. Definition 6. An optimal policy ⇡ x is covering if O Mx (s x , a x ) = 1 ) a x 2 supp(⇡ x (•|s x )).

We first restate the definition of MDP reductions:

EQUATION

2. (dynamics) 8s y , s 0 y 2 S y , a y 2 A y where O My (s y , a y ) = 1, P y (s y , a y ) = (P x (s x , a x ))

EQUATION

where we define

1 (s y ) = {s x | (s x ) = s y }, 1 (a y ) = {a x | (a x ) = a y }.

Furthermore, r is an MDP permutation if and only if , are bijective maps.

Definition 7. MDP M x is unichain, if all policies induce irreducible Markov Chains and all stochastic optimal policies induce ergodic, i.e irreducible and aperiodic, Markov Chains.

Assumption 1. All considered MDPs are unichain with discrete state, action spaces and deterministic dynamics i.e. P : S ⇥ A ! S. Furthermore, there exists dummy state, actions s d , a d

where O M (s, a d ) = 0 8s 2 S and O M (s d , a) = 0 8a 2 A As stated in Assumption 1, we specifically consider MDPs that are unichain with deterministic dynamics. We note this is a reasonable assumption since physics is largely deterministic and many control behaviors, such as walking, are described by unichains. We now formalize a notion of MDP alignability starting from defining a class of structure preserving maps between MDPs. We first prove some lemmas that will assist in proving the main Theorem. Recall that f : S x ! S y , g : A y ! A x and ⇡x = g ⇡ y f Lemma 1. Let M x , M y be MDPs satisfying Assumption 1 (see Supp. Materials), M x , M y , and ⇡ y be optimal in M y . 8g :

A y ! A x s.t g(a y ) = a y 8a y 2 {a y |9s y 2 S y s.t O My (s y , a y ) = 1}, it holds that ⇡x = g ⇡ y is optimal in M x .

Proof. Without loss of generality, consider an arbitrarily chosen sample

a x = g(a y ), a y ⇠ ⇡ y (•| (s x ))

for any s x 2 S x . We first see that:

O My (s x ), (a x ) = O My (s x ), (g(a y )) = O My (s x ), a y = 1 (9)

where the first step substitutes a x = g(a y ), the second step applies g(a y ) = a y since O( (s x ), a y ) = 1 due to the optimality of ⇡ y , and the last step follows from Corollary 1. Since ( , ) is a reduction, we have that O My ( (s x ), (a

x )) = 1 ) O Mx (s x , a x ) = 1 by Equation (1). Therefore, O Mx (s x , a x ) = 1 8s x 2 S x , 8a x 2 supp(⇡ x (•|s x )).

Then by Lemma 2, ⇡x is optimal.

Lemma 2. Let MDP M x satisfy Assumption 1 and ⇡ x (a x |s x ) be a (stochastic) mixture policy that chooses a x randomly from {a x |O(s x , a x ) = 1}. Then, ⇡ x is optimal. (Ortner, 2005) Corollary 1. Let MDP M x satisfy Assumption 1 and ⇡ x be optimal. Then O Mx (s x , a x ) = 1 8s x 2 S x , a x 2 supp(⇡ x (•|s x )) Lemma 3. Let MDP M x satisfy Assumption 1 and ⇡ x be a stochastic optimal policy. Then the triplet stationary distribution ⇢ x ⇡x (s x , a x , s 0 x ) = lim t!1 Pr(s

EQUATION

x = a x , s

(t+1) x = s 0 x ; ⇡ x , P x , ⌘ x ) exists and is unique. Proof. ⇢ x ⇡x (s x , a x , s 0 x ) = lim t!1 Pr(s (t) x = s x , a (t) x = a x , s (t+1) x = s 0 x ; ⇡ x , P x , ⌘ x ) = lim t!1

Pr(s (t) x = s x ; ⇡ x , P x , ⌘ x )⇡ x (a x |s x ) (s 0 x = P x (s x , a x )) = ⇡ x (a x |s x ) (s 0

x = P x (s x , a x )) lim t!1

Pr(s (t) x = s x ; ⇡ x , P x , ⌘ y )

where is the indicator function. The limit in the last line is the stationary distribution over states, which exists and is unique since a stochastic optimal policy induces an ergodic Markov Chain over states. 

EQUATION

According to the Stolz-Cesàro theorem,

lim T !1 A T +1 A T B T +1 B T = lim T !1 A T B T

if the limit on the left hand side exists. Therefore

EQUATION

which completes the proof.

Recall that our target distribution y ⇡y and proxy distribution x!y ⇡x were defined as: 

x!y ⇡x (s y , a y , s 0 y ) = lim

EQUATION

EQUATION

We are now ready to prove that our proxy and target limiting distributions exist.

Lemma 5. Let MDP M y satisfy Assumption 1 and ⇡ y be a stocahstic optimal policy. Then, y ⇡y (s y , a y , s 0 y ) = ⇢ y ⇡y (s y , a y , s 0 y ).

Proof. Recall that the stationary distribution ⇢ y ⇡y (s y , a y , s 0 y ) is the following limiting distribution:

EQUATION

⇢ y ⇡y (s y , a y , s 0 y ) exist for M y as shown in Lemma 3. Then, y ⇡y (s y , a y , s 0 y ) = lim 

as desired. The second line follows from Lemma 4 and the last line follows from Lemma 3.

Lemma 6. Let MDP M y satisfy Assumption 1 and ⇡ y be a stochastic optimal policy. Then, supp( y ⇡y ) ✓ {(s y , a y , s 0 y )|O My (s y , a y ) = 1, s y , s 0 y 2 S y , a y 2 A y } Lemma 7. Let MDP M x satisfy Assumption 1 and ⇡x = g ⇡ y f be an stochastic optimal policy in M x where f : S x ! S y is the state map, g : A y ! A x is injective action map, and ⇡ y is a stochastic optimal policy in M y . Further let F : S x ⇥ g(A y ) ⇥ S x ! S y ⇥ A y ⇥ S y be the map F(a, b, c) = (f (a), g 1 (b), f(c)). Then, x!y ⇡x (s y , a y , s 0 y ) = F(⇢ x ⇡x (s x , a x , s 0 x )).

Proof. We first define the triplet random variables X (t) = (s

(t)

x , a

x , s

) for t = 0, 1, 2, ... where s (t)

x , a (t)

x , s (t+1) x for t = 0, 1, 2, ... were defined in Definition 5. F is a function on supp(⇢ x ⇡x ) 2 S x ⇥ g(A y ) ⇥ S x and F(X (t) ) = (ŝ

EQUATION

). Furthermore, since F is a function defined on a discrete domain and codomain, there always exists a trivial continuous extension of F. We may thus apply the continuous mapping theorem (Billingsley, 1968) :

X (t) d ! X ) F(X (t) ) d ! F (X)

Since M x is unichain and ⇡x is stochastic optimal, the distribution of X (t) converges (in distribution) to ⇢ x ⇡x (s x , a x , s 0 x ) as t ! 1 by Lemma 3. Applying the continuous mapping theorem, it follows that the distribution of F(X (t) ) = (ŝ

EQUATION

) converges (in distribution) to the pushforward measure F(⇢ x ⇡x (s x , a x , s 0 x )) as t ! 1 Directly applying this result, we obtain: Pr(ŝ (t) y = s y , â(t) y = a y , ŝ(t+1)

EQUATION

as desired. Line ( 18) ! (19) follows from Lemma 4 and ( 19) ! (20) follows from the continuous mapping theorem.

Lemma 8. Let X, Y be countable sets, : X ! Y be a function, and be the indicator function. We denote 1 (y) = {x| (x) = y}. Then 8x 2 X, y 2 Y (y = (x)) = P z2 1 (y) (x = z)

Proof. Since both the left and right hand-side of the desired equality only take on values in {0, 1}, it suffices to show the following statements hold for arbitrarily chosen x 2 X, y 2 Y :

P z2 1 (y) (x = z) = 1 ) (y = (x)) = 1 (y = (x)) = 1 ) P z2 1 (y) (x = z) = 1

For the first direction, we see that if P z2 1 (y) (x = z) = 1, then x 2 1 (y), and thus (x) = y. For the second direction if (y = (x)) = 1, then x 2 1 (y). Thus there exists a unique z such that z = x and z 2 1 (y). Then, P z2 1 (y) (x = z) = 1 as desired, which concludes the proof.

Finally, we prove the main theorem. Our objectives are:

1. ⇡x is optimal 2. x!y ⇡x = y ⇡y 3. g is injective Theorem 1. Let M x , M y be MDPs satisfying Assumption 1 (see Supp Materials). If M x M y , then 9f : S x ! S y , g : A y ! A x , and an optimal covering policy ⇡ y (Supp Materials, Def 6) that satisfy objectives 1, 2. Conversely, if 9f : S x ! S y , g : A y ! A x and an optimal covering policy ⇡ y satisfying objectives 1, 2, 3, then M x M y and 9( , ) 2 (M x , M y ) s.t f = and g(a y ) = a y , 8a y 2 A y .

Proof. We first show the ()) direction. Using any ( , ) 2 (M x , M y ) we construct f and g in the following manner: f (s x ) = (s x ) 8s x 2 S x . g(a y ) maps to an arbitrary chosen element from the set 1 (a y ) = {a x | (a x ) = a y } if 1 (a y ) 6 = ; and an arbitrarily chosen action a x 2 A x otherwise. We see that 8a y 2 A y for which 9s y 2 S y such that O My (s y , a y ) = 1, it holds that 1 (a y ) 6 = ; by Eq 2. Therefore, g(a y ) = a y 8a y 2 A y for which 9s y such that O My (s y , a y ) = 1 since maps all elements in 1 (a y ) to a y . For ⇡ y we choose any covering optimal policy for M y . It suffices to show that this choice of f, g, ⇡ y satisfies objectives 1, 2.

• Objective 1. ⇡x is optimal: follows from Lemma 1.

• Objective 2. x!y ⇡x = y ⇡y : Since f = is a reduction, it follows that 8s y 2 S y , a y 2 A y such that O My (s y , a y ) = 1, any s 0 y 2 S y , and 8t = 0, 1, 2, ...:

Pr(ŝ (t+1) y = s 0 y |ŝ (t) y = s y , â(t) y = a y ) = P s 0 x 2Sx

Pr(ŝ

(t+1) y = s 0 y |ŝ (t+1) x = s 0 x , ŝ(t) y = s y , â(t) y = a y ) Pr(ŝ (t+1) x = s 0 x |ŝ (t) y = s y , â(t) y = a y ) = P s 0 x 2Sx

Pr(ŝ

(t+1) y = s 0 y |ŝ (t+1) x = s 0 x ) P sx2Sx ax2Ax

Pr(ŝ

EQUATION

x = a x , ŝ(t) y = s y , â(t) y = a y ) Pr(s Pr(ŝ

EQUATION

EQUATION

x = a x ) Pr(s x = s 00

EQUATION

x ) Pr(s

(t) x = s 00 x ) (a x = g(a y )) = P s 0 x 2Sx (s 0 y = (s 0 x )) P sx2Sx (s 0 x = P x (s x , g(a y ))) (s y = (s x )) Pr(s (t) x = s x ) P s 00 x 2Sx

(s y = (s 00

x )) Pr(s

(t) x = s 00 x ) = P s 0 x 2 1 (s 0 y ) P sx2 1 (sy) (s 0 x = P x (s x , g(a y )))

Pr(s

(t) x = s x ) P s 00 x 2 1 (sy) Pr(s (t) x = s 00 x ) = P sx2 1 (sy)

Pr(s

(t) x = s x ) P s 00 x 2 1 (sy) Pr(s (t) x = s 00 x ) P s 0 x 2 1 (s 0 y ) (s 0 x = P x (s x , g(a y ))) Lemma8 = P sx2 1 (sy)

Pr(s

(t) x = s x ) P s 00 x 2 1 (sy) Pr(s (t) x = s 00 x ) ⇣ s 0 y = ⇣ P x s x , g(a y ) ⌘⌘ Eq3 = P sx2 1 (sy)

Pr(s

(t) x = s x ) P s 00 x 2 1 (sy) Pr(s (t) x = s 00 x )

Now we show the (() direction. We first introduce some overloaded notation:

EQUATION

Then,

EQUATION

Given f, g that satisfy objective 1, 2, and 3 we construct ( , ) as follows and show that ( , ) 2 (M x , M y ): Mapping to the dummy state, action will ensure that the constructions will not map suboptimal state, action pairs from domain x to optimal state action pairs in domain y. The following statement holds for our construction ( , ):

EQUATION

)

We first prove the forward direction:

(s ⇤ x , a ⇤ x ) 2 supp( x ⇡x (s x , a x )) ) x ⇡x (s ⇤ x , a ⇤ x ) Eq25 = x ⇡x (s x )⇡ x (a ⇤ x |s ⇤

x ) > 0, so x ⇡x (s ⇤ x ) > 0, i.e s ⇤ x 2 supp( x ⇡x (s x )), and ⇡x (a ⇤ x |s ⇤ x ) > 0. Furthermore, ⇡x (a ⇤

x |s ⇤ x ) > 0 ) g 1 (a ⇤ x ) 2 supp(⇡ y (•|f (s ⇤ x ))) since g is injective. To see this, assume 9(s ⇤ x , a ⇤ x ) such that ⇡x (a ⇤

x |s ⇤ x ) > 0 but g 1 (a ⇤ x ) / 2 supp(⇡ y (•|f (s ⇤ x ))). Then there must exists a 0 y 2 supp(⇡ y (•|f (s ⇤ x ))) such that a 0 y 6 = g 1 (a ⇤ x ) but g(a 0 y ) = g(g 1 (a ⇤ x )) = a ⇤ x contradicting the injectivity of g on A y . Putting these results together we obtain (a ⇤

x ) = g 1 (a ⇤ x ) 2 supp(⇡ y (•| (s ⇤ x ))). Since ⇡ y is a stochastic optimal policy and M y is unichain, (a ⇤

x ) 2 supp(⇡ y (•| (s ⇤ x ))) ) O My ( (s ⇤ x ), (a ⇤ x )) = 1 by Corollary 1. For the converse direction we prove the contrapostive: (s ⇤

x , a ⇤ x ) / 2 supp( x ⇡x (s x , a x )) ) O My ( (s ⇤

x ), (a ⇤ x )) = 0 8s x 2 S x , a x 2 A x . We exhaustively consider all cases in which (s ⇤

x , a )). This concludes the proof of Equation 28. We proceed to show that the optimal policy and dynamics preservation properties hold for our construction ( , ).

• Optimal Policy (Equation 1): From the converse direction of the above subclaim and the optimality of ⇡x the result immediate follows:

O My ( (s ⇤

x ), (a ⇤ x )) = 1

Eq28:

) (s ⇤ x , a ⇤ x ) 2 supp( x ⇡x (s x , a x ))

Eq25:

) ⇡x (a ⇤ x |s ⇤ x ) > 0

• Dynamics (Equation 3): Assume for contradiction that 9s

x , a x and s 0 x = P x (s x , a

x such that O My ( (s x ), (a x )) = 1 but the dynamics preservation property is violated, i.e P y ( (s x ), (a x )) 6 = (P x (s

x , a

x )) = (s 0 x ). If (s x , a x ) / 2 supp( x ⇡x (s x , a x )), then O My ( (s x ), (a x )) = 0 by Equation 28 which contradicts O( (s x ), (a x )) = 1. Thus, it must be that (s x , a x ) 2 supp( x ⇡x (s x , a x )) which further implies (s x , a x , s 0 x ) 2 supp( x ⇡x (s x , a x , s 0 x )) by Equation 26and (s x ) = f (s x ), (a x ) = g 1 (a

x ) by Equation 25 since x ⇡x (s x ) > 0, ⇡(a x |s x ) > 0. Let F : S x ⇥ g(A y ) ⇥ S x ! S y ⇥ A y ⇥ S y be a function (a, b, c) 7 ! (f (a), g 1 (b), f(c)). Then, by Lemma 7, we have x!y ⇡x (s x , a x , s 0 x ) = F(⇢ x ⇡x (s x , a x , s 0 x ))

Lemma5:

= F( x ⇡x (s x , a x , s 0 x )). So, 

:



Figures and Tables:

Figure 2: Example MDP reduction from M x to M y . , are state and action maps

Figure 3: Illustration of MDP alignment problem

Figure 4: Visualization of the learned state maps for pen$pen (Top Left), pen$cart (Top Right), snake4$snake3 (Bottom Left), reach2$reach3 (Bottom Right). GAMA is able to recover MDP reductions (Top Left/Right) and finds interpretable correspondences between domains that are not perfectly alignable, yet intuitively share structure (Bottom Left/Right). Baselines fail in most cases

Figure 5: CDIL performance. Alignment complexity (Left), Adaptation complexity (Middle), and transferability (Right) for W2C/R2W on the top/bottom rows, respectively. GAMA outperforms baselines in all metrics. Notably, adaptation complexity of GAMA is close to that of the self-demo baseline. Error bars/regions show the standard deviation over 5 runs.6.2 CDIL PERFORMANCEWall2Corner (W2C): The self domain is reacher2 and the expert domain is reacher3. We use the robot's internal state, action representation. The alignment tasks are reaching for 12 goals near the room wall centers and the target tasks are reaching for 12 new goals at the room corners, maximally away from the wall goals. The significant difference between training and test goals makes generalization challenging.

If a real sequence {a i } 1 i=1 converges to some a 2 R, thenlim i = lim i!1 a i = aProof. Denote A T = P T i=1 a i , and B T = T . We have lim T !1

y ; ⇡ y , P y , ⌘ y )

x = P x (s x , a x )) Pr(s

s x ) = ⇢ f (s x ) if s x 2 supp( x ⇡x (s x )) s d y otherwise (a x ) = ⇢ g 1 (a x ) if a x 2 A ⇡x = S sx2Sx supp(⇡ x (•|s x )) a dy otherwise where s d y , a d y are dummy state, actions such that O My (s d y , a y ) = 0 8a y 2 A y and O My (s y , a d y ) = 0 8s y 2 S y . Such dummy state, actions always exist per Assumption 1.

2 supp( x!y ⇡x (s x , a x , s 0x )). However, ( x!y ⇡x ) 6 = supp( y ⇡y ) ) x!y ⇡x 6 = y ⇡y which contradicts f, g satisfying objective 3. This concludes the proof of the main theorem.



Table content: <table><tr><td/><td>GAMA (ours)</td><td>CCA</td><td>UMA</td><td>IF</td><td>IfO</td><td>Random</td></tr><tr><td>pen $ pen pen $ cart</td><td>0.057 ± 0.017 0.178 ± 0.051</td><td>0.72 ± 0.25 3.92 ± 3.77</td><td>&gt;100 &gt;100</td><td>2.50 ± 1.08</td><td>2.24 ± 0.82</td><td>&gt;100</td></tr></table>

Comparison of baselines by attributes demonstrated in the paper. The "No Act" column denotes whether or not the demonstrations need to contain actions.

Table content: <table><tr><td/><td>Unpair. Unalign. Data</td><td>Zeroshot Imit.</td><td>Embod. Mismatch</td><td>Viewpoint Mismatch</td><td>Single-domain Demo.</td><td>No Act.</td></tr><tr><td>TPIL (Stadie et al., 2017)</td><td>3</td><td>7</td><td>7</td><td>3</td><td>3</td><td>7</td></tr><tr><td>IF (Gupta et al., 2017)</td><td>7</td><td>7</td><td>3</td><td>7</td><td>7</td><td>7</td></tr><tr><td>IfO (Liu et al., 2018)</td><td>7</td><td>7</td><td>7</td><td>3</td><td>7</td><td>3</td></tr><tr><td>TCN (Sermanet et al., 2018)</td><td>7</td><td>7</td><td>7</td><td>3</td><td>3</td><td>3</td></tr><tr><td>GAMA (ours)</td><td>3</td><td>3</td><td>3</td><td>3</td><td>7</td><td>7</td></tr></table>

My (s d y , a y ) = 0 8a y 2 A y . Else if ⇡x (a ⇤ x |s ⇤ x ) = 0, x ⇡x (s ⇤ x ) > 0 and a x / 2 A ⇡x then O My (s y , (a ⇤ x )) = O My (s y , a d y ) = 0 8s y 2 S y . Finally, consider the case ⇡x (a ⇤ x |s ⇤ It follows that g(g 1 (a ⇤ x )) 2 supp(g(⇡ y (•|f (s ⇤ x )))) ) a ⇤ x 2 supp(⇡ x (•|s ⇤ x )) since ⇡x (•|s ⇤ x ) is the pushforward measure g(⇡ y (•|f (s ⇤ x ))). Then, x ⇡x (s ⇤ x , a ⇤ x ) ⇤ x )⇡ x (a ⇤ x |s ⇤ x ) > 0, since ⇡x (a ⇤ x |s ⇤ x ) > 0 and x ⇡x (s ⇤ x ) > 0,which contradicts (s ⇤ x , a ⇤ x ) / 2 supp( x ⇡x (s x , a x

Table content: <table><tr><td>Eq25 = x ⇡x (s</td></tr></table>

Peer review (iclr2020):
The paper proposes a learning approach for zero-shot imitation learning in an RL setting across domains with different embodiments and viewpoint mismatch. The proposed approach involves two steps, alignment and adaptation. In contrast to previous work, the alignment between domains, represented as MDPs, is learned from unpaired, unaligned samples from both domains. The paper presents a theoretical formulation of the cross-domain imitation learning problem, and presents an algorithm for training alignment and adaptation from data. I think the paper is well written and theoretically well-founded. The authors provide experiments comparing to many previous works in cross-domain imitation learning and show that their approach outperforms previous approaches. I only have minor comments. 1. For imitation between reacher2 and reacher3, there are multiple correspondences between the two domains due to the redundancy in the 3-link robot (and in general with n-link robots). How does GAMA deal with these redundancies? For example, an n-link robot is able to perform the same task with different configurations (elbow up, elbow down, etc.,) and all these will correspond to one configuration of a 2-link robot. 2. In practise, can *alignment complexity* and *adaptation complexity* help identify if transfer with GAMA between two domains is not beneficial? Results in Figure 5 only shows cases for GAMA in which the two metrics are good, resulting in good transfer. However, I am interested in knowing if there could be cases in which the two complexity metrics tell beforehand that transfer will not be beneficial. 3. In Figure 5*s caption, Adaptation complexity is on Left and Alignment Complexity in the Middle. However, the text refers to Alignment complexity on the Left and Adaptation complexity in the Middle. 4. A reference is missing in Appendix B.