[Paper Review] Self-Attention Attribution: Interpreting Information Interactions Inside Transformer
This paper introduces Self-Attention Attribution (AttAttr), a method based on integrated gradients to interpret information interactions within Transformer models like BERT. It identifies salient attention heads, constructs hierarchical attribution trees to visualize compositional dependencies, enables effective head pruning, and generates adversarial triggers that severely degrade model performance, revealing model over-reliance on spurious patterns.
The great success of Transformer-based models benefits from the powerful multi-head self-attention mechanism, which learns token dependencies and encodes contextual information from the input. Prior work strives to attribute model decisions to individual input features with different saliency measures, but they fail to explain how these input features interact with each other to reach predictions. In this paper, we propose a self-attention attribution method to interpret the information interactions inside Transformer. We take BERT as an example to conduct extensive studies. Firstly, we apply self-attention attribution to identify the important attention heads, while others can be pruned with marginal performance degradation. Furthermore, we extract the most salient dependencies in each layer to construct an attribution tree, which reveals the hierarchical interactions inside Transformer. Finally, we show that the attribution results can be used as adversarial patterns to implement non-targeted attacks towards BERT.
Motivation & Objective
- To address the lack of interpretability in how input tokens interact via self-attention in Transformers.
- To develop a method that explains not just individual token importance, but also compositional interactions between tokens.
- To enable model pruning by identifying the most influential attention heads based on attribution scores.
- To construct hierarchical attribution trees that visualize the flow of information across layers.
- To discover and exploit adversarial patterns from attribution scores to test model robustness.
Proposed method
- Proposes AttAttr, a self-attention attribution method based on integrated gradients to compute the contribution of each attention head to the final prediction.
- Applies integrated gradients to attention weights, computing attribution scores that reflect the importance of each attention connection in the model's decision-making.
- Uses attribution scores to identify the most important attention heads per layer, enabling structured head pruning with minimal performance loss.
- Develops a heuristic algorithm to extract the most salient dependencies and construct attribution trees that visualize hierarchical information flow across layers.
- Leverages top attribution scores to extract adversarial triggers—specific word patterns that, when inserted, drastically reduce model accuracy.
- Validates the method on BERT across multiple NLP datasets, using quantitative analysis to assess contribution of edges in attribution trees.
Experimental results
Research questions
- RQ1How can we interpret the interactions between input tokens in the self-attention mechanism of Transformers beyond individual token saliency?
- RQ2To what extent do attention weights correlate with actual contributions to model predictions?
- RQ3Can attribution scores be used to identify and prune less important attention heads without significant performance degradation?
- RQ4Can we reconstruct hierarchical dependency structures (attribution trees) that reflect the compositional reasoning of the model?
- RQ5Can the most salient interaction patterns identified by attribution be used to craft effective non-targeted adversarial attacks?
Key findings
- On the MNLI dataset, inserting the top adversarial trigger (‘with’ and ‘math’) into the premise reduced entailment accuracy from 82.87% to 0.8%, demonstrating extreme model vulnerability.
- The top-3 adversarial triggers reduced average accuracy across all MNLI and SST-2 classes by over 40 percentage points, indicating widespread model over-reliance on spurious patterns.
- The proposed head pruning method based on AttAttr achieved competitive performance compared to the Taylor expansion method, with minimal accuracy drop after pruning.
- Important attention heads in BERT were found to be consistent across homogeneous tasks and datasets, suggesting stable functional roles.
- Attribution trees constructed from AttAttr scores revealed hierarchical information flow, showing how dependencies are composed across layers.
- The method demonstrated that attention weights alone are not reliable indicators of contribution, as some high-weight connections contribute little to predictions.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.