Fine-Grained Causal Dynamics Learning with Quantization for Improving Robustness in Reinforcement Learning

Inwoo Hwang, Yunhyeok Kwak, Suhyung Choi, Byoung-Tak Zhang, Sanghack Lee

Introduction

Model-based reinforcement learning (MBRL) relies on an agent's ability to accurately predict future states based on current actions—a "dynamics model." However, standard dynamics models often suffer from brittleness in complex environments because they fail to distinguish between relevant causal factors and spurious correlations. While recent research has explored causal dynamics models to prune irrelevant dependencies, these often rely on a single global causal graph that is too coarse for environments where relationships change based on context.

Fine-Grained Causal Dynamics Learning (FCDL) addresses this by discovering context-specific causal relationships. By partitioning the state-action space into subgroups, FCDL learns distinct "local causal graphs" (LCGs), allowing agents to ignore noise and generalize to unseen scenarios.

The Challenge of Context-Dependent Dynamics

In many real-world scenarios, the importance of a variable depends entirely on the situation. For instance, a robot might learn that a green light signals it to move, but in the context of a pedestrian crossing, the light becomes secondary to the pedestrian's position. A global causal model might struggle to capture this shift, while a model that tries to find a unique graph for every single data point (sample-specific) often overfits and becomes uninterpretable.

Comparison of causal modeling approaches: (a) global causal graphs, (b) sample-specific graphs, and (c) the proposed fine-grained local causal graphs (LCGs).

FCDL finds the "sweet spot" by identifying meaningful subgroups of states that share the same causal structure, as illustrated in the comparison above.

The FCDL Framework

The core of FCDL is the joint learning of a dynamics model and a discrete latent space that categorizes the environment into causal "contexts."

  1. Quantization via Codebook: The model uses an encoder to map a state-action pair $(s, a)$ to a latent embedding. This embedding is then "quantized" by matching it to the nearest entry in a learned codebook. Each entry represents a specific causal context.
  2. Local Causal Graphs (LCGs): Each codebook entry is associated with a specific adjacency matrix. This graph defines the "parent" variables for each next-state variable in that context.
  3. Masked Prediction: The dynamics model predicts the next state, but its input is restricted by the LCG of the current context. This ensures the model only attends to causally relevant features.
The FCDL architecture uses vector quantization to map state-action pairs to context-specific local causal graphs for masked dynamics prediction.

The entire system is trained end-to-end using a Gumbel-Softmax trick for differentiability and a sparsity penalty to encourage simple causal explanations. Theoretically, the authors prove this joint optimization is "identifiable," meaning it is guaranteed to recover the true underlying local causal structures under certain conditions.

Experimental Evaluation

FCDL was evaluated on two primary benchmarks designed to test context-dependent causality:

  • Chemical: A benchmark where 10 nodes change colors. The causal structure (e.g., "chain" or "fork") depends on the color of a root node.
  • Magnetic: A robot arm task involving a ball and a box. If objects are red, they are "magnetic" (dense causality); if one is black, they are non-magnetic (sparse causality).

Testing involved Out-of-Distribution (OOD) scenarios, such as adding heavy noise to irrelevant nodes to evaluate the model's ability to ignore spurious information.

Key Results and Insights

FCDL demonstrated significant improvements in robustness and generalization:

  • Superior Robustness: In the noisy full-fork Chemical environment, FCDL achieved an average reward of 15.27, significantly higher than standard MLPs (6.49) and previous state-of-the-art causal models (9.37).
  • OOD Generalization: In the Magnetic task, FCDL maintained a reward of 4.81 in OOD settings, while baselines dropped to near 1.0.
  • Interpretability: Visualizations of the learned LCGs showed they almost perfectly matched ground-truth causal structures, such as correctly ignoring the box's position in non-magnetic contexts.

Conclusion

FCDL represents a significant step forward in making model-based RL more robust. By treating "context" as a discoverable latent variable through quantization, the model effectively clusters states that behave similarly from a causal perspective. While challenges remain regarding codebook stability and scaling to high-dimensional pixel inputs, FCDL provides a strong theoretical and empirical foundation for fine-grained causal modeling in reinforcement learning.

Summary updated

BibTeX
@inproceedings{hwang2024fine,
  author = {Inwoo Hwang and Yunhyeok Kwak and Suhyung Choi and Byoung-Tak Zhang and Sanghack Lee},
  title = {{Fine-Grained Causal Dynamics Learning with Quantization for Improving Robustness in Reinforcement Learning}},
  booktitle = {International Conference on Machine Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=mrd4e8ZJjm},
}
Figure