Abstract
Pretrained transformer-based models such as BERT have demonstrated state-of-the-art predictive performance when adapted into a range of natural language processing tasks. An open problem is how to improve the faithfulness of explanations (rationales) for the predictions of these models. In this paper, we hypothesize that salient information extracted a priori from the training data can complement the task-specific information learned by the model during fine-tuning on a downstream task. In this way, we aim to help BERT not to forget assigning importance to informative input tokens when making predictions by proposing SaLoss; an auxiliary loss function for guiding the multi-head attention mechanism during training to be close to salient information extracted a priori using TextRank. Experiments for explanation faithfulness across five datasets, show that models trained with SaLoss consistently provide more faithful explanations across four different feature attribution methods compared to vanilla BERT. Using the rationales extracted from vanilla BERT and SaLoss models to train inherently faithful classifiers, we further show that the latter result in higher predictive performance in downstream tasks.
Introduction
While Transformer-based models like BERT achieve incredible accuracy, they are notoriously "black boxes." Researchers often use rationales (short snippets of input text) to explain why a model made a specific choice. However, these explanations must be faithful: they should represent the actual reasons behind a model's prediction, not just look plausible to a human.
A major hurdle for faithfulness in Transformers is information mixing. Because of the self-attention mechanism, by the time a signal reaches the final layers, the information from individual tokens has been heavily contextualized and blurred. This often leads to attention distributions that don't clearly correspond to the most influential input words. This paper introduces SALOSS (Salient Loss), an auxiliary objective that uses unsupervised graph-based salience to guide Transformer attention during training.
Methodology
The core contribution is SALOSS, an auxiliary loss function added to the standard cross-entropy loss during fine-tuning. The process involves three key steps:
- Computing Salience: Before training, we use TextRank, an unsupervised graph-based algorithm, to calculate a "salience score" for every word in the input document. This provides a task-agnostic prior of which words are inherently informative.
- The SALOSS Objective: During training, the model is penalized if its internal attention distribution (specifically from the
[CLS]token in the last layer) deviates from the TextRank salience distribution, measured using Kullback-Leibler (KL) divergence. - Joint Optimization: The final loss function is a weighted sum of the task-specific classification loss and the SALOSS term. This "nudges" the model to keep its attention focused on salient tokens while it learns the specific task.
We evaluated this method across five diverse datasets: SST (sentiment), AGNews (topic classification), Evidence Inference (medical), MultiRC (reading comprehension), and SemEval 2017 (tweet sentiment).
Key Results
Improved Faithfulness via Input Erasure
To measure faithfulness, we used Input Erasure (Decision Flip). This metric determines what fraction of the most "important" tokens must be removed to flip the model's prediction. A lower score indicates that the model's reasoning is more concentrated on the identified tokens.
As shown in Figure 3, in 19 out of 20 experimental setups, SALOSS models required significantly fewer tokens to be removed to flip a decision compared to vanilla BERT. For the medical dataset (EV.INF), the fraction dropped from 0.25 to 0.14, indicating much more identifiable reasoning.
Rationale Quality (FRESH Evaluation)
We further validated rationale quality using the FRESH framework, where a separate classifier is trained using only the rationales extracted from the models.
Figure 2 demonstrates that classifiers trained on rationales from SALOSS models consistently outperformed those trained on vanilla BERT rationales. For example, we observed a 4% absolute F1 increase on the SST dataset, proving that SALOSS rationales contain a higher concentration of task-relevant signal.
Discussion and Conclusion
Our analysis shows that SALOSS naturally shifts model attention toward task-relevant linguistic features, such as adjectives in sentiment analysis or comparative conjunctions in medical inference. Crucially, adding SALOSS did not hurt the model's overall predictive accuracy; F1 scores for the primary tasks remained virtually identical to the baseline.
While SALOSS significantly improves faithfulness, limitations remain regarding the contiguity of rationales and the occasional high importance assigned to unidentified tokens (symbols). Future work will explore objectives that encourage the selection of continuous text spans to improve human readability.
Summary updated