DYNAMICS-AWARE UNSUPERVISED DISCOVERY OF SKILLS
Year: 2020

Abstract:
Conventionally, model-based reinforcement learning (MBRL) aims to learn a global model for the dynamics of the environment. A good model can potentially enable planning algorithms to generate a large variety of behaviors and solve diverse tasks. However, learning an accurate model for complex dynamical systems is difficult, and even then, the model might not generalize well outside the distribution of states on which it was trained. In this work, we combine model-based learning with model-free learning of primitives that make modelbased planning easy. To that end, we aim to answer the question: how can we discover skills whose outcomes are easy to predict? We propose an unsupervised learning algorithm, Dynamics-Aware Discovery of Skills (DADS), which simultaneously discovers predictable behaviors and learns their dynamics. Our method can leverage continuous skill spaces, theoretically, allowing us to learn infinitely many behaviors even for high-dimensional state-spaces. We demonstrate that zero-shot planning in the learned latent space significantly outperforms standard MBRL and model-free goal-conditioned RL, can handle sparsereward tasks, and substantially improves over prior hierarchical RL methods for unsupervised skill discovery. We have open-sourced our implementation at: https://github.com/google-research/dads Figure 1: A humanoid agent discovers diverse locomotion primitives without any reward using DADS. We show zero-shot generalization to downstream tasks by composing the learned primitives using model predictive control, enabling the agent to follow an online sequence of goals (green markers) without any additional training.

heading: 1 INTRODUCTION
text: Deep reinforcement learning (RL) enables autonomous learning of diverse and complex tasks with rich sensory inputs, temporally extended goals, and challenging dynamics, such as discrete gameplaying domains (Mnih et al., 2013; Silver et al., 2016), and continuous control domains including locomotion (Schulman et al., 2015; Heess et al., 2017) and manipulation (Rajeswaran et al., 2017; Kalashnikov et al., 2018; Gu et al., 2017). Most of the deep RL approaches learn a Q-function or a policy that are directly optimized for the training task, which limits their generalization to new scenarios. In contrast, MBRL methods (Li & Todorov, 2004; Deisenroth & Rasmussen, 2011; Watter et al., 2015) can acquire dynamics models that may be utilized to perform unseen tasks at test time. While this capability has been demonstrated in some of the recent works (Levine et al., 2016; Nagabandi et al., 2018; Chua et al., 2018b; Kurutach et al., 2018; Ha & Schmidhuber, ∗Work done a part of the Google AI Residency program.
2018), learning an accurate global model that works for all state-action pairs can be exceedingly challenging, especially for high-dimensional system with complex and discontinuous dynamics. The problem is further exacerbated as the learned global model has limited generalization outside of the state distribution it was trained on and exploring the whole state space is generally infeasible. Can we retain the flexibility of model-based RL, while using model-free RL to acquire proficient low-level behaviors under complex dynamics?
While learning a global dynamics model that captures all the different behaviors for the entire statespace can be extremely challenging, learning a model for a specific behavior that acts only in a small part of the state-space can be much easier. For example, consider learning a model for dynamics of all gaits of a quadruped versus a model which only works for a specific gait. If we can learn many such behaviors and their corresponding dynamics, we can leverage model-predictive control to plan in the behavior space, as opposed to planning in the action space. The question then becomes: how do we acquire such behaviors, considering that behaviors could be random and unpredictable? To this end, we propose Dynamics-Aware Discovery of Skills (DADS), an unsupervised RL framework for learning low-level skills using model-free RL with the explicit aim of making model-based control easy. Skills obtained using DADS are directly optimized for predictability, providing a better representation on top of which predictive models can be learned. Crucially, the skills do not require any supervision to learn, and are acquired entirely through autonomous exploration. This means that the repertoire of skills and their predictive model are learned before the agent has been tasked with any goal or reward function. When a task is provided at test-time, the agent utilizes the previously learned skills and model to immediately perform the task without any further training.
The key contribution of our work is an unsupervised reinforcement learning algorithm, DADS, grounded in mutual-information-based exploration. We demonstrate that our objective can embed learned primitives in continuous spaces, which allows us to learn a large, diverse set of skills. Crucially, our algorithm also learns to model the dynamics of the skills, which enables the use of model-based planning algorithms for downstream tasks. We adapt the conventional model predictive control algorithms to plan in the space of primitives, and demonstrate that we can compose the learned primitives to solve downstream tasks without any additional training.

