Quantifying Attention Flow in Transformers
About
In the Transformer model, "self-attention" combines information from attended embeddings into the representation of the focal embedding in the next layer. Thus, across layers of the Transformer, information originating from different tokens gets increasingly mixed. This makes attention weights unreliable as explanations probes. In this paper, we consider the problem of quantifying this flow of information through self-attention. We propose two methods for approximating the attention to input tokens given attention weights, attention rollout and attention flow, as post hoc methods when we use attention weights as the relative relevance of the input tokens. We show that these methods give complementary views on the flow of information, and compared to raw attention, both yield higher correlations with importance scores of input tokens obtained using an ablation method and input gradients.
Related benchmarks
| Task | Dataset | Result | Rank | |
|---|---|---|---|---|
| Image-to-Text Retrieval | MS-COCO (test) | R@117.53 | 99 | |
| Text-to-Image Retrieval | MS-COCO (test) | R@112.94 | 66 | |
| Feature Attribution Plausibility | MDACE (test) | P1.7 | 65 | |
| Across-modality synthesis (T2-weighted MRI to CT) | Pelvic MRI-CT dataset (test) | PSNR26.8 | 42 | |
| Faithfulness Evaluation | MDACE (test) | Comp Score40 | 40 | |
| Explanation Plausibility | MDACE bigger (test) | Precision1.8 | 32 | |
| Next Token Prediction Perturbation | Next Token Prediction Perturbation | HS-MSE0.014 | 29 | |
| Multi-contrast MRI Synthesis (T2, PD -> T1) | IXI (test) | PSNR27.86 | 23 | |
| Explanation Faithfulness | ImageNet 2015 (test) | AOPC0.671 | 22 | |
| Segmentation | ImageNet segmentation | Pixel Accuracy58.18 | 22 |