summaries: This paper frames cross-domain imitation learning as an optimal transport problem using the Gromov-Wasserstein distance. This problem is highly relevant to imitation learning settings where there is often substantial domain mismatch between action and state spaces, eg. a humanoid robot learning to walk from a human demonstrator. The paper introduces a reward function that can be optimised and proves that this is equivalent to minimising the Gromov-Wasserstein distance between state action occupancies of an agent and expert. Substantial discussion/ proofs are included to show that minimising the Gromov-Wasserstein distance is equivalent to recovering an optimal policy up to an isometry. This is both a blessing and a curse, as it allows for optimal policies to be recovered under extreme changes in domain or differences, but does mean that recovered policies could be entirely unsuitable due to isometry.   The paper is well written and concisely written, although does get excessively mathy at times, when a figure could be more helpful. Experimental results corroborate the proofs and propositions, and highlight the value of the proposed approach.    This paper presents a method to transfer policies between different MDPs based on the minimization of Gromov-Wasserstein distance. This distance provides a pseudo-reward that can be used to learn via RL the optimal policy in the target MDP given an optimal policy in the original MDP. The method is optimal if the MDPs can be mapped into each other through an isometry, but works also empirically in other cases.  In this paper, the authors focus on a more general cross domain imitation learning problem where only expert demonstrations from one domain is available. To solve such a problem, the authors use the Gromov-Wasserstein distance to align and compare states between tasks from different domains and propose a Gromov-Wasserstein Imitation Learning (GWIL).  They also show theoretically the possibilities and limitations of GWIL.  A method is proposed for cross-domain imitation learning, without resorting to any form of correspondence. This is done using a Gromov-Wasserstein distance between policies (in practice, Euclidiean distances on collected state-action pairs,  within a given domain), which finds isometric transformations that best preserve distance measures, between the two domains. Given an imitation domain and an expert domain with example trajectories, a pseudo-reward is computed  based on the degree to which the distances from a state to its neighbors in the imitation domain, are preserved in the expert domain. Given these pseudo-rewards, as computed for collected episodes, SAC is used as an RL algorithm to optimize the policy.  The paper contributes both a theoretical analysis and experiments with:  U-maze, pendulum-to-cart-and-pole, and half-cheetah-to-fallen-walker. 
abstractText: Cross-domain imitation learning studies how to leverage expert demonstrations of one agent to train an imitation agent with a different embodiment or morphology. Comparing trajectories and stationary distributions between the expert and imitation agents is challenging because they live on different systems that may not even have the same dimensionality. We propose Gromov-Wasserstein Imitation Learning (GWIL), a method for cross-domain imitation that uses the GromovWasserstein distance to align and compare states between the different spaces of the agents. Our theory formally characterizes the scenarios where GWIL preserves optimality, revealing its possibilities and limitations. We demonstrate the effectiveness of GWIL in non-trivial continuous control domains ranging from simple rigid transformation of the expert domain to arbitrary transformation of the state-action space. 1
references.authors: Pieter Abbeel Andrew Y Ng
references.title: Apprenticeship learning via inverse reinforcement learning
references.venue: In Proceedings of the twenty-first international conference on Machine learning,
references.authors: Pieter Abbeel Adam Coates Andrew Y Ng
references.title: Autonomous helicopter aerobatics through apprenticeship learning
references.venue: The International Journal of Robotics Research,
references.authors: David Alvarez-Melis Stefanie Jegelka Tommi S. Jaakkola
references.title: Towards optimal transport with global invariances
references.venue: Proceedings of the Twenty-Second International Conference on Artificial Intelligence and Statistics,
references.authors: Haitham Bou Ammar Eric Eaton Paul Ruvolo Matthew E Taylor
references.title: Unsupervised cross-domain transfer in policy gradient reinforcement learning via manifold alignment
references.venue: In Twenty-Ninth AAAI Conference on Artificial Intelligence,
references.authors: Yusuf Aytar Tobias Pfaff David Budden Tom Le Paine Ziyu Wang Nando de Freitas
references.title: Playing hard exploration games by watching youtube
references.venue: arXiv preprint arXiv:1805.11592,
references.authors: Christopher Berner Greg Brockman Brooke Chan Vicki Cheung Przemysław Dębiak Christy Dennison David Farhi Quirin Fischer Shariq Hashme Chris Hesse
references.title: Dota 2 with large scale deep reinforcement learning
references.venue: arXiv preprint arXiv:1912.06680,
references.authors: Samuel Cohen Giulia Luise Alexander Terenin Brandon Amos Marc Deisenroth
references.title: Aligning time series on incomparable spaces
references.venue: In International Conference on Artificial Intelligence and Statistics,
references.authors: Robert Dadashi Léonard Hussenot Matthieu Geist Olivier Pietquin
references.title: Primal wasserstein imitation learning
references.venue: arXiv preprint arXiv:2006.04678,
references.authors: Sira Ferradans Nicolas Papadakis Julien Rabin Gabriel Peyré Jean-François Aujol
references.title: Regularized discrete optimal transport
references.venue: In International Conference on Scale Space and Variational Methods in Computer Vision,
references.authors: Ian Goodfellow Jean Pouget-Abadie Mehdi Mirza Bing Xu David Warde-Farley Sherjil Ozair Aaron Courville Yoshua Bengio
references.title: Generative adversarial nets
references.venue: Advances in neural information processing systems,
references.authors: Abhishek Gupta Coline Devin YuXuan Liu Pieter Abbeel Sergey Levine
references.title: Learning invariant feature spaces to transfer skills with reinforcement learning
references.venue: arXiv preprint arXiv:1703.02949,
references.authors: Tuomas Haarnoja Aurick Zhou Kristian Hartikainen George Tucker Sehoon Ha Jie Tan Vikash Kumar Henry Zhu Abhishek Gupta Pieter Abbeel
references.title: Soft actor-critic algorithms and applications
references.venue: arXiv preprint arXiv:1812.05905,
references.authors: Nicolas Heess Dhruva TB Srinivasan Sriram Jay Lemmon Josh Merel Greg Wayne Yuval Tassa Tom Erez Ziyu Wang SM Eslami
references.title: Emergence of locomotion behaviours in rich environments
references.venue: arXiv preprint arXiv:1707.02286,
references.authors: Donald Hejna Lerrel Pinto Pieter Abbeel
references.title: Hierarchically decoupled imitation for morphological transfer
references.venue: In International Conference on Machine Learning,
references.authors: Jonathan Ho S. Ermon
references.title: Generative adversarial imitation learning
references.venue: In NIPS,
references.authors: Kuno Kim Yihong Gu Jiaming Song Shengjia Zhao Stefano Ermon
references.title: Domain adaptive imitation learning
references.venue: In International Conference on Machine Learning,
references.authors: Jens Kober J Andrew Bagnell Jan Peters
references.title: Reinforcement learning in robotics: A survey
references.venue: The International Journal of Robotics Research,
references.authors: Sergey Levine Chelsea Finn Trevor Darrell Pieter Abbeel
references.title: End-to-end training of deep visuomotor policies
references.venue: The Journal of Machine Learning Research,
references.authors: Fangchen Liu Zhan Ling Tongzhou Mu Hao Su
references.title: State alignment-based imitation learning
references.venue: arXiv preprint arXiv:1911.10947,
references.authors: YuXuan Liu Abhishek Gupta Pieter Abbeel Sergey Levine
references.title: Imitation from observation: Learning to imitate behaviors from raw video via context translation
references.venue: IEEE International Conference on Robotics and Automation (ICRA),
references.authors: Facundo Mémoli
references.title: Gromov–wasserstein distances and the metric approach to object matching
references.venue: Foundations of computational mathematics,
references.authors: Meinard Müller
references.title: Dynamic time warping. Information retrieval for music and motion, pp
references.authors: Andrew Y. Ng Stuart J. Russell
references.title: Algorithms for inverse reinforcement learning
references.venue: In Proceedings of the Seventeenth International Conference on Machine Learning,
references.authors: Georgios Papagiannis Yunpeng Li
references.title: Imitation learning with sinkhorn distances
references.venue: arXiv preprint arXiv:2008.09167,
references.authors: Xue Bin Peng Pieter Abbeel Sergey Levine Michiel van de Panne
references.title: Deepmimic: Exampleguided deep reinforcement learning of physics-based character skills
references.venue: ACM Transactions on Graphics (TOG),
references.authors: Gabriel Peyré Marco Cuturi Justin Solomon
references.title: Gromov-wasserstein averaging of kernel and distance matrices
references.venue: In International Conference on Machine Learning,
references.authors: D. Pomerleau
references.title: Alvinn: An autonomous land vehicle in a neural network
references.venue: In NIPS,
references.authors: D. Pomerleau
references.title: Efficient training of artificial neural networks for autonomous navigation
references.venue: Neural Computation,
references.authors: Martin L Puterman
references.title: Markov decision processes: discrete stochastic dynamic programming
references.authors: Dripta S Raychaudhuri Sujoy Paul Jeroen van Baar Amit K Roy-Chowdhury
references.title: Cross-domain imitation from observations
references.venue: arXiv preprint arXiv:2105.10037,
references.authors: Bradly C Stadie Pieter Abbeel Ilya Sutskever
references.title: Third-person imitation learning
references.venue: arXiv preprint arXiv:1703.01703,
references.authors: Richard S Sutton Andrew G Barto
references.title: Reinforcement learning: An introduction
references.venue: MIT press,
references.authors: Emanuel Todorov Tom Erez Yuval Tassa
references.title: Mujoco: A physics engine for model-based control
references.venue: In 2012 IEEE/RSJ International Conference on Intelligent Robots and Systems,
references.authors: Cédric Villani
references.title: Optimal transport: old and new, volume 338
references.authors: Oriol Vinyals Igor Babuschkin Wojciech M Czarnecki Michaël Mathieu Andrew Dudzik Junyoung Chung David H Choi Richard Powell Timo Ewalds Petko Georgiev
references.title: Grandmaster level in starcraft ii using multi-agent reinforcement learning
references.authors: Kevin Zakka Andy Zeng Pete Florence Jonathan Tompson Jeannette Bohg Debidatta Dwibedi
references.title: Xirl: Cross-embodiment inverse reinforcement learning
references.venue: arXiv preprint arXiv:2106.03911,
references.authors: Feng Zhou Fernando Torre
references.title: Canonical time warping for alignment of human behavior
references.venue: Advances in neural information processing systems,
references.authors: Yuke Zhu Ziyu Wang Josh Merel Andrei Rusu Tom Erez Serkan Cabi Saran Tunyasuvunakool János Kramár Raia Hadsell Nando de Freitas
references.title: Reinforcement and imitation learning for diverse visuomotor skills
references.venue: arXiv preprint arXiv:1802.09564,
sections.heading: 1 INTRODUCTION
sections.text: Reinforcement learning (RL) methods have attained impressive results across a number of domains, e.g., Berner et al. (2019); Kober et al. (2013); Levine et al. (2016); Vinyals et al. (2019). However, the effectiveness of current RL method is heavily correlated to the quality of the training reward. Yet for many real-world tasks, designing dense and informative rewards require significant engineering effort. To alleviate this effort, imitation learning (IL) proposes to learn directly from expert demonstrations. Most current IL approaches can be applied solely to the simplest setting where the expert and the agent share the same embodiment and transition dynamics that live in the same state and action spaces. In particular, these approaches require expert demonstrations from the agent domain. Therefore, we might reconsider the utility of IL as it seems to only move the problem, from designing informative rewards to providing expert demonstrations, rather than solving it. However, if we relax the constraining setting of current IL methods, then natural imitation scenarios that genuinely alleviate engineering effort appear. Indeed, not requiring the same dynamics would enable agents to imitate humans and robots with different morphologies, hence widely enlarging the applicability of IL and alleviating the need for in-domain expert demonstrations.
  This relaxed setting where the expert demonstrations comes from another domain has emerged as a budding area with more realistic assumptions (Gupta et al., 2017; Liu et al., 2019; Sermanet et al., 2018; Kim et al., 2020; Raychaudhuri et al., 2021) that we will refer to as Cross-Domain Imitation Learning. A common strategy of these works is to learn a mapping between the expert and agent domains. To do so, they require access to proxy tasks where both the expert and the agent act optimally in there respective domains. Under some structural assumptions, the learned map enables to transform a trajectory in the expert domain into the agent domain while preserving the optimality. Although these methods indeed relax the typical setting of IL, requiring proxy tasks heavily restrict the applicability of Cross-Domain IL. For example, it rules out imitating an expert never seen before as well as transferring to a new robot.
  In this paper, we relax the assumptions of Cross-Domain IL and propose a benchmark and method that do not need access to proxy tasks. To do so, we depart from the point of view taken by previous work and formalize Cross-Domain IL as an optimal transport problem. We propose a method, that we call Gromov Wasserstein Imitation Learning (GWIL), that uses the Gromov-Wasserstein distance
  1Project site with videos: https://sites.google.com/view/gwil/home
  to solve the benchmark. We formally characterize the scenario where GWIL preserves optimality (theorem 1), revealing the possibilities and limitations. The construction of our proxy rewards to optimize optimal transport quantities using RL generalizes previous work that assumes uniform occupancy measures (Dadashi et al., 2020; Papagiannis & Li, 2020) and is of independent interest. Our experiments show that GWIL learns optimal behaviors with a single demonstration from another domain without any proxy tasks in non-trivial continuous control settings.
