Conditional Mutual Information for Disentangled Representations in Reinforcement Learning

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

TL;DR

Reinforcement Learning (RL) agents often overfit to spurious correlations in their training environments (e.g., associating an object's color with its physical dynamics), causing them to fail dramatically when deployed in the real world where these correlations shift. This paper introduces Conditional Mutual Information for Disentanglement (CMID), an auxiliary task that enables online RL agents to learn robust, disentangled representations of correlated features. By minimizing conditional mutual information rather than absolute mutual information, CMID achieves a 77% average increase in zero-shot generalization performance when environment correlations are inverted.

What Problem Does This Paper Address?

Deep reinforcement learning agents operating on high-dimensional observations (like pixels) are notorious for latching onto shortcuts. If an autonomous driving agent always sees aggressive drivers in green cars during training, it might encode "green" and "aggressive" into the same latent feature. When deployed in a world where car color is independent of driving style, the agent's policy breaks down.

To fix this, researchers use disentangled representation learning, which aims to separate distinct environmental factors (like color, size, or position) into independent dimensions in the agent's latent space. However, traditional disentanglement methods (such as $\beta$-VAEs or Independent Component Analysis) rely on a fatal assumption: that the underlying factors of variation are completely independent. When features are highly correlated in the training data, these methods fail to separate them.

This paper addresses the challenge of learning disentangled representations specifically in environments where features are strongly correlated during training, ensuring the agent can still generalize when those correlations shift.

Methods

The authors propose CMID, an auxiliary task that relaxes the strict assumption of absolute independence to conditional independence.

Instead of minimizing the standard Mutual Information (MI) between latent features, CMID minimizes the Conditional Mutual Information (CMI) between each feature dimension $z_t^n$ and all other dimensions $z_t^{-n}$.

The core technical contributions include:

  1. MDP Causal Graph Conditioning: To achieve conditional independence without relying on unobservable ground-truth labels, the authors leverage the causal structure of a Markov Decision Process (MDP). They show that conditioning on the agent's immediate history—specifically the previous representation $z_{t-1}$ and the previous action $a_{t-1}$—effectively blocks the "backdoor paths" in the causal graph that introduce spurious correlations.
The conditioning set (grey) blocks backdoor paths between representation features in the MDP causal graph.
  1. Adversarial CMI Estimation: To minimize CMI during online training, CMID uses an adversarial framework. A discriminator network ($D_\phi$) is trained to distinguish between true latent samples and permuted samples that represent the product of marginal distributions.
  2. Isolated $k$-Nearest Neighbours ($k\text{NN}$) Permutation: To generate the conditional product of marginals, the authors use a $k\text{NN}$ approach. For a given sample, they find its closest neighbors in the batch based on the conditioning set (past state and action) and permute the features among these neighbors. The encoder is then trained adversarially to make the true and permuted distributions indistinguishable to the discriminator, effectively driving the CMI to zero.
The CMID architecture utilizes an adversarial discriminator and $k\text{NN}$ permutations to minimize conditional mutual information.

Datasets

The method was evaluated on continuous control tasks from the DeepMind Control Suite (DMC), specifically:

  • cartpole_swingup
  • walker_walk
  • finger_spin
  • hopper_stand

To introduce strong feature correlations, the authors modified these environments by creating two distinct morphological variations of the controlled objects (Variation A and Variation B, which alter dynamics like pole length or thigh size) and strongly correlating them with task-irrelevant colors (Blue and Green).

Figure 3: Illustration of correlations with test- ing on reversed correlation in the cartpole en- vironment, ρ indicates the probability of an object/colour combination.

During training, Object A was blue 95% of the time and Object B was green 95% of the time. During testing, the agent faced a correlation shift: either a reversed correlation (Object A becomes green) or no correlation (50/50 distribution).

Key Insights and Ideas

  • Conditional over Absolute Independence: The fundamental "aha" moment is that features don't need to be unconditionally independent to be disentangled. By shifting the objective to conditional independence, the agent can successfully separate features that always co-occur during training.
  • The MDP as a Natural Confounder Filter: The temporal nature of RL provides a built-in mechanism to resolve confounding. Because the next state is causally dependent on the current state and action, the agent's own history serves as the perfect conditioning set, eliminating the need for human-labeled data.
  • Improved Training, Not Just Generalization: Spurious correlations actually make standard training harder because the agent gets confused trying to map irrelevant features (like color) to optimal actions. By ignoring these correlations, CMID achieves higher training returns even before the test-time shift occurs.

Key Results

CMID was evaluated against several state-of-the-art baselines, including SVEA (data augmentation), DrQ, CURL (contrastive learning), and TED (a state-of-the-art RL disentanglement method assuming absolute independence).

  • Zero-Shot Generalization: When the correlation was completely reversed at test time, CMID maintained high performance, achieving a 77% average increase in zero-shot returns across all tasks compared to the base SVEA algorithm.
  • Baseline Failure: Traditional disentanglement methods like TED failed completely under strong correlations, performing on par with or worse than standard non-disentangled baselines because they could not separate the correlated color and dynamics features.

Limitations and Future Work

  • Computational Overhead: The isolated $k\text{NN}$ permutation step adds significant computational complexity, resulting in a 67% average increase in runtime during training compared to the base RL algorithm.
  • History Length Constraints: In this work, the conditioning set was limited to a history length of one timestep ($t-1$). While this proved sufficient for these tasks, more complex environments with long-term dependencies (e.g., moving backgrounds) would require scaling to longer histories, which drastically increases the conditioning set size and training difficulty.
  • Frame Stacking Incompatibility: CMID cannot easily ingest standard frame-stacked inputs because stacking introduces direct causal relationships between consecutive frames. Instead, it requires stacking the latent representations post-encoder, which alters standard RL network pipelines.

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