Year: 2019

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.

heading: 1 INTRODUCTION
text: 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,
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.

heading: 2 CROSS DOMAIN IMITATION LEARNING PROBLEM STATEMENT
text: 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 Mx,T = (Sx,Ax, Px, ⌘x, Rx,T ), where Rx,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 Mx,T is a map ⇡x,T : Sx ! B(Ax) where B is the set of probability measures on Ax and an optimal policy ⇡⇤x,T = argmax⇡x J(⇡x) achieves the highest policy performance J(⇡x) = E⇡x [ P1 t=0 tRx,T (s (t) x , a (t) 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 )}Ht=1 sampled from an optimal policy and DMx,T = {⌧ (k) Mx,T } K k=1 is a set of demonstrations for Mx,T
Let Mx,T ,My,T be self and expert MDPs for a target task T . Given expert domain demonstrations DMy,T , Cross Domain Imitation Learning (CDIL) aims to determine an optimal self domain policy ⇡ ⇤ x,T without access to the reward function Rx,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 Dx,y = {(DMx,Ti ,DMy,Ti )} N
i=1 containing demonstrations for N tasks {Ti}Ni=1 from both the self and expert domain. Dx,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.

heading: 3 ALIGNABLE MDPS
text: 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) P1 t=0
t Pr(s(t) = s;⇡, P, ⌘). Definition 1. An optimality function OMx : Sx ⇥ Ax ! {0, 1} for an MDP Mx satisfies: OMx(sx, ax) = 1 if 9⇡⇤x 2 ⇧⇤Mx such that (sx, ax) 2 supp(q⇡⇤x) and OMx(sx, ax) = 0 otherwise.
Definition 2. An MDP reduction from Mx = (Sx,Ax, Px, ⌘x, Rx) to My = (Sy,Ay, Py, ⌘y, Ry) is a tuple r = ( , ) where : Sx ! Sy, : Ax ! Ay are maps that preserve:
1. (optimal policy) 8sx 2 Sx, ax 2 Ax, sy 2 Sy, ay 2 Ay , OMy ( (sx), (ax)) = 1 ) OMx(sx, ax) = 1 (1)
OMy (sy, ay) = 1 ) 1(sy) 6= ;, 1(ay) 6= ; (2) 2. (dynamics) 8sy, s0y 2 Sy , ay 2 Ay where OMy (sy, ay) = 1,
Py(sy, ay) = (Px(sx, ax)) 8sx 2 1(sy), ax 2 1(ay) (3)
where we define 1(sy) = {sx| (sx) = sy}, 1(ay) = {ax| (ax) = ay}. 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 Mx , My to denote that ( , ) is a reduction from Mx to My, and the shorthand Mx My to denote that Mx reduces to My . 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 Mx to My homomorphs the execution graph of an optimal policy in Mx to a execution graph of an optimal policy in My. Figure 2 shows an example of a valid reduction from Mx to My: states 1, 2 in Sx are mapped (merged) to state a in Sy and the blue, green actions in Ax are mapped to the brown action in Ay. Intuitively, if Mx , My , then ( , ) compresses Mx by merging all optimal state, action pairs that have identical dynamics properties. Definition 3. Two MDPs Mx,My are alignable if and only if Mx My or My Mx. Definition 3 states that MDPs are alignable if reductions exists between them, meaning that they share structure. We use (Mx,My) = {( , )|Mx , My} to denote the set of all valid reductions from Mx to My. Reductions have a particularly useful property which is that they adapt policies across alignable MDPs. Consider a state map f : Sx ! Sy, an inverse action map g : Ay ! Ax, 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 Mx,My be MDPs satisfying Assumption 1 (see Supp. Materials), Mx , My, and ⇡y be optimal in My. 8g : Ay ! Ax s.t g(ay) = ay 8ay 2 {ay|9sy 2 Sy s.t OMy (sy, ay) = 1}, it holds that ⇡̂x = g ⇡y is optimal in Mx. 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 (Mx,My), (Mx0,My 0) 2 ⌦2 be two MDP pairs. Then, (Mx,My) ⇠ (Mx0,My 0), i.e they are joint alignable, if and only if (Mx,My) \ (Mx0,My 0) 6= ;. In words, two MDP pairs are joint alignable if there exists a shared reduction. We define an equivalence class [(Mx,My)]⇠ = {(Mx0,My 0) | (Mx0,My 0) ⇠ (Mx,My)} of MDP pairs that share reductions. Overloading notation, ({(Mxi,Myi)}Ni=1) = {( , ) | ( , ) 2 (Mx
1,Mx1) \ · · · \ (MxN ,MxN )}. We now formally state the MDP alignment problem: Let (Mx,T ,My,T ) be an MDP pair for a target task T . Given an alignment task set Dx,y = {(DMx,Ti ,DMy,Ti )} N
i=1 comprising unpaired, unaligned demonstrations for MDP pairs {(Mx,Ti ,My,Ti)} N
i=1 ✓ [(Mx,T ,My,T )]⇠, determine ( , ) 2 ({(Mx,Ti ,My,Ti)} N
i=1) such that ( , ) 2 (Mx,T ,My,T ). As shown in Figure 3, with more MDP pairs, there are likely a smaller the number of joint alignments | ({(Mx,Ti ,My,Ti)} N i=1)| and, as a result, ( , ) 2 ({(Mx,Ti ,My,Ti)} N
i=1) is more likely to "generalize" to an MDP pair for a new target task (Mx,T ,My,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 DMy,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.

heading: 4 LEARNING MDP REDUCTIONS
text: 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 Mx, My be two MDPs and ⇡̂x = g ⇡y f for f : Sx ! Sy, g : Ay ! Ax and policy ⇡y . P = {ŝ(t)y , â(t)y }t 0 is the co-domain policy execution process realized by running ⇡̂x, i.e:
s(0) x ⇠ ⌘x, ŝ(t)y = f(s(t)x ), â(t)y ⇠ ⇡y(·|ŝ(t)y ), a(t)x = g(â(t)y ), s(t+1)x = Px(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 (sy, ay, s 0 y ) = lim
T!1
1
T
P T 1 t=0 Pr(s (t) y = sy, a (t) y = ay, s (t+1) y = s0y;⇡y, Py, ⌘y) (5)
x!y ⇡̂x (sy, ay, s 0 y ) = lim
T!1
1
T
P T 1 t=0 Pr(ŝ (t) y = sy, â (t) y = ay, ŝ (t+1) y = s0y;P) (6)
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 Mx,My be MDPs satisfying Assumption 1 (see Supp Materials). If Mx My, then 9f : Sx ! Sy, g : Ay ! Ax, and an optimal covering policy ⇡y (Supp Materials, Def 6) that satisfy objectives 1, 2. Conversely, if 9f : Sx ! Sy, g : Ay ! Ax and an optimal covering policy ⇡y satisfying objectives 1, 2, 3, then Mx My and 9( , ) 2 (Mx,My) s.t f = and g(ay) = ay, 8ay 2 Ay . 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.

heading: 5 GENERATIVE ADVERSARIAL MDP ALIGNMENT
text: Building on Theorem 1, we propose the following general form training objective for aligning MDPs:
min f,g
J(⇡̂x) + d( x!y⇡̂x , y ⇡y ) (7)
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 Dx,y = {(DMx,Ti ,DMy,Ti )} N
i=1. In the alignment step, we learn ⇡⇤
y,Ti , 8Ti and parameterized state, action maps f✓f : Sx ! Sy, g✓g : Ay ! Ax 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✓iD per task are trained to distinguish between "real" transitions (sy, ay, s0y) ⇠ ⇡⇤y,Ti and "fake" transitions (ŝy, ây, ŝ 0 y ) ⇠ ⇡̂x,Ti , where ŝy = f✓f (sx), ây = ⇡y(ŝy), ŝ0y = f✓f (P x ✓P (sx, g(â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 DMy,Ti , and the policy performance objective on ⇡̂x,Ti is achieved by IL on DMx,Ti . In this work we use behavioral cloning (Pomerleau, 1991) for IL. We thus seek to find a saddle point {f, g} [ {D✓iD} N i=1 of the following objective:
min f,g max {D✓i
D }Ni=1
P N
i=1 Esx⇠⇡⇤x,Ti [DKL(⇡ ⇤ x,Ti(·|sx)||⇡̂x,Ti(·|sx))]
+ (E⇡⇤y,Ti [logD✓iD (sy, ay, s 0 y )] + E⇡⇤x,Ti [log(1 D✓iD (ŝy, ây, ŝ 0 y ))]
(8)
where DKL is the KL-divergence. We provide the full execution flow of GAMA in Algorithm 1 In the adaptation step, we are given expert demonstrations DMy,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 : Sy ! Sx, adapts demonstrations DMy,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) 1 input: Alignment task set Dx,y = {(DMx,Ti ,DMy,Ti )} N
i=1 of unpaired trajectories, fitted ⇡⇤y,Ti 2 while not done do: 3 for i = 1, ..., N do: 4 Sample (sx, ax, s0x) ⇠ DMx,Ti , (sy, ay, s 0 y ) ⇠ DMy,Ti and store in buffer B i x ,Bi y 5 for j = 1, ...,M do: 6 Sample mini-batch j from Bi
x ,Bi y
7 Update dynamics model with: Ê⇡⇤x,Ti [r✓P (P x ✓P (sx, ax) s0x)2] 8 Update discriminator: Ê⇡⇤y,Ti [r✓iD logD✓iD (sy, ay, s 0 y )] + Ê⇡⇤x,Ti [r✓iD log 1 D✓iD (ŝy, ây, ŝ 0 y ) ] 9 Update alignments (f✓f , g✓g ) with gradients:
Ê⇡⇤x,Ti [r✓f logD✓D (ŝy, ây, ŝ 0 y )] + Ê⇡⇤x,Ti [r✓f (⇡̂x,Ti(sx) ax) 2] Ê⇡⇤x,Ti [r✓g logD✓D (ŝy, ây, ŝ 0 y )] + Ê⇡⇤x,Ti [r✓g (⇡̂x,Ti(sx) ax) 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.

heading: 6 EXPERIMENTS
text: 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 DMy,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 DMy,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 Cx, Cy 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.

heading: 6.1 MDP ALIGNMENT EVALUATION
text: 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
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.

heading: 6.2 CDIL PERFORMANCE
text: Wall2Corner (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.
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.

heading: 6.3 CDIL WITH VISUAL INPUTS
text: 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.

heading: 7 DISCUSSION AND FUTURE WORK
text: 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.

heading: A HIGH-LEVEL COMPARISON TO BASELINES
text: 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.
1. We propose an unsupervised MDP alignment algorithm (GAMA) capable of learning state correspondences from unpaired, unaligned demonstrations while Gupta et al. (2017); Liu et al. (2018); Sermanet et al. (2018) obtain these correspondences from paired, time-aligned trajectories. Our demonstrations have varying length (up to 2x difference) and diverse starting positions. Since good observation correspondences are prerequisites to the success of Gupta et al. (2017); Liu et al. (2018); Sermanet et al. (2018), our work provide the missing ingredient. Future work could try learning alignments with GAMA, then apply methods from Gupta et al. (2017); Liu et al. (2018); Sermanet et al. (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.

heading: B GAMA MODEL ARCHITECTURE
text: 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✓iD} N i=1 are neural networks with hidden layers of size (200, 200). The fitted policies {⇡y,Ti}Ni=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.

heading: C BASELINE IMPLEMENTATION DETAILS
text: 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.
rproxy(s (t) x ) =
1 |T| P ⌧2T kf(s (t) y,⌧ ) g(s(t)x )k22
, 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.

heading: D ENVIRONMENTS
text: We use the ’Pendulum-v0’, ’Cartpole-v0’ environments for the pendulum and cartpole tasks which have state space (w, ẇ) and (w, ẇ, x, ẋ), respectively, where w is the angle of the pendulum/pole and x is the position of the cart. The action spaces are (Fw) and (Fx) where Fw is the torque applied to the pendulum’s pivot and Fx 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 (w1, ..., wK , ẇ1, ..., ẇK) where wk is the angle of the kth snake joint. The action vector has the form (Fw1 , ...FwK ) where Fwk 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 (w1, ..., wK , ẇ1, ..., ẇK , xg, yg) where wk is the angle of the kth reacher joint and (xg, yg) 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 (Fw1 , ...FwK ) where Fwk is the torque applied to joint k. The third person reacher environment (reach-tp) has an angle off set of ⇡ such that (w1 + ⇡, ..., wK + ⇡, ẇ1, ..., ẇK , xg, yg) corresponds to the same internal robot state as (w1, ..., wK , ẇ1, ..., ẇK , xg, yg) in the original reacher domain. Note that the goal coordinates (xg, yg) 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:
Rwrite(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.

heading: F PROOFS
text: Definition 1. An optimality function OMx : Sx ⇥ Ax ! {0, 1} for an MDP Mx satisfies: OMx(sx, ax) = 1 if 9⇡⇤x 2 ⇧⇤Mx such that (sx, ax) 2 supp(q⇡⇤x) and OMx(sx, ax) = 0 otherwise.
Definition 6. An optimal policy ⇡x is covering if OMx(sx, ax) = 1 ) ax 2 supp(⇡x(·|sx)).
We first restate the definition of MDP reductions: Definition 2. An MDP reduction from Mx = (Sx,Ax, Px, ⌘x, Rx) to My = (Sy,Ay, Py, ⌘y, Ry) is a tuple r = ( , ) where : Sx ! Sy, : Ax ! Ay are maps that preserve:
1. (optimal policy) 8sx 2 Sx, ax 2 Ax, sy 2 Sy, ay 2 Ay ,
OMy ( (sx), (ax)) = 1 ) OMx(sx, ax) = 1 (1) OMy (sy, ay) = 1 ) 1(sy) 6= ;, 1(ay) 6= ; (2)
2. (dynamics) 8sy, s0y 2 Sy , ay 2 Ay where OMy (sy, ay) = 1, Py(sy, ay) = (Px(sx, ax)) 8sx 2 1(sy), ax 2 1(ay) (3)
where we define 1(sy) = {sx| (sx) = sy}, 1(ay) = {ax| (ax) = ay}. Furthermore, r is an MDP permutation if and only if , are bijective maps.
Definition 7. MDP Mx 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 sd, ad where OM(s, ad) = 0 8s 2 S and OM(sd, 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 : Sx ! Sy, g : Ay ! Ax and ⇡̂x = g ⇡y f Lemma 1. Let Mx,My be MDPs satisfying Assumption 1 (see Supp. Materials), Mx , My, and ⇡y be optimal in My. 8g : Ay ! Ax s.t g(ay) = ay 8ay 2 {ay|9sy 2 Sy s.t OMy (sy, ay) = 1}, it holds that ⇡̂x = g ⇡y is optimal in Mx.
Proof. Without loss of generality, consider an arbitrarily chosen sample ax = g(ay), ay ⇠ ⇡y(·| (sx)) for any sx 2 Sx. We first see that:
OMy (sx), (ax) = OMy (sx), (g(ay)) = OMy (sx), ay = 1 (9)
where the first step substitutes ax = g(ay), the second step applies g(ay) = ay since O( (sx), ay) = 1 due to the optimality of ⇡y, and the last step follows from Corollary 1. Since ( , ) is a reduction, we have that OMy ( (sx), (ax)) = 1 ) OMx(sx, ax) = 1 by Equation (1). Therefore, OMx(sx, ax) = 1 8sx 2 Sx, 8ax 2 supp(⇡̂x(·|sx)). Then by Lemma 2, ⇡̂x is optimal.
Lemma 2. Let MDP Mx satisfy Assumption 1 and ⇡x(ax|sx) be a (stochastic) mixture policy that chooses ax randomly from {ax|O(sx, ax) = 1}. Then, ⇡x is optimal. (Ortner, 2005) Corollary 1. Let MDP Mx satisfy Assumption 1 and ⇡x be optimal. Then OMx(sx, ax) = 1 8sx 2 Sx, ax 2 supp(⇡x(·|sx))
Lemma 3. Let MDP Mx satisfy Assumption 1 and ⇡x be a stochastic optimal policy. Then the triplet stationary distribution ⇢x
⇡x (sx, ax, s0x) = limt!1 Pr(s (t) x = sx, a (t) x = ax, s (t+1) x = s0x;⇡x, Px, ⌘x)
exists and is unique.
Proof.
⇢x ⇡x (sx, ax, s 0 x ) = lim t!1 Pr(s(t) x = sx, a (t) x = ax, s (t+1) x = s0 x ;⇡x, Px, ⌘x)
= lim t!1
Pr(s(t) x = sx;⇡x, Px, ⌘x)⇡x(ax|sx) (s0x = Px(sx, ax))
= ⇡x(ax|sx) (s0x = Px(sx, ax)) lim t!1 Pr(s(t) x = sx;⇡x, Px, ⌘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.
Lemma 4. If a real sequence {ai}1i=1 converges to some a 2 R, then
lim T!1
1
T
P T
i=1 ai = limi!1 ai = a
Proof. Denote AT = P T i=1 ai, and BT = T . We have
lim T!1 AT+1 AT BT+1 BT = lim T!1 aT+1 = a (10)
According to the Stolz–Cesàro theorem,
lim T!1 AT+1 AT BT+1 BT = lim T!1 AT BT
if the limit on the left hand side exists. Therefore
lim T!1 AT BT = lim T!1 1 T
P T
i=1 ai = a (11)
which completes the proof.
Recall that our target distribution y ⇡y and proxy distribution x!y ⇡̂x were defined as:
y ⇡y (sy, ay, s 0 y ) = lim
T!1
1
T
P T 1 t=0 Pr(s (t) y = sy, a (t) y = ay, s (t+1) y = s0y;⇡y, Py, ⌘y) (12)
x!y ⇡̂x (sy, ay, s 0 y ) = lim
T!1
1
T
P T 1 t=0 Pr(ŝ (t) y = sy, â (t) y = ay, ŝ (t+1) y = s0y;P) (13)
We are now ready to prove that our proxy and target limiting distributions exist. Lemma 5. Let MDP My satisfy Assumption 1 and ⇡y be a stocahstic optimal policy. Then, y ⇡y (sy, ay, s0y) = ⇢ y ⇡y (sy, ay, s0y).
Proof. Recall that the stationary distribution ⇢y ⇡y (sy, ay, s0y) is the following limiting distribution:
⇢y ⇡y (sy, ay, s 0 y ) = lim t!1 Pr(s(t) y = sy, a (t) y = ay, s (t+1) y = s0 y ;⇡y, Py, ⌘y) (14)
⇢y ⇡y (sy, ay, s0y) exist for My as shown in Lemma 3. Then,
y ⇡y (sy, ay, s 0 y ) = lim
T!1
1
T
P T 1 t=0 Pr(s (t) y = sy, a (t) y = ay, s (t+1) y = s0y;⇡y, Py, ⌘y) (15)
= lim t!1
Pr(s(t) y = sy, a (t) y = ay, s (t+1) y = s0 y ;⇡y, Py, ⌘y) (16)
= ⇢y ⇡y (sy, ay, s 0 y ) (17)
as desired. The second line follows from Lemma 4 and the last line follows from Lemma 3.
Lemma 6. Let MDP My satisfy Assumption 1 and ⇡y be a stochastic optimal policy. Then,
supp( y ⇡y ) ✓ {(sy, ay, s0y)|OMy (sy, ay) = 1, sy, s0y 2 Sy, ay 2 Ay}
Proof. Assume for contradiction that there exists (sy, ay, s0y) 2 supp( y⇡y ) but (sy, ay, s 0 y ) /2 {(sy, ay, s0y)|OMy (sy, ay) = 1, sy, s0y 2 Sy, ay 2 Ay}. Then OMy (sy, ay) = 0. Since
y ⇡y (sy, ay, ay) = lim t!1 Pr(s(t) y = sy, a (t) y = ay, s (t+1) y = s0 y ;⇡y, Py, ⌘y)
= lim t!1
Pr(s(t) y = sy) Pr(a (t) y = ay|s(t)y = sy) Pr(s(t+1)y = s0y|s(t)y = sy, a(t)y = ay)
= lim t!1
Pr(s(t) y = sy)⇡y(ay|sy) Pr(s(t+1)y = s0y|s(t)y = sy, a(t)y = ay)
= ⇠⇠⇠ ⇠⇠:0⇡y(ay|sy) Pr(s(t+1)y = s0y|s(t)y = sy, a(t)y = ay) lim
t!1 Pr(s(t) y = sy)
= 0
First line follows from Lemma 5 and terms are taken out of the limit in the second to last line since the stationary distribution over states exist as My is unichain and ⇡y is stochastic optimal. ⇡y(ay|sy) = 0 since OMy (sy, ay) = 0 ) ⇡y(ay|sy) = 0 from Corollary 1. Then, we have y⇡y (sy, ay, ay) = 0 which contradicts (sy, ay, s0y) 2 supp( y⇡y ) concluding the proof.
Lemma 7. Let MDP Mx satisfy Assumption 1 and ⇡̂x = g ⇡y f be an stochastic optimal policy in Mx where f : Sx ! Sy is the state map, g : Ay ! Ax is injective action map, and ⇡y is a stochastic optimal policy in My. Further let F : Sx ⇥ g(Ay) ⇥ Sx ! Sy ⇥ Ay ⇥ Sy be the map F(a, b, c) = (f(a), g 1(b), f(c)). Then, x!y
⇡̂x (sy, ay, s0y) = F(⇢x⇡̂x(sx, ax, s 0 x )).
Proof. We first define the triplet random variables X(t) = (s(t)x , a (t) x , s (t+1) x ) 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 Sx ⇥
g(Ay)⇥ Sx and F(X(t)) = (ŝ(t)y , â(t)y , ŝ(t+1)y ). 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 Mx is unichain and ⇡̂x is stochastic optimal, the distribution of X(t) converges (in distribution) to ⇢x
⇡̂x (sx, ax, s0x) as t ! 1 by Lemma 3. Applying the continuous mapping theorem, it follows that the distribution of F(X(t)) = (ŝ(t)y , â(t)y , ŝ(t+1)y ) converges (in distribution) to the pushforward measure F(⇢x
⇡̂x (sx, ax, s0x)) as t ! 1
Directly applying this result, we obtain:
x!y ⇡̂x (sy, ay, s 0 y ) = lim
T!1
1
T
P T 1 t=0 Pr(ŝ (t) y = sy, â (t) y = ay, ŝ (t+1) y = s0y;P) (18)
= lim t!1
Pr(ŝ(t) y = sy, â (t) y = ay, ŝ (t+1) y = s0 y ;P) (19)
= F(⇢x ⇡̂x (sx, ax, s 0 x )) (20)
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 Mx,My be MDPs satisfying Assumption 1 (see Supp Materials). If Mx My, then 9f : Sx ! Sy, g : Ay ! Ax, and an optimal covering policy ⇡y (Supp Materials, Def 6) that satisfy objectives 1, 2. Conversely, if 9f : Sx ! Sy, g : Ay ! Ax and an optimal covering policy ⇡y satisfying objectives 1, 2, 3, then Mx My and 9( , ) 2 (Mx,My) s.t f = and g(ay) = ay, 8ay 2 Ay .
Proof. We first show the ()) direction. Using any ( , ) 2 (Mx,My) we construct f and g in the following manner: f(sx) = (sx) 8sx 2 Sx. g(ay) maps to an arbitrary chosen element from the set 1(ay) = {ax| (ax) = ay} if 1(ay) 6= ; and an arbitrarily chosen action ax 2 Ax otherwise. We see that 8ay 2 Ay for which 9sy 2 Sy such that OMy (sy, ay) = 1, it holds that 1(ay) 6= ; by Eq 2. Therefore, g(ay) = ay 8ay 2 Ay for which 9sy such that OMy (sy, ay) = 1 since maps all elements in 1(ay) to ay. For ⇡y we choose any covering optimal policy for My. 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 8sy 2 Sy, ay 2 Ay such that
OMy (sy, ay) = 1, any s0y 2 Sy , and 8t = 0, 1, 2, ...:
Pr(ŝ(t+1) y = s0 y |ŝ(t) y = sy, â (t) y = ay) = P
s0x2Sx Pr(ŝ(t+1)y = s0y|ŝ (t+1) x = s0x, ŝ (t) y = sy, â (t) y = ay) Pr(ŝ (t+1) x = s0x|ŝ (t) y = sy, â (t) y = ay)
= P
s0x2Sx Pr(ŝ(t+1)y = s0y|ŝ (t+1) x = s0x)
P sx2Sx ax2Ax Pr(ŝ(t+1)x = s0x|s (t) x = sx, a (t) x = ax, ŝ (t) y = sy, â (t) y = ay) Pr(s (t) x = sx, a (t) x = ax|ŝ(t)y = sy, â(t)y = ay)
= P
s0x2Sx (s0 y = (s0 x ))
P sx2Sx ax2Ax Pr(ŝ(t+1)x = s0x|s (t) x = sx, a (t) x = ax) Pr(s (t) x = sx|a(t)x = ax, ŝ(t)y = sy, â(t)y = ay) Pr(a(t)x = ax|ŝ(t)y = sy, â(t)y = ay)
= P
s0x2Sx (s0 y = (s0 x )) P sx2Sx ax2Ax (s0 x = Px(sx, ax)) Pr(s (t) x = sx|ŝ(t)y = sy) Pr(a(t)x = ax|â(t)y = ay)
= P
s0x2Sx (s0 y = (s0 x )) P sx2Sx ax2Ax (s0 x = Px(sx, ax)) Pr(ŝ(t)y = sy|s(t)x = sx) Pr(s(t)x = sx) P s00x2Sx Pr(ŝ(t)y = sy|s(t)x = s00x) Pr(s (t) x = s00x) (ax = g(ay))
= P
s0x2Sx (s0 y = (s0 x )) P sx2Sx (s0 x = Px(sx, g(ay)))
(sy = (sx)) Pr(s (t) x = sx)
P s00x2Sx (sy = (s00x)) Pr(s (t) x = s00x)
= P
s0x2 1(s0y) P sx2 1(sy) (s0 x = Px(sx, g(ay))) Pr(s(t)x = sx) P
s00x2 1(sy) Pr(s(t)x = s00x)
= P
sx2 1(sy)
Pr(s(t)x = sx) P
s00x2 1(sy) Pr(s(t)x = s00x)
P s0x2 1(s0y) (s0 x = Px(sx, g(ay)))
Lemma8 = P sx2 1(sy) Pr(s(t)x = sx) P
s00x2 1(sy) Pr(s(t)x = s00x)
⇣ s0 y = ⇣ Px sx, g(ay) ⌘⌘
Eq3 = P sx2 1(sy) Pr(s(t)x = sx) P
s00x2 1(sy) Pr(s(t)x = s00x)
(s0 y = Py(sy, ay))
= (s0 y = Py(sy, ay))
= Pr(s(t+1) y = s0 y |s(t) y = sy, a (t) y
= ay) (21) Furthermore, from Definition 5, we have:
Pr(â(t) y = ay|ŝ(t)y = sy) = ⇡y(ay|sy) = Pr(a(t)y = ay|s(t)y = sy) (22)
Then, 8sy, s0y 2 Sy and 8t = 0, 1, 2, ...
Pr(ŝ(t+1) y = sy|ŝ(t)y = sy) = P
ay2Ay Pr(ŝ(t+1)y = sy|ŝ(t)y = sy, â(t)y = ay) Pr(â(t)y = ay|ŝ(t)y = sy)
= P
ay2supp(⇡y(·|sy)) Pr(s(t+1)y = sy|s(t)y = sy, a(t)y = ay)⇡y(ay|sy)
= Pr(s(t+1) y = sy|s(t)y = sy) (23)
we are justified in the substitution for the dynamics in the second line since OMy (sy, ay) = 18sy 2 Sy, ay 2 supp(⇡y(·|sy)) by Corollary 1. Since My is unichain and ⇡y is a stochastic optimal policy, the stationary distribution limt!1 Pr(s (t) y = sy) is invariant to the initial state distribution ⌘y and only depends on the state transition dynamics Pr(s(t+1)y = s0y|s (t) y = sy). Equivalently any stochastic process with the same state transition dynamics will converge to the same stationary distribution regardless of the initial state distribution. Thus,
lim t!1
Pr(ŝ(t) y
= sy) = lim t!1
Pr(s(t) y = sy) 8sy 2 Sy (24)
Finally putting these results together, the following equalities hold for (sy, ay, s0y) 2 {(sy, ay, s0y)|OMy (sy, ay) = 1, sy, s0y 2 Sy, ay 2 Ay}
x!y ⇡̂x (sy, ay, s 0 y ) = Lemma 5 lim t!1 Pr(ŝ(t) y = sy, â (t) y = ay, ŝ (t+1) y = s0 y ;P)
= lim t!1
Pr(ŝ(t) y = sy) Pr(â (t) y = ay|ŝ(t)y = sy) Pr(ŝ(t+1)y = s0y|ŝ(t)y = sy, â(t)y = ay)
= Eq (21),(22)
lim t!1
Pr(ŝ(t) y = sy) Pr(a (t) y = ay|s(t)y = sy) Pr(s(t+1)y = s0y|s(t)y = sy, a(t)y = ay)
= ⇡y(ay|sy) (s0y = Py(sy, ay)) lim t!1 Pr(ŝ(t) y = sy)
= Eq (24) ⇡y(ay|sy) (s0y = Py(sy, ay)) lim t!1 Pr(s(t) y = sy)
= lim t!1
Pr(s(t) y = sy) Pr(a (t) y = ay|s(t)y = sy) Pr(s(t+1)y = s0y|s(t)y = sy, a(t)y = ay)
= Lemma 5
y ⇡y (sy, ay, s 0 y )
The constant terms are moved in and out of the limit in the fourth and sixth line since the stationary distribution over states exist as My is unichain and ⇡y is optimal for My. This allows us to conclude that x!y
⇡̂x = y ⇡y since y ⇡y is supported on {(sy, ay, s0y)|OMy (sy, ay) = 1, sy, s0y 2 Sy, ay 2 Ay} by
Lemma 6.
Now we show the ( ) direction. We first introduce some overloaded notation:
x ⇡̂x (sx) = lim
T!1
1
T
P T 1 t=0 Pr(s (t) x = sx; ⇡̂x, Px, ⌘x) Lemma5 = limt!1 Pr(s (t) x = sx; ⇡̂x, Px, ⌘x)
x ⇡̂x (sx, ax) = lim
T!1
1
T
P T 1 t=0 Pr(s (t) x = sx, a (t) x = ax; ⇡̂x, Px, ⌘x)
= Lemma 5
lim t!1
Pr(s(t) x = sx, a (t) x = ax; ⇡̂x, Px, ⌘x)
= lim t!1
Pr(s(t) x = sx; ⇡̂x, Px, ⌘x)⇡̂x(ax|sx)
= ⇡̂x(ax|sx) lim t!1 Pr(s(t) x = sx; ⇡̂x, Px, ⌘x)
= ⇡̂x(ax|sx) x⇡̂x(sx) (25) Then,
x ⇡̂x (sx, ax, s 0 x ) = Lemma 5 lim t!1 Pr(s(t) x = sx, a (t) x = ax, s (t+1) x = s0 x ; ⇡̂x, Px, ⌘x)
= lim t!1
Pr(s(t+1) x = s0 x |s(t) x = sx, a (t) x = ax) Pr(s (t) x = sx, a (t) x = ax; ⇡̂x, Px, ⌘x)
= (s0 x = Px(sx, ax)) lim t!1 Pr(s(t) x = sx, a (t) x = ax; ⇡̂x, Px, ⌘x)
= (s0 x = Px(sx, ax)) x ⇡̂x (sx, ax) (26)
= (s0 x = Px(sx, ax))⇡̂x(ax|sx) x⇡̂x(sx) (27)
Given f, g that satisfy objective 1, 2, and 3 we construct ( , ) as follows and show that ( , ) 2 (Mx,My):
(sx) = ⇢ f(sx) if sx 2 supp( x⇡̂x(sx)) sd y otherwise
(ax) =
⇢ g 1(ax) if ax 2 A⇡̂x = S sx2Sx supp(⇡̂x(·|sx))
ad y
otherwise
where sd y , ad y are dummy state, actions such that OMy (sdy, ay) = 0 8ay 2 Ay and OMy (sy, ady) = 0 8sy 2 Sy. Such dummy state, actions always exist per Assumption 1. 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 ( , ):
(s⇤ x , a⇤ x ) 2 supp( x ⇡̂x (sx, ax)) () OMy ( (s⇤x), (a⇤x)) = 1 8s⇤x 2 Sx, a⇤x 2 Ax (28)
We first prove the forward direction: (s⇤ x , a⇤ x ) 2 supp( x ⇡̂x (sx, ax)) ) x⇡̂x(s ⇤ x , a⇤ x )
Eq25 =
x ⇡̂x (sx)⇡̂x(a⇤x|s⇤x) > 0, so x⇡̂x(s ⇤ x ) > 0, i.e s⇤ x 2 supp( x ⇡̂x (sx)), 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 a0y 2 supp(⇡y(·|f(s⇤x))) such that a0
y 6= g 1(a⇤ x ) but g(a0 y ) = g(g 1(a⇤ x )) = a⇤ x contradicting the injectivity of g on Ay. 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 My is unichain, (a⇤x) 2 supp(⇡y(·| (s⇤x))) ) OMy ( (s⇤x), (a⇤x)) = 1 by Corollary 1. For the converse direction we prove the contrapostive: (s⇤
x , a⇤ x ) /2 supp( x ⇡̂x (sx, ax)) )
OMy ( (s ⇤ x ), (a⇤ x )) = 0 8sx 2 Sx, ax 2 Ax. We exhaustively consider all cases in which
(s⇤ x , a⇤ x ) /2 supp( x ⇡̂x (sx, ax)), i.e x⇡̂x(s ⇤ x , a⇤ x ) Eq25 = ⇡̂x(a⇤x|s⇤x) x⇡̂x(s ⇤ x ) = 0. If x ⇡̂x (s⇤ x ) = 0, then s⇤ x /2 supp( x ⇡̂x (sx)), so OMy ( (s⇤x), ay) = OMy (sdy, ay) = 0 8ay 2 Ay. Else if ⇡̂x(a⇤x|s⇤x) = 0, x ⇡̂x (s⇤ x ) > 0 and ax /2 A⇡̂x then OMy (sy, (a⇤x)) = OMy (sy, ady) = 0 8sy 2 Sy. Finally, consider the case ⇡̂x(a⇤x|s⇤x) = 0, x⇡̂x(s ⇤ x ) > 0 and a⇤ x 2 A⇡̂x . Assume for contradiction that OMy ( (s ⇤ x ), (a⇤ x )) = 1. Then, (a⇤ x ) 2 supp(⇡y(·| (s⇤x)) since ⇡y is a covering optimal policy from Definition 6, which implies g 1(a⇤ x ) 2 supp(⇡y(·|f(s⇤x)) since x⇡̂x(s ⇤ x ) > 0 and a⇤ x 2 A⇡̂x . 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 ) Eq25 = x ⇡̂x (s⇤ 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 (sx, ax)). 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:
OMy ( (s ⇤ x ), (a⇤ x )) = 1 Eq28) (s⇤ x , a⇤ x ) 2 supp( x ⇡̂x (sx, ax))
Eq25) ⇡̂x(a⇤x|s⇤x) > 0 Cor1) OMx(s⇤x, a⇤x) = 1 8s⇤x 2 Sx, a⇤x 2 Ax
• Surjection (Equation 2): Assume for contradiction 9(s⇤ y , a⇤ y ) such that OMy (s⇤y, a⇤y) = 1, but 1(s⇤y) = ; or 1(a⇤ y ) = ;. Since OMy (s⇤y, a⇤y) = 1 we have s⇤y 6= sdy, a⇤y 6= ady. Thus (s⇤y) 1 = f 1(s⇤y) and 1(a⇤ y ) = {(g 1) 1(a⇤ y )} = {g(a⇤ y )}. Since g is a function defined 8ay 2 Ay, it follows that
1(a⇤ y ) 6= ;. Thus it must be that 1(s⇤ y ) = ;. Let s⇤0 y = Py(s⇤y, a ⇤ y ). Then,
x!y ⇡̂x (s⇤ y , a⇤ y , s⇤
0
y ) = Lemma 5 lim t!1 Pr(ŝ(t) y = s⇤ y , â(t) y = a⇤ y , ŝ(t+1) y = s⇤ 0 y )
= lim t!1
Pr(ŝ(t+1) y
= s⇤ 0
y |ŝ(t) y = s⇤ y , â(t) y = a⇤ y ) Pr(ŝ(t) y = s⇤ y , â(t) y = a⇤ y )
= lim t!1
Pr(ŝ(t+1) y
= s⇤ 0
y |ŝ(t) y = s⇤ y , â(t) y = a⇤ y ) Pr(â(t) y = a⇤ y |ŝ(t) y = s⇤ y ) Pr(ŝ(t) y = s⇤ y )
= lim t!1
Pr(ŝ(t+1) y
= s⇤ 0
y |ŝ(t) y = s⇤ y , â(t) y = a⇤ y )⇡y(a ⇤ y |s⇤ y ) P sx2 1(s⇤y) Pr(ŝ(t)x = sx)
= lim t!1
Pr(ŝ(t+1) y
= s⇤ 0
y |ŝ(t) y = s⇤ y , â(t) y = a⇤ y )⇡y(a ⇤ y |s⇤ y ) · 0
= 0
However,
y ⇡y (s⇤ y , a⇤ y , s⇤
0
y ) = Eq 27 (Py(s ⇤ y , a⇤ y ) = Py(s ⇤ y , a⇤ y ))⇡y(a ⇤ y |s⇤ y ) y ⇡y (s⇤ y )
= ⇡y(a ⇤ y |s⇤ y ) y ⇡y (s⇤ y ) > 0
To see why the last inequality holds, first recall that My is unichain and ⇡y is stochastic optimal for My, so the stationary distribution over states have full support over Sy (* stationary distributions of irreducible markov chains are fully supported over the entire state space) Therefore y
⇡y (sy)
Lemma5 =
limt!1 Pr(s (t) y = sy;⇡y, Py) > 0 8sy 2 Sy . Thus, we have y⇡y (s ⇤ y ) > 0. Furthermore, ⇡y(a⇤y|s⇤y) > 0 by Corollary 1. Putting these two results together, we obtain y ⇡y (s⇤ y , a⇤ y , s⇤ 0 y ) > 0. Then, x!y ⇡̂x 6= y ⇡y which contradicts the satisfiability of objective 3.
• Dynamics (Equation 3): Assume for contradiction that 9s x , a x and s
0
x = Px(s x , a x such that OMy ( (s x ), (a x )) = 1 but the dynamics preservation property is violated, i.e Py( (s x ), (a x )) 6=
(Px(s x , a x )) = (s
0
x ). If (s x , a x ) /2 supp( x ⇡̂x (sx, ax)), then OMy ( (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 (sx, ax)) which further implies (s x , a x , s 0 x ) 2 supp( x ⇡̂x (sx, ax, s0x)) by Equation 26 and (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 : Sx ⇥ g(Ay) ⇥ Sx ! Sy ⇥ Ay ⇥ Sy be a function (a, b, c) 7! (f(a), g 1(b), f(c)). Then, by Lemma 7, we have x!y
⇡̂x (sx, ax, s0x) = F(⇢x⇡̂x(sx, ax, s 0 x )) Lemma5 = F( x ⇡̂x (sx, ax, s0x)). So,
x ⇡̂x (s x , a x , s
0
x ) > 0 ) x!y ⇡̂x (F(s x , a x , s
0
x )) = x!y ⇡̂x (f(s x ), g 1(a x ), f(s
0
x )) > 0
Thus, (f(s x ), g 1(a x ), f(s
0
x )) = ( (s x ), (a x ), (s
0 x )) 2 supp( x!y ⇡̂x (sx, ax, s0x)). However,
y ⇡y ( (s x ), (a x ), (s
0
x )) = Eq 26 y ⇡y ( (s x ), (a x ))
(s
0
x ) = Py( (s x ), (a x ))
= y ⇡y ( (s x ), (a x )) · 0
= 0
Thus, supp( 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.

Review summaries:
This paper proposes Generative Adversarial MDP Alignment (GAMA) for imitation learning. Given a set of paired MDPs, GAMA learns a state mapping f and an action mapping g such that one MDP can be reduced to another. For a new test MDP pair (x,y) where expert demonstrations are available for y, GAMA can use f to map a state of x to a state of y, mimic the expert behavior, then use g to map the expert action back to an action in x. The reduction is theoretically motivated, the optimization is based on adversarial learning and finally, experiments on common Gym environments show that GAMA can achieve effective transfer.

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.