sections.heading: 2 RELATED WORK
sections.text: Imitation learning. An early approach to IL is Behavioral Cloning (Pomerleau, 1988; 1991) which amounts to training a classifier or regressor via supervised learning to replicate the expert’s demonstration. Another key approach is Inverse Reinforcement Learning (Ng & Russell, 2000; Abbeel & Ng, 2004; Abbeel et al., 2010), which aims at learning a reward function under which the observed demonstration is optimal and can then be used to train a agent via RL. To bypass the need to learn the expert’s reward function, Ho & Ermon (2016) show that IRL is a dual of an occupancy measure matching problem and propose an adversarial objective whose optimization approximately recover the expert’s state-action occupancy measure, and a practical algorithm that uses a generative adversarial network (Goodfellow et al., 2014). While a number of recent work aims at improving this algorithm relative to the training instability caused by the minimax optimization, Primal Wasserstein Imitation Learning (PWIL) (Dadashi et al., 2020) and Sinkhorn Imitation Learning (SIL) (Papagiannis & Li, 2020) view IL as an optimal transport problem between occupancy measures to completely eliminate the minimax objective and outperforms adversarial methods in terms of sample efficiency. Heess et al. (2017); Peng et al. (2018); Zhu et al. (2018); Aytar et al. (2018) scale imitation learning to complex human-like locomotion and game behavior in non-trivial settings. Our work is an extension of Dadashi et al. (2020); Papagiannis & Li (2020) from the Wasserstein to the GromovWasserstein setting. This takes us beyond limitation that the expert and imitator are in the same domain and into the cross-domain setting between agents that live in different spaces.
  Transfer learning across domains and morphologies. Work transferring knowledge between different domains in RL typically learns a mapping between the state and action spaces. Ammar et al. (2015) use unsupervised manifold alignment to find a linear map between states that have similar local geometry but assume access to hand-crafted features. More recent work in transfer learning
  across viewpoint and embodiment mismatch learn a state mapping without handcrafted features but assume access to paired and time-aligned demonstration from both domains (Gupta et al., 2017; Liu et al., 2018; Sermanet et al., 2018). Furthermore, Kim et al. (2020); Raychaudhuri et al. (2021) propose methods to learn a state mapping from unpaired and unaligned tasks. All these methods require proxy tasks, i.e. a set of pairs of expert demonstrations from both domains, which limit the applicability of these methods to real-world settings. Stadie et al. (2017) have proposed to combine adversarial learning and domain confusion to learn a policy in the agent’s domain without proxy tasks but their method only works in the case of small viewpoint mismatch. Zakka et al. (2021) take a goal-driven perspective that seeks to imitate task progress rather than match fine-grained structural details to transfer between physical robots. In contrast, our method does not rely on learning an explicit cross-domain latent space between the agents, nor does it rely on proxy tasks. The GromovWasserstein distance enables us to directly compare the different spaces without a shared space. The existing benchmark tasks we are aware of assume access to a set of demonstrations from both agents whereas the experiments in our paper only assume access to expert demonstrations.
