Order-sensitive Shapley Values for Evaluating Conceptual Soundness of NLP Models

Kaiji Lu, Anupam DattaarXiv 2022

Abstract

Previous works show that deep NLP models are not always conceptually sound: they do not always learn the correct linguistic concepts. Specifically, they can be insensitive to word order. In order to systematically evaluate models for their conceptual soundness with respect to word order, we introduce a new explanation method for sequential data: Order-sensitive Shapley Values (OSV). We conduct an extensive empirical evaluation to validate the method and surface how well various deep NLP models learn word order. Using synthetic data, we first show that OSV is more faithful in explaining model behavior than gradient-based methods. Second, applying to the HANS dataset, we discover that the BERT-based NLI model uses only the word occurrences without word orders. Although simple data augmentation improves accuracy on HANS, OSV shows that the augmented model does not fundamentally improve the model's learning of order. Third, we discover that not all sentiment analysis models learn negation properly: some fail to capture the correct syntax of the negation construct. Finally, we show that pretrained language models such as BERT may rely on the absolute positions of subject words to learn long-range Subject-Verb Agreement. With each NLP task, we also demonstrate how OSV can be leveraged to generate adversarial examples.

Introduction

Deep learning models for Natural Language Processing (NLP) often achieve human-level performance on benchmarks, yet they frequently do so by exploiting spurious correlations rather than learning underlying linguistic rules. A significant concern is the lack of conceptual soundness: models like BERT can be surprisingly indifferent to word order, performing similarly on shuffled sentences as they do on coherent ones. This suggests they may rely on a "bag-of-words" approach, ignoring the syntax and logic that differentiate sentences like "The dog chased the cat" from "The cat chased the dog." To address this, we propose Order-sensitive Shapley Values (OSV), a model-agnostic framework to quantify a model's reliance on word order versus word occurrence.

Methodology: Order-sensitive Shapley Values

OSV extends the game-theoretic framework of Shapley Values to sequential data. While standard feature attribution treats a sentence as a set of words, OSV decomposes the attribution into two distinct components:

  1. Occurrence Features ($x$): Attribution based on the presence of a specific word.
  2. Order Features ($z$): Attribution based on whether a word occupies its correct position.
OSV explanations for NLI and Subject-Verb Agreement tasks, highlighting the distinction between occurrence and order features.

To isolate these effects, we employ two intervention strategies: Absolute Position ($q^a$), which evaluates if the model relies on a word being at a specific index, and Relative Order ($q^r$), which evaluates if the model relies on the sequence of words (e.g., n-grams) independent of their absolute position. Empirical validation confirms that OSV is more "faithful"—accurately representing model behavior—than traditional gradient-based methods like Saliency Maps or Integrated Gradients.

Empirical Evaluation and Insights

We evaluated OSV across several benchmarks, revealing critical weaknesses in state-of-the-art models.

The Failure of Data Augmentation in NLI

On the HANS (Heuristic Analysis for NLI Systems) dataset, BERT-based models often fail because they rely on word overlap heuristics. While data augmentation can improve benchmark accuracy to 100%, OSV reveals that the underlying model remains conceptually hollow. As shown in Figure 4, the augmented model's reliance on order features ($z$) does not fundamentally increase; it simply learns a more complex shortcut to ignore overlapping words while remaining dependent on occurrence features ($x$).

Comparison of OSV and standard SV on the HANS dataset, revealing how models rely on word occurrence even after data augmentation.

Negation and Syntax

Sentiment analysis models often struggle with negation syntax. OSV analysis shows that models like BERT frequently ignore the position of "not" when it precedes a positive word (e.g., "not good"). The word "not" itself carries such a strong negative occurrence signal that the model over-relies on its presence rather than its syntactic role in modifying the following adjective.

The Absolute Position Trap in SVA

In Subject-Verb Agreement (SVA) tasks, models often fail to truly parse sentence structure. OSV reveals a reliance on absolute position—for instance, assuming the subject is always the second word. We demonstrated this by prepending a neutral token (like #) to sentences, which shifted the subject's position and caused a significant drop in accuracy (e.g., a 14% drop for DistilBERT), proving the model was not performing genuine syntactic parsing.

Conclusion

OSV provides a rigorous diagnostic tool for evaluating the conceptual soundness of NLP models. Our results show that high benchmark performance often masks a lack of understanding of word order. OSV is more faithful than traditional gradient-based methods and can be used to generate effective adversarial examples. Future work will explore using OSV as a training regularizer to encourage models to learn more robust, order-sensitive representations.

Summary updated

BibTeX
@misc{lu2022order,
  author = {Kaiji Lu and Anupam Datta},
  title = {{Order-sensitive Shapley Values for Evaluating Conceptual Soundness of NLP Models}},
  year = {2022},
  eprint = {2206.00192},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2206.00192},
}
Figure