heading: 2 PRELIMINARIES
text: Mutual information can been used as an objective to encourage exploration in reinforcement learning (Houthooft et al., 2016; Mohamed & Rezende, 2015). According to its definition, I(X;Y ) = H(X) − H(X | Y ), maximizing mutual information I with respect to Y amounts to maximizing the entropyH of X while minimizing the conditional entropyH(X | Y ). In the context of RL, X is usually a function of the state and Y a function of actions. Maximizing this objective encourages the state entropy to be high, making the underlying policy to be exploratory. Recently, multiple works (Eysenbach et al., 2018; Gregor et al., 2016; Achiam et al., 2018) apply this idea to learn diverse skills which maximally cover the state space.
To leverage planning-based control, MBRL estimates the true dynamics of the environment by learning a model p̂(s′ | s, a). This allows it to predict a trajectory of states τ̂H = (st, ŝt+1, . . . ŝt+H) resulting from a sequence of actions without any additional interaction with the environment. While model-based RL methods have been demonstrated to be sample efficient compared to their modelfree counterparts, learning an effective model for the whole state-space is challenging. An openproblem in model-based RL is to incorporate temporal abstraction in model-based control, to enable high-level planning and move-away from planning at the granular level of actions.
These seemingly unrelated ideas can be combined into a single optimization scheme, where we first discover skills (and their models) without any extrinsic reward and then compose these skills to optimize for the task defined at test time using model-based planning. At train time, we assume a Markov Decision Process (MDP) M1 ≡ (S,A, p). The state space S and action space A are assumed to be continuous, and theA bounded. We assume the transition dynamics p to be stochastic, such that p : S × A× S 7→ [0,∞). We learn a skill-conditioned policy π(a | s, z), where the skills z belongs to the space Z , detailed in Section 3. We assume that the skills are sampled from a prior p(z) over Z . We simultaneously learn a skill-conditioned transition function q(s′ | s, z), coined as skill-dynamics, which predicts the transition to the next state s′ from the current state s for the skill z under the given dynamics p. At test time, we assume an MDPM2 ≡ (S,A, p, r), where S,A, p
match those defined inM1, and the reward function r : S × A 7→ (−∞,∞). We plan in Z using q(s′ | s, z) to compose the learned skills z for optimizing r inM2, which we detail in Section 4.

heading: 3 DYNAMICS-AWARE DISCOVERY OF SKILLS (DADS)
text: We use the information theoretic paradigm of mutual information to obtain our unsupervised skill discovery algorithm. In particular, we propose to maximize the mutual information between the next state s′ and current skill z conditioned on the current state s.
I(s′; z | s) = H(z | s)−H(z | s′, s) (1) = H(s′ | s)−H(s′ | s, z) (2)
Mutual information in Equation 1 quantifies how much can be known about s′ given z and s, or symmetrically, z given the transition from s → s′. From Equation 2, maximizing this objective corresponds to maximizing the diversity of transitions produced in the environment, that is denoted by the entropy H(s′ | s), while making z informative about the next state s′ by minimizing the entropy H(s′ | s, z). Intuitively, skills z can be interpreted as abstracted action sequences which are identifiable by the transitions generated in the environment (and not just by the current state). Thus, optimizing this mutual information can be understood as encoding a diverse set of skills in the latent space Z , while making the transitions for a given z ∈ Z predictable. We use the entropydecomposition in Equation 2 to connect this objective with model-based control.
We want to optimize the our skill-conditioned controller π(a | s, z) such that the latent space z ∼ p(z) is maximally informative about the transitions s→ s′. Using the definition of conditional mutual information, we can rewrite Equation 2 as:
I(s′; z | s) = ∫ p(z, s, s′) log
p(s′ | s, z) p(s′ | s) ds′dsdz (3)
We assume the following generative model: p(z, s, s′) = p(z)p(s | z)p(s′ | s, z), where p(z) is user specified prior over Z , p(s|z) denotes the stationary state-distribution induced by π(a | s, z) for a skill z and p(s′ | s, z) denotes the transition distribution under skill z. Note, p(s′ | s, z) =∫ p(s′ | s, a)π(a | s, z)da is intractable to compute because the underlying dynamics are unknown. However, we can variationally lower bound the objective as follows:
I(s′; z | s) = Ez,s,s′∼p [
log p(s′ | s, z) p(s′ | s) ] = Ez,s,s′∼p [ log qφ(s ′ | s, z)
p(s′ | s)
] + Es,z∼p [ DKL(p(s′ | s, z) || qφ(s′ | s, z)) ] ≥ Ez,s,s′∼p [ log qφ(s ′ | s, z)
p(s′ | s)
] (4)
where we have used the non-negativity of KL-divergence, that is DKL ≥ 0. Note, skill-dynamics qφ represents the variational approximation for the transition function p(s′ | s, z), which enables model-based control as described in Section 4. Equation 4 suggests an alternating optimization between qφ and π, summarized in Algorithm 1. In every iteration: (Tighten variational lower bound) We minimize DKL(p(s′ | s, z) || qφ(s′ | s, z)) with respect to the parameters φ on z, s ∼ p to tighten the lower bound. For general function approximators like neural networks, we can write the gradient for φ as follows:
∇φEs,z[DKL(p(s′ | s, z) || qφ(s′ | s, z))] = ∇φEz,s,s′ [
log p(s′ | s, z) qφ(s′ | s, z) ] = −Ez,s,s′ [ ∇φ log qφ(s′ | s, z) ] (5)
which corresponds to maximizing the likelihood of the samples from p under qφ.
(Maximize approximate lower bound) After fitting qφ, we can optimize π to maximize Ez,s,s′ [log qφ(s′ | s, z) − log p(s′ | s)]. Note, this is a reinforcement-learning style optimization with a reward function log qφ(s′ | s, z) − log p(s′ | s). However, log p(s′ | s) is intractable to compute, so we approximate the reward function for π:
rz(s, a, s ′) = log qφ(s ′ | s, z)∑L
i=1 qφ(s ′ | s, zi)
+ logL, zi ∼ p(z). (6)
The approximation is motivated as follows: p(s′ | s) = ∫ p(s′ | s, z)p(z|s)dz ≈ ∫ qφ(s
′ | s, z)p(z)dz ≈ 1L ∑L i=1 qφ(s
′ | s, zi) for zi ∼ p(z), where L denotes the number of samples from the prior. We are using the marginal of variational approximation qφ over the prior p(z) to approximate the marginal distribution of transitions. We discuss this approximation in Appendix C. Note, the final reward function rz encourages the policy π to produce transitions that are (a) predictable under qφ (predictability) and (b) different from the transitions produced under zi ∼ p(z) (diversity). To generate samples from p(z, s, s′), we use the rollouts from the current policy π for multiple samples z ∼ p(z) in an episodic setting for a fixed horizon T . We also introduce entropy regularization for π(a | s, z), which encourages the policy to discover action-sequences with similar state-transitions and to be clustered under the same skill z, making the policy robust besides encouraging exploration (Haarnoja et al., 2018a). The use of entropy regularization can be justified from an information bottleneck perspective as discussed for Information Maximization algorithm in (Mohamed & Rezende, 2015). This is even more extensively discussed from the graphical model perspective in Appendix B, which connects unsupervised skill discovery and information bottleneck literature, while also revealing the temporal nature of skills z. Details corresponding to implementation and hyperparameters are discussed in Appendix A.

