Conditional Mutual Information for Disentangled Representations in Reinforcement Learning

Mhairi Dunion, Trevor McInroe, Kevin Sebastian Luck, Josiah P. Hanna, Stefano V Albrecht

Abstract

Reinforcement Learning (RL) agents often struggle with spurious correlations, where models mistakenly associate task-irrelevant features (e.g., background color) with task-relevant dynamics. This paper introduces Conditional Mutual Information for Disentanglement (CMID), an auxiliary task designed to learn robust, disentangled representations. By leveraging the temporal structure of Markov Decision Processes (MDPs), CMID enforces conditional independence between representation dimensions, even when training data features are heavily correlated. Experimental results on the DeepMind Control Suite demonstrate that CMID achieves a 77% average improvement in zero-shot generalization under correlation shifts compared to state-of-the-art baselines.

Introduction

In real-world environments, features are rarely independent. For example, an autonomous driving agent might be trained in a city where aggressive drivers predominantly operate green vehicles. If the agent's neural network entangles the concept of "aggressiveness" with the color "green," it will likely fail to generalize when encountering aggressive drivers in red vehicles. This phenomenon, known as a correlation shift, poses a significant challenge for standard RL agents.

Traditional disentanglement techniques, such as $\beta$-VAEs, attempt to force the dimensions of a latent representation to be independent. However, these methods typically fail when the training data itself contains strong correlations. If two features are always observed together during training, a standard model cannot learn to separate them. CMID addresses this by shifting the objective from absolute independence to conditional independence, utilizing the causal structure of the environment to break these spurious links.

Methodology

Conditional Mutual Information (CMI)

The core innovation of CMID is the use of Conditional Mutual Information to enforce disentanglement. Instead of requiring features to be completely independent, CMID requires them to be independent given the agent's recent history. Based on the causal graph of an MDP, a feature at time $t$ can be rendered independent of other features if conditioned on the history of that feature and the agent's previous actions. In practice, the authors found that conditioning on the immediate previous timestep ($z_{t-1}, a_{t-1}$) is highly effective for achieving this separation.

Adversarial Training and kNN Permutation

The CMID framework employs an adversarial training loop consisting of an encoder $f_\theta$ and a discriminator $D_\phi$. The discriminator is tasked with distinguishing between the "true" joint distribution of features and a "permuted" version representing the conditional product of marginals.

To generate this permuted data, the authors implement a k-Nearest Neighbors (kNN) Permutation strategy. This involves finding samples within a training batch that possess similar conditioning sets (similar previous states and actions) and swapping specific feature dimensions between them. The encoder is then trained to minimize the CMI by attempting to "fool" the discriminator, effectively ensuring that the learned representation dimensions do not share information that is not already explained by the conditioning set.

Experimental Evaluation

Setup: The Correlation Shift Challenge

The researchers evaluated CMID using the DeepMind Control Suite (DMC), focusing on tasks such as cartpole_swingup, walker_walk, finger_spin, and hopper_stand. To test robustness, they introduced artificial spurious correlations. In the Cartpole environment, for instance, they created two hardware configurations (e.g., narrow cart/long pole vs. wide cart/short pole). During training, one configuration was paired with a specific color 95% of the time. Generalization was then tested on "reversed" correlations, where the color-hardware pairings were swapped.

Performance and Generalization

CMID demonstrated significant advantages in zero-shot generalization. On average, the SVEA-CMID variant achieved a 77% increase in returns over the base SVEA algorithm when faced with reversed correlations. While baselines like DrQ, CURL, and TED eventually adapted to new correlations after extensive retraining, CMID provided immediate, zero-shot robustness. Furthermore, CMID was found to improve training stability; by ignoring spurious correlations early in the process, agents learned core task dynamics more efficiently.

Qualitative Analysis

Saliency map analysis revealed that CMID-trained agents focused their attention on task-relevant pixels (such as the pole's position and length) while ignoring irrelevant background colors. In contrast, baseline agents exhibited "messy" attention patterns that overlapped both relevant and irrelevant features, explaining their failure under correlation shifts.

Discussion and Limitations

While CMID offers a powerful tool for disentanglement, it introduces certain trade-offs:

  • Computational Overhead: The kNN permutation step is intensive, increasing total runtime by approximately 67% in the tested environments.
  • History Dependencies: The current implementation relies on a single-timestep history. While sufficient for DMC, more complex environments with long-term dependencies or shifting camera angles may require more sophisticated conditioning sets, potentially utilizing RNNs or Transformers.
  • Frame Stacking: To avoid causal "leaks" between stacked frames, CMID currently processes frames individually. Integrating traditional frame-stacking while maintaining the integrity of the disentanglement objective remains an open area for future research.

Conclusion

CMID represents a significant step forward in learning robust representations for RL. By leveraging the inherent causal structure of MDPs through conditional mutual information, the method allows agents to successfully navigate environments where features are heavily correlated, providing a path toward more reliable and generalizable autonomous systems.

Summary updated

BibTeX
@inproceedings{dunion2023conditional,
  author = {Mhairi Dunion and Trevor McInroe and Kevin Sebastian Luck and Josiah P. Hanna and Stefano V Albrecht},
  title = {{Conditional Mutual Information for Disentangled Representations in Reinforcement Learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=EmYWJsyad4},
}
Figure