Causal Interpretation of Self-Attention in Pre-Trained Transformers
Abstract
We propose a causal interpretation of self-attention in the Transformer neural network architecture. We interpret self-attention as a mechanism that estimates a structural equation model for a given input sequence of symbols (tokens). The structural equation model can be interpreted, in turn, as a causal structure over the input symbols under the specific context of the input sequence. Importantly, this interpretation remains valid in the presence of latent confounders. Following this interpretation, we estimate conditional independence relations between input symbols by calculating partial correlations between their corresponding representations in the deepest attention layer. This enables learning the causal structure over an input sequence using existing constraint-based algorithms. In this sense, existing pre-trained Transformers can be utilized for zero-shot causal-discovery. We demonstrate this method by providing causal explanations for the outcomes of Transformers in two tasks: sentiment classification (NLP) and recommendation.
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
10 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- Probabilistic Conceptual Explainers: Trustworthy Conceptual Explanations for Vision Foundation Models cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- Probabilistic Conceptual Explainers: Trustworthy Conceptual Explanations for Vision Foundation Models cites Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
- Where does In-context Learning Happen in Large Language Models? cites Language Models are Few-Shot Learners
- An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale cites Language Models are Few-Shot Learners
- Token Activation Map to Visually Explain Multimodal LLMs cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
- Swin Transformer: Hierarchical Vision Transformer using Shifted Windows cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
Cited by top-tier papers10
- Walking the Tightrope: Autonomous Disentangling Beneficial and Detrimental Drifts in Non-Stationary Custom-TuningXiaoyu Yang, Jie Lu, En YuNeurIPS 2025 · 22 citations
- Where does In-context Learning Happen in Large Language Models?Suzanna Sia, David Mueller, Kevin DuhNeurIPS 2024 · 14 citations
- Probabilistic Conceptual Explainers: Trustworthy Conceptual Explanations for Vision Foundation ModelsHengyi Wang, Shiwei Tan, Hao WangICML 2024 · 9 citations
- Boosting Resilience of Large Language Models through Causality-Driven Robust OptimizationXiaoling Zhou, Mingjie Zhang, Zhemg Lee, Yuncheng Hua et al.NeurIPS 2025 · 5 citations
- Token Activation Map to Visually Explain Multimodal LLMsYi Li, Hualiang Wang, Xinpeng Ding, Haonan Wang et al.ICCV 2025 · 3 citations
Builds on6
- Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
- Swin Transformer: Hierarchical Vision Transformer using Shifted WindowsZe Liu, Yutong Lin, Yue Cao, Han Hu et al.ICCV 2021 · 31,683 citations
- An Image is Worth 16x16 Words: Transformers for Image Recognition at ScaleAlexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn et al.ICLR 2021 · 21,477 citations
- The Causal-Neural Connection: Expressiveness, Learnability, and InferenceKevin Xia, Kai-Zhan Lee, Yoshua Bengio, Elias BareinboimNeurIPS 2021 · 158 citations
- Iterative Causal Discovery in the Possible Presence of Latent Confounders and Selection BiasRaanan Y. Rohekar, Shami Nisimov, Yaniv Gurwicz, Gal NovikNeurIPS 2021 · 43 citations
Related papers
- A Causal World Model Underlying Next Token Prediction: Exploring GPT in a Controlled EnvironmentRaanan Yehezkel Rohekar, Yaniv Gurwicz, Sungduk Yu, Estelle Aflalo et al.ICML 2025
- Trustworthy and Explainable Causal Representation Learning in TransformersYang Liu, Yinghao Zhang, Lin Liu, Jiuyong Li et al.ACL Findings 2026
- Causal Discovery and Inference through Next-Token PredictionEivinas Butkus, Nikolaus KriegeskorteNeurIPS 2025 · 3 citations
- How Transformers Learn Causal Structure with Gradient DescentEshaan Nichani, Alex Damian, Jason D. LeeICML 2024 · 117 citations
- Automatic Rule Induction for Efficient Semi-Supervised LearningReid Pryzant, Ziyi Yang, Yichong Xu, Chenguang Zhu et al.EMNLP Findings 2022 · 9 citations