sections.heading: 3 PRELIMINARIES
sections.text: Metric Markov Decision Process. An infinite-horizon discounted Markov decision Process (MDP) is a tuple (S,A,R, P, p0, γ) where S and A are state and action spaces, P : S × A → ∆(S) is the transition function, R : S×A→ R is the reward function, p0 ∈ ∆(S) is the initial state distribution and γ is the discount factor. We equip MDPs with a distance d : S × A → R+ and call the tuple (S,A,R, P, p0, γ, d) a metric MDP.
  Gromov-Wasserstein distance. Let (X , dX , µX ) and (Y, dY , µY) be two metric measure spaces, where dX and dY are distances, and µX and µY are measures on their respective spaces2. The Gromov-Wasserstein distance (Mémoli, 2011) extends the Wasserstein distance from optimal transportation (Villani, 2009) to these spaces and is defined as
  GW((X , dX , µX ), (Y, dY , µY))2 = min u∈U(µX ,µY) ∑ X 2×Y2 |dX (x, x′)− dY(y, y′)|2ux,yux′,y′ , (1)
  where U(µX , µY) is the set of couplings between the atoms of the measures defined by
  U(µX , µY) = u ∈ RX×Y ∣∣∣∣∣∣ ∀x ∈ X , ∑ y∈Y ux,y = µX (x),∀y ∈ Y, ∑ x∈X ux,y = µY(y)  . GW compares the structure of two metric measure spaces by comparing the pairwise distances within each space to find the best isometry between the spaces. Figure 1 illustrates this distance in the case of the metric measure spaces (SE ×AE , dE , ρπE ) and (SA ×AA, dA, ρπA).
