Abstract
Sequential Integrated Gradients (SIG) is a novel attribution method designed to improve the interpretability of language models. Unlike standard Integrated Gradients (IG), which interpolates all input features simultaneously, SIG performs sequential interpolation of individual words while keeping the surrounding context fixed. By leveraging the <mask> token as a baseline—a state the model is naturally familiar with from pre-training—SIG generates more faithful explanations that align with the model's internal logic. Experimental results on sentiment analysis benchmarks show that SIG significantly outperforms existing attribution methods across various transformer architectures.
Introduction
To deploy language models (LMs) in high-stakes domains, understanding the rationale behind their predictions is crucial. Feature attribution methods, particularly path-based approaches like Integrated Gradients (IG), are widely used for this purpose. Standard IG calculates word importance by creating a linear interpolation path between a "blank" baseline (e.g., all zeros or <pad> tokens) and the input sentence.
However, this approach faces a significant challenge in natural language processing: the "blurry" input problem. During interpolation, every word in the sentence is partially masked simultaneously, creating intermediate inputs that are linguistically nonsensical and out-of-distribution for the model. Consequently, the gradients computed along this path may not accurately reflect the true importance of words in a coherent sentence.
Sequential Integrated Gradients (SIG)
To address these limitations, the authors propose Sequential Integrated Gradients (SIG). This method introduces two primary innovations:
1. Sequential Interpolation
Instead of a global interpolation, SIG isolates the contribution of each word $x_i$ by interpolating it individually from a baseline to its actual value while keeping all other words in the sentence fixed. This ensures that the model always processes a structurally valid sentence, providing more reliable gradients.
2. The <mask> Baseline
While many methods use <pad> or zero-vectors as baselines, SIG utilizes the <mask> token. Since models like BERT are pre-trained using Masked Language Modeling (MLM), the <mask> token represents a natural "uninformative" state that the model has learned to handle during training.
Experimental Evaluation
The effectiveness of SIG was evaluated on three sentiment analysis benchmarks: SST2, IMDB, and Rotten Tomatoes. The experiments covered three popular transformer architectures: BERT, RoBERTa, and DistilBERT.
Performance was measured using two key faithfulness metrics:
- Comprehensiveness (Comp): Measures the drop in model confidence when the most important words (as identified by the attribution method) are removed. Higher is better.
- Sufficiency (Suff): Measures the model's confidence when only the most important words are retained. Lower is better.
Results and Insights
SIG consistently outperformed established baselines, including standard IG, DeepLift, GradientShap, and Discretized Integrated Gradients (DIG).
Key findings include:
- Contextual Importance: By maintaining a fixed context, SIG captures how a word functions within its specific environment, leading to clearer attributions in complex sentences.
- Pre-training Alignment: The use of the
<mask>token aligns the explanation process with the model's pre-training objective, significantly improving faithfulness even for standard IG. - Efficiency: Although SIG requires $N$ path calculations for $N$ words, it is highly effective even with fewer interpolation steps. For instance, SIG with 10 steps can outperform standard IG with 250 steps.
Conclusion and Limitations
SIG provides a simple yet powerful framework for explaining LM predictions by respecting linguistic structure and pre-training objectives. While its computational complexity scales linearly with input length, this can be mitigated through parallelization. Future work may extend SIG to auto-regressive "decoder" models by adapting the masking strategy for unidirectional contexts.
Summary updated