heading: 4 PLANNING USING SKILL DYNAMICS
text: Given the learned skills π(a | s, z) and their respective skill-transition dynamics qφ(s′ | s, z), we can perform model-based planning in the latent space Z to optimize for a reward r that is given to the agent at test time. Note, that this essentially allows us to perform zero-shot planning given the unsupervised pre-training procedure described in Section 3.
In order to perform planning, we employ the model-predictive-control (MPC) paradigm Garcia et al. (1989), which in a standard setting generates a set of action plans Pk = (ak,1, . . . ak,H) ∼ P for a planning horizon H . The MPC plans can be generated due to the fact that the planner is able to simulate the trajectory τ̂k = (sk,1, ak,1 . . . sk,H+1) assuming access to the transition dynamics p̂(s′ | s, a). In addition, each plan computes the reward r(τ̂k) for its trajectory according to the reward function r that is provided for the test-time task. Following the MPC principle, the planner selects the best plan according to the reward function r and executes its first action a1. The planning algorithm repeats this procedure for the next state iteratively until it achieves its goal.
We use a similar strategy to design an MPC planner to exploit previously-learned skill-transition dynamics qφ(s′ | s, z). Note that unlike conventional model-based RL, we generate a plan Pk = (zk,1, . . . zk,HP ) in the latent space Z as opposed to the action space A that would be used by a standard planner. Since the primitives are temporally meaningful, it is beneficial to hold a primitive
for a horizon HZ > 1, unlike actions which are usually held for a single step. Thus, effectively, the planning horizon for our latent space planner is H = HP ×HZ , enabling longer-horizon planning using fewer primitives. Similar to the standard MPC setting, the latent space planner simulates the trajectory τ̂k = (sk,1, zk,1, ak,1, sk,2, zk,2, ak,2, . . . sk,H+1) and computes the reward r(τ̂k). After a small number of trajectory samples, the planner selects the first latent action z1 of the best plan, executes it for HZ steps in the environment, and the repeats the process until goal completion.
The latent planner P maintains a distribution of latent plans, each of length HP . Each element in the sequence represents the distribution of the primitive to be executed at that time step. For continuous spaces, each element of the sequence can be modelled using a normal distribution, N (µ1,Σ), . . .N (µHP ,Σ). We refine the planning distributions for R steps, using K samples of latent plans Pk, and compute the rk for the simulated trajectory τ̂k. The update for the parameters follows that in Model Predictive Path Integral (MPPI) controller Williams et al. (2016):
µi = K∑ k=1 exp(γrk)∑K p=1 exp(γrp) zk,i ∀i = 1, . . . HP (7)
While we keep the covariance matrix of the distributions fixed, it is possible to update that as well as shown in Williams et al. (2016). We show an overview of the planning algorithm in Figure 3, and provide more implementation details in Appendix A.

