Abstract
Neural networks have achieved high performance on Natural Language Inference (NLI) benchmarks, but it remains unclear if they have learned the underlying logic of language. McCoy et al. (2019) introduce the HANS (Heuristic Analysis for NLI Systems) dataset to diagnose whether models rely on shallow syntactic shortcuts. Their findings reveal that state-of-the-art models, including BERT, fail catastrophically on cases where simple syntactic heuristics—such as lexical overlap—do not hold, suggesting these models are "right for the wrong reasons."
Introduction
In Natural Language Inference (NLI), a model is tasked with determining if a "premise" sentence entails a "hypothesis" sentence. While neural networks have become remarkably good at this task on standard benchmarks like MNLI, researchers have long suspected they are exploiting statistical "heuristics"—simple patterns that happen to be true most of the time in the training data—rather than learning deep logic.
For example, if the hypothesis uses the same words as the premise, it is usually an entailment in standard datasets. However, this shortcut breaks down in the real world. A model using this trick might correctly identify that "The judge was paid by the actor" entails "The actor paid the judge," but it will incorrectly claim that "The actor was paid by the judge" also entails it.
The HANS Diagnostic Dataset
To diagnose these shortcuts, the authors formalize three specific syntactic heuristics:
- Lexical Overlap: Assume entailment if all words in the hypothesis appear in the premise.
- Subsequence: Assume entailment if the hypothesis is a contiguous chunk of the premise.
- Constituent: Assume entailment if the hypothesis is a complete phrase (subtree) in the premise's parse tree.
The authors built HANS, a controlled evaluation set of 30,000 examples balanced across these categories. For every example where a heuristic leads to the correct answer, there is a "flipped" example where the heuristic leads to a wrong answer. If a model relies on these shortcuts, it will perform perfectly on the "correct" half but fail miserably (0% accuracy) on the "incorrect" half. Human baselines confirm the task's validity, with experts achieving 97% accuracy.
Experimental Results
The authors tested four model architectures: a bag-of-words model (DA), a sequence-based LSTM (ESIM), a tree-based model (SPINN), and the Transformer-based BERT.
As shown in Figure 1, while all models perform well on the standard MNLI development set (a), they fail catastrophically on the non-entailed cases of HANS (b). For many subcases, models like DA and ESIM achieved 0.0% accuracy. Even BERT, the most robust model, scored 0% on specific logic tests like subject-object swaps. This "Clever Hans" effect—named after the horse that seemed to do math but was actually reading its owner's body language—demonstrates that models are exploiting dataset biases rather than learning true semantics.
Mitigating Heuristic Reliance
A key insight of the paper is that the training data distribution is a more powerful driver of model behavior than architectural structure. Even models with "linguistic" inductive biases, like SPINN, fell into the same traps. To address this, the authors experimented with data augmentation, adding a small amount of HANS-like data (about 8% of the total) to the MNLI training set (referred to as MNLI+).
As illustrated in Figure 2, this simple augmentation allowed models to "unlearn" the heuristics, leading to high accuracy across all HANS categories without significantly impacting performance on the original MNLI benchmark. This suggests that models can be trained to avoid these specific shortcuts if the training data is sufficiently diverse.
Limitations and Future Work
While HANS is a powerful diagnostic tool, it relies on template-based synthetic data, which lacks the lexical diversity of natural language. Furthermore, the success of data augmentation might indicate that models are simply memorizing new templates rather than learning generalizable logic. Addressing the "whack-a-mole" problem—where models find new shortcuts as soon as old ones are blocked—remains a significant challenge for the field.
Conclusion
The HANS dataset reveals that current NLI models are highly susceptible to shallow syntactic shortcuts. While data augmentation offers a temporary fix, the underlying challenge remains: developing models and training objectives that prioritize robust semantic reasoning over statistical pattern matching.
Summary updated