Evolutionary Planning in Latent Space

Thor V. A. N. Olesen, Dennis T. T. Nguyen, Rasmus Berg Palm, Sebastian Risi

Abstract

This paper introduces Evolutionary Planning in Latent Space (EPLS), a model-based reinforcement learning approach that performs online planning entirely within the compressed latent space of a learned world model. By combining a Variational Autoencoder (VAE), a recurrent neural network, and a simple evolutionary algorithm, the agent iteratively learns to drive in a continuous control environment from raw pixel data, ultimately outperforming standard model-free RL approaches.

Introduction

Planning algorithms, such as Monte Carlo Tree Search, have driven significant breakthroughs in reinforcement learning for discrete games like Chess and Go. These algorithms rely on a "world model"—a simulator that allows the agent to predict future states based on potential actions. However, in continuous control tasks like driving from pixel observations, a perfect simulator is rarely available.

While model-free RL can learn policies without a simulator, it is often sample-inefficient. Conversely, agents can learn a world model from experience, but planning within these learned models often requires high computational resources or complex dynamics. This paper explores whether efficient, online planning in continuous action spaces can be achieved using a simple evolutionary algorithm operating within a learned, latent world model.

Methodology

The EPLS architecture builds upon the "World Models" framework (Ha & Schmidhuber, 2018), replacing the standard linear controller with an online evolutionary planner. The system consists of three primary components:

  1. Visual Component (VAE): A Convolutional Variational Autoencoder compresses high-dimensional 64x64 RGB pixel frames into a compact 64-dimensional latent vector ($z$).
  2. Memory Component (MDN-RNN): A Mixture Density Recurrent Neural Network serves as the forward dynamics model. It predicts the next latent state, expected reward, and episode termination given the current latent state and action.
  3. Planning Component (RMHC): The agent uses Random Mutation Hill Climbing (RMHC) for online planning. At each time step, RMHC evolves an action sequence by simulating trajectories within the MDN-RNN's latent space.
The EPLS system architecture, showing the interaction between the Environment, the VAE visual component, and the World Model (MDRNN) used by the RMHC policy.

Iterative Training and Bootstrapping

A critical aspect of the methodology is iterative training. A model trained only on random actions cannot accurately predict the dynamics of high-performance driving. To address this, the authors bootstrap the model: they collect initial random rollouts to train the model, use the RMHC planner to generate higher-quality rollouts, and then add these to a replay buffer to refine the world model iteratively.

Evolutionary Planning in Latent Space

The core of the EPLS approach is the use of RMHC for simulated planning. Instead of training a static policy network, the agent performs local search at every step to find the optimal sequence of actions.

The RMHC planning loop: action sequences are mutated and evaluated within the simulated latent space of the MDN-RNN to maximize predicted rewards.

As shown in the planning loop, the agent maintains a "best sequence" of actions. It mutates this sequence, evaluates the mutation using the MDN-RNN to predict cumulative rewards, and replaces the best sequence if the mutation performs better. The first action of the optimized sequence is then executed in the real environment.

Experiments and Results

The approach was evaluated on the CarRacing-v0 environment from OpenAI Gym, a continuous control task requiring navigation of randomly generated tracks using raw pixel observations.

Performance Comparison

The iterative EPLS approach significantly outperformed standard model-free baselines and approached expert-level performance:

  • EPLS (Initial/Random): 356 ± 177
  • EPLS (Iterative - 5 cycles): 708 ± 195
  • DQN Baseline: 343 ± 18
  • Continuous A3C: 591 ± 45
  • Expert Model (Supervised): 765 ± 102

Key Insights

  • Evolution in Latent Space: Simple local search methods like RMHC are highly effective for online planning in continuous spaces when paired with a learned dynamics model.
  • Imagination Horizon: There is a "sweet spot" for planning depth. The authors found that horizons beyond 20 steps degraded performance due to compounding uncertainty in the learned model.
  • Bootstrapping: Feeding the agent's successful planned trajectories back into the training data is essential for capturing the dynamics of optimal behavior.

Limitations and Future Work

Despite its success, the model exhibits biases derived from its training data. For instance, the agent occasionally struggles with right turns because the randomly generated tracks in the training set featured a higher frequency of left turns. Additionally, the agent sometimes favors high-speed cornering over conservative braking, as it lacks sufficient experience with the long-term benefits of slowing down. Future work will focus on extended iterative training cycles to expose the agent to a wider variety of edge cases and failure modes.

Summary updated

BibTeX
@inproceedings{olesen2021evolutionary,
  author = {Thor V. A. N. Olesen and Dennis T. T. Nguyen and Rasmus Berg Palm and Sebastian Risi},
  title = {{Evolutionary Planning in Latent Space}},
  booktitle = {EvoApplications},
  year = {2021},
  doi = {10.1007/978-3-030-72699-7\_33},
}
Figure