sections.heading: 4 CROSS-DOMAIN IMITATION LEARNING VIA OPTIMAL TRANSPORT
sections.heading: 4.1 COMPARING POLICIES FROM ARBITRARILY DIFFERENT MDPS
sections.text: For a stationary policy π acting on a metric MDP (S,A,R, P, γ, d), the occupancy measure is:
  ρπ : S ×A→ R ρ(s, a) = π(a|s) ∞∑ t=0 γtP (st = s|π).
  We compare policies from arbitrarily different MDPs in terms of their occupancy measures. Definition 1 (Gromov-Wasserstein distance between policies). Given an expert policy πE and an agent policy πA acting, respectively, on
  ME = (SE , AE , RE , PE , TE , dE) and MA = (SA, AA, RA, PA, TA, dA).
  We define the Gromov-Wasserstein distance between πE and πA as the Gromov-Wasserstein distance between the metric measure spaces (SE ×AE , dE , ρπE ) and (SA ×AA, dA, ρπA):
  GW(π, π′) = GW((SE ×AE , dE , ρπE ), (SA ×AA, dA, ρπA)). (2) 2We use discrete spaces for readability but show empirical results in continuous spaces.
  We now define an isometry between policies by comparing the distances between the state-action spaces and show that GW defines a distance up to an isometry between the policies. Figure 2 illustrates examples of simple isometric policies. Definition 2 (Isometric policies). Two policies πE and πA are isometric if there exists a bijection φ : supp[ρπE ]→ supp[ρπA ] that satisfies for all (sE , aE), (sE ′, aE ′) ∈ supp[ρπE ]2:
  dE ((sE , aE), (sE ′, aE ′)) = dA (φ(sE , aE), φ(sE ′, aE ′))
  In other words, φ is an isometry between (supp[ρπE ], dE) and (supp[ρπA ], dA). Proposition 1. GW defines a metric on the collection of all isometry classes of policies.
  Proof. By definition 1, GW(πE , πA) = 0 if and only if GW((SE , dE , ρπE ), (SA, dA, ρπA)) = 0. By Mémoli (2011, Theorem 5.1), this is true if and only if there is an isometry that maps supp[ρφE ] to supp[ρφA ]. By definition 2, this is true if and only if πA and πE are isometric. The symmetry and triangle inequality follow from Mémoli (2011, Theorem 5.1).
  The next theorem3 gives a sufficient condition to recover, by minimizing GW , an optimal policy4 in the agent’s domain up to an isometry. Theorem 1. Consider two MDPs
  ME = (SE , AE , RE , PE , pE , γ) and MA = (SA, AA, RA, PA, pA, γ).
  Suppose that there exists four distances dSE , d A E , d S A, d A A defined on SE ,AE , SA andAE respectively, and two isometries φ : (SE , dSE) → (SA, dSA) and ψ : (AE , dSE) → (AS , dSA) such that for all (sE , aE , s ′ E) ∈ SE ×AE × SE the three following conditions hold:
  R(sE , aE) = RA(φ(sE), ψ(aE)) (3)
  PEsE ,aE (s ′ E) = PAφ(sE)ψ(aE)(φ(s ′ E)) (4)
  pE(sE) = pA(φ(sE)). (5) Consider an optimal policy π∗E in ME . Suppose that πGW minimizes GW(π∗E , πGW ) with
  dE : (sE , aE) 7→ dSE(sE) + dAE(aE) and dA : (sA, aA) 7→ dSA(sA) + dAA(aA). Then πGW is isometric to an optimal policy in MA.
  Proof. Consider the occupancy measure ρ∗A : SA ×AA → R given by (sA, aA) 7→ ρπ∗E (φ −1(sA), ψ −1(aA)). We first show that ρ∗A is feasible in MA, i.e. there exists a policy π ∗ A acting in MA with occupancy measure ρ∗A (a). Then we show that π ∗ A is optimal in MA (b) and is isometric to π ∗ E (c). Finally we show that πGW is isometric to π∗A, which concludes the proof (d). (a) Consider sA ∈ SA. By definition of ρ∗A,∑ aA∈AA ρ∗A(sA) = ∑ aA∈AA ρπ∗E (φ −1(sA), ψ −1(aA)) = ∑ aE∈AE ρπ∗E (φ −1(sA), aE). Since ρπ∗E is feasible in M , it follows from Puterman (2014, Theorem 6.9.1) that∑ aE∈AE ρπ∗E (φ −1(sA), aE) = pE(φ −1(sA)) + γ ∑ sE∈SE ,aE∈AE PEsE ,aE (φ −1(sA)) + ρπ∗E (sE , aE). By conditions 4 and 5 and by definition of ρ∗A,
  pE(φ −1(sA)) + γ ∑ sE∈SE ,aE∈AE PEsE ,aE (φ −1(sA)) + ρπ∗E (sE , aE)
  = pA(sA) + γ ∑
  sE∈SE ,aE∈AE
  PAφ(sE),ψ(aE)(sA) + ρ ∗ A(φ(sE), ψ(aE))
  = pA(sA) + γ ∑
  s′A∈SA,aA∈AA
  PAs′A,aA(sA) + ρ ∗ A(s ′ A, aA).
  3Our proof is in finite state-action spaces for readability and can be directly extended to infinite spaces. 4A policy is optimal in the MDP (S,A,R, P, γ, d) if it maximizes the expected return E ∑∞ t=0R(st, at).
  It follows that∑ aA∈AA ρ∗A(sA) = pA(sA) + γ ∑
  s′A∈SA,aA∈AA
  PAs′A,aA(sA) + ρ ∗ A(s ′ A, aA).
  Therefore, by Puterman (2014, Theorem 6.9.1), ρ∗A is feasible in MA, i.e. there exists a policy π ∗ A acting in MA with occupancy measure ρ∗A.
  (b) By condition 5 and definition of ρ∗A, the expected return of π ∗ A in MA is then∑
  sA∈SA,aA∈AA
  ρ∗A(sA, aA)RA(sA, aA)
  = ∑
  sA∈SA,aA∈AA
  ρ∗E(φ −1(sA), ψ −1(aA))RE(φ −1(sA), ψ −1(aA))
  = ∑
  sE∈SE ,aE∈AE
  ρ∗E(sE , aE)RE(sE , aE)
  Consider any policy πA in M ′. By condition 5, the expected return of πA is∑ sA∈SA,aA∈AA ρπA(sA, aA)RA(sA, aA) = ∑ sE∈SE ,aE∈AE ρπA(φ(sE), ψ(aE))RE(sE , aE).
  Using the same arguments that we used to show that ρ∗A is feasible in M ′, we can show that
  (sE , aE) 7→ ρπA(φ(sE), ψ(aE))
  is feasible in M . It follows by optimality of π∗E in M that∑ sE∈SE ,aE∈AE ρπA(φ(sE), ψ(aE))RE(sE , aE) ≤ ∑ sE∈SE ,aE∈AE ρπ∗E (φ(sE), ψ(aE))RE(sE , aE)
  = ∑
  sA∈SA,aA∈AA
  ρ∗A(sA, aA)RA(sA, aA).
  It follows that π∗A is optimal in M ′.
  (c) Notice that ξ : (sE , aE) 7→ (φ(sE), ψ(aE))
  is an isometry between (SE ×AE , dE) and (SA ×AA, dA), where dE and dA and given, resp., by
  (sE , aE) 7→ dSE(sE) + dAE(aE) and (sA, aA) 7→ dSA(sA) + dAA(aA).
  Therefore by definition of ρ∗A, π ∗ A is isometric to π ∗ E .
  (d) Recall from the statement of the theorem that πGW is a minimizer of GW(π∗E , πGW ). Since π∗A is isometric to π∗E , it follows from prop. 1 that GW(π∗E , π∗A) = 0. Therefore GW(π∗E , πGW ) must be 0. By prop. 1, it follows that there exists an isometry
  χ : (supp[ρ∗E ], dE)→ (supp[ρπGW ], dA).
  Notice that χ ◦ ξ−1|supp[ρ∗A] is an isometry from (supp[ρ ∗ A], dA) to (supp[ρπGW ], dA). It follows that πGW is isometric to π∗A, an optimal policy in MA, which concludes the proof.
  Remark 1. Theorem 1 shows the possibilities and limitations of our method. It shows that our method can recover optimal policies even though arbitrary isometries are applied to the state and action spaces of the expert’s domain. Importantly, we don’t need to know the isometries, hence our method is applicable to a wide range of settings. We will show empirically that our method produces strong results in other settings where the environment are not isometric and don’t even have the same dimension. However, a limitation of our method is that it recovers optimal policy only up to isometries. We will see that in practice, running our method on different seeds enables to find an optimal policy in the agent’s domain.
  Algorithm 1 Gromov-Wasserstein imitation learning from a single expert demonstration. Inputs: expert demonstration τ , metrics on the expert (dE) and agent (dA) space Initialize the imitation agent’s policy πθ and value estimates Vθ while Unconverged do
  Collect an episode τ ′ Compute GW(τ, τ ′) Set pseudo-rewards r with eq. (7) Update πθ and Vθ to optimize the pseudo-rewards
  end while
