Generalizing Goal-Conditioned Reinforcement Learning with Variational Causal Reasoning

Wenhao Ding, Haohong Lin, Bo Li, Ding Zhao

Standard Reinforcement Learning (RL) agents are notorious for overfitting to their training environments. In Goal-Conditioned RL (GCRL), where an agent must reach various target states, this often manifests as a failure to handle spurious correlations or compositional changes.

For example, if a robotic arm always sees a pink hexagon on top of a blue box during training, it might incorrectly learn that "pinkness" is a prerequisite for "hexagon-ness." When tested on a blue hexagon, the agent fails. This happens because most RL algorithms lack a mechanism for causal reasoning—the ability to distinguish between coincidental patterns and true cause-and-effect relationships.

Training vs. Testing Generalization

To address this, researchers introduced GRADER (GeneRAlizing by DiscovERing), a framework that integrates variational causal reasoning into GCRL to help agents generalize to unseen tasks and environments.

The GRADER Framework

GRADER enables RL agents to discover the underlying causal structure of their environment while simultaneously learning to achieve goals. By treating the causal graph as a latent variable in a variational framework, the authors formulate GCRL as a probabilistic inference problem.

The framework operates through an iterative two-step process:

  1. Causal Discovery: The agent uses "interventional data" (data collected by its own policy) to estimate the posterior of the Causal Graph. It uses statistical tests to determine if an edge exists between two variables.
  2. Model and Policy Learning: Using the discovered graph, the agent learns a transition model. Because the graph tells the model which variables actually influence each other, the model ignores noise and spurious correlations. The agent then uses this model for planning via Model Predictive Control (MPC).
The GRADER Paradigm

A key theoretical contribution of GRADER is the proof of a "virtuous cycle": as the policy improves, it explores more relevant regions of the state space, providing better data for causal discovery. A more accurate causal graph then leads to a better transition model, which further improves the policy.

Experimental Setup and Key Results

Because existing RL benchmarks rarely test for causal reasoning, the authors designed tasks across new environments: Stack (robotic manipulation), Unlock (gridworld navigation), Crash (autonomous driving), and Chemistry (a standard causal discovery benchmark). These tasks were evaluated in three settings: In-distribution, Spuriousness (swapping features to break correlations), and Composition (increasing task complexity).

GRADER significantly outperformed strong baselines (including SAC, PETS, and other causal RL methods) across almost all generalization tasks:

  • Generalization: In the Crash environment's spuriousness setting, GRADER achieved a success rate of 84.3%, compared to just 18.6% for standard Soft Actor-Critic (SAC).
  • Data Efficiency: GRADER learns to solve tasks much faster than baselines, reaching high reward levels while other methods struggle to understand the environment's dynamics.
  • Graph Accuracy: In the Chemistry environment, GRADER identified the true causal structure with near-perfect accuracy (F-scores > 0.91), whereas score-based discovery methods struggled.

Key Insights

  • Causality as a Bottleneck: By forcing the transition model to follow a discovered causal graph, the model is prevented from "cheating" by using irrelevant features that might disappear during testing.
  • The Importance of Active Exploration: Causal discovery using data from a random policy (offline) is significantly worse than discovery using data from a learning policy. The agent must actively "intervene" in the environment to uncover true causal links.

Limitations and Future Work

The authors identify two main hurdles for future research. First, the current method for causal discovery (testing every pair of variables) does not scale well as the number of nodes in the environment increases, making efficient gradient-based discovery methods a priority. Second, GRADER assumes the state and action spaces are already "factorized" into meaningful components (e.g., "object 1 color"). In raw pixel-based environments, a pre-processing step to extract these semantic abstractions would be necessary.

Summary updated

BibTeX
@inproceedings{ding2022generalizing,
  author = {Wenhao Ding and Haohong Lin and Bo Li and Ding Zhao},
  title = {{Generalizing Goal-Conditioned Reinforcement Learning with Variational Causal Reasoning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2022},
  url = {https://openreview.net/forum?id=ytnwPTrpl38},
}
Figure