Accounting for the Sequential Nature of States to Learn Features for Reinforcement Learning

Nathan Michlo, Devon Jarvis, Richard Klein, Steven JamesarXiv 2022 · DOI

Introduction

In deep reinforcement learning (RL), the quality of state representations is a critical factor in an agent's ability to learn complex tasks. Ideally, these representations should capture the underlying factors of variation in the environment—such as spatial coordinates or object properties—rather than raw pixel values. While Variational Autoencoders (VAEs) are frequently employed to learn these latent features, they often struggle in environments where transitions result in non-overlapping pixel states. This paper introduces a "weakly supervised" approach using Temporal Triplet Loss to overcome these limitations.

The Challenge of Low Pixel Overlap

Standard VAEs rely heavily on pixel-level reconstruction. When an agent moves through an environment, the VAE's loss function effectively "smooths" the latent space based on visual similarity. However, if the agent's step size is large relative to the size of objects or features (e.g., jumping several pixels in a gridworld), consecutive states may share zero pixel overlap.

In such scenarios, the VAE perceives all non-overlapping states as equally "different," leading to a phenomenon the authors term the "Overlap Gap." The latent space fails to capture the continuous nature of the environment, either collapsing or becoming disorganized, which significantly hinders downstream RL performance.

Visualization of the "Overlap Gap": as grid spacing increases, the perceived similarity between states (bottom row) becomes binary compared to the ground truth (top row), losing the gradient necessary for effective learning.

Methodology: Leveraging Temporal Continuity

To address the overlap gap, the authors propose shifting from pure reconstruction to metric learning. The core idea is to use the sequential order of states as a proxy for their semantic similarity.

Temporal Triplet Loss

The researchers utilize a Triplet Loss mechanism. Instead of manual labels, they leverage the temporal sequence of states in a replay buffer. They sample triplets $(s_a, s_p, s_n)$—an anchor, a positive, and a negative state—based on their time indices ($a < p < n$). The model is trained to ensure that the anchor state is closer to the positive state (which occurred sooner after the anchor) than to the negative state in the latent space.

Disentanglement with Ada-TVAE

Building on the concept of Adaptive Group VAEs (Ada-GVAE), the authors introduce Ada-TVAE. This model encourages disentanglement by identifying which latent dimensions are shared between temporally close states. By forcing the model to factorize the representation (e.g., separating $x$ and $y$ coordinates into distinct latent variables), the learned features become more robust and useful for RL agents.

Experimental Evaluation

The proposed methods were evaluated on two primary datasets:

  1. 3D Shapes: A benchmark for disentangled representation learning featuring objects with varying attributes.
  2. Custom Visual Gridworld: A controlled environment designed to test the impact of varying "step sizes" and pixel overlap.

Results and Discussion

The results demonstrate that the Temporal Triplet VAE (TVAE) significantly outperforms standard $\beta$-VAEs in low-overlap conditions.

  • Metric Correlation: TVAE maintained a high rank correlation between latent distances and ground-truth spatial distances, even when pixel overlap was non-existent.
  • Disentanglement: The Ada-TVAE variant successfully maintained high Mutual Information Gap (MIG) scores across various grid spacings, whereas standard models saw their performance plummet as spacing increased.
  • RL Performance: Most importantly, when these learned features were used to train a Deep Q-Network (DQN), the Ada-TVAE representations led to the fastest convergence and the highest cumulative rewards, even rivaling supervised baselines.
Cumulative rewards for various representation learning methods; Ada-TVAE variants demonstrate superior learning speed and final performance compared to standard VAEs.

Conclusion

By accounting for the sequential nature of states, the authors provide a powerful method for learning useful representations in RL without the need for manual supervision. The use of temporal proximity as a weak label effectively bridges the "overlap gap," enabling agents to learn from disentangled, logically structured features even in visually sparse environments. While the assumption that "time equals similarity" may have limitations in complex or looping environments, this work marks a significant step toward more robust unsupervised feature learning for autonomous agents.

Summary updated

BibTeX
@misc{michlo2022accounting,
  author = {Nathan Michlo and Devon Jarvis and Richard Klein and Steven James},
  title = {{Accounting for the Sequential Nature of States to Learn Features for Reinforcement Learning}},
  year = {2022},
  eprint = {2205.06000},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2205.06000},
}
Figure