Learning Causal Graphs at Scale: A Foundation Model Approach

Tian Gao, Naiyu Yin, Tian Gao 0007, Yue YuarXiv 2025 · DOI

Abstract

Identifying the underlying causal structure of a system, typically represented as a Directed Acyclic Graph (DAG), is a fundamental challenge in scientific research. Traditional causal discovery methods often struggle with super-exponential search spaces, data scarcity, and a lack of generalization across tasks. This paper introduces Attention-DAG (ADAG), a novel foundation model approach that shifts causal discovery from per-task optimization to amortized learning. By pre-training a transformer-based architecture on thousands of related causal tasks, ADAG learns a robust "structural prior." This enables near-instant, zero-shot inference of causal graphs from new observational data, even in challenging low-sample regimes where traditional methods frequently fail.

Introduction

Causal discovery—the process of inferring cause-and-effect relationships from data—faces three primary hurdles. First, the computational complexity is immense; the number of possible DAGs grows super-exponentially with the number of variables. Second, in small-sample regimes, many graphs may fit the data equally well, leading to identifiability issues. Third, most existing algorithms are "one-offs" that do not leverage knowledge gained from previous, similar tasks.

ADAG addresses these challenges by treating causal discovery as a mapping problem rather than a search problem. By learning a nonlinear function that maps observational data to a weighted adjacency matrix, ADAG can generalize across domains and provide high-accuracy results in a fraction of the time required by conventional methods.

Methodology: The ADAG Architecture

The core of the ADAG framework is a foundation model designed to process observational data tokens. Each token represents all samples of a single variable, allowing the model to capture inter-variable dependencies efficiently.

ADAG Architecture: Training and Zero-shot Inference Pipelines.

Key components of the architecture include:

  • Linear Transformer Blocks: These provide the computational efficiency necessary to process large-scale data tokens.
  • Nonlinear Kernel Map: An attention-based mechanism that predicts both graph structure and edge weights simultaneously by capturing complex dependencies.
  • Multi-Task Pre-training: The model is trained across thousands of domains using an unsupervised data reconstruction loss combined with an acyclicity constraint. This ensures the output is a valid DAG without requiring ground-truth labels during the pre-training phase.
  • Zero-Shot Inference: Once trained, the model can infer the causal graph for a novel dataset in a single forward pass, typically taking less than a millisecond.

Experimental Evaluation

The researchers evaluated ADAG against state-of-the-art baselines like NOTEARS, DAGMA, and MetaDAG using several benchmarks:

  • Synthetic ER Graphs: Erdos-Rényi graphs with 5 to 20 nodes to test structural accuracy.
  • Heterogeneous and Order-Consistent Data: Tasks sharing either graph structures or topological orderings to test the model's ability to learn shared priors.
  • Sachs Dataset: A real-world protein signaling dataset used to validate the model's performance on biological data after pre-training on synthetic data with similar causal orders.

Key Results and Insights

ADAG demonstrates significant improvements in both accuracy and efficiency. It consistently achieves the lowest Structural Hamming Distance (SHD), particularly in low-sample settings (e.g., 25 samples for a 5-variable problem). This performance is attributed to the "power of the prior"—the model's learned intuition about what a plausible causal structure looks like.

Comparison of estimated vs. ground-truth covariance matrices for the weighted adjacency matrix.

Qualitative analysis of the estimated adjacency matrices (as seen in the covariance comparisons above) shows that ADAG accurately captures the underlying structural dependencies. Furthermore, ADAG's inference speed is a major breakthrough; it performs inference in approximately 0.0003 seconds, making it 2,000x to 20,000x faster than traditional optimization-based baselines in a 20-node setup.

Conclusion and Future Work

ADAG represents a paradigm shift in causal discovery, demonstrating that foundation models can effectively learn structural priors to solve complex scientific inference tasks. While the current work focuses on linear Structural Equation Models (SEMs) and relatively small variable scales ($d \le 20$), it provides a clear roadmap for scaling to larger, nonlinear systems. Future research will focus on generalizing across entirely different graph families and topological orders, moving closer to a universal foundation model for causal analysis.

Summary updated

BibTeX
@misc{gao2025learning,
  author = {Tian Gao and Naiyu Yin and Tian Gao and Yue Yu},
  title = {{Learning Causal Graphs at Scale: A Foundation Model Approach}},
  year = {2025},
  eprint = {2506.18285},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2506.18285},
}
Figure