heading: 5 RELATED WORK
text: Central to our method is the concept of skill discovery via mutual information maximization. This principle, proposed in prior work that utilized purely model-free unsupervised RL methods (Daniel et al., 2012; Florensa et al., 2017; Eysenbach et al., 2018; Gregor et al., 2016; Warde-Farley et al., 2018; Thomas et al., 2018), aims to learn diverse skills via a discriminability objective: a good set of skills is one where it is easy to distinguish the skills from each other, which means they perform distinct tasks and cover the space of possible behaviors. Building on this prior work, we distinguish our skills based on how they modify the original uncontrolled dynamics of the system. This simultaneously encourages the skills to be both diverse and predictable. We also demonstrate that constraining the skills to be predictable makes them more amenable for hierarchical composition and thus, more useful on downstream tasks.
Another line of work that is conceptually close to our method copes with intrinsic motivation (Oudeyer & Kaplan, 2009; Oudeyer et al., 2007; Schmidhuber, 2010) which is used to drive the agent’s exploration. Examples of such works include empowerment Klyubin et al. (2005); Mohamed & Rezende (2015), count-based exploration Bellemare et al. (2016); Oh et al. (2015); Tang et al. (2017); Fu et al. (2017), information gain about agent’s dynamics Stadie et al. (2015) and
forward-inverse dynamics models Pathak et al. (2017). While our method uses an informationtheoretic objective that is similar to these approaches, it is used to learn a variety of skills that can be directly used for model-based planning, which is in contrast to learning a better exploration policy for a single skill.
The skills discovered using our approach can also provide extended actions and temporal abstraction, which enable more efficient exploration for the agent to solve various tasks, reminiscent of hierarchical RL (HRL) approaches. This ranges from the classic option-critic architecture (Sutton et al., 1999; Stolle & Precup, 2002; Perkins et al., 1999) to some of the more recent work (Bacon et al., 2017; Vezhnevets et al., 2017; Nachum et al., 2018; Hausman et al., 2018). However, in contrast to end-to-end HRL approaches (Heess et al., 2016; Peng et al., 2017), we can leverage a stable, two-phase learning setup. The primitives learned through our method provide action and temporal abstraction, while planning with skill-dynamics enables hierarchical composition of these primitives, bypassing many problems of end-to-end HRL.
In the second phase of our approach, we use the learned skill-transition dynamics models to perform model-based planning - an idea that has been explored numerous times in the literature. Model-based reinforcement learning has been traditionally approached with methods that are well-suited for lowdata regimes such as Gaussian Processes (Rasmussen, 2003) showing significant data-efficiency gains over model-free approaches (Deisenroth et al., 2013; Kamthe & Deisenroth, 2017; Kocijan et al., 2004; Ko et al., 2007). More recently, due to the challenges of applying these methods to highdimensional state spaces, MBRL approaches employs Bayesian deep neural networks (Nagabandi et al., 2018; Chua et al., 2018b; Gal et al., 2016; Fu et al., 2016; Lenz et al., 2015) to learn dynamics models. In our approach, we take advantage of the deep dynamics models that are conditioned on the skill being executed, simplifying the modelling problem. In addition, the skills themselves are being learned with the objective of being predictable, further assists with the learning of the dynamics model. There also have been multiple approaches addressing the planning component of MBRL including linear controllers for local models (Levine et al., 2016; Kumar et al., 2016; Chebotar et al., 2017), uncertainty-aware (Chua et al., 2018b; Gal et al., 2016) or deterministic planners (Nagabandi et al., 2018) and stochastic optimization methods (Williams et al., 2016). The main contribution of our work lies in discovering model-based skill primitives that can be further combined by a standard model-based planner, therefore we take advantage of an existing planning approach - Model Predictive Path Integral (Williams et al., 2016) that can leverage our pre-trained setting.

heading: 6 EXPERIMENTS
text: Through our experiments, we aim to demonstrate that: (a) DADS as a general purpose skill discovery algorithm can scale to high-dimensional problems; (b) discovered skills are amenable to hierarchical composition and; (c) not only is planning in the learned latent space feasible, but it is competitive to strong baselines. In Section 6.1, we provide visualizations and qualitative analysis of the skills learned using DADS. We demonstrate in Section 6.2 and Section 6.4 that optimizing the primitives for predictability renders skills more amenable to temporal composition that can be used for Hierarchical RL.We benchmark against state-of-the-art model-based RL baseline in Section 6.3, and against goal-conditioned RL in Section 6.5.

heading: 6.1 QUALITATIVE ANALYSIS
text: In this section, we provide a qualitative discussion of the unsupervised skills learned using DADS. We use the MuJoCo environments (Todorov et al., 2012) from the OpenAI gym as our test-bed (Brockman et al., 2016). We find that our proposed algorithm can learn diverse skills without any reward, even in problems with high-dimensional state and actuation, as illustrated in Figure 4. DADS can discover primitives for Half-Cheetah to run forward and backward with multiple different gaits, for Ant to navigate the environment using diverse locomotion primitives and for Humanoid to walk using stable locomotion primitives with diverse gaits and direction. The videos of the discovered primitives are available at: https://sites.google.com/view/dads-skill
Qualitatively, we find the skills discovered by DADS to be predictable and stable, in line with implicit constraints of the proposed objective. While the Half-Cheetah will learn to run in both backward and forward directions, DADS will disincentivize skills which make Half-Cheetah flip owing to the reduced predictability on landing. Similarly, skills discovered for Ant rarely flip over, and tend to provide stable navigation primitives in the environment. This also incentivizes the Humanoid, which is characteristically prone to collapsing and extremely unstable by design, to discover gaits which are stable for sustainable locomotion.
One of the significant advantages of the proposed objective is that it is compatible with continuous skill spaces, which has not been shown in prior work on skill discovery (Eysenbach et al., 2018). Not only does this allow us to embed a large and diverse set of skills into a compact latent space, but also the smoothness of the learned space allows us to interpolate between behaviors generated in the environment. We demonstrate this on the Ant environment (Figure 5), where we learn two-dimensional continuous skill space with a uniform prior over (−1, 1) in each dimension, and compare it to a discrete skill space with a uniform prior over 20 skills. Similar to Eysenbach et al. (2018), we restrict the observation space of the skill-dynamics q to the cartesian coordinates (x, y). We hereby call this the x-y prior, and discuss its role in Section 6.2.
In Figure 5, we project the trajectories of the learned Ant skills from both discrete and continuous spaces onto the Cartesian plane. From the traces of the skills, it is clear that the continuous latent space can generate more diverse trajectories. We demonstrate in Section 6.3, that continuous primitives are more amenable to hierarchical composition and generally perform better on downstream tasks. More importantly, we observe that the learned skill space is semantically meaningful. The heatmap in Figure 5 shows the orientation of the trajectory (with respect to the x-axis) as a function of the skill z ∈ Z , which varies smoothly as z is varied, with explicit interpolations shown in Appendix D.

