summaries: This paper proposes a novel approach to hierarchical reinforcement learning approach by first learning a graph decomposition of the state space through a recurrent VAE and then use the learned graph to efficiently explore the environment. The algorithm is separated into 2 stages where in the first stage random walk and goal conditioned policy is used to explore the environment and simultaneous use a recurrent binary VAE to compress the trajectory. The inference network is given the observation and action and the reconstruction is to, given the hidden state or hidden state+observation, reconstruct the action taken. The approximate posterior takes on the form of a hard Kumaraswamy distribution which can differentiably approximate a binary variable; when the approximate posterior is 0, the decoder must reconstruct the action using the hidden state alone. The nodes of the world graph are roughly states that are used to reconstruct the trajectories in the environment. After the graph is constructed, the agent can use a combination of high-level policy and classical planning to solve tasks with sparse reward. This paper proposes an approach to identifying important waypoint states in RL domains in an unsupervised fashion, and then for using these states within a hierarchical RL approach.  Specifically, the authors propose to use a binary latent variable VAE to identify waypoint states, then an HRL algorithm uses these waypoints as intermediate goals to better decompose large RL domains. The authors show that on several grid world tasks, the resulting policies substantially outperform baseline approaches.
abstractText: Efficiently learning to solve tasks in complex environments is a key challenge for reinforcement learning (RL) agents. We propose to decompose a complex environment using a task-agnostic world graphs, an abstraction that accelerates learning by enabling agents to focus exploration on a subspace of the environment. The nodes of a world graph are important waypoint states and edges represent feasible traversals between them. Our framework has two learning phases: 1) identifying world graph nodes and edges by training a binary recurrent variational autoencoder (VAE) on trajectory data and 2) a hierarchical RL framework that leverages structural and connectivity knowledge from the learned world graph to bias exploration towards task-relevant waypoints and regions. We thoroughly evaluate our approach on a suite of challenging maze tasks and show that using world graphs significantly accelerates RL, achieving higher reward and faster learning.
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: Joshua Achiam Shankar Sastry
references.title: Surprise-based intrinsic motivation for deep reinforcement learning
references.venue: arXiv preprint arXiv:1703.01732,
references.authors: Adrien Angeli David Filliat Stéphane Doncieux Jean-Arcady Meyer
references.title: A fast and incremental method for loop-closure detection using bags of visual words
references.venue: IEEE Transactions on Robotics,
references.authors: Pierre-Luc Bacon Jean Harb Doina Precup
references.title: The option-critic architecture
references.venue: In Thirty-First AAAI Conference on Artificial Intelligence,
references.authors: André Barreto Will Dabney Rémi Munos Jonathan J Hunt Tom Schaul Hado P van Hasselt David Silver
references.title: Successor features for transfer in reinforcement learning
references.venue: In Advances in neural information processing systems,
references.authors: Joost Bastings Wilker Aziz Ivan Titov
references.title: Interpretable neural predictions with differentiable binary variables. In Proceedings of the 2019 Conference of the Association for Computational Linguistics, Volume 1 (Long Papers)
references.venue: Association for Computational Linguistics,
references.authors: Yuri Burda Harri Edwards Deepak Pathak Amos Storkey Trevor Darrell Alexei A Efros
references.title: Large-scale study of curiosity-driven learning
references.venue: arXiv preprint arXiv:1808.04355,
references.authors: Maria Chatzigiorgaki Athanassios N Skodras
references.title: Real-time keyframe extraction towards video content identification
references.venue: In 2009 16th International conference on digital signal processing,
references.authors: Fei Chen Yang Gao Shifu Chen Zhenduo Ma
references.title: Connect-based subgoal discovery for options in hierarchical reinforcement learning
references.venue: In Third International Conference on Natural Computation (ICNC 2007),
references.authors: Junyoung Chung Kyle Kastner Laurent Dinh Kratarth Goel Aaron C Courville Yoshua Bengio
references.title: A recurrent latent variable model for sequential data
references.venue: In Advances in neural information processing systems,
references.authors: John D Co-Reyes YuXuan Liu Abhishek Gupta Benjamin Eysenbach Pieter Abbeel Sergey Levine
references.title: Self-consistent trajectory autoencoder: Hierarchical reinforcement learning with trajectory embeddings
references.venue: arXiv preprint arXiv:1806.02813,
references.authors: Christian Daniel Herke Van Hoof Jan Peters Gerhard Neumann
references.title: Probabilistic inference for determining options in reinforcement learning
references.venue: Machine Learning,
references.authors: Peter Dayan Geoffrey E Hinton
references.title: Feudal reinforcement learning
references.venue: In Advances in neural information processing systems,
references.authors: Jacob Devlin Ming-Wei Chang Kenton Lee Kristina Toutanova
references.title: Bert: Pre-training of deep bidirectional transformers for language understanding
references.authors: Bruce L Digney
references.title: Learning hierarchical control structures for multiple tasks and changing environments
references.authors: Jeff Donahue Yangqing Jia Oriol Vinyals Judy Hoffman Ning Zhang Eric Tzeng Trevor Darrell
references.title: Decaf: A deep convolutional activation feature for generic visual recognition
references.venue: In International conference on machine learning,
references.authors: Adrien Ecoffet Joost Huizinga Joel Lehman Kenneth O Stanley Jeff Clune
references.title: Go-explore: a new approach for hard-exploration problems
references.authors: Negin Entezari Mohammad Ebrahim Shiri Parham Moradi
references.title: A local graph clustering algorithm for discovering subgoals in reinforcement learning
references.venue: In International Conference on Future Generation Communication and Networking,
references.authors: Benjamin Eysenbach Ruslan Salakhutdinov Sergey Levine
references.title: Search on the replay buffer: Bridging planning and reinforcement learning
references.venue: arXiv preprint arXiv:1903.00606,
references.authors: Zhengzhu Feng Richard Dearden Nicolas Meuleau Richard Washington
references.title: Dynamic programming for structured continuous markov decision problems
references.venue: In Proceedings of the 20th conference on Uncertainty in artificial intelligence,
references.authors: Dieter Fox Wolfram Burgard Sebastian Thrun
references.title: Active markov localization for mobile robots
references.venue: Robotics and Autonomous Systems,
references.authors: Dibya Ghosh Abhishek Gupta Sergey Levine
references.title: Learning actionable representations with goalconditioned policies
references.venue: arXiv preprint arXiv:1811.07819,
references.authors: Anirudh Goyal Riashat Islam Daniel Strouse Zafarali Ahmed Matthew Botvinick Hugo Larochelle Sergey Levine Yoshua Bengio
references.title: Infobot: Transfer and exploration via the information
references.authors: Karol Gregor Frederic Besse
references.title: Temporal difference variational auto-encoder
references.venue: arXiv preprint arXiv:1806.03107,
references.authors: Karol Gregor Ivo Danihelka Alex Graves Danilo Jimenez Rezende Daan Wierstra
references.title: Draw: A recurrent neural network for image generation
references.venue: In ICML,
references.authors: Zhaohan Daniel Guo Mohammad Gheshlaghi Azar Bilal Piot Bernardo A Pires Toby Pohlen Rémi Munos
references.title: Neural predictive belief representations
references.venue: arXiv preprint arXiv:1811.06407,
references.authors: Tuomas Haarnoja Kristian Hartikainen Pieter Abbeel Sergey Levine
references.title: Latent space policies for hierarchical reinforcement learning
references.venue: arXiv preprint arXiv:1804.02808,
references.authors: Danijar Hafner Timothy Lillicrap Ian Fischer Ruben Villegas David Ha Honglak Lee James Davidson
references.title: Learning latent dynamics for planning from pixels
references.venue: arXiv preprint arXiv:1811.04551,
references.authors: Peter Henderson Riashat Islam Philip Bachman Joelle Pineau Doina Precup David Meger
references.title: Deep reinforcement learning that matters
references.venue: In Thirty-Second AAAI Conference on Artificial Intelligence,
references.authors: Irina Higgins Loic Matthey Arka Pal Christopher Burgess Xavier Glorot Matthew Botvinick Shakir Mohamed Alexander Lerchner
references.title: beta-vae: Learning basic visual concepts with a constrained variational framework
references.venue: In ICLR),
references.authors: Ahmed Hussein Mohamed Medhat Gaber Eyad Elyan Chrisina Jayne
references.title: Imitation learning: A survey of learning methods
references.venue: ACM Computing Surveys (CSUR),
references.authors: Dinesh Jayaraman Frederik Ebert Alexei A Efros Sergey Levine
references.title: Time-agnostic prediction: Predicting predictable video frames
references.venue: arXiv preprint arXiv:1808.07784,
references.authors: Lukasz Kaiser Mohammad Babaeizadeh Piotr Milos Blazej Osinski Roy H Campbell Konrad Czechowski Dumitru Erhan Chelsea Finn Piotr Kozakowski Sergey Levine
references.title: Model-based reinforcement learning for atari
references.authors: Diederik P Kingma Jimmy Ba
references.title: Adam: A method for stochastic optimization
references.venue: arXiv preprint arXiv:1412.6980,
references.authors: Diederik P Kingma Max Welling
references.title: Auto-encoding variational bayes
references.venue: In ICLR,
references.authors: Thomas Kipf Yujia Li Hanjun Dai Vinicius Zambaldi Edward Grefenstette Pushmeet Kohli Peter Battaglia
references.title: Compositional imitation learning: Explaining and executing one task at a time
references.venue: arXiv preprint arXiv:1812.01483,
references.authors: Quoc V Le Navdeep Jaitly Geoffrey E Hinton
references.title: A simple way to initialize recurrent networks of rectified linear units
references.venue: arXiv preprint arXiv:1504.00941,
references.authors: Alberto Quattrini Li Marios Xanthidis Jason M O’Kane Ioannis Rekleitis
references.title: Active localization with dynamic obstacles
references.venue: In 2016 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS),
references.authors: Christos Louizos Max Welling Diederik P Kingma
references.title: Learning sparse neural networks through l_0 regularization
references.venue: arXiv preprint arXiv:1712.01312,
references.authors: Stephanie Lowry Niko Sünderhauf Paul Newman John J Leonard David Cox Peter Corke Michael J Milford
references.title: Visual place recognition: A survey
references.venue: IEEE Transactions on Robotics,
references.authors: Chris J Maddison Andriy Mnih Yee Whye Teh
references.title: The concrete distribution: A continuous relaxation of discrete random variables
references.venue: arXiv preprint arXiv:1611.00712,
references.authors: Sridhar Mahadevan Mauro Maggioni
references.title: Proto-value functions: A laplacian framework for learning representation and control in markov decision processes
references.venue: Journal of Machine Learning Research,
references.authors: Shie Mannor Ishai Menache Amit Hoze Uri Klein
references.title: Dynamic abstraction in reinforcement learning via clustering
references.venue: In Proceedings of the twenty-first international conference on Machine learning,
references.authors: Amy McGovern Andrew G Barto
references.title: Automatic discovery of subgoals in reinforcement learning using diverse density
references.authors: Jan Hendrik Metzen
references.title: Learning graph-based representations for continuous reinforcement learning domains
references.venue: In Joint European Conference on Machine Learning and Knowledge Discovery in Databases,
references.authors: Dmytro Mishkin Jiri Matas
references.title: All you need is a good init
references.venue: arXiv preprint arXiv:1511.06422,
references.authors: Volodymyr Mnih John Agapiou Simon Osindero Alex Graves Oriol Vinyals Koray Kavukcuoglu
references.title: Strategic attentive writer for learning macro-actions
references.venue: arXiv preprint arXiv:1606.04695,
references.authors: Volodymyr Mnih Adria Puigdomenech Badia Mehdi Mirza Alex Graves Timothy Lillicrap Tim Harley David Silver Koray Kavukcuoglu
references.title: Asynchronous methods for deep reinforcement learning
references.venue: In International Conference on Machine Learning,
references.authors: Ashvin V Nair Vitchyr Pong Murtaza Dalal Shikhar Bahl Steven Lin Sergey Levine
references.title: Visual reinforcement learning with imagined goals
references.venue: In Advances in Neural Information Processing Systems,
references.authors: Eric Nalisnick Padhraic Smyth
references.title: Stick-breaking variational autoencoders
references.venue: arXiv preprint arXiv:1605.06197,
references.authors: Georg Ostrovski Marc G Bellemare Aaron van den Oord Rémi Munos
references.title: Count-based exploration with neural density models
references.authors: Yudha P Pane Subramanya P Nageshrao Robert Babuška
references.title: Actor-critic reinforcement learning for tracking control in robotics
references.venue: In Decision and Control (CDC),
references.authors: Deepak Pathak Pulkit Agrawal Alexei A Efros Trevor Darrell
references.title: Curiosity-driven exploration by self-supervised prediction
references.venue: In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition Workshops,
references.authors: Karl Pertsch Oleh Rybkin Jingyun Yang Kost Derpanis Joseph Lim Kostas Daniilidis Andrew Jeable. Keyin
references.title: Discovering subgoal structure with keyframe-based video prediction
references.authors: Sébastien Racanière Théophane Weber David Reichert Lars Buesing Arthur Guez Danilo Jimenez Rezende Adria Puigdomenech Badia Oriol Vinyals Nicolas Heess Yujia Li
references.title: Imaginationaugmented agents for deep reinforcement learning
references.venue: In Advances in neural information processing systems,
references.authors: Alec Radford Jeff Wu Rewon Child David Luan Dario Amodei Ilya Sutskever
references.title: Language models are unsupervised multitask learners
references.authors: Danilo Jimenez Rezende Shakir Mohamed Daan Wierstra
references.title: Stochastic backpropagation and approximate inference in deep generative models
references.venue: In ICML,
references.authors: Olga Russakovsky Jia Deng Hao Su Jonathan Krause Sanjeev Satheesh Sean Ma Zhiheng Huang Andrej Karpathy Aditya Khosla Michael Bernstein
references.title: Imagenet large scale visual recognition challenge
references.venue: International journal of computer vision,
references.authors: Wenling Shang Herk van Hoof Max Welling
references.title: Stochastic activation actor-critic methods
references.venue: In ECML-PKDD,
references.authors: Özgür Şimşek Alicia P Wolfe Andrew G Barto
references.title: Identifying useful subgoals in reinforcement learning by local graph partitioning
references.venue: In Proceedings of the 22nd international conference on Machine learning,
references.authors: Richard S Sutton
references.title: Introduction to reinforcement learning, volume 135
references.authors: Matthew E Taylor Peter Stone
references.title: Transfer learning for reinforcement learning domains: A survey
references.venue: Journal of Machine Learning Research,
references.authors: Sebastian Thrun
references.title: Learning metric-topological maps for indoor mobile robot navigation
references.venue: Artificial Intelligence,
references.authors: Yuandong Tian Qucheng Gong
references.title: Latent forward model for real-time strategy game planning with incomplete information
references.venue: In NIPS Symposium,
references.authors: Alexander Sasha Vezhnevets Simon Osindero Tom Schaul Nicolas Heess Max Jaderberg David Silver Koray Kavukcuoglu
references.title: Feudal networks for hierarchical reinforcement learning
references.venue: In Proceedings of the 34th International Conference on Machine Learning-Volume
references.authors: Yuhuai Wu Elman Mansimov Roger B Grosse Shun Liao Jimmy Ba
references.title: Scalable trust-region method for deep reinforcement learning using kronecker-factored approximation
references.authors: Yuxin Wu Yuandong Tian
references.title: Training agent for first-person shooter game with actor-critic curriculum
sections.heading: 1 INTRODUCTION
sections.text: Many real-world applications, e.g., self-driving cars and in-home robotics, require an autonomous agent to execute different tasks within a single environment that features, e.g. high-dimensional state space, complex world dynamics or structured layouts. In these settings, model-free reinforcement learning (RL) agents often struggle to learn efficiently, requiring a large amount of experience collections to converge to optimal behaviors. Intuitively, an agent could learn more efficiently by focusing its exploration in task-relevant regions, if it has knowledge of the high-level structure of the environment.
  We propose a method to 1) learn and 2) use an environment decomposition in the form of a world graph, a task-agnostic abstraction. World graph nodes are waypoint states, a set of salient states that can summarize agent trajectories and provide meaningful starting points for efficient exploration (Chatzigiorgaki & Skodras, 2009; Jayaraman et al., 2018; Ghosh et al., 2018). The directed and weighted world graph edges characterize feasible traversals among the waypoints. To leverage the world graph, we model hierarchical RL (HRL) agents where a high-level policy chooses a waypoint state as a goal to guide exploration towards task-relevant regions, and a low-level policy strives to reach the chosen goals.
  Our framework consists of two phases. In the task-agnostic phase, we obtain world graphs by training a recurrent variational auto-encoder (VAE) (Chung et al., 2015; Gregor et al., 2015; Kingma & Welling, 2013) with binary latent variables (Nalisnick & Smyth, 2016) over trajectories collected using a random walk policy (Ha & Schmidhuber, 2018) and a curiosity-driven goal-conditioned policy (Ghosh et al., 2018; Nair et al., 2018). World graph nodes are states that are most frequently selected by the binary latent variables, while edges are inferred from empirical transition statistics between neighboring waypoints. In the task-specific phase, taking advantage of the learned world graph for structured exploration, we efficiently train an HRL model (Taylor & Stone, 2009).
  In summary, our main contributions are:
  • A task-agnostic unsupervised approach to learn world graphs, using a recurrent VAE with binary latent variables and a curiosity-driven goal-conditioned policy.
  • An HRL scheme for the task-specific phase that features multi-goal selection (Wide-thenNarrow) and navigation via world graph traversal.
  • Empirical evaluations on multiple tasks in complex 2D grid worlds to validate that our framework produces descriptive world graphs and significantly improves both sample efficiency and final performance on these tasks over baselines, especially thanks to transfer learning from the unsupervised phase and world graph traversal.
