Attention Flows for General Transformers
Not on the map. Why?
Abstract (arXiv)
In this paper, we study the computation of how much an input token in a Transformer model influences its prediction. We formalize a method to construct a flow network out of the attention values of encoder-only Transformer models and extend it to general Transformer architectures including an auto-regressive decoder. We show that running a maxflow algorithm on the flow network construction yields Shapley values, which determine the impact of a player in cooperative game theory. By interpreting the input tokens in the flow network as players, we can compute their influence on the total attention flow leading to the decoder's decision. Additionally, we provide a library that computes and visualizes the attention flow of arbitrary Transformer models. We show the usefulness of our implementation on various models trained on natural language processing and reasoning tasks.
Key facts. Cited by 1 paper in the map (data through 14 Oct 2026). Builds on 27 of its 47 references that are in the map. First posted on arXiv 30 May 2022.
Builds on
27 of 47 references.
References · 27
- 2017Attention Is All You Needcited by 60,361
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2019RoBERTa: A Robustly Optimized BERT Pretraining Approachcited by 13,372
- 2021Evaluating Large Language Models Trained on Codecited by 8,320
- 2017A Unified Approach to Interpreting Model Predictionscited by 6,555
- 2014Neural Machine Translation by Jointly Learning to Align and Translatecited by 4,548
- 2017Axiomatic Attribution for Deep Networkscited by 3,384
- 2016Man is to Computer Programmer as Woman is to Homemaker? Debiasing Word Embeddingscited by 1,312
- 2021Transformers in Vision: A Surveycited by 1,013
- 2019DialoGPT: Large-Scale Generative Pre-training for Conversational Response Generationcited by 842
- 2020Quantifying Attention Flow in Transformerscited by 775
15 more
- 2019Data Shapley: Equitable Valuation of Data for Machine Learningcited by 629
- 2020Transformer Interpretability Beyond Attention Visualizationcited by 627
- 2020TweetEval: Unified Benchmark and Comparative Evaluation for Tweet Classificationcited by 417
- 2019The many Shapley values for model explanationcited by 344
- 2019A Multiscale Visualization of Attention in the Transformer Modelcited by 292
- 2018Consistent Individualized Feature Attribution for Tree Ensemblescited by 285
- 2019Deep Learning for Symbolic Mathematicscited by 270
- 2015Explaining NonLinear Classification Decisions with Deep Taylor Decompositioncited by 250
- 2020A Survey on the Explainability of Supervised Machine Learningcited by 227
- 2019Explaining individual predictions when features are dependent: More accurate approximations to Shapley valuescited by 208
- 2021Proof Artifact Co-training for Theorem Proving with Language Modelscited by 132
- 2020Teaching Temporal Logics to Neural Networkscited by 51
- 2021Attention Flows are Shapley Value Explanationscited by 30
- 2021Dodrio: Exploring Transformer Models with Interactive Visualizationcited by 28
- 2021Neural Circuit Synthesis from Specification Patternscited by 17
Built on by
Citing papers per year: 2026: 1.
1 paper.
- 2026RIFT: Token Influence Follows the Path of Least Resistance12 Oct 2026