heading: 6.2 SKILL VARIANCE ANALYSIS
text: In an unsupervised skill learning setup, it is important to optimize the primitives to be diverse. However, we argue that diversity is not sufficient for the learned primitives to be useful for downstream tasks. Primitives must exhibit low-variance behavior, which enables long-horizon composition of the learned skills in a hierarchical setup. We analyze the variance of the x-y trajectories in the environment, where we also benchmark the variance of the primitives learned by DIAYN (Eysenbach et al., 2018). For DIAYN, we use the x-y prior for the skill-discriminator, which biases the discovered skills to diversify in the x-y space. This step was necessary for that baseline to obtain a
competitive set of navigation skills. Figure 6 (Top-Left) demonstrates that DADS, which optimizes the primitives for predictability and diversity, yields significantly lower-variance primitives when compared to DIAYN, which only optimizes for diversity. This is starkly demonstrated in the plots of X-Y traces of skills learned in different setups. Skills learned by DADS show significant control over the trajectories generated in the environment, while skills from DIAYN exhibit high variance in the environment, which limits their utility for hierarchical control. This is further demonstrated quantitatively in Section 6.4.
While optimizing for predictability already significantly reduces the variance of the trajectories generated by a primitive, we find that using the x-y prior with DADS brings down the skill variance even further. For quantitative benchmarks in the next sections, we assume that the Ant skills are learned using an x-y prior on the observation space, for both DADS and DIAYN.

heading: 6.3 MODEL-BASED REINFORCEMENT LEARNING
text: The key utility of learning a parametric model qφ(s′|s, z) is to take advantage of planning algorithms for downstream tasks, which can be extremely sample-efficient. In our setup, we can solve testtime tasks in zero-shot, that is without any learning on the downstream task. We compare with the state-of-the-art model-based RL method (Chua et al., 2018a), which learns a dynamics model parameterized as p(s′|s, a), on the task of the Ant navigating to a specified goal with a dense reward. Given a goal g, reward at any position u is given by r(u) = −‖g− u‖2. We benchmark our method against the following variants:
• Random-MBRL (rMBRL): We train the model p(s′|s, a) on randomly collected trajectories, and test the zero-shot generalization of the model on a distribution of goals.
• Weak-oracle MBRL (WO-MBRL): We train the model p(s′|s, a) on trajectories generated by the planner to navigate to a goal, randomly sampled in every episode. The distribution of goals during training matches the distribution at test time. • Strong-oracle MBRL (SO-MBRL): We train the model p(s′|s, a) on a trajectories generated
by the planner to navigate to a specific goal, which is fixed for both training and test time.
Amongst the variants, only the rMBRL matches our assumptions of having an unsupervised taskagnostic training. Both WO-MBRL and SO-MBRL benefit from goal-directed exploration during training, a significant advantage over DADS, which only uses mutual-information-based exploration.
We use ∆ = ∑H t=1 −r(u) H‖g‖2 as the metric, which represents the distance to the goal g averaged over the episode (with the same fixed horizon H for all models and experiments), normalized by the initial distance to the goal g. Therefore, lower ∆ indicates better performance and 0 < ∆ ≤ 1 (assuming the agent goes closer to the goal). The test set of goals is fixed for all the methods, sampled from [−15, 15]2. Figure 7 demonstrates that the zero-shot planning significantly outperforms all model-based RL baselines, despite the advantage of the baselines being trained on the test goal(s). For the experiment depicted in Figure 7 (Right), DADS has an unsupervised pre-training phase, unlike SO-MBRL which is training directly for the task. A comparison with Random-MBRL shows the significance of mutual-information-based exploration, especially with the right parameterization and priors. This experiment also demonstrates the advantage of learning a continuous space of primitives, which outperforms planning on discrete primitives.