sections.heading: 2 RELATED WORK
sections.text: An understanding of the environment and its dynamics is essential for effective planning and control in model-based RL. For example, a robotics agent often locates or navigates by interpreting a map (Lowry et al., 2015; Thrun, 1998; Angeli et al., 2008). Our exploration strategy draws inspiration from active localization, where robots are actively guided to investigate unfamiliar regions (Fox et al., 1998; Li et al., 2016). Besides mapping, recent works (Azar et al., 2019; Ha & Schmidhuber, 2018; Guo et al., 2018) learn to represent the world with generative latent states (Tian & Gong, 2017; Haarnoja et al., 2018; Racanière et al., 2017). If the latent dynamics are also extrapolated, the latent states can assist planning (Mnih et al., 2016a; Hafner et al., 2018) or model-based RL (Gregor & Besse, 2018; Kaiser et al., 2019).
  While also aiming to model the world, we approach this as abstracting both the structure and dynamics of the environment in a graph representation, where nodes are states from the environment and edges encode actionable efficient transitions between nodes. Existing works (Metzen, 2013; Mannor et al., 2004; Eysenbach et al., 2019; Entezari et al., 2010) have shown benefits of such graph abstractions but typically select nodes only subject to a good coverage the observed state space. Instead, we identify a parsimonious subset of states that can summarize trajectories and provide more useful intermediate landmarks, i.e. waypoints, for navigating complex environments.
  Our method for estimating waypoint states can be viewed as performing automatic (sub)goal discovery. Subgoal and subpolicy learning are two major approaches to identify a set of temporally-extended actions, “skills”, that allow agents to efficiently learn to solve complex tasks. Subpolicy learning identifies policies useful to solve RL tasks, such as option-based methods (Daniel et al., 2016; Bacon et al., 2017) and subtask segmentations (Pertsch et al., 2019; Kipf et al., 2018). Subgoal learning, on the other hand, identifies “important states” to reach (Şimşek et al., 2005).
  Previous works consider various definitions of “important” states: frequently visited states during successful task completions (Digney, 1998; McGovern & Barto, 2001), states introducing the most novel information (Goyal et al., 2019), bottleneck states connecting densely-populated regions (Chen
  et al., 2007; Şimşek et al., 2005), or environment-specific heuristics (Ecoffet et al., 2019). Our work draws intuition from unsupervised temporal segmentation (Chatzigiorgaki & Skodras, 2009; Jayaraman et al., 2018) and imitation learning (Abbeel & Ng, 2004; Hussein et al., 2017). We define “important” states (waypoints) as the most critical states in recovering action sequences generated by some agent, which indicates that these states contain the richest information about the executed policy (Azar et al., 2019).
