Temporal Difference Variational Auto-Encoder

Karol Gregor, George Papamakarios, Frederic Besse, Lars Buesing, Theophane Weber

TL;DR

TD-VAE is a generative sequence model designed for agents that need to plan in complex environments. Unlike standard models that simulate the world step-by-step, TD-VAE learns to make "jumpy" predictions directly into the distant future by using a training objective inspired by temporal difference (TD) learning.

What Problem Does This Paper Address?

In reinforcement learning (RL), an agent needs a "mental simulator" to plan its actions. However, most existing generative models (like standard RNNs or state-space models) have three major flaws for this use case:

  1. Lack of Abstraction: They often predict raw observations (pixels) rather than abstract concepts.
  2. Step-by-Step Bottleneck: They simulate the world one micro-step at a time. If you want to plan a trip, you don't simulate every second of the drive; you think in "jumps" (e.g., leaving home, arriving at the airport).
  3. Poor Uncertainty Handling: They struggle to maintain a "belief state"—a representation of what the agent knows (and doesn't know) about the world based on past evidence.

Researchers from DeepMind propose TD-VAE to bridge these gaps, creating a model that can jump across time intervals while maintaining a coherent representation of uncertainty.

Methods

TD-VAE combines the architecture of a Variational Auto-Encoder (VAE) with the sequential logic of state-space models, but introduces a novel temporal jump mechanism.

Architecture and training flow of the TD-VAE model, illustrating the jump between time points $t_1$ and $t_2$.
  • Belief States ($b_t$): The model uses a recurrent neural network (RNN) to aggregate all observations up to time $t$ into a deterministic "belief code." This code parameterizes a distribution over the latent state $z_t$.
  • Temporal Abstraction: Instead of training the model to predict $t+1$ from $t$, the authors train it on pairs of temporally separated points $(t_1, t_2)$.
  • The TD-like Objective: The core innovation is a modified Evidence Lower Bound (ELBO). To train the model to "jump" from $t_1$ to $t_2$, it uses a smoothing posterior. It imagines a state at $t_2$, then looks back to see what the state at $t_1$ must have been to reach that future. It then forces the agent's current belief at $t_1$ to be consistent with this "future-informed" look-back. This mirrors the logic of Temporal Difference learning, where a future estimate (the bootstrap) is used to update a current estimate.
  • Hierarchical Structure: For complex tasks, they use a "Deep TD-VAE" with multiple layers of latent variables, allowing for even higher levels of abstraction.

Datasets

The authors evaluated TD-VAE on four distinct environments:

  1. MiniPacman: A partially observed grid-world where the agent only sees a $5 \times 5$ window.
  2. Moving MNIST: Images of digits moving across a frame, used to test if the model can maintain object identity while skipping frames.
  3. Noisy Harmonic Oscillator: A 1D signal used to test the model's ability to capture underlying physics (frequency/magnitude) from noisy data.
  4. DeepMind Lab: A complex 3D first-person environment used to demonstrate the model's performance on high-dimensional visual data.

Key Insights and Ideas

  • Jumpy is Better: By training on random time intervals, the model learns a representation that is independent of the specific "tick rate" of the environment. It learns the logic of the transition rather than just the next frame.
  • Belief vs. State: The model explicitly separates the belief (what we know from history) from the state (a specific realization of the world). This allows the model to imagine multiple different, plausible futures from the same starting point.
  • Smoothing as a Teacher: Using a smoothing distribution (looking from the future back to the past) provides a much stronger training signal for the latent states than simple forward prediction.

Key Results

  • MiniPacman: TD-VAE significantly outperformed standard filtering and mean-field baselines. It achieved an estimated negative log-probability of 0.0553, compared to 0.0962 for the best baseline, proving it builds a much more accurate internal model of the environment.
Performance comparison on the MiniPacman environment, showing TD-VAE outperforming baseline models.
  • Moving MNIST: The model successfully "rolled out" predictions by skipping multiple frames. It maintained the correct digit shape and velocity even when jumping 4 steps at a time.
  • Harmonic Oscillator: Even with high noise, TD-VAE could predict the state 100 steps into the future, correctly identifying the frequency and magnitude of the oscillation where next-step predictors failed.
  • DeepMind Lab: In 3D environments, the model demonstrated the ability to generate diverse future trajectories (e.g., "I might turn left or I might turn right") from a single belief state, effectively capturing the multi-modal nature of the future.

Limitations and Future Work

  • Hyperparameter Sensitivity: The distribution of time skips ($t_2 - t_1$) used during training is a crucial choice that can affect how the model generalizes.
  • Integration with Policy: While the paper presents a powerful model of the world, it does not show the model being used by an RL agent to actually solve a task (policy learning).
  • Future Directions: The authors suggest that TD-VAE could be a cornerstone for hierarchical RL, where a high-level "manager" plans in jumpy abstract states while a low-level "worker" executes step-by-step actions.

Summary updated

BibTeX
@inproceedings{gregor2019temporal,
  author = {Karol Gregor and George Papamakarios and Frederic Besse and Lars Buesing and Theophane Weber},
  title = {{Temporal Difference Variational Auto-Encoder}},
  booktitle = {International Conference on Learning Representations},
  year = {2019},
}
Figure