Abstract
Natural Language Inference (NLI) models often rely on spurious correlations, such as word overlap, rather than deep semantic understanding. This paper introduces a novel framework that enhances model robustness through Relation-based Counterfactual Data Augmentation (RDA) and Relation-based Contrastive Learning (RCL). By automatically generating "counterfactual" sentence pairs—minimal edits that alter logical relationships—and employing a contrastive objective to distinguish between them, the proposed method significantly improves performance on challenge sets and out-of-domain benchmarks.
Introduction
Natural Language Inference (NLI) requires determining the logical relationship between a premise and a hypothesis: entailment, contradiction, or neutral. While transformer-based models achieve high accuracy on standard benchmarks like SNLI, they are prone to "cheating" by exploiting statistical biases. For example, a model might incorrectly predict "entailment" simply because the premise and hypothesis share many tokens.
This fragility is exposed by counterfactual datasets, where small, targeted changes to a sentence flip its logical label. While human-curated counterfactuals are effective for training, they are prohibitively expensive to scale. This research addresses the challenge by automating the generation of high-quality counterfactual data and integrating it into a robust training pipeline.
Methodology
The proposed framework consists of two main components: RDA for data generation and RCL for model training.
Relation-based Counterfactual Data Augmentation (RDA)
RDA generates new training samples by modifying existing premise-hypothesis pairs to satisfy a target logical label. It employs two distinct strategies:
- Token-level Augmentation: Using part-of-speech tagging and WordNet, the system identifies nouns and replaces them based on semantic relations. For instance, replacing a word with its antonym can flip a relationship to "contradiction," while using a hypernym (a more general term) can create "neutrality."
- Sentence-level Augmentation: A T5 model is fine-tuned to generate entire sentences conditioned on a specific label. To maintain data quality, a "confidence-based filtering" mechanism is used: a secondary classifier must verify that the generated sentence pair actually reflects the intended label before it is added to the training set.
Relation-based Contrastive Learning (RCL)
Standard NLI training uses cross-entropy loss on individual pairs. In contrast, RCL leverages the augmented data to create "relation sets" for each original sample, containing examples for all three NLI classes (Entailment, Neutral, Contradiction). During training, the model is tasked with pulling embeddings of same-label pairs closer together while pushing different-label pairs apart in the representation space. This forces the encoder to focus on the semantic "delta" that differentiates logical relations.
Experimental Results
The authors evaluated the RDA-RCL framework on SNLI and MNLI, with a specific focus on the human-authored CF-SNLI challenge set. Key findings include:
- Robustness Gains: On CF-SNLI, the method improved accuracy by 6–8% for revised premises and 3–5% for revised hypotheses over BERT and RoBERTa baselines.
- Generalization: The model showed an 8–12% performance boost on the MNLI dataset, indicating that learning from counterfactuals helps the model generalize to unseen genres and domains.
- Efficiency: The automated pipeline successfully generated full relation sets for over 95% of the training data, providing a scalable alternative to human annotation.
Discussion and Conclusion
A key insight of this work is that NLI is fundamentally about the interaction between sentences. By holding one sentence constant and varying the other to flip the label, the model learns to identify the specific semantic features that drive logical inference.
While the current implementation is primarily noun-centric and relies on the quality of the T5 generator, it demonstrates that automated counterfactuals can effectively "robustify" models. Future work may extend these techniques to other parts of speech and broader pairwise tasks like paraphrase detection.
Summary updated