Transforming Causality: Transformer-Based Temporal Causal Discovery with Prior Knowledge Integration

Jihua Huang, Yi Yao, Ajay Divakaran
8/21/2025
cs.LGstat.ML

No confident code implementation found for this paper.

Abstract

We introduce a novel framework for temporal causal discovery and inference that addresses two key challenges: complex nonlinear dependencies and spurious correlations. Our approach employs a multi-layer Transformer-based time-series forecaster to capture long-range, nonlinear temporal relationships among variables. After training, we extract the underlying causal structure and associated time lags from the forecaster using gradient-based analysis, enabling the construction of a causal graph. To mitigate the impact of spurious causal relationships, we introduce a prior knowledge integration mechanism based on attention masking, which consistently enforces user-excluded causal links across multiple Transformer layers. Extensive experiments show that our method significantly outperforms other state-of-the-art approaches, achieving a 12.8% improvement in F1-score for causal discovery and 98.9% accuracy in estimating causal lags.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{huang2025transforming,
  title  = {Transforming Causality: Transformer-Based Temporal Causal Discovery with Prior Knowledge Integration},
  author = {Jihua Huang and Yi Yao and Ajay Divakaran},
  year   = {2025},
  eprint = {2508.15928},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2508.15928v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2508.15928.svg)](https://codeofpaper.com/paper/2508.15928)

Discussion