Introduction
Transformers have become the backbone of modern NLP, yet their internal decision-making processes remain largely opaque. Existing explanation methods, particularly vector-based ones, suffer from significant limitations: they often ignore Feed-Forward Networks (FFNs), use lossy "rollout" aggregation that collapses multi-dimensional information into scalars, and fail to account for the final classification head. Consequently, these methods can identify "important" tokens but cannot specify whether a token contributes positively or negatively to a particular class prediction.
The DecompX Methodology
DecompX introduces a "propagate-not-aggregate" framework to address these shortcomings. Instead of simplifying token representations at each layer, DecompX decomposes the hidden state of every token into a sum of vectors, where each vector represents the contribution of a specific input token. These vectors are then propagated through the model's components—Attention, LayerNorm, and FFNs—without being mixed or collapsed.
Key Innovations
- Full-Path Propagation: Unlike previous methods that stop at the last encoder layer, DecompX propagates decomposed vectors through the entire model, including the classification head. This transforms vectors into "logit" contributions that directly sum to the model's final prediction score.
- Linearizing FFNs: To handle non-linear activation functions (e.g., GeLU), DecompX employs a point-wise linear approximation. By treating the activation as a scaling factor at the current operating point, the decomposition can pass through the FFN mathematically.
- Bias Distribution: The method introduces "AbsDot" to distribute internal model biases among token vectors based on their alignment and magnitude, ensuring a more faithful attribution.
Quantitative Evaluation
The authors evaluated DecompX using BERT and RoBERTa models across benchmarks including SST-2, MNLI, QNLI, and HateXplain. Faithfulness was measured using the Area Over the Perturbation Curve (AOPC) and Accuracy drop upon masking important tokens.
As shown in the figures above, DecompX significantly outperforms both gradient-based (e.g., Integrated Gradients) and vector-based (e.g., ALTI, GlobEnc) baselines. On the SST-2 dataset, DecompX achieved an AOPC of 0.627, nearly doubling the performance of ALTI (0.416). Furthermore, masking the top 20% of tokens identified by DecompX caused model accuracy to plummet to approximately 40%, a much steeper decline than observed with competing methods.
Qualitative Analysis and Signed Attributions
A major advantage of DecompX is its ability to provide class-specific, signed explanations. By integrating the classification head, it can distinguish between tokens that support a prediction (positive) and those that contradict it (negative).
In the example above, while ALTI and GlobEnc only highlight general token importance, DecompX correctly identifies "not" and "often" as negative contributors to a positive sentiment prediction, while "good" is identified as a strong positive contributor. This nuance is critical for understanding why a model might be misclassifying specific instances.
Conclusion
DecompX represents a significant step forward in Transformer interpretability. By avoiding lossy aggregation and incorporating the entire model architecture—including FFNs and the classification head—it provides highly faithful and nuanced explanations. Future work will explore extending this decomposition approach to Encoder-Decoder architectures and Vision Transformers.
Summary updated