On Sample Based Explanation Methods for NLP: Efficiency, Faithfulness, and Semantic Evaluation

Wei Zhang, Ziming Huang, Yada Zhu, Guangnan Ye, Xiaodong Cui, Fan Zhang

Abstract

This paper addresses the limitations of sample-based explanation methods in NLP, specifically focusing on granularity, computational efficiency, and evaluation metrics. We introduce TracIn++, a gradient-based method that identifies influential text spans rather than entire sentences. By leveraging $\delta$-faithful model variants, TracIn++ achieves high faithfulness without the need for expensive Hessian calculations. Furthermore, we propose Semantic Agreement (Sag) as a more robust metric for evaluating explanation quality. Empirical results on Aspect-Based Sentiment Analysis (ABSA) datasets demonstrate that TracIn++ consistently outperforms existing methods in both efficiency and semantic relevance.

Introduction

As NLP models like BERT and RoBERTa grow in complexity, understanding the rationale behind their predictions becomes critical. Sample-based explanation methods aim to identify which training examples most influenced a model's decision on a specific test case. However, current methods suffer from three primary issues: coarse granularity (pointing to entire sentences), a trade-off between computational efficiency and model faithfulness, and an evaluation gap where metrics fail to capture human-like semantic reasoning.

Methodology

To address these challenges, we propose a framework centered on span-based explanations and efficient gradient tracking.

Span-based Explanations ($IF^{++}$ and $TracIn^{++}$)

Traditional methods identify entire training instances as explanations. For long documents, this lacks precision. Our approach utilizes "spans" (specific phrases) identified through a masking technique. By observing how the model's loss changes when a specific span is modified, we can pinpoint the exact phrase responsible for a prediction.

Examples of span-level annotations in MAMS and Sentihood datasets showing how specific phrases relate to aspects and sentiments.

TracIn++: Efficient and Faithful Tracking

Influence Functions (IF) are theoretically faithful to the final model but require calculating a Hessian matrix, which is computationally prohibitive. Conversely, standard TracIn is fast but tracks the entire training history, which may not represent the final deployed model. TracIn++ bridges this gap by looking only at model variants very close to the final trained state ($\delta$-faithful variants), ensuring both efficiency and faithfulness.

Semantic Agreement (Sag)

We introduce Semantic Agreement (Sag) to evaluate explanation quality beyond simple label matching. Sag uses BERT embeddings to measure the semantic similarity between the test instance and the training spans suggested as explanations, rewarding explanations that are semantically relevant to the case at hand.

Experimental Setup

We evaluated our methods on two Aspect-Based Sentiment Analysis (ABSA) datasets: MAMS (product reviews) and Sentihood (neighborhood reviews). Ground truth spans were automatically annotated using a pre-trained RoBERTa-large Reading Comprehension model.

Results and Analysis

Our empirical evaluation shows that TracIn++ consistently provides superior performance across multiple metrics and datasets.

Comprehensive comparison of explanation methods showing that TracIn++ achieves the best balance of faithfulness, efficiency, and interpretability.

Key Findings

  • Superior Performance: On the MAMS dataset, TracIn++ achieved a Sag score of 23.92 (K=10), significantly outperforming the standard IF score of 14.22. It also dominated in Label Agreement (Lag) metrics.
  • Computational Efficiency: While traditional Influence Functions required approximately 20 minutes per test instance, TracIn++ calculations were nearly instantaneous, requiring only basic gradient computations.
  • Stability: TracIn++ exhibited lower variance compared to $IF^{++}$, indicating higher reliability when explaining deep non-convex networks.

Conclusion

TracIn++ offers a scalable and interpretable solution for explaining NLP model decisions. By focusing on spans rather than full sentences and ensuring faithfulness through $\delta$-faithful variants, it provides high-quality explanations with minimal computational overhead. Future work will explore extending this framework to generative models and refining span discovery in unsupervised settings.

Summary updated

BibTeX
@inproceedings{zhang2021sample,
  author = {Wei Zhang and Ziming Huang and Yada Zhu and Guangnan Ye and Xiaodong Cui and Fan Zhang},
  title = {{On Sample Based Explanation Methods for NLP: Efficiency, Faithfulness, and Semantic Evaluation}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2021},
  doi = {10.18653/v1/2021.acl-long.419},
}
Figure