Source-linked AI summary
Diffusion Causal Models for Counterfactual Estimation
Pedro Sanchez, Sotirios A. Tsaftaris
TL;DR
Estimating intervention effects for high-dimensional data remains an open challenge, despite its importance for counterfactual estimation from observations. Diff-SCM combines diffusion models with anti-causal predictors and latent-noise inference; it achieves better quantitative and qualitative counterfactual-generation results than state-of-the-art methods on MNIST, with qualitative application to ImageNet. Its empirical setting specifies only two variables, limiting the demonstrated scope for more complex causal models.
Problem
Quantifying intervention effects for high-dimensional data with neural networks remains an open challenge, although such estimates are needed for counterfactuals from observational imaging data.
Source: §1 · p. 2Method
Diff-SCM combines diffusion-based structural causal modeling with anti-causal predictor gradients, inferring latent noise by deterministic forward diffusion before intervention-guided reverse diffusion.
Source: §1 · p. 2, §3.4 · p. 6Results
Diff-SCM achieves better quantitative and qualitative counterfactual-generation results than state-of-the-art methods on MNIST and is also applied qualitatively to ImageNet.
Source: §6 · p. 12Takeaways & Limitations
Counterfactual latent divergence measures latent-space distance from an observation to its generated counterfactual and is used for baseline comparison and hyperparameter search.
Source: §5.2 · p. 10, §6 · p. 12The empirical setting specifies only two variables; applying Diff-SCM to more complex causal models requires additional techniques.
Source: §6 · p. 12
Abstract
from arXiv · showhide
We consider the task of counterfactual estimation from observational imaging data given a known causal structure. In particular, quantifying the causal effect of interventions for high-dimensional data with neural networks remains an open challenge. Herein we propose Diff-SCM, a deep structural causal model that builds on recent advances of generative energy-based models. In our setting, inference is performed by iteratively sampling gradients of the marginal and conditional distributions entailed by the causal model. Counterfactual estimation is achieved by firstly inferring latent variables with deterministic forward diffusion, then intervening on a reverse diffusion process using the gradients of an anti-causal predictor w.r.t the input. Furthermore, we propose a metric for evaluating the generated counterfactuals. We find that Diff-SCM produces more realistic and minimal counterfactuals than baselines on MNIST data and can also be applied to ImageNet data. Code is available https://github.com/vios-s/Diff-SCM.
1. Introduction
Causal estimation seeks to quantify intervention effects under a known causal structure, but neural-network methods for high-dimensional data remain limited. Diff-SCM uses diffusion models to estimate such effects and counterfactuals, and proposes a metric for evaluating counterfactual minimality.
Causal inference
- Causal models represent directed relationships: intervening on a cause changes its effect, but not conversely.Counterfactuals are hypothetical scenarios for a given instance after an intervention.Source: §1 · pp. 1–2
Motivation
- Neural-network causal estimation for high-dimensional data remains an open problem, with most methods applied to semi-synthetic low-dimensional datasets.The paper targets estimation through generated counterfactuals on imaging datasets.Source: §1 · p. 2
Approach
- Diff-SCM combines diffusion-based causal estimation with anti-causal predictors, using their gradients to apply interventions during iterative sampling.Deterministic forward diffusion recovers manipulable latent variables, and counterfactuals are generated with MCMC.Source: §1 · p. 2
Contributions
- The framework supports sampling from interventional distributions and counterfactual estimation, and introduces counterfactual latent divergence to evaluate minimality.The paper compares the metric with selected baselines and uses it for hyperparameter search.Source: §1 · p. 2
2. Background
The background introduces diffusion models as iterative image-denoising generators and structural causal models as directed systems of mechanisms. Together, these concepts provide the generative and causal foundations used by Diff-SCM.
2.1. Generative Energy-Based Models
- Diffusion models corrupt data with Gaussian noise at increasing scales, then learn a reverse process that denoises samples and approximates the data log-likelihood gradient.Generation starts from Gaussian noise and iteratively samples from the reverse Markov chain.Source: §2.1 · pp. 2–3
2.2. Causal Models
- A structural causal model comprises structural assignments over endogenous variables and exogenous variables, whose joint distribution represents uncertainty in factors omitted from the model.The endogenous variables form a directed acyclic graph whose edges encode causal relationships.Source: §2.2 · p. 3
3. Causal Modeling with Diffusion Processes
Diff-SCM treats diffusion as a process over causal variables that weakens their relationships toward independent exogenous noise. It uses gradients of causal-model distributions and anti-causal predictors to sample interventions and infer counterfactuals from factual observations.
3.1. Problem Statement
- The setup assumes a known identifiable SCM, sufficient information to recover causes with an anti-causal predictor, and annotated endogenous variables.The described experimental algorithm simplifies the graph to two variables; extending it to more complex SCMs is left for future work.Source: §3.1 · p. 4, §3.4 · p. 6
3.2. Diff-SCM: Unifying Diffusion Processes and Causal Models
- Diff-SCM defines causal-variable dynamics with stochastic differential equations constrained to reproduce the SCM distribution, while forward diffusion gradually weakens causal relations.At the diffusion endpoint, the joint distribution reaches independent exogenous-noise distributions.Source: §3.2 · pp. 4–5
3.3. How to Apply Interventions with Anti-Causal Predictors?
- The intervention framework uses gradients of anti-causal conditional distributions to propagate an intervention in the causal direction without requiring the cause distribution.The stated proposition equates an interventional effect with reverse diffusion guided by an anti-causal predictor.Source: §3.3 · pp. 5–6
3.4. Counterfactual Estimation with Diff-SCM
- Counterfactual estimation follows abduction of exogenous noise, action through graph mutilation, and prediction by reverse diffusion guided by an anti-causal classifier.The inferred noise retains information about the factual observation while the classifier gradient guides the desired intervention.Source: §3.4 · pp. 6–7
4. Related Work
Diff-SCM builds on diffusion-based generation while distinguishing its counterfactual inference from prior conditional sampling and classifier-guided approaches.
4. Related Work
- Reinterpreting Dhariwal and Nichol’s (2021) conditional DDIM sampler, Diff-SCM adds deterministic latent inference and exogenous-noise abduction to estimate counterfactuals rather than interventional distributions.The abduction helps preserve aspects of the original image while changing the intended aspect.Source: §4 · p. 8
- DDIM (Song et al., 2021a) supports faster sampling and latent recovery, while the framework draws on denoising diffusion and SDE theory (Song et al., 2021b).The cited diffusion literature also includes Ho et al. (2020), Nichol and Dhariwal (2021), and Sohl-Dickstein et al. (2015).Source: §4 · pp. 7–8
- Schut et al. (2021) also estimate counterfactuals with iterative classifier-gradient updates, but use adversarial updates based on epistemic uncertainty rather than diffusion.Source: §4 · p. 8
- Prior deep-learning causal models have been applied to high-dimensional inference and to tasks including explaining predictions, defining fairness, and mitigating data biases.The passage also lists reinforcement learning, accuracy prediction, and robustness to spurious correlations as applications.Source: §4 · p. 8
5. Experiments
The experiments evaluate Diff-SCM counterfactuals against image-generation baselines and introduce CLD to assess minimality and tune the model. On MNIST, Diff-SCM performs better on both reported realism metrics, and CLD-based tuning selects an intermediate intervention scale.
5. Experiments
- The experiments compare counterfactuals for images x(1) under interventions on class x(2), using quantitative and qualitative evaluations on MNIST.ImageNet results are qualitative because the baselines cannot generate counterfactuals for that dataset.Source: §5 · pp. 8–9
5.1. Evaluating Counterfactuals: Realism and Closeness to Data Manifold
- Diff-SCM achieves better (lower) results than the baselines on both IM1 and IM2.Table 1 reports test-set means and standard deviations; the supplied passages do not give the metric values.Source: Table 1 · p. 9, §5.1 · p. 9, §5 · p. 9
5.2. Counterfactual Latent Divergence (CLD)
- CLD estimates counterfactual minimality using relative distances in VAE latent space, addressing limitations of pixel-level similarity when image structure changes.The VAE representation is intended to capture factors of variation, and CLD compares the factual-counterfactual distance with distances to samples from factual and target classes.Source: §5.2 · pp. 10–11
- CLD balances two competing probabilities: a low target-class relative measure encourages minimality, while a low factual-class relative measure encourages separation from the factual class.The metric combines the probabilities with LogSumExp, a smooth approximation of their maximum.Source: §5.2 · p. 11
- Using the same experimental setup as the earlier comparison, CLD improves counterfactual estimation against the baseline methods.The comparison is reported in Table 1.Source: §5.2 · p. 11
5.3. Tuning the Hyperparameter s with CLD
- The model selected by CLD also outperforms previous methods on other metrics and yields the best qualitative results.The authors present this as further validation of CLD for counterfactual evaluation.Source: §5.3 · p. 11
- CLD is used to tune the scale hyperparameter s; the best value reported for MNIST is s = 0.7.At s = 0, the classifier does not influence generation; at s = 3, the classifier can dominate the diffusion model and ignore observation-specific exogenous noise, with high CLD in both cases.Source: §5.3 · pp. 11–12, Figure 4 · p. 12
6. Conclusions
Diff-SCM uses gradients of SCM-implied marginal and conditional distributions for causal estimation and counterfactual generation. It outperforms state-of-the-art counterfactual-generation methods on MNIST, while its empirical setting covers only two variables.
6. Conclusions
- Diff-SCM uses gradients of SCM-implied marginal and conditional distributions, allowing anti-causal mechanisms to guide generation through causal mechanisms.The authors demonstrate the approach empirically on a two-variable causal model.Source: §6 · p. 12
- Diff-SCM achieves better quantitative and qualitative counterfactual-generation results than state-of-the-art methods on MNIST.Source: §6 · p. 12
- The empirical setting specifies only two variables; extending Diff-SCM to more complex causal models requires additional techniques to address confounding in anti-causal predictors.With the stated setup, intervening on x(2) changes all correlated variables in the dataset.Source: §6 · p. 12
Appendix A. Theory for Training Diffusion Models
The appendices review diffusion-model training, distinguish observational, interventional, and counterfactual distributions, and illustrate how an anti-causal conditional can guide an intervention.
Appendix A. Theory for Training Diffusion Models
- DDPMs add Gaussian noise in a forward process and learn reverse transitions; training optimizes a variational lower bound, with a simplified objective predicting the added noise.Source: Appendix A · p. 17
Appendix B. Pearl’s Causal Hierarchy
- Pearl’s Causal Hierarchy distinguishes observational sampling, interventions propagated to descendants, and counterfactual interventions applied to a specific factual instance.Source: Appendix B · pp. 17–18
Appendix C. Example of Anti-causal Intervention
- For x(1) caused by x(2), the intervention gradient for p(x(1) | x(2)) can be expressed using the anti-causal conditional p(x(2) | x(1)) and the marginal p(x(1)).Source: Appendix C · p. 18
Appendix D. DDIM sampling procedure
DDIM provides deterministic sampling and latent inference, with a near-invertible mapping between images and latents and the option to sample in fewer iterations.
Appendix D. DDIM sampling procedure
- DDIM replaces the Markovian sampling process with a non-Markovian process that maps latents to images deterministically while retaining DDPM’s forward marginals.Source: Appendix D · p. 18
- DDIM’s near-invertible latent-to-image mapping also permits efficient sampling with fewer iterations by undersampling timesteps.Source: Appendix D · p. 18
end
- The appendix presents DDIM procedures for generating an image from xT and for inferring a latent from an input image x0.Source: Appendix D · p. 18, end · p. 19
Appendix E. Implementation Details
The implementation uses separately trained diffusion and anti-causal classifier models, with DDIM sampling at 1000 timesteps; despite its speed, DDIM did not work well for counterfactuals.
Appendix E. Implementation Details
- Each dataset uses a separately trained time-conditioned diffusion model and anti-causal classifier; the diffusion model is U-Net-like, and the classifier uses its encoder with pooling and a linear layer.Training uses Adam, 16-bit precision with loss scaling, 32-bit weights and optimizer state, and an EMA rate of 0.9999.Source: Appendix E · p. 19
- DDIM sampling uses 1000 timesteps, but the authors found that it did not work well for counterfactuals despite allowing faster sampling.Source: Appendix E · p. 19
- Table 2 lists hyperparameters for the models; the text directs readers there for diffusion and classification model settings.Source: Table 2 · p. 19, Appendix E · p. 19
Appendix F. Sampling from The Interventional Distribution
Diff-SCM samples interventional ImageNet distributions by guiding diffusion with a target-class intervention, and uses fixed initial noise to isolate the effect of changing interventions. IM1 and IM2 assess counterfactual realism and closeness to the data manifold using autoencoder reconstruction losses.
Appendix F. Sampling from The Interventional Distribution
- Interventional ImageNet samples use Gaussian-prior noise and the algorithm’s “Generation with Intervention” stage, rather than inferring latent noise from an observation.The formulation is identical to guided DDIM; the section presents qualitative ImageNet results.Source: Appendix F · p. 20
- Holding initial noise fixed while changing the intervention isolates the classifier-guidance contribution from exogenous-noise sampling.The experiment uses one Gaussian-sampled latent and scale s = 5.Source: Appendix F · p. 20, Figure 5 · p. 20
Appendix G. IM1 and IM2
- IM1 and IM2 use class-specific and all-class autoencoder reconstruction losses to measure counterfactual realism and closeness to the data manifold.IM1 is the ratio of class-specific to all-class reconstruction loss; IM2 is their normalized reconstruction difference.Source: Appendix G · pp. 20–21
Appendix H. More MNIST Counterfactuals
Diff-SCM generates counterfactuals for every MNIST class from a given factual image. The figure shows the original, its reconstruction without the anti-causal predictor, and the class-specific counterfactuals.
Appendix H. More MNIST Counterfactuals
- Diff-SCM generates counterfactuals for all MNIST classes given one factual image.The experiments use classifier scale s = 0.7.Source: Appendix H · p. 21
- The MNIST counterfactual experiments use classifier scale s = 0.7.Source: Appendix H · p. 21
- The figure places the original image and a reconstruction without the anti-causal predictor before the counterfactuals for each digit class..Source: Figure 6 · p. 21
Appendix I. Qualitative influence of classifier scale
Classifier scale controls the strength of the intervention: too little has a mild effect, while too much neglects information in exogenous noise. The figure identifies s = 0.7 as optimal for MNIST.
Appendix I. Qualitative influence of classifier scale
- Too-low classifier scale gives the intervention only a mild effect.Source: Appendix I · p. 21
- Too-high classifier scale neglects information in exogenous noise, so the counterfactual retains fewer factors from the original image.Source: Appendix I · p. 21
- For MNIST, s = 0.7 is identified as the optimal classifier scale.The figure compares the original, reconstruction, and do(5) counterfactuals across three scales.Source: Figure 7 · p. 22