Embed to Control: A Locally Linear Latent Dynamics Model for Control from Raw Images

Manuel Watter, Jost Tobias Springenberg, Joschka Boedecker, Martin A. Riedmiller

Introduction

In robotics and reinforcement learning, controlling systems with complex, non-linear dynamics—such as a swinging pendulum or a multi-jointed robotic arm—is a classic challenge. Classical Stochastic Optimal Control (SOC) methods, like iterative Linear-Quadratic Gaussian (iLQG), excel at these tasks. However, they traditionally require a low-dimensional state representation (e.g., exact joint angles and velocities) and a known model of the system's physics.

Real-world autonomous agents often lack this privileged information, relying instead on high-dimensional, raw sensory input like pixel data from a camera. This presents two massive hurdles: the sheer dimensionality of images makes traditional SOC computationally intractable, and the relationship between pixel changes and underlying physical laws is highly non-linear.

To address this, researchers introduced Embed to Control (E2C), a deep generative model that learns a low-dimensional latent space from raw images where complex, non-linear dynamics are forced to be locally linear. By finding this "Goldilocks" latent space—simple enough for linear control but expressive enough to reconstruct the original images—E2C allows classical optimal control algorithms to be applied directly to high-dimensional visual data.

The Embed to Control (E2C) Architecture

At its core, E2C is built upon the framework of a Variational Autoencoder (VAE), but it introduces a specialized transition model to enforce control-friendly dynamics.

E2C Architecture Diagram

The architecture consists of three main components:

  1. Encoder ($Q_\phi$): A deep neural network that maps a high-dimensional image $x_t$ to a low-dimensional latent probability distribution $z_t$.
  2. Transition Model ($Q_\psi$): Instead of a standard neural network transition, this component predicts the parameters of a locally linear model: $z_{t+1} = A_t z_t + B_t u_t + o_t$. A transition network ($h_{trans}$) takes the current latent state $z_t$ and outputs the matrices $A_t, B_t$ and the offset $o_t$.
  3. Decoder ($P_\theta$): Maps the latent states back into the image space to ensure the learned representation accurately captures the environment's state.

Training and Loss Function

The model is trained by minimizing a loss function with two primary components. First, a standard Reconstruction Loss ensures that $z_t$ can recreate $x_t$ and $z_{t+1}$ can recreate $x_{t+1}$. Second, a Consistency Constraint (KL Divergence) forces the "predicted" next latent state (generated by the linear transition model) to match the "encoded" next latent state (derived from the actual observed next image). This crucial term ensures the latent space remains consistent over long trajectories, preventing the model from "drifting" during long-term planning.

Key Insights: Structuring the Latent Space

Rather than letting a VAE learn any arbitrary representation, E2C explicitly forces the latent space to obey linear dynamics. This makes the representation "control-friendly" by design. By having a network predict the $A$ and $B$ matrices, the model essentially performs the linearization step required for SOC internally, bypassing the need to compute complex Jacobians of a non-linear transition model during the control phase.

Latent Space Comparison

Without the KL divergence consistency term, a model might learn to reconstruct single frames perfectly but fail to understand how those frames link together over time. This leads to "hallucinated" trajectories that do not exist in reality. E2C's structured approach ensures that the latent space is organized in a way that directly supports iterative Linear-Quadratic Gaussian (iLQR/iLQG) control, unlike standard autoencoders which fail to capture actionable dynamical structure.

Experimental Results

The authors evaluated E2C on four simulated visual environments: a 2D Planar System with obstacles, an Inverted Pendulum, a Cart-pole balancing task, and a Three-link Robot Arm.

The results demonstrated significant improvements over baseline generative models:

  • High Success Rates: In the Planar System and Pendulum tasks, E2C achieved 100% and 90% success rates, respectively. In stark contrast, standard Autoencoders (AE) and VAEs failed completely (0% success) because their latent spaces lacked the necessary dynamical structure for effective planning.
  • Near-Oracle Performance: In the more complex robot arm and cart-pole tasks, the control costs incurred by E2C were only slightly higher than those of an "oracle" controller that had direct access to the true underlying physical state (e.g., exact joint angles).
  • Generative Power: The deep up-convolutional networks used in the decoder proved highly effective at "dreaming up" realistic future image sequences from latent trajectories, validating their use as generative models for complex visual scenes.

Limitations and Future Directions

While E2C represents a significant step forward, it has limitations. The model relies on a Markov assumption, presuming the current image (or a small stack of consecutive images) fully observes the state. It may struggle in partially observed environments where hidden variables, like wind or varying friction, are not visible in the pixels.

Additionally, the training data for these experiments was collected via random interactions. In environments where critical states are difficult to reach, a more sophisticated exploration strategy would be necessary. Finally, in tasks like the planar system, obstacle positions were encoded into the cost function rather than being dynamically identified by the model. Future work could explore learning these cost functions directly from the pixel data, further closing the gap between raw perception and optimal control.

Summary updated

BibTeX
@inproceedings{watter2015embed,
  author = {Manuel Watter and Jost Tobias Springenberg and Joschka Boedecker and Martin A. Riedmiller},
  title = {{Embed to Control: A Locally Linear Latent Dynamics Model for Control from Raw Images}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2015},
  url = {https://openreview.net/forum?id=S1bxUdWuZr},
}
Figure