Normalizing Flows (NFs) have long been a staple of the generative modeling toolkit, prized for their ability to model complex probability distributions while remaining mathematically tractable. But can they help us understand why things happen, rather than just what the data looks like?
In their NeurIPS 2023 paper, "Causal normalizing flows: from theory to practice," Adrián Javaloy and colleagues demonstrate that NFs aren't just good at density estimation—they are a natural fit for Structural Causal Models (SCMs).
TL;DR
The authors prove that autoregressive normalizing flows can uniquely recover the underlying causal mechanisms of a system given just a causal ordering of variables. By introducing a novel "abductive" architecture and an efficient implementation of the do-operator, they provide a framework that outperforms existing methods in accuracy and speed while handling real-world challenges like mixed discrete-continuous data and partial graph knowledge.
What Problem Does This Paper Address?
Causal inference is the science of answering "what-if" questions. If I change the price of a product, how will sales change (an intervention)? If a specific customer hadn't received a loan, would they have defaulted (a counterfactual)?
To answer these, researchers typically use Structural Causal Models (SCMs), which describe how variables are generated from independent noise sources (exogenous variables). However, learning these models from raw data is notoriously difficult. Traditional deep learning approaches often train a separate neural network for every single variable in the system. This leads to two major headaches:
- Error Propagation: Small errors in the first variable's model compound as you move down the causal chain.
- Complexity: Managing dozens of independent networks is computationally expensive and difficult to scale.
The authors set out to find a way to learn the entire causal process using a single, unified neural network.
Methods
The researchers leverage the fact that both SCMs and Autoregressive Normalizing Flows (ANFs) are essentially "triangular maps"—functions where each output depends only on the current input and its predecessors.
The "Abductive" Advantage
The paper compares two primary design choices for mapping between observations ($x$) and underlying noise ($u$):
- Generative Models ($u \to x$): Mapping noise to observations.
- Abductive Models ($x \to u$): Mapping observations back to the underlying noise.
Surprisingly, they found that Abductive models with a single layer ($L=1$) are the most effective. Because of the way ANFs are structured, a single-layer abductive model is mathematically guaranteed to be "causally consistent"—it naturally respects the parent-child relationships of the causal graph without needing complex regularizers.
Implementing the do-operator
Standard NFs aren't built for interventions. The authors propose a clever trick: instead of changing the neural network functions to simulate an intervention (the do-operator), they modify the distribution of the noise variables ($u$). By restricting the noise to only those values that would result in the desired intervened value, they can perform interventions and counterfactuals across any architecture without "breaking" the network.
Key Insights and Ideas
- Identifiability is easier than we thought: You don't need to know the exact causal graph to recover the model. If you have the correct causal ordering (e.g., age comes before health status), the model is identifiable from observational data alone.
- Simplicity wins: While deep learning usually favors "deeper is better," for causal NFs, a single-layer abductive model is often superior because it avoids "shortcuts" that misrepresent indirect causal paths.
- Handling the Real World: The authors introduce a "dequantization" technique (adding controlled noise) to allow NFs—which are inherently continuous—to handle discrete, categorical data like "Checking Account Status."
- Partial Knowledge: If you don't know the relationship between two variables, you can group them into "Strongly Connected Components" (SCCs) and still perform valid causal inference on the rest of the graph.
Key Results
The framework was put through its paces on a variety of benchmarks, including synthetic SCMs, the complex 9-node LARGEBD graph, and the real-world German Credit Dataset.
- Superior Accuracy: In tests on non-linear SCMs, the Causal NF achieved near-zero KL divergence and significantly lower error (RMSE) in estimating Average Treatment Effects (ATE) compared to previous state-of-the-art methods like CAREFL and VACA.
- Massive Speedup: Because it uses a single network rather than a Graph Neural Network (GNN) or multiple independent networks, Causal NF is orders of magnitude faster. Evaluation times were roughly 0.6μs per sample, compared to 23μs for GNN-based approaches.
- Fairness Auditing: On the German Credit dataset, the model successfully identified "counterfactual unfairness" in standard classifiers and helped build new models that were demonstrably fairer, accurately estimating interventional probabilities.
Limitations and Future Work
While powerful, the authors acknowledge a few hurdles:
- Causal Sufficiency: The model assumes there are no "hidden confounders" (unobserved variables that influence two or more observed variables). If hidden variables exist, the causal conclusions may be invalid.
- Graph Mismatches: If the assumed causal ordering is wrong, the interventional and counterfactual queries will produce poor estimates.
- Bijectivity: The theory relies on the causal mechanisms being bijective (invertible). Non-bijective relationships might invalidate some of the theoretical guarantees.
The team suggests that future work could involve using interventional data to discover the causal graph itself (causal discovery) or exploring alternative loss functions beyond Maximum Likelihood Estimation.
Check out the code: https://github.com/psanch21/causal-flows
Summary updated