sections.heading: 4.2 GROMOV-WASSERSTEIN IMITATION LEARNING
sections.text: Minimizing GW between an expert and agent requires derivatives through the transition dynamics, which we typically don’t have access to. We introduce a reward proxy suitable for training an agent’s policy that minimizes GW via RL. Figure 1 illustrates the method. For readability, we combine expert state and action variables (sE , aE) into single variables zE , and similarly for agent state-action pairs. Also, we define ZE = SE ×AE and ZA = SA ×AA. Definition 3. Given an expert policy πE and an agent policy πA, the Gromov-Wasserstein reward of the agent is defined as rGW : supp[ρπA ]→ R given by
  rGW(zA) = − 1
  ρπ(zA) ∑ zE∈ZE z′E∈ZE z′A∈ZA |dE(zE , z′E))− dA(zA, z′A)|2u?zE ,zAu ? z′E ,z ′ A
  where u? is the coupling minimizing objective 1.
  Proposition 2. The agent’s policy πA trained with rGW minimizes GW(πE , πA). Proof. Suppose that πA maximizes E( ∑∞ t=0 γ trGW(s A t , a A t )) and denote by ρπA its occupancy measure. By Puterman (2014, Theorem 6.9.4), πA maximizes the following objective:
  E zA∼ρπA
  rGW(zA) =− ∑
  zA∈supp[ρπA ]
  ρπA(zA) ρπA(zA) ∑ zE∈ZE z′E∈ZE z′A∈ZA |dE(zE , z′E)− dA(zA, z′A)|2u?zA,zEu ? z′ A ,z′ E
  =− ∑
  zE∈ZE z′E∈ZE zA∈ZA z′A∈ZA
  |dE(zE , z′E)− dA(zA, z′A)|2u?zA,zEu ? z′ A ,z′ E
  =− GW2(πE , πA)
  In practice we approximate the occupancy measures of π by ρ̂π(s, a) = 1T ∑T t=1 1(s = st∧a = at) where τ = (s1, a1, .., sT , aT ) is a finite trajectory collected with π. Assuming that all state-action pairs in the trajectory are different5, ρ̂ is a uniform distribution. Given an expert trajectory τE and an agent trajectory τA 6, the (squared) Gromov-Wasserstein distance between the empirical occupancy measures is
  GW2(τE , τA) = min θ∈ΘTE×TA ∑ 1≤i,i′≤TE 1≤j,j′≤TA |dE((sEi , aEi ), (sEi′ , aEi′ ))− dA((sAj , sAj ), (sAj′ , aAj′))|2θi,jθi′,j′
  (6)
  5We can add the time step to the state to distinguish between two identical state-action pairs in the trajectory. 6Note that the Gromov-Wasserstein distance defined in equ. (6) does not depend on the temporal ordering
  of the trajectories.
  where Θ is the set of is the set of couplings between the atoms of the uniform measures defined by
  ΘT×T ′ = θ ∈ RT×T ′ ∣∣∣∣∣∣ ∀i ∈ [T ], ∑ j∈[T ′] θi,j = 1/T, ∀j ∈ [T ′], ∑ i∈[T ] θi,j = 1/T ′  . In this case the reward is given for every state-action pairs in the trajectory by:
  r(sAj , s A j ) = −TA ∑ 1≤i,i′≤TE 1≤j′≤TA |dE((sEi , aEi ), (sEi′ , aEi′ ))− dA((sAj , sAj ), (sAj′ , aAj′))|2θ?i,jθ?i′,j′ (7)
  where θ? is the coupling minimizing objective 6.
  In practice we drop the factor TA because it is the same for every state-action pairs in the trajectory.
  Remark 2. The construction of our reward proxy is defined for any occupancy measure and extends to previous work optimizing optimal transport quantities via RL that assumes uniform occupancy measure in the form of a trajectory to bypass the need for derivatives through the transition dynamics (Dadashi et al., 2020; Papagiannis & Li, 2020).
  Computing the pseudo-rewards. We compute the Gromov-Wasserstein distance using Peyré et al. (2016, Proposition 1) and its gradient using Peyré et al. (2016, Proposition 2). To compute the coupling minimizing 6, we use the conditional gradient method as discussed in Ferradans et al. (2013).
  Optimizing the pseudo-rewards. The pseudo-rewards we obtain from GW for the imitation agent enable us to turn the imitation learning problem into a reinforcement learning problem (Sutton & Barto, 2018) to find the optimal policy for the Markov decision process induced by the pseudorewards. We consider agents with continuous state-action spaces and thus do policy optimization with the soft actor-critic algorithm (Haarnoja et al., 2018). Algorithm 1 sums up GWIL in the case where a single expert trajectory is given to approximate the expert occupancy measure.