sections.heading: 3 LEARNING WORLD GRAPHS
sections.text: We propose a method for learning a world graph Gw, a task-agnostic abstraction of an environment that captures its high-level structure and dynamics. In this work, the primary use of world graphs is to accelerate reinforcement learning of downstream tasks. The nodes of Gw, denoted by a set of waypoints states sp ∈ Vp, are generically “important” for accomplishing tasks within the environment, and therefore useful as starting points for exploration. Our method identifies such waypoint states from interactions with the environment. In addition, we embed feasible transitions between nearby waypoint states as the edges of Gw. In this work, we define important states in the context of learning Gw (see Section 2 for alternative definitions). That is, we wish to discover a small set of states that, when used as world graph nodes, concisely summarize the structure and dynamics of the environment. Below, we describe 1) how to collect state-action trajectories and an unsupervised learning objective to identify world graph nodes, and 2) how the graph’s edges (i.e., how to transition between nodes) are formed from trajectories.
sections.heading: 3.1 WAYPOINT STATE IDENTIFICATION
sections.text: The structure and dynamics of an environment are implicit in the state-action trajectories observed during exploration. To identify world graph nodes from such data, we train a recurrent variational autoencoder (VAE) that, given a sequence of state-action pairs, identifies a subset of the states in the sequence from which the full action sequence can be reconstructed (Figure 2). In particular, the VAE infers binary latent variables that controls whether each state in the sequence is used by the generative decoder, i.e., whether a state is “important” or not.
  Binary Latent VAE The VAE consists of an inference, a generative and a prior network. These are structured as follows: the input to the inference network qφ is a trajectory of state-action pairs observed from the environment τ={(st, at)}Tt=0, with s={st}Tt=0 and a={at}Tt=0 denoting the state and action sequences respectively. The output of the inference network is the approximated posterior over a sequence z={zt}Tt=0 of binary latent variables, denoted as qφ(z|a, s). The generative network pθ computes a distribution over the full action sequence a using the masked state sequence, where st is masked if zt=0 (we fix z0=zT=1 during training), denoted as pθ(a|s, z). Finally, a state-conditioned pψ(zt|st) given by the prior network pψ for each st encodes the empirical average probability that state st is activated for reconstruction. This choice encourages inference to select within a consistent subset of states for use in action reconstruction. In particular, the waypoint
  Algorithm 1: Identifying waypoint states Vp and learning a goal-conditioned policy πg Result: Waypoint states Vp and a goal-conditioned policy πg Initialize network parameters for the recurrent variational inference model V Initialize network parameters for the goal-conditioned policy πg Initialize Vp with the initial position of the agent, i.e. Vp = {s0 = (1, 1)} while VAE reconstruction error has not converged do
  for n← 1 to N do Sample random waypoint sp ∈ Vp Navigate agent to sp and perform T -step rollout using a randow walk policy: τ rn ← {(s0 = sp, a0), ..., (sT , aT )} gn ← sT Navigate agent to sp and perform T -step rollout using πg with goal gn: τπn ← {(s0 = sp, a0), ..., (sT , aT )}at∼πg(·|st,gn) Re-label πg rewards with action reconstruction error as curiosity bonus: rπn ← {1st+1=gn − λ · pθ(at|s, z)}Tt=0 end Perform policy gradient update of πg using τπ and rπ Update V using τ r and τπ Update Vp as set of states with largest prior mean αsαs+βs .
  end
  states Vp are chosen as the states with the largest prior means and during training, once every few iterations, Vp is updated based on the current prior network. Objective Formally, we optimize the VAE using the following evidence lower bound (ELBO):
  ELBO = Eqφ(z|a,s) [log pθ(a|s, z)]−DKL (qφ(z|a, s)|pψ(z|s)) . (1) To ensure differentiablity, we apply a continuous relaxation over the discrete zt. We use the Beta distribution pψ(zt) = Beta(αt, βt) for the prior and the Hard Kumaraswamy distribution qψ(zt|a, z) = HardKuma(α̃t, β̃t) for the approximate posterior, which resembles the Beta distribution but is outside the exponential family (Bastings et al., 2019). This choice allows us to sample 0s and 1s without sacrificing differentiability, accomplished via the stretch-and-rectify procedure (Bastings et al., 2019; Louizos et al., 2017) and the reparametrization trick (Kingma & Welling, 2013). Lastly, to prevent the trivial solution of using all states for reconstruction, we use a secondary objective L0 to regularize the L0 norm of z at a targeted value µ0 (Louizos et al., 2017; Bastings et al., 2019), the desired number of selected states out of T steps, e.g. for when T = 25, we set µ0 = 5, meaning ideally 5 out of 25 states are activated for action reconstruction. Another term LT to encourage temporal separation between selected states by targeting the number of 0/1 switches among z at 2µ0:
  L0 = ∥∥Eqφ(z|s,a)[‖z‖0]− µ0∥∥2 , LT = ∥∥∥∥∥Eqφ(z|s,a) [ T∑ t=0 1[zt 6= zt+1] ] − 2µ0 ∥∥∥∥∥ 2 . (2)
  See Appendix A for details on training the VAE with binary zt, including integration of the Hard Kumaraswamy distribution and how to regularize the statistics of z.