heading: 6.4 HIERARCHICAL CONTROL WITH UNSUPERVISED PRIMITIVES
text: We benchmark hierarchical control for primitives learned without supervision, against our proposed scheme using an MPPI based planner on top of DADS-learned skills. We persist with the task of Ant-navigation as described in 6.3. We benchmark against Hierarchical DIAYN (Eysenbach et al., 2018), which learns the skills using the DIAYN objective, freezes the low-level policy and learns a meta-controller that outputs the skill to be executed for the next HZ steps. We provide the x-y prior to the DIAYN’s disciminator while learning the skills for the Ant agent. The performance of the meta-controller is constrained by the low-level policy, however, this hierarchical scheme is agnostic to the algorithm used to learn the low-level policy. To contrast the quality of primitives learned by the DADS and DIAYN, we also benchmark against Hierarchical DADS, which learns a meta-controller the same way as Hierarchical DIAYN, but learns the skills using DADS.
From Figure 8 (Left) We find that the meta-controller is unable to compose the skills learned by DIAYN, while the same meta-controller can learn to compose skills by DADS to navigate the Ant to different goals. This result seems to confirm our intuition described in Section 6.2, that the high variance of the DIAYN skills limits their temporal compositionality. Interestingly, learning a RL
meta-controller reaches similar performance to the MPPI controller, taking an additional 200, 000 samples per goal.

heading: 6.5 GOAL-CONDITIONED RL
text: To demonstrate the benefits of our approach over model-free RL, we benchmark against goalconditioned RL on two versions of Ant-navigation: (a) with a dense reward r(u) and (b) with a sparse reward r(u) = 1 if ‖u− g‖2 ≤ , else 0. We train the goal-conditioned RL agent using soft actor-critic, where the state variable of the agent is augmented with u − g, the position delta to the goal. The agent gets a randomly sampled goal from [−10, 10]2 at the beginning of the episode. In Figure 8 (Right), we measure the average performance of the all the methods as a function of the initial distance of the goal, ranging from 5 to 30 metres. For dense reward navigation, we observe that while model-based planning on DADS-learned skills degrades smoothly as the initial distance to goal to increases, goal-conditioned RL experiences a sudden deterioration outside the goal distribution it was trained on. Even within the goal distribution observed during training of goal-conditioned RL model, skill-space planning performs competitively to it. With sparse reward navigation, goal-conditioned RL is unable to navigate, while MPPI demonstrates comparable performance to the dense reward up to about 20 metres. This highlights the utility of learning task-agnostic skills, which makes them more general while showing that latent space planning can be leveraged for tasks requiring long-horizon planning.

heading: 7 CONCLUSION
text: We have proposed a novel unsupervised skill learning algorithm that is amenable to model-based planning for hierarchical control on downstream tasks. We show that our skill learning method can scale to high-dimensional state-spaces, while discovering a diverse set of low-variance skills. In addition, we demonstrated that, without any training on the specified task, we can compose the learned skills to outperform competitive model-based baselines that were trained with the knowledge of the test tasks. We plan to extend the algorithm to work with off-policy data, potentially using relabelling tricks (Andrychowicz et al., 2017; Nachum et al., 2018) and explore more nuanced planning algorithms. We plan to apply the hereby-introduced method to different domains, such as manipulation and enable skill/model discovery directly from images.

heading: 8 ACKNOWLEDGEMENTS
text: We would like to thank Evan Liu, Ben Eysenbach, Anusha Nagabandi for their help in reproducing the baselines for this work. We are thankful to Ben Eysenbach for their comments and discussion on the initial drafts. We would also like to acknowledge Ofir Nachum, Alex Alemi, Daniel Freeman, Yiding Jiang, Allan Zhou and other colleagues at Google Brain for their helpful feedback and discussions at various stages of this work. We are also thankful to Michael Ahn and others in Adept team for their support, especially with the infrastructure setup and scaling up the experiments.