sections.heading: 5 EXPERIMENTS
sections.text: We propose a benchmark set for cross-domain IL methods consisting of 3 tasks and aiming at answering the following questions:
  1. Does GWIL recover optimal behaviors when the agent domain is a rigid transformation of the expert domain? Yes, we demonstrate this with the maze in sect. 5.1.
  2. Can GWIL recover optimal behaviors when the agent has different state and action spaces than the expert? Yes, we show in sect. 5.2 for slightly different state-action spaces between the cartpole and pendulum, and in sect. 5.3 for significantly different spaces between a walker and cheetah.
  To answer these three questions, we use simulated continuous control tasks implemented in Mujoco (Todorov et al., 2012) and the DeepMind control suite (Tassa et al., 2018). In all settings we use the Euclidean metric within the expert and agent spaces for dE and dA.
sections.heading: 5.1 AGENT DOMAIN IS A RIGID TRANSFORMATION OF THE EXPERT DOMAIN
sections.text: We evaluate the capacity of IL methods to transfer to rigid transformation of the expert domain by using the PointMass Maze environment from Hejna et al. (2020). The agent’s domain is obtained by applying a reflection to the expert’s maze. This task satisfies the condition of theorem 1 with φ being the reflection through the central horizontal plan and ψ being the reflection through the x-axis in the action space. Therefore by theorem 1, the agent’s optimal policy should be isometric to the policy trained using GWIL. By looking at the geometry of the maze, it is clear that every policy in the isometry class of an optimal policy is optimal. Therefore we expect GWIL to recover an optimal policy in the agent’s domain. Figure 3 shows that GWIL indeed recovers an optimal policy.
sections.heading: 5.2 AGENT AND THE EXPERT HAVE SLIGHTLY DIFFERENT STATE AND ACTION SPACES
sections.text: We evaluate here the capacity of IL methods to transfer to transformation that does not have to be rigid but description map should still be apparent by looking at the domains. A good example of such transformation is the one between the pendulum and cartpole. The pendulum is our expert’s domain while cartpole constitutes our agent’s domain. The expert is trained on the swingup task. Even though the transformation is not rigid, GWIL is able to recover the optimal behavior in the agent’s domain as shown in fig. 4. Notice that pendulum and cartpole do not have the same state-action space dimension: The pendulum has 3 dimensions while the cartpole has 5 dimensions. Therefore GWIL can indeed be applied to transfer between problems with different dimension.
sections.heading: 5.3 AGENT AND THE EXPERT HAVE SIGNIFICANTLY DIFFERENT STATE AND ACTION SPACES
sections.text: We evaluate here the capacity of IL methods to transfer to non-trivial transformation between domains. A good example of such transformation is two arbitrarily different morphologies from the DeepMind Control Suite such as the cheetah and walker. The cheetah constitutes our expert’s domain while the walker constitutes our agent’s domain. The expert is trained on the run task.
  Although the mapping between these two domains is not trivial, minimizing the GromovWasserstein solely enables the walker to interestingly learn to move backward and forward by imitating a cheetah. Since the isometry class of the optimal policy – moving forward– of the cheetah and walker contains a suboptimal element –moving backward–, we expect GWIL to recover one of these two trajectories. Indeed, depending on the seed used, GWIL produces a cheetah-imitating walker moving forward or a cheetah-imitating walker moving backward, as shown in fig. 5.