sections.heading: 3.2 EXPLORATION FOR WORLD GRAPH DISCOVERY
sections.text: Naturally, the latent structure learned by the VAE depends on the trajectories used to train it. Hence, collecting a rich set of trajectories is crucial. Here, we propose a strategy to bootstrap a useful set of trajectories by alternately exploring the environment based on the current iteration’s Vp and updating the VAE and Vp, repeating this cycle until the action reconstruction accuracy plateaus (Algorithm 1). During exploration, we use action replay to navigate the agent to a state drawn from the current iteration’s Vp. Although resetting via action replay assumes our underneath environment to be deterministic, in cases where this resetting strategy is infeasible, it may be modified so long as to allow the exploration starting points to expand as the agent discovers more of its environment. For
  each such starting point, we collect two rollouts. In the first rollout, we perform a random walk to explore the nearby region. In the second rollout, we perform actions using a goal-conditioned policy πg (GCP), setting the final state reached by the random walk as the goal. Both rollouts are used for trianing the VAE and the latter is also used for training πg .
  GCP provides a venue to integrate intrinsic motivation, such as curiosity (Burda et al., 2018; Achiam & Sastry, 2017; Pathak et al., 2017; Azar et al., 2019) to generate more diverse rollouts. Specifically, we use the action reconstruction error of the VAE as an intrinsic reward signal when training πg . This choice of curioisty also prevents the VAE from collapsing to the simple behaviors of a vanilla πg .