heading: B GRAPHICAL MODELS, INFORMATION BOTTLENECK AND UNSUPERVISED SKILL LEARNING
text: We now present a novel perspective on unsupervised skill learning, motivated from the literature on information bottleneck. This section takes inspiration from (Alemi & Fischer, 2018), which helps us provide a rigorous justification for our objective proposed earlier. To obtain our unsupervised RL objective, we setup a graphical model P as shown in Figure 9, which represents the distribution of trajectories generated by a given policy π. The joint distribution is given by:
p(s1, a1 . . . aT−1, sT , z) = p(z)p(s1) T−1∏ t=1 π(at|st, z)p(st+1|st, at). (8)
We setup another graphical modelN , which represents the desired model of the world. In particular, we are interested in approximating p(s′|s, z), which represents the transition function for a particular primitive. This abstraction helps us get away from knowing the exact actions, enabling model-based planning in behavior space (as discussed in the main paper). The joint distribution for N shown in Figure 10 is given by:
η(s1, a1, . . . sT , aT , z) = η(z)η(s1) T−1∏ t=1 η(at)η(st+1|st, z). (9)
The goal of our approach is to optimize the distribution π(a|s, z) in the graphical model P to minimize the distance between the two distributions, when transforming to the representation of the graphical model Z. In particular, we are interested in minimizing the KL divergence between p and η, that is DKL(p||η). Note, if N had the same structure as P , the information lost in projection would be 0 for any valid P . Interestingly, we can exploit the following result from in Friedman et al. (2001) to setup the objective for π, without explicitly knowing η:
min η DKL(p||η) = IP − IN , (10)
where IP and IN represents the multi-information for distribution P on the respective graphical models. Note, minη∈N DKL(p||η), which is the reverse information projection (Csiszár & Matus, 2003). The multi-information (Slonim et al., 2005) for a graphical model G with nodes gi is defined as:
IG = ∑ i I(gi;Pa(gi)), (11)
where Pa(gi) denotes the nodes upon which gi has direct conditional dependence in G. Using this definition, we can compute the multi-information terms:
IP = T∑ t=1 I(at; {st, z}) + T∑ t=2 I(st; {st−1, at−1}) and IN = T∑ t=2 I(st; {st−1, z}). (12)
Following the Optimal Frontier argument in (Alemi & Fischer, 2018), we introduce Lagrange multipliers βt ≥ 0, δt ≥ 0 for the information terms in IP to setup an objective R(π) to be maximized with respect to π:
R(π) = T−1∑ t=1 I(st+1; {st, z})− βtI(at; {st, z})− δtI(st+1; {st, at}) (13)
(14)
As the underlying dynamics are fixed and unknown, we simplify the optimization by setting δt = 0 which intuitively corresponds to us neglecting the unchangeable information of the underlying dynamics. This gives us
R(π) = T−1∑ t=1 I(st+1; {st, z})− βtI(at; {st, z}) (15)
≥ T−1∑ t=1 I(st+1; z | st)− βtI(at; {st, z}) (16)
Here, we have used the chain rule of mutual information: I(st+1; {st, z}) = I(st+1; st) + I(st+1; z | st) ≥ I(st+1; z | st), resulting from the non-negativity of mutual information. This yield us an information bottleneck style objective where we maximize the mutual information motivated in Section 3, while minimizing I(at; {st, z}). We can show that the minimization of the latter mutual information corresponds to entropy regularization of π(at | st, z), as follows:
I(at; {st, z}) = Eat∼π(at|st,z),st,z∼p [ log π(at | st, z)
π(at)
] (17)
= Eat∼π(at|st,z),st,z∼p [ log π(at | st, z)
p(at)
] −DKL(π(at) || p(at)) (18)
≤ Eat∼π(at|st,z),st,z∼p [ log π(at | st, z)
p(at)
] (19)
for some arbitrary distribution log p(at) (for example uniform). Again, we have used the nonnegativity of DKL to get the inequality. We use Equation 19 in Equation 16 to get:
R(π) ≥ T−1∑ t=1 I(st+1; z | st)− βtEat∼π(at|st,z),st,z∼p [ log π(at | st, z) ]
(20)
where we have ignored p(at) as it is a constant with respect to optimization for π. This motivates the use of entropy regularization. We can follow the arguments in Section 3 to obtain an approximate lower bound for I(st+1; z | st). The above discussion shows how DADS can be motivated from a graphical modelling perspective, while justifying the use of entropy regularization from an information bottleneck perspective. This objective also explicates the temporally extended nature of z, and how it corresponds to a sequence of actions producing a predictable sequence of transitions in the environment.
We can carry out the exercise for the reward function in Eysenbach et al. (2018) (DIAYN) to provide a graphical model interpretation of the objective used in the paper. To conform with objective in the paper, we assume to be sampling to be state-action pairs from skill-conditioned stationary distributions in the world P , rather than trajectories. The objective to be maximized is given by:
R(π) = −IP + IQ (21) = −I(a; {s, z}) + I(z; s) (22)
= Eπ[log p(z|s) p(z) − log π(a|s, z) π(a) ] (23)
≥ Eπ[log qφ(z|s)− log p(z)− log π(a|s, z)] = R(π, qφ) (24) where we have used the variational inequalities to replace p(z|s) with qφ(z|s) and π(a) with a uniform prior over bounded actions p(a) (which is ignored as a constant).

