CausalCOMRL: Context-based offline meta-reinforcement learning with causal representation

Zhengzhe Zhang, Wenjia Meng, Haoliang Sun, Gang Pan

TL;DR

CausalCOMRL is a new framework for offline meta-reinforcement learning that uses causal representation learning to eliminate "spurious correlations"—patterns that appear in training data but fail in new environments. By integrating causal graphs with mutual information and contrastive learning, the model develops task representations that are significantly more robust and generalize better to unseen tasks than existing methods.

What Problem Does This Paper Address?

In Offline Meta-Reinforcement Learning (OMRL), an agent learns from a fixed dataset of various tasks to quickly adapt to new, unseen ones. Most current "context-based" methods try to summarize a task into a compact "representation" (or context) based on past experiences.

However, these methods often fall into the trap of spurious correlations. For example, a robot learning to walk might incorrectly correlate its success with a specific starting tilt angle simply because that happened frequently in the training data. If a test environment has different starting conditions (confounders), the agent’s learned policy fails. This paper tackles the challenge of distinguishing true causal relationships (e.g., "applying force moves the leg") from coincidental ones, ensuring the agent remains effective even when the environment's underlying parameters shift.

Methods

The authors propose CausalCOMRL, which stands for Causal Context-Based Offline Meta-Reinforcement Learning. Its architecture consists of three main pillars:

  1. Causal Variational Autoencoder (Causal VAE): Instead of a standard encoder, CausalCOMRL uses a causal layer that implements a linear structural causal model. It enforces a Directed Acyclic Graph (DAG) constraint to ensure the model learns a valid causal structure between states, actions, and rewards.
  2. Mutual Information (MI) Optimization: To make task representations more informative, the authors maximize the mutual information between the task and its latent representation using an InfoNCE-style lower bound. This helps the encoder capture the "essence" of a task.
  3. Contrastive Learning: The framework employs triplet loss and hard sample mining. This ensures that representations of the same task are clustered tightly together, while representations of different tasks are pushed far apart in the latent space.

The entire system is trained in two phases: first, the causal task encoder is optimized; then, a Soft Actor-Critic (SAC) policy is trained using these stable, causal representations.

The CausalCOMRL framework: (a) Training the causal task encoder, (b) Meta-training the policy, and (c) Meta-testing on new tasks.

Datasets

The model was evaluated on four representative multi-task MuJoCo benchmarks, which are standard for testing continuous control in RL:

  • Half-Cheetah-Vel: Running at different target velocities.
  • Ant-Dir: Navigating an ant-like robot in various directions.
  • Hopper-Rand-Params: Maximizing forward velocity with randomized physical parameters (like torso mass or friction).
  • Walker-Rand-Params: A bipedal agent adapting to randomized physical dynamics.

The researchers sampled 20 tasks for training and 20 for testing (Out-of-Distribution) for each benchmark.

Key Insights and Ideas

  • Causality as a Noise Filter: By forcing the model to follow a causal graph (where states and actions cause rewards), the agent ignores "shortcuts" or coincidental patterns that don't hold up across different task distributions.
  • Structural Knowledge vs. Pure Correlation: Standard encoders treat all data points as equal correlations. CausalCOMRL’s DAG constraint (Figure 1a) provides a structural prior that mimics the actual physics of the environment.
  • Better Discrimination: The combination of causal modeling and contrastive learning leads to much cleaner latent spaces. As seen in the t-SNE visualizations, CausalCOMRL produces distinct, well-separated clusters for different tasks, whereas standard encoders often produce a "hairball" of overlapping points.
Causal graph example and t-SNE visualization showing how the Causal Encoder creates tighter, more distinct task clusters compared to a standard encoder.

Key Results

CausalCOMRL consistently outperformed state-of-the-art baselines like CORRO, FOCAL, and Offline-PEARL:

  • Superior Generalization: On Out-of-Distribution (OOD) tasks, CausalCOMRL achieved the highest returns in almost every environment. For example, in Walker-Rand-Params (OOD), it reached a return of 426.7, significantly higher than CORRO (368.1) and FOCAL (318.6).
  • Robustness to Parameter Shifts: The performance gap was most notable in "Rand-Params" environments, proving that causal representations are particularly effective when the underlying physics (transition dynamics) of the world change.
  • Ablation Success: Removing either the causal layer or the combined MI/Contrastive loss led to a drop in performance, confirming that both structural causality and discriminative learning are necessary for peak performance.

Limitations and Future Work

While CausalCOMRL shows great promise, the authors note a few areas for growth:

  • Causal Graph Complexity: The current model assumes a relatively simple linear structural causal model. Real-world scenarios might involve more complex, non-linear causal dependencies.
  • High-Dimensional Inputs: The experiments focused on state-based inputs. Extending this to high-dimensional visual data (pixels) would be a significant next step.
  • Dynamic Discovery: Future work could explore more automated ways to discover the causal graph structure during training rather than relying on predefined DAG constraints.

Summary updated

BibTeX
@article{zhang2026causalcomrl,
  author = {Zhengzhe Zhang and Wenjia Meng and Haoliang Sun and Gang Pan},
  title = {{CausalCOMRL: Context-based offline meta-reinforcement learning with causal representation}},
  journal = {Neural Networks},
  year = {2026},
  doi = {10.1016/j.neunet.2025.107955},
}
Figure