sections.heading: 3.3 EDGE FORMATION
sections.text: The final stage is to construct the edges of Gw, which should ideally capture the environment dynamics, i.e. how to transition between waypoint states. Once VAE training is complete and Vp is fixed, we collect random walk rollouts from each of the waypoints sp ∈ Vp to estimate the underlying adjacency matrix (Biggs, 1993). More precisely, we claim a directed edge sp → sq if there exists a random walk trajectory from sp to sq that does not intersect a third waypoint. We also consider paths taken by πg (starting at sp and setting sq as the goal) and keep the shortest observed path from sp to sq as a world graph edge transition. We use the action sequence length of the edge transition between adjacent waypoints as the weight of the edge. As shown experimentally, a key benefit of our approach is the ability to plan over Gw. To navigate from one waypoint to another, we can use dynamic programming (Sutton, 1998; Feng et al., 2004) to output the optimal traversal of the graph.
sections.heading: 4 ACCELERATING REINFORCEMENT LEARNING WITH WORLD GRAPHS
sections.text: World graphs present a high-level, task-agnostic abstraction of the environment through waypoints and feasible transition routes between them. A key example of world graph applications for taskspecific RL is structured exploration: instead of exploring the entire environment, RL agents can use world graphs to quickly identify task-relevant regions and bias low-level exploration to these regions. Our framework to leverage world graphs for structured exploration consists of two parts:
  1. Hierarchical RL wherein the high-level policy selects subgoals from Vp. 2. Traversals using world graph edges.
sections.heading: 4.1 HIERARCHICAL RL OVER WORLD GRAPHS
sections.text: Formally, an RL agent learning to solve a task is formulated as a Markov Decision Process: at time t, the agent is in a state st, executes an action at via a policy π(at|st) and receives a rewards rt. The agent’s goal is to maximize its cumulative expected return R = E(st,at)∼π,p,p0 [∑ t≥0 γ trt ] , where p(st+1|st, at), p0(s0) are the transition and initial state distributions. To incorporate world graphs with RL, we use a hierarchical approach based on the Feudal Network (FN) (Dayan & Hinton, 1993; Vezhnevets et al., 2017), depicted in Figure 3. A standard FN
  decomposes the policy of the agent into two separate policies that receive distinct streams of reward: a high-level policy (“Manager”) learns to propose subgoals; a low-level policy (“Worker”) receives subgoals from the Manager as inputs and is rewarded for taking actions in the environment that reach the subgoals. The Manager receives the environment reward defined by the task and therefore must learn to emit subgoals that lead to task completion. The Manager and Worker do not share weights and operate at different temporal resolutions: the Manager only outputs a new subgoal if either the Worker reaches the chosen one or a subgoal horizon c is exceeded.
  For all our experiments, policies are trained using advantage actor-critic (A2C), an on-policy RL algorithm (Wu & Tian, 2016; Pane et al., 2016; Mnih et al., 2016b). To ease optimization, the feature extraction layers of the Manager and Worker that encode st are initialized with the corresponding layers from πg , the GCP learned during world graph discovery phase. More details are in Appendix B.