sections.heading: 6 CONCLUSION
sections.text: Our work demonstrates that optimal transport distances are a useful foundational tool for crossdomain imitation across incomparable spaces. Future directions include exploring:
  1. Scaling to more complex environments and agents towards the goal of transferring the structure of many high-dimensional demonstrations of complex tasks into an agent.
  2. The use of GW to help agents explore in extremely sparse-reward environments when we have expert demonstrations available from other agents.
  3. How GW compares to other optimal transport distances that work apply between two metric MDPs, such as Alvarez-Melis et al. (2019), that have more flexibility over how the spaces are connected and what invariances the coupling has.
  4. Metrics aware of the MDP’s temporal structure such as Zhou & Torre (2009); Cohen et al. (2021) that build on dynamic time warping (Müller, 2007). The Gromov-Wasserstein ignores the temporal information and ordering present within the trajectories.
sections.heading: A OPTIMIZATION OF THE PROXY REWARD
sections.text: In this section we show that the proxy reward introduced in equation 7 constitutes a learning signal that is easy to optimize using standards RL algorithms. Figure 6 shows proxy reward curves across 5 different seeds for the 3 environments. We observe that in each environment the SAC learner converges quickly and consistently to the asymptotic episodic return. Thus there is reason to think that the proxy reward introduced in equation 7 will be similarly easy to optimize in other crossdomain imitation settings.
sections.heading: B TRANSFER TO SPARSE-REWARD ENVIRONMENTS
sections.text: In this section we show that GWIL can be used to facilitate learning in sparse-reward environments when the learner has only access to one expert demonstration from another domain. We compare GWIL to a baseline learner having access to a single demonstration from the same domain and minimizing the Wasserstein distance, as done in Dadashi et al. (2020). In these experiments, both agents are given a sparse reward signal in addition to their respective optimal transport proxy reward. We perform experiments in two sparse-reward environment. In the first environment, the agent controls a point mass in a maze and obtain a non-zero reward only if it reaches the end of the maze. In the second environment, which is a sparse version of cartpole, the agent controls a cartpole and obtains a non-zero reward only if he can maintain the cartpole up for 10 consecutive time steps. Note that a SAC agent fails to learn any meaningful behavior in both environments. Figure 7 shows that GWIL is competitive with the baseline learner in the sparse maze environment even though GWIL has only access to a demonstration from another domain, while the baseline learner has access to a demonstration from the same domain. Thus there is reason to think that GWIL efficiently and reliably extracts useful information from the expert domain and hence should work well in other cross-domain imitation settings.
sections.heading: C SCALABILITY OF GWIL
sections.text: In this section we show that our implementation of GWIL offers good performance in terms of wallclock time. Note that the bottleneck of our method is in the computation of the optimal coupling which only depends on the number of time steps in the trajectories, and not on the dimension of the expert and the agent. Hence our method naturally scales with the dimension of the problems. Furthermore, while we have not used any entropy regularizer in our experiments, entropy regularized methods have been introduced to enable Gromov-Wasserstein to scale to demanding machine learning tasks and can be easily incorporated into our code to further improve the scalability. Figure 8 compares the time taken by GWIL in the maze with the time taken by the baseline learner introduced in the previous section. It shows that imitating with Gromov-Wasserstein requires the same order of time than imitating with Wasserstein. Figure 9 compares the wall-clock time taken by a walker imitating a cheetah using GWIL to reach a walking speed (i.e., a horizontal velocity of 1) and the wall-clock time taken by a SAC walker trained to run. It shows that a GWIL walker imitating a cheetah reaches a walking speed faster than a SAC agent trained to run. Even though the SAC agent is optimizing for standing in addition to running, it was not obvious that GWIL could compete with SAC in terms of wall-clock time. These results gives hope that GWIL has the potential to scale to
  more complex problems (possibly with an additional entropy regularizer) and be a useful way to learn by analogy.