heading: C APPROXIMATING THE REWARD FUNCTION
text: We revisit Equation 4 and the resulting approximate reward function constructed in Equation 6. The maximization objective for policy was:
R(π | qφ) = Ez,s,s′ [ log qφ(s ′ | s, z)− log p(s′ | s) ] (25)
The computational problem arises from the intractability of p(s′ | s) = ∫ p(s′ | s, z)p(z | s)dz, where both p(s′ | s, z) and p(z | s) ∝ p(s | z)p(z) are intractable. Unfortunately, any variational approximation results in an improper lower bound for the objective. To see that:
R(π | qφ) = Ez,s,s′ [ log qφ(s ′ | s, z)− log q(s′ | s) ] −DKL(p(s′ | s) || q(s′ | s)) (26)
≤ Ez,s,s′ [ log qφ(s ′ | s, z)− log q(s′ | s) ] (27)
where the inequality goes the wrong way for any variational approximation q(s′ | s). Our approximation can be seen as a special instantiation of q(s′ | s) = ∫ qφ(s
′ | s, z)p(z)dz. This approximation is simple to compute as generating samples from the prior p(z) is inexpensive and effectively requires only a forward pass through qφ. Reusing qφ to approximate p(s′ | s) makes intuitive sense because we want qφ to reasonably approximate p(s′ | s, z) (which is why we collect large batches of data and take multiple steps of gradient descent for fitting qφ). While sampling from the prior p(z) is crude, sampling p(z | s) can be computationally prohibitive. For a certain class of problems, especially locomotion, sampling from p(z) is a reasonable approximation as well. We want our primitives/skills to be usable from any state, which is especially the case with locomotion. Empirically, we have found our current approximation provides satisfactory results. We also discuss some other potential solutions (and their limitations):
(a) One could potentially use another network qβ(z | s) to approximate p(z | s) by minimizing Es,z∼p [ DKL(p(z | s) || qβ(z | s)) ] . Note, the resulting approximation would still be an improper lower bound for R(π | qφ). However, sampling from this qβ might result in a better approximation than sampling from the prior p(z) for some problems.
(b) We can bypass the computational intractability of p(s′ | s) by exploiting the variational lower bounds from Agakov (2004). We use the following inequality, used in Hausman et al. (2018):
H(x) ≥ ∫ p(x, z) log
q(z|x) p(x, z) dxdz (28)
where q is a variational approximation to the posterior p(z|x). I(s′; z|s) = −H(s′|s, z) +H(s′|s) (29)
≥ Ez,s,s′∼p [ log qφ(s ′|s, z)] + Ez,s,s′∼p [ log qα(z|s′, s) ] +H(s′, z|s) (30)
= Ez,s,s′∼p [ log qφ(s ′|s, z) + log qα(z|s′, s)] +H(s′, z|s) (31)
where we have used the inequality for H(s′|s) to introduce the variational posterior for skill inference qα(z | s′, s) besides the conventional variational lower bound to introduce q(s′ | s, z). Further decomposing the leftover entropy:
H(s′, z|s) = H(z|s) +H(s′|s, z)
Reusing the variational lower bound for marginal entropy from Agakov (2004), we get: H(s′|s, z) ≥ Es,z [ ∫ p(s′, a|s, z) log q(a|s ′, s, z)
p(s′, a|s, z) ds′da
] (32)
= − log c+H(s′, a|s, z) (33) = − log c+H(s′|s, a, z) +H(a|s, z) (34)
Since, the choice of posterior is upon us, we can choose q(a|s′, s, z) = 1/c to induce a uniform distribution for the bounded action space. For H(s′|s, a, z), notice that the underlying dynamics p(s′|s, a) are independent of z, but the actions do depend upon z. Therefore, this corresponds to entropy-regularized RL when the dynamics of the system are deterministic. Even for stochastic dynamics, the analogy might be a good approximation , assuming the underlying dynamics are not very entropic. The final objective (making this low-entropy dynamics assumption) can be written as:
I(s′; z|s) ≥ EsEp(s′,z|s)[log qφ(s′|s, z) + log qα(z|s′, s)− log p(z|s)] +H(a|s, z) (35)
While this does bypass the intractability of p(s′ | s), it runs into the intractable p(z | s), despite deploying significant mathematical machinery and additional assumptions. Any variational approximation for p(z | s) would again result in an improper lower bound for I(s′; z | s). (c) One way to a make our approximation q(s′ | s) to more closely resemble p(s′ | s) is to change our generative model p(z, s, s′). In particular, if we resample z ∼ p(z) for every timestep of the rollout from π, we can indeed write p(z | s) = p(z). Note, p(s′ | s) is still intractable to compute, but marginalizing qφ(s′ | s, z) over p(z) becomes a better approximation of p(s′ | s). However, this severely dampens the interpretation of our latent space Z as temporally extended actions (or skills). It becomes better to interpret the latent space Z as dimensional reduction of action space. Empirically, we found that this significantly throttles the learning, not yielding useful or interpretable skills.
D INTERPOLATION IN CONTINUOUS LATENT SPACE

heading: E MODEL PREDICTION
text: From Figure 14, we observe that skill-dynamics can provide robust state-predictions over long planning horizons. When learning skill-dynamics with x−y prior, we observe that the error in prediction rises slower with horizon as compared to the norm of the actual position. This provides strong evidence of cooperation between the primitives and skill-dynamics learned using DADS with x − y prior. As the error-growth for skill-dynamics learned on full-observation space is sub-exponential, similar argument can be made for DADS without x− y prior as well (albeit to a weaker extent).

Review summaries:
This paper proposes a novel approach to learn a continuous set of skills (where a skill is associated with a latent vector and the skill policy network takes that vector as an extra input) by pure unsupervised exploration using as intrinsic reward a proxy for the mutual information  between next states and the skill (given the previous state). These skills can be used in a model-based planning (model-predictive control) with zero 'supervised' training data (for which the rewards are given), but using calls to the reward function to evaluate candidate sequences of skills and actions. The proposed approach is convincingly compared in several ways to both previous model-based approaches and model-free approaches.

This paper introduces an unsupervised learning algorithm Dynamics-Aware Discovery of Skills (DADS) for learning low-level “skills” that can be leveraged for model-predictive control. The skills are learned by maximizing the mutual information between the next state s’ and the current skill z conditioned on the current state s. Maximizing this objective corresponds to maximizing the diversity of transitions produced in the environment, while making the skill z be informative about the next state s’. The idea is that using this objective leads to learning a diverse set of skills that are predictive of the environment. The skills z correspond to a set of action sequences, which are represented by a distribution \pi(a|s,z). Because the above objective is intractable to compute (because it relies on the true dynamics p(s’|s,a)), it is variationally lower bounded using the approximate dynamics q_{\phi}(s’|s,z), which represents the transition dynamics when using a certain skill and this variational lower bound is optimized to produce the optimal q_{\phi}(s’|s,z) and \pi(a|s,z).