sections.heading: 4.2 WIDE-THEN-NARROW GOALS AND WORLD GRAPHS
sections.text: To incorporate the world graph, we introduce a Manager policy that factorizes subgoal selection as follows: a wide policy πw(gwt |st) selects a waypoint state as the wide goal gw ∈ Vp, and a narrow policy πn(gnt |st, gwt ) selects a state within a local neighborhood of gwt , i.e. its -net (Mahadevan & Maggioni, 2007), as the narrow goal gn ∈ {s : D(s, gwt ) ≤ }. The Worker policy πworker(at|st, gnt , gwt ) chooses the action taken by the agent given the current state and the wide and narrow goals from the Manager. A visual illustration is in Figure 4 and training details in Appendix C.2.
sections.heading: 4.3 WORLD GRAPH TRAVERSAL
sections.text: The wide-then-narrow subgoal format simplifies the search space for the Manager policy. Using waypoints as wide goals also makes it possible to leverage the edges of the world graph for planning and executing the planned traversals. This process breaks down as follows:
  1. When to Traverse: When the agent encounters a waypoint state st ∈ Vp, a “traversal” is initiated if st has a feasible connection in Gw to the active wide goal gwt . 2. Planning: Upon triggering a traversal, the optimal traversal route from the initiating state to gwt is estimated from the Gw edge weights using classic dynamic programming planning (Sutton, 1998; Feng et al., 2004). This yields a sequence of intermediate waypoint states.
  3. Execution: Execution of graph traversals depends on the nature of the environment. If deterministic, the agent simply follows the action sequences given by the edges of the traversal. Otherwise, the agent uses the pretrained GCP πg to sequentially reach each of the intermediate waypoint states along the traversal (we fine-tune πg in parallel where applicable). If the agent fails to reach the next waypoint state within a certain time limit, it stops its current pursuit and a new (gw, gn) pair is received from the Manager.
  World graph traversal allows the Manager to assign task-relevant wide goals gw that can be far away from the agent yet still reachable, which consequentially accelerates learning by focusing exploration around the task-relevant region near gw.
sections.heading: 5 EXPERIMENTAL VALIDATION
sections.text: We now assess each component of our framework on a set of challenging 2D grid worlds. Our ablation studies demonstrate the following benefits of our framework:
  Waypoint type MultiGoal MultiGoal-Sparse MultiGoal-Stochastic Door-Key Learned 2.72±0.59 0.26±0.11 0.60±0.12 0.26±0.19 Random 2.30±0.49 0.19±0.11 0.41±0.25 0.27±0.40
  Implementation details, snippets of the tasks and mazes are in Appendix C-D.
sections.heading: 5.1 ABLATION STUDIES ON 2D GRID WORLDS
sections.text: For our ablation studies, we construct 2D grid worlds of increasing sizes (small, medium and large) along with challenging tasks with different reward structures, levels of stochasticity and logic (summarized in Table 1). In all tasks, every action taken by the agent receives a negative reward penalty. We follow a rigorous evaluation protocol (Wu et al., 2017; Ostrovski et al., 2017; Henderson et al., 2018): each experiment is repeated with 3 training seeds. 10 additional validation seeds are used to pick the model with the best reward performance. This model is then tested on 100 testing seeds. We report mean reward and standard deviation.
  We ablate each of the following components in our framework and compare against non-hierarchical (A2C) and hierarchical baselines (FN):
  1. initializing the feature extraction layers of the Manager and Worker from πg , 2. applying Wide-then-Narrow Manager (WN) goal instruction, and 3. allowing the Worker to traverse along Gw.
  Results are shown in Table 2. In sum, each component improves performance over the baselines.
  Wide and narrow goals Using two goal types is a highly effective way to structure the Manager instructions and enables the Worker to differentiate the transition and local task-solving phases. We note that for small MultiGoal, agents do not benefit much from Gw traversal: it can rely solely on the guidance from WN goals to master both phases. However with increasing maze size, the Worker struggles to master traversals on its own and thus fails solving the tasks.
  World Graph Traversal As conjectured in Section 4.3, the performance gain of our framework can be explained by the larger range and more targeted exploration strategy. In addition, the Worker
  does not have to learn long distance transitions with the aid of Gw traversals. Figure 4 confirms that Gw traversal speeds up convergence and its effect becomes more evident with larger mazes. Note that the graph learning stage only need 2.4K iterations to converge. Even when taking these additional environment interactions into account, Gw traversal still exhibits superior sample efficiency, not to mention that the graph is shared among all tasks. Moreover, solving Door-Key involves a complex combination of sub-tasks: find and pick up the key, reach and open the door and finally exit. With limited reward feedback, this is particularly difficult to learn. The ability to traverse along Gw enables longer-horizon planning on top of the waypoints, thanks to which the agents boost the success rate on medium Door-Key from 0.56±0.02 to 0.75±0.06.
  Benefits of Learned Waypoints To highlight the benefit of establishing the waypoints learned by the VAE as nodes for Gw, we compare against results using a Gw constructed around randomly selected states (Vrand). The edges of the random-node graph are formed in the same way as described in Section 3.3 and its feature extractor is also initialized from πg. Although granting knowledge acquired during the unsupervised phase to Vrand is unfair to Vp, deploying both initialization and traversal while only varying Vrand and Vp isolates the effect from the nodes to the best extent. The comparative results (in Table 3, learning curves for MultiGoal in Figure 4) suggest Vp generally outperforms Vrand. Door-Key is the only task in which the two matches. However, Vrand exhibits a large variance, implying that certain sets of random states can be suitable for this task, but using learned waypoints gives strong performance more consistently.
  Initialization with GCP Initializing the weights of the Worker and Manager feature extractors from πg (learned during the task-agnostic phase) consistently benefits learning.In fact, we observe that models starting from scratch fail on almost all tasks within the maximal number of training iterations, unless coupled with Gw traversal, which is still inferior to using πg-initialization. Particularly, for the small MultiGoal-Stochastic environment, there is a high chance that a lava square blocks traversal; therefore, without the environment knowledge from πg transferred by weight initialization, the interference created by the episode-terminating lava prevents the agent from learning the task.
