Source-linked AI summary
Deep Structural Causal Models for Tractable Counterfactual Inference
Nick Pawlowski, Daniel C. Castro, Ben Glocker
TL;DR
Deep causal learning lacks tractable inference of exogenous noise, a prerequisite for principled counterfactual inference. The paper introduces deep structural causal models using normalising flows and variational inference, and demonstrates all three levels of Pearl’s causal hierarchy on Morpho-MNIST and brain MRI data. The framework supports plausible counterfactual generation, with potential applications in explainability, data augmentation, and domain adaptation.
Problem
Existing deep causal learning methods lack tractable inference of exogenous noise, which is required for counterfactual inference.
Method
The paper develops a general framework for structural causal models with modular deep mechanisms, using normalising flows and variational inference for exogenous-noise inference.
Results
The DSCM framework fulfils all three rungs of Pearl’s causal hierarchy and is demonstrated on Morpho-MNIST and brain MRI data.
Takeaways & Limitations
Plausible counterfactuals could support explainability, counterfactual data augmentation, and domain adaptation.
Takeaways & Limitations
The current setup precludes unobserved confounding and requires all variables to be observed during training and counterfactual computation.
Abstract
from arXiv · showhide
We formulate a general framework for building structural causal models (SCMs) with deep learning components. The proposed approach employs normalising flows and variational inference to enable tractable inference of exogenous noise variables - a crucial step for counterfactual inference that is missing from existing deep causal learning methods. Our framework is validated on a synthetic dataset built on MNIST as well as on a real-world medical dataset of brain MRI scans. Our experimental results indicate that we can successfully train deep SCMs that are capable of all three levels of Pearl's ladder of causation: association, intervention, and counterfactuals, giving rise to a powerful new approach for answering causal questions in imaging applications and beyond. The code for all our experiments is available at https://github.com/biomedia-mira/deepscm.
1 Introduction
Causal inference extends beyond statistical association to interventions and counterfactuals, but its integration with deep learning remains recent. This work develops deep causal models motivated by applications requiring causal reasoning in complex, high-dimensional data.
- Causal questions concern interventions and hypothetical alternate worlds, which statistical tools based only on probabilities cannot answer.
- Deep learning has only recently incorporated causal approaches, including work on disentanglement, causal discovery, explanations, and data augmentation.
- Explicit causal modelling is motivated by deep learning’s susceptibility to spurious correlations, bias amplification, and input-distribution changes.
- The framework combines modular deep structural causal models with variational inference or normalising flows for counterfactual inference.
- Applications include synthetic Morpho-MNIST experiments and brain MRI modelling to demonstrate counterfactual reasoning in imaging.
2 Deep Structural Causal Models
Deep structural causal models combine causal mechanisms with deep-learning components to support association, intervention, and counterfactual reasoning. The framework addresses counterfactual abduction using normalising flows and variational inference, while offering mechanism designs for high-dimensional data.
- Background on structural causal models: SCMs represent variables through acyclic structural assignments with independent exogenous noise and causal graph structure.Their observational distribution factorises according to each variable’s mechanism and parent set.
- Background on structural causal models: Interventions replace structural assignments, whereas counterfactuals retain the observed unit’s exogenous noise while changing mechanisms.Counterfactual inference proceeds through abduction, action, and prediction.
- Deep mechanisms: Deep structural causal models use normalising flows and variational inference to make exogenous-noise inference tractable for counterfactual queries.The framework targets fully specified models without unobserved confounding and supports continuous and discrete variables.
- Deep mechanisms: Normalising flows provide invertible, explicit-likelihood mechanisms whose densities are computed through efficiently evaluated Jacobian determinants.Conditional flows extend this construction to mechanisms depending on parent variables.
- Deep mechanisms: Amortised explicit-likelihood mechanisms split each assignment into a low-level invertible mapping and a high-level non-invertible branch.The decomposition reduces the burden of applying invertible transformations directly in high-dimensional data space, while variational inference handles the intractable marginalisation.
- Deep mechanisms: True image counterfactuals can retain pixel-level details, unlike conditional generators that may produce blurry means or noisy samples.The paper also reports that implicit-likelihood mechanisms were proposed without empirical evaluation, although later work found comparable Morpho-MNIST performance.
3 Related Work
Deep generative models have been extended toward causal representation, intervention, and counterfactual tasks, but existing approaches do not explicitly combine all three causal levels for high-dimensional imaging data.
- Deep generative models have been used for conditional distributions and structured data by incorporating probabilistic graphical models.
- Causal deep-learning research has addressed disentanglement, causal discovery, explanations, and data augmentation.
- Related counterfactual tasks include explainability, image-to-image translation, style transfer, and changing attributes such as age in images or medical scans.
- Existing related approaches do not explicitly model associations, interventions, and causal structure together.
- The proposed DSCM framework is presented as a flexible approach for end-to-end training and tractable inference across all three causal levels for high-dimensional data.
4 Case Study 1: Morpho-MNIST
The Morpho-MNIST case study models stroke thickness as a cause of digit intensity and compares independent, conditional, and full causal models across associative, interventional, and counterfactual tasks.
- Dataset and models: The synthetic dataset uses morphological MNIST transformations with a known causal structure in which stroke thickness causes digit brightness.
- Dataset and models: The study compares fully independent, conditional decoder, and full causal models, using conditional normalising flows for thickness and intensity and a conditional VAE for images.
- Association: Associative performance improves with model capability: conditional image generation improves p(x|t, i), while adding t→i improves p(i|t).
- Intervention: The full model’s interventional densities after manipulating thickness closely resemble the true generative behaviour, unlike the conditional and independent models.
- Counterfactuals: Counterfactual MAE under do(t + 2) was 41.6 for the independent model, 31.8 for the conditional model, and 17.6 for the full model.
- Counterfactuals: Full-model counterfactuals preserve digit identity while changing thickness and intensity consistently with the underlying causal model.
5 Case Study 2: Brain Imaging
The brain-imaging case study uses a learned DSCM to generate plausible counterfactual anatomical changes under demographic and anatomical interventions. Anatomical identity remains well preserved while intervention effects differ in scope and direction.
- The learned DSCM generates plausible counterfactual brain changes, including age-related ventricular enlargement and reduced overall brain volume.
- Changing brain volume directly produces a ventricular effect opposite to that associated with changing age.
- Intervening on ventricle volume produces a more localised anatomical effect than the other illustrated interventions.
- Intervening on biological sex produces smaller, more diffuse effects while preserving anatomical identity such as cortical folding.
6 Conclusion
The paper introduces a general deep-SCM framework that supports all three rungs of Pearl’s causal hierarchy and demonstrates it on synthetic digits and brain MRI. It also identifies important constraints involving confounding, observability, identifiability, and counterfactual evaluation.
- The DSCM framework fits SCMs with deep mechanisms and enables efficient exogenous-noise abduction for principled counterfactual inference.
- The framework fulfils association, intervention, and counterfactual reasoning across Morpho-MNIST and brain-MRI case studies.
- Correctly generated counterfactuals may support explainability, data augmentation, and domain adaptation applications.
- The current setup excludes unobserved confounding and requires all variables to be observed during training and counterfactual computation.
- Flexible deep mechanisms raise identifiability concerns, while true counterfactuals are generally unavailable for evaluating real datasets.
Broader Impact
The paper presents causal inference with deep learning as a way to model high-dimensional data while addressing spurious correlations, bias, interpretability, and robustness. It also cautions that causal conclusions depend on strong assumptions and careful use.
- Combining causal models with deep learning is presented as a methodological approach for modelling high-dimensional data and preventing spurious correlations.
- Counterfactual explanations may improve interpretability, while causal discovery could yield novel understanding.
- Causal modelling relies on strong assumptions and may not uniquely determine the true causal structure from observational data.
A.1 Data Generation
The synthetic Morpho-MNIST dataset extends MNIST with controllable intensity and thickness measurements. Images are transformed to target values, thickness operations are made absolute, and the resulting data are split for training and validation.
- The data-generation pipeline combines MNIST with Morpho-MNIST measurements to control image intensity and thickness.
- Intensity is measured from masked pixels using the median, after which the image is rescaled to the target intensity and clamped to 0–255.
- Relative thinning and thickening are extended to absolute target thicknesses using dilation or erosion based on the target-to-measured thickness ratio.
- The transformed MNIST images are generated using Eq. (7), then the original training set is randomly split into training and validation data.
- Figure A.1 displays random exemplars from the synthetically generated Morpho-MNIST test dataset.
A.2 Experimental Setup
The experiments use normalising flows for covariates and deep encoder-decoder mechanisms for images, with variational inference supporting encoder-based inference. Models are trained with Adam using specified Monte Carlo estimators and validation-based model selection.
- Model architecture: Normalising flows model all variables except images, which use conditional deep encoder-decoder architectures with unit-Gaussian exogenous noise.Flows include support-constraining and distribution-fitting components.
- Covariate mechanisms: Covariate mechanisms use conditional flows with affine, spline, sigmoid, exponential, and fixed affine normalisation transformations to respect variable support.The model uses unconstrained normalised values internally for bounded variables.
- Normalisation caveat: Without input normalisation, deep models may prioritise dependence on the variable with largest magnitude, a phenomenon the authors say requires further investigation.The implementation therefore includes normalisation transformations.
- Conditional transformations: Conditional affine transformations reparameterise noise distributions using parent-dependent parameters, with the image mechanism implemented by a decoder network.The context network predicts the affine bias for the image transformation.
- Image mechanisms: The image decoder uses a high-level noise vector concatenated with parent covariates, while the encoder outputs mean and log-variance for an independent Gaussian.The decoder is implemented with convolutional and transposed-convolutional layers; the encoder is a CNN.
- Optimisation: Adam training uses batch size 256, learning rates 10−4 for encoder-decoder networks and 0.005 for covariate flows, with 4 and 32 Monte Carlo samples for training and evaluation.Models are trained for 1000 epochs and the model with the best validation loss is reported.
A.3 Additional Results
Additional MNIST analyses compare independent, conditional, and full models across association, intervention, and counterfactual queries. The conditional and full models represent covariate-dependent image changes, while counterfactuals preserve digit identity and style despite some artefacts.
- Association: All three models appear to have the same unconditional generation capacity in random-sample comparisons.The comparison concerns independent, conditional, and full models.
- Association: Shared high-level noise preserves digit style while conditional and full models change thickness and intensity consistently with their covariates.The independent model generates identical images across covariate settings.
- Reconstruction: Reconstructions from all models appear faithful to the original images.The reconstructions are Monte Carlo averages over the image latent posterior and decoder.
- Covariate fidelity: Target covariates and measurements from generated images are compared with transform accuracy and the fidelity of samples from each learned model.The figure contrasts independent, conditional, and full models.
- Intervention: The learned full model distinguishes conditioning from intervention: p(t|i) differs from p(t|do(i)), whereas p(i|do(t)) and p(i|t) are identical.Because t causes i, intervening on i leaves p(t) unchanged in the displayed comparison.
- Counterfactuals: Counterfactuals from the full model preserve digit identity and style, including sensible outputs in very low-density covariate regions, though some artefacts remain.The figure includes a thick-but-dim ‘0’ under do(i = 64).
B.1 Data Generation
The UK Biobank experiment uses pre-processed brain MRI data and image-derived anatomical measurements within a simplified causal model. The data preparation includes registration, segmentation-derived covariates, and a train-validation-test split of 13,750 images.
- MRI preprocessing: UK Biobank T1-weighted brain MRI scans were skull-stripped, bias-field corrected, segmented, and rigidly registered to standard MNI atlas space.The preprocessing was performed by data providers with FSL, followed by additional in-house registration.
- Covariates: Brain volume and ventricle-related measurements are image-derived proxies for true anatomical quantities within a simplified yet plausible causal model.The authors explicitly qualify these measurements as proxies.
- Dataset: The experiment uses random exemplars from the adopted UK Biobank dataset as its real-data reference.The cited figure presents examples from the test set.
B.2 Experimental Setup
The UK Biobank model follows the MNIST setup while using cropped, downsampled MRI images and deeper image mechanisms. It models sex directly and uses invertible transformations for age, brain volume, and ventricle volume, then evaluates observational and counterfactual behaviour, including discrete mechanisms.
- Data preparation: The 13,750 brain images are split 70%/15%/15% into training, validation, and test sets, then cropped and downsampled to 64 px × 64 px.Training uses random crops; validation and testing use center crops.
- Image model: The image mechanism uses five scales of convolutional blocks and a 100-dimensional latent space, adapting the MNIST low-level mechanism to brain images.Each scale contains three LeakyReLU, batch-normalisation, and convolution blocks.
- Covariate model: Sex is modelled through its binary probability, while age, brain volume, and ventricle volume use invertible transformations with neural context networks.The context networks use 8 and 16 hidden units with LeakyReLU nonlinearities.
- Evaluation: Additional analyses examine the learned observational distribution and counterfactual queries on UK Biobank brain images and covariates.The accompanying figures include random samples, conditional samples, reconstructions, density comparisons, and counterfactuals.
- Discrete counterfactuals: Discrete mechanisms use Gumbel–max parametrisation, whose properties support counterfactuals invariant to category permutations and stable under increased odds of the observed outcome.The framework supports discrete variables without continuous relaxations because the likelihood is closed form and gradients of expectations are unnecessary.