Causal Diffusion Autoencoders: Toward Counterfactual Generation via Diffusion Probabilistic Models

Aneesh Komanduri, Chen Zhao, Feng Chen, Xintao Wu

TL;DR

CausalDiffAE introduces a novel framework that embeds Structural Causal Models (SCMs) directly into diffusion autoencoders. By mapping high-dimensional images to causally linked, disentangled latent factors, it enables precise $do$-interventions to generate high-quality, physically consistent counterfactual images.

What Problem Does This Paper Address?

While Diffusion Probabilistic Models (DPMs) excel at generating high-resolution, realistic images, their latent spaces are typically uninterpretable "black boxes." Existing representation-learning diffusion models can isolate semantic features, but they treat these features as independent.

In reality, generative factors are often causally related. For example, in a physical system, changing the angle of a light source causally alters the length and position of a shadow. Standard diffusion models cannot reason about these "what-if" scenarios (counterfactuals) because they lack a mechanism to propagate causal effects downstream. Conversely, existing causal generative models (like CausalVAE) rely on older architectures like VAEs or GANs, which often yield blurry or low-quality images.

This paper bridges the gap by enabling high-fidelity counterfactual image generation that respects underlying causal structures.

Methods

The authors propose CausalDiffAE, which structures the latent space of a diffusion autoencoder using a structural causal model (SCM).

The CausalDiffAE framework consists of a causal encoding phase during training (left) and a three-step counterfactual generation process during inference (right).

The architecture splits the image representation into two parts:

  1. Stochastic Latent ($x_T$): Captured via a deterministic forward Denoising Diffusion Implicit Model (DDIM) process, preserving low-level texture and noise details.
  2. Causal Semantic Latent ($z_{causal}$): Extracted by a learnable encoder that maps the input image to an exogenous noise vector $u$, which is then transformed into causally related semantic variables $z_{causal}$ using neural networks that parameterize the causal graph's mechanisms.

To generate a counterfactual image, the model follows a classic three-step causal inference procedure:

  • Abduction: The factual image $x_0$ is encoded into the exogenous noise $u$.
  • Action: A $do$-intervention is applied to a target variable (e.g., setting a pendulum's angle to a specific value), and the effects are propagated through the SCM to compute the modified latent vector $\bar{z}_{causal}$.
  • Prediction: A conditional DDIM decoder reconstructs the counterfactual image $x_0^{CF}$ using the modified $\bar{z}_{causal}$ and the original, unaltered stochastic noise $x_T$.

Weak Supervision Extension

To make the model practical for scenarios where labeled data is scarce, the authors introduce a semi-supervised variant inspired by classifier-free guidance. By jointly training conditional and unconditional diffusion paths, they introduce a guidance weight ($\omega$) that allows users to granularly tune the "strength" of the intervention during inference.

Datasets

The framework was evaluated on three causal image datasets:

  • MorphoMNIST: A modified MNIST dataset where a 2-variable SCM dictates that digit stroke thickness causally influences digit brightness/intensity.
  • Pendulum: A 7,000-image dataset of a physical pendulum system where the light source position and pendulum angle causally determine the shadow's length and position.
  • CausalCircuit: A complex 3D robotics dataset featuring a robot arm interacting with buttons to activate red, green, and blue lights with downstream causal dependencies.

Key Insights and Ideas

  • Best of Both Worlds: By separating low-level stochastic noise ($x_T$) from high-level causal variables ($z_{causal}$), CausalDiffAE achieves the structural rigor of causal inference without sacrificing the state-of-the-art image generation quality of diffusion models.
  • True Interventions vs. Conditioning: The paper highlights that acausal models merely condition on labels (narrowing the scope to a correlation found in the training data). CausalDiffAE performs true interventions, allowing it to generate physically plausible images even outside the support of the training distribution.
  • Guidance as Causal Strength: Utilizing classifier-free guidance on the representation level provides an elegant mechanism: adjusting $\omega$ acts like a dial controlling how strongly the downstream causal effects manifest in the generated image.

Key Results

Disentanglement Performance

CausalDiffAE achieved near-perfect scores on the DCI (Disentanglement, Completeness, and Informativeness) metric, substantially outperforming both standard VAE-based causal models and acausal diffusion baselines.

Dataset Model DCI ↑
MorphoMNIST CausalVAE <br> CausalDiffAE (Ours) 0.784 ± 0.01 <br> 0.993 ± 0.01
Pendulum CausalVAE <br> CausalDiffAE (Ours) 0.885 ± 0.01 <br> 0.999 ± 0.01
CausalCircuit CausalVAE <br> CausalDiffAE (Ours) 0.886 ± 0.01 <br> 0.999 ± 0.01

Qualitative Accuracy

Quantitatively evaluated using an "Effectiveness" metric (measuring the Mean Absolute Error of features in generated images via an independent anti-causal predictor), CausalDiffAE consistently generated the most accurate counterfactuals.

Qualitative comparison showing counterfactual trajectories across MorphoMNIST and Pendulum datasets.

As seen in Figure 2, when intervening on "thickness" in MorphoMNIST, CausalDiffAE correctly updates the digit's intensity as dictated by the causal graph, whereas acausal baselines either fail to alter the downstream variable or distort the digit's identity entirely.

Limitations and Future Work

  • Prior Graph Knowledge: The current framework assumes that the causal DAG (Directed Acyclic Graph) is known beforehand. The authors note that integrating end-to-end causal discovery methods (like NOTEARS) into the pipeline is a vital next step.
  • Computational Complexity: Because it relies on iterative diffusion steps, CausalDiffAE inherits the high computational overhead and slower sampling times characteristic of DPMs compared to VAEs or GANs.
  • Scaling Up: The authors suggest expanding this methodology to large-scale text-to-image diffusion models in future work.

Summary updated

BibTeX
@inproceedings{komanduri2024causal,
  author = {Aneesh Komanduri and Chen Zhao and Feng Chen and Xintao Wu},
  title = {{Causal Diffusion Autoencoders: Toward Counterfactual Generation via Diffusion Probabilistic Models}},
  booktitle = {ECAI},
  year = {2024},
  url = {https://openreview.net/forum?id=AFrL7YM25c},
}
Figure