sections.heading: 6 CONCLUSION
sections.text: We have shown that world graphs are powerful environment abstractions, which, in particular, are capable of accelerating reinforcement learning. Future works may extend their applications to more challenging RL setups, such as real-world multi-task learning and navigation. It is also interesting to generalize the proposed framework to learn dynamic world graphs for evolving environments, and applying world graphs to multi-agent problems, where agents become part of the world graphs of other agents.
sections.heading: A RECURRENT VAE WITH DIFFERENTIABLE BINARY LATENT VARIABLES
sections.text: As illustrated in the main text, the main objective for the recurrent VAE is the following evidence lower bound with derivation:
  log p(a|s) = log ∫ p(a|s, z)dz
  = log ∫ p(a|s, z)p(z|s)q(z|a, s)
  q(z|a, s) dz
  = log ∫ p(a|s, z) p(z|s)
  q(z|a, s) q(z|a, s)dz
  ≥ Eq(z|a,s)[log p(a|s, z)− log q(z|a, s) p(z|s) ]
  = Eq(z|a,s)[log p(a|s, z)]−DKL(q(z|a, s)||p(z|s))
  The inference network qψ takes in the trajectories of state-action pairs τ and at each time step approximates the posterior of the corresponding latent variable zt. The prior network pψ takes the state st at each time step and outputs the state-conditioned prior pψ(st). We choose Beta as the prior distribution and the Hard Kuma as the approximated posterior to relax the discrete latent variables to continuous surrogates.
  The Kuma distribution Kuma(α, β) highly resembles the Beta Distribution in shape but does not come from the exponential family. Similar to Beta, the Kuma distribution also ranges from bimodal (when α ≈ β) to unimodal (α/β → 0 or α/β → ∞). Also, when α = 1 or β = 1, Kuma(α, β) = Beta(α, β). We observe empirically better performance when we fix β = 1 for the Kuma approximated posterior. One major advantage of the Kuma distribution is its simple Cumulative Distribution Function (CDF):
  FKuma(x, α, β) = (1− (1− xα))β . (3)
  It is therefore amendable to the reparametrization trick (Kingma & Welling, 2013; Rezende et al., 2014; Maddison et al., 2016) by sampling from uniform distribution u ∼ U(0, 1):
  z = F−1Kuma(u;α, β) ∼ Kuma(α, β). (4)
  Lastly, the KL-divergence between the Kuma and Beta distributions can be approximated in closed form (Nalisnick & Smyth, 2016):
  DKL(Kuma(a, b)|Beta(α, β)) = a− α a
  ( −γ −Ψ(b)− 1
  b ) + log(ab) + log Beta(α, β)− b− 1
  b + (β − 1)b ∞∑ m=1
  1
  m+ ab Beta (m a , b ) , (5)
  where Ψ is the Digamma function, γ the Euler constant, and the approximation uses the first few terms of the Taylor series expansion. We take the first 5 terms here.
  Next, we make the Kuma distribution “hard” by following the steps in Bastings et al. (2019). First stretch the support to (r = 0− 1, l = 1 + 2), 1, 2 > 0, and the resulting CDF distribution takes the form:
  FS(z) = FKuma ( z − l r − l ;α, β ) . (6)
  Then, the non-eligible probabilities for 0’s and 1’s are attained by rectifying all samples below 0 to 0 and above 1 to 1, and other value as it is, that is
  P (z = 0) = FKuma ( −l r − l ;α, β ) , P (z = 1) = 1− FKuma ( 1− l r − l ;α, β ) . (7)
  Lastly, we impose two additional regularization terms L′ and LT on the approximated posteriors. As described in the main text, L′ prevents the model from selecting all states to reconstruct {at}T−10
  by restraining the expected L0 norm of z = (z1 · · · zT−1) to approximately be at a targeted value µ0 (Louizos et al., 2017; Bastings et al., 2019). In other words, this objective adds the constraint that there should be µ0 of activated zt = 1 given a sequence of length T . The other term LT encourages temporally isolated activation of zt, meaning the number of transition between 0 and 1 among zt’s should roughly be 2µ0. Note that both expectations in Equation 2 have closed forms for HardKuma.
  L0 = ∥∥Eq(z|s,a) [‖z‖0]− µ0∥∥2 , where (8)
  Eq(z|s,a) [‖z‖0] = T∑ t=1 Eq(zt|s,a) [1zt 6=0]
  = T∑ t=1 1− p (zt = 0) = T∑ t=1 1− FKuma ( −l r − l ;αt, βt ) , (9)
  LT = ‖Eq(z|s,a) T−1∑ t=1 1zt 6=zt+1 − 2µ0‖2, where (10)
  Eq(z|s,a)[ T−1∑ t=1 1zt 6=zt+1 ] = T−1∑ t=1 p (zt = 0) (1− p (zt+1 = 0)) + (1− p (zt = 0)) p (zt+1 = 0) .
  (11)
  Lagrangian Relaxation. The overall optimization objective consists of action sequence reconstruction, KL-divergence between the posterior and prior, L0 and LT (Equation 12). We tune the objective weights λi using Lagrangian relaxation (Higgins et al., 2017; Bastings et al., 2019; Bertsekas, 1999), treating λi’s as learnable parameters and performing alternative optimization between λi’s and the model parameters. We observe that as long as their initialization is within a reasonable range, λi’s converge to a local optimum:
  max {λ1,2,3} min {θ,φ,ψ} −Eqψ(z|a,s) [log pθ(a|s, z)] +λ1DKL (qφ(z|a, s)|pψ(z|s)) +λ2L0+λ3LT . (12)
  We observe this approach to produce efficient and stable mini-batch training.
sections.heading: B GOAL-CONDITIONED POLICY INITIALIZATION FOR HRL
sections.text: Optimizing composite neural networks like HRL (Co-Reyes et al., 2018) is sensitive to weight initialization (Mishkin & Matas, 2015; Le et al., 2015), due to its complexity and lack of clear supervision at various levels. Therefore, taking inspiration from prevailing pre-training procedures in computer vision (Russakovsky et al., 2015; Donahue et al., 2014) and NLP (Devlin et al., 2018; Radford et al., 2019), we take advantage of the weights learned by πg during world graph discovery when initializing the Worker and Manager policies for downstream HRL, as πg has already implicitly embodied much environment dynamics information.
  More specifically, we extract the weights of the feature extractor, i.e. the state encoder, and use them as the initial weights for the state encoders of the HRL policies. Our empirical results demonstrate that such weight initialization consistently improves performance and validates the value of skill/knowledge transfer from GCP (Taylor & Stone, 2009; Barreto et al., 2017).
sections.heading: C ADDITIONAL IMPLEMENTATION DETAILS
sections.text: Model code folder including all architecture details is shared in comment.
  C.1 HYPERPARAMETERS FOR VAE TRAINING
  Our models are optimized with Adam (Kingma & Ba, 2014) using mini-batches of size 128, thus spawning 128 asynchronous agents to explore. We use an initial learning rate of 0.0001, with = 0.001, β1 = 0.9, β2 = 0.999; gradients are clipped to 40 for inference and generation nets. For HardKuma, we set l = −0.1 and r = 1.1. The maximum sequence length for BiLSTM is 25. The
  total number of training iterations is 3600 and model usually converges around 2400 iterations. We train the prior, inference, and generation networks end-to-end.
  We initialize λi’s (see Lagrangian Relaxation) to be λ1 = 0.01 (KL-divergence),λ2 = 0.06 (L0), λ3 = 0.02 (LT ). After each update of the latent model, we update λi’s, whose initial learning rate is 0.0005, by maximizing the original objective in a similar way as using Lagrangian Multiplier. At the end of optimization, λi’s converge to locally optimal values. For example, with the medium maze, λ1 = 0.067 for the KL-term, λ2 = 0.070 for the L0 and λ3 = 0.051 for the LT term. The total number of waypoints |Vp| is set to be 20% of the size of the full state space.
  C.2 TRAINING HRL MODELS
  The procedure of the Manager and the Worker in sending/receiving orders using either traversal paths among Vp from replay buffer for deterministic environments or with πg for stochastic ones follows:
  1. The Manager gives a wide-narrow subgoal pair (gw, gn). 2. The agent takes action based on the Worker policy πω conditioned on (gw, gn) and reaches
  a new state s′. If s′ ∈ Vp, gw has not yet met, and there exists a valid path basing on the edge paths from the world graph s′ → gw, agent then either follows replay actions or πg to reach gw. If πg still does not reach desired destination in a certain steps, then stop the agent wherever it stands; also πg can be finetuned here.
  3. The Worker receives positive reward for reaching gw for the first time. 4. If agent reaches gn, the Worker also receives positive rewards and terminates this horizon. 5. The Worker receives negative for every action taken except for during traversal; the Manager
  receives negative reward for every action taken including traversal. 6. When either gn is reached or the maximum time step for this horizon is met, the Manager
  renews its subgoal pair.
  The training of the Worker policy πω follows the same A2C algorithm as πg .
  The training of the Manager policy πm also follows a similar procedure but as it operates at a lower temporal resolution, its value function regresses against the tm-step discounted reward where tm covers all actions and rewards generated from the Worker.
  When using the Wide-then-Narrow instruction, the policy gradient for the Manager policy πm becomes:
  E(st,at)∼π,p,p0 [Am,t∇ log (π ω (gw,t|st)πn (gn,t|st, gw,t, sw,t))] +∇ [H (πω) +H (πn(·|gw,t))] ,
  where Am,t is the Manager’s advantage at time t. Also, for Manager, as the size of the action space scales linearly with |S|, the exact entropy for the πm can easily become intractable. Essentially there are O ( |V| × (N2) ) possible actions. To calculate the entropy exactly, all of them has to be summed, making it easily computationally intractable:
  H = ∑ w∈V ∑ wn∈sw πn(wn|sw, st)πω(w|st) log∇πn(wn|sw, st)πω(w|st).
  Thus in practice we resort to an effective alternativeH (πω) +H (πn(·|gw,t)). Psuedo-code for Manager training is in Algorithm 2.
  C.3 HYPERPARAMETERS FOR HRL
  For training the HRL policies, we inherit most hyperparameters from those used when training πg , as the Manager and the Worker both share similar architectures with πg . The hyperparameters used when training πg follow those from Shang et al. (2019). Because the tasks used in HRL experiments are more difficult than the generic goal-reaching task, we set the maximal number of training iterations to 100K abd training is stopped early if model performance reaches a plateau. The rollout steps for each iteration is 60. Hyperparameters specific to HRL are the horizon c = 20 and the size of the Manager’s local attention range (that is, the neighborhood around gw within which gn is selected), which are N = 5 for small and medium mazes, and N = 7 for the large maze.
  Algorithm 2: Training of πm for HRL models Initialize network parameters θ for πm, here πm,t refers to the policy at time rollout time step t; Given a map of V , sV ; for iter = 0, 1, 2, · · · do
  Clear gradients dθ ← 0; Reset the set of time steps where πm,t omits a new subgoal Sm = {} and tm = 0.; while t <= tmax or episode not terminated do
  Simulate under current policy πm,t−1, πw,t−1; if the Worker has met the previous subgoal or exceeded the horizon c then
  Sample a new subgoal gm,t from πm,t; zm,t = fLSTM(CNN(sm,t, sV), hm,tm), Vm,t = fv(zm,t), πt = fp(zm,t) ;
  end Sm = Sm ∪ {tm} and tm = t;
  end
  R = { 0, if terminal Vtmax+1, otherwise ; for t = tmax, · · · 1 do R← rt + γR; if t ∈ Sm then
  Am,t ← R− Vm,t; Accumulate gradients from value loss: dθ ← dθ + λ∂A 2 m,t
  ∂θ ; Accumulate policy gradients with entropy regularization: dθ ← dθ +∇ log πm,t(gm,t)Am,t + β∇H(πm,t);
  end end
  end
  D 2D GRID WORLD VISUALIZATIONS