Introduction
Natural Language Inference (NLI) is a fundamental task in artificial intelligence that requires a model to determine the logical relationship between two sentences: a "premise" and a "hypothesis." The relationship is typically classified as entailment, contradiction, or neutral. While modern transformer-based models like BERT and RoBERTa achieve high scores on standard NLI benchmarks, there is growing concern that these models rely on "shortcut learning"—exploiting statistical patterns and word-level correlations rather than performing genuine logical reasoning.
To probe these reasoning gaps, researchers have developed adversarial attacks. However, many existing attacks rely on simple word substitutions that often break the logical consistency of the sentence, leading to invalid test cases. This paper introduces NatLogAttack, a principled framework that leverages formal Natural Logic to generate adversarial examples that are both logically sound and highly effective at exposing the superficiality of current NLI models.
The Challenge of Spurious Correlations
The primary motivation for NatLogAttack is the observation that state-of-the-art models often fail when faced with subtle logical shifts. Existing adversarial methods frequently prioritize semantic similarity (making the sentence look similar to the original) over logical validity. If an attack changes a word but inadvertently alters the ground-truth label in a way the attacker didn't intend, the resulting "adversarial" example is flawed. NatLogAttack addresses this by using formal logic as a constraint, ensuring that every perturbation is mathematically guaranteed to either preserve the original label or flip it to a specific target label.
Methodology: Leveraging Natural Logic
NatLogAttack is built upon the formalism of Natural Logic, which maps lexical relationships to sentence-level entailment based on the context in which words appear. The framework consists of several key components:
1. Monotonicity Awareness
The framework distinguishes between "upward" and "downward" monotone contexts. In an upward context, replacing a specific word with a more general one (a hyponym with a hypernym) preserves entailment. For example, "I saw a dog" entails "I saw an animal." Conversely, in a downward context (often triggered by negation), the logic reverses: "No animals were seen" entails "No dogs were seen." NatLogAttack uses these rules to ensure its edits are logically valid.
2. Reverse Projection
Unlike standard models that predict a label from a sentence, NatLogAttack employs "Reverse Projection." It starts with a desired target label (e.g., forcing a model to see a "Contradiction" where there is "Entailment") and works backward to identify the specific word-level changes—such as negation or hypernym substitution—required to satisfy that logical goal.
3. Candidate Generation and Quality Control
To generate natural-sounding alternatives, the framework utilizes WordNet for lexical relations and DistilBERT for context-aware "alternation" (finding words that belong to the same category but are not synonyms). To ensure the resulting sentences remain fluent and human-readable, the authors apply a "pseudo-perplexity" filter using a language model, discarding candidates that result in ungrammatical or nonsensical text.
Experimental Evaluation
The authors evaluated NatLogAttack against several top-tier adversarial baselines, including TextFooler, BertAttack, and Clare. The framework was tested across multiple NLI benchmarks:
- SNLI & MNLI: Large-scale general-purpose datasets.
- SICK: A dataset focused on lexical and syntactic phenomena.
- MED (Monotonicity Entailment Dataset): A specialized dataset designed to test logic and monotonicity.
Key Findings
The results demonstrate that NatLogAttack is both more effective and more efficient than previous methods:
- Higher Human Validation: NatLogAttack achieved a significantly higher Human Validated Attack Success Rate (HVASR). On the MED dataset, it reached a success rate of approximately 56.9%, outperforming the next best baseline, TextFooler, which stood at 47.3%.
- Drastic Efficiency: The framework is remarkably efficient in its search for adversarial examples. On the SNLI dataset, NatLogAttack required an average of only 42.8 queries to the victim model, compared to the 328.3 queries required by Clare.
- Superior Fluency: By incorporating perplexity constraints and logical rules, the generated examples were found to be more fluent and natural-sounding than those produced by brute-force word-swapping methods.
- Vulnerability to Label-Flipping: The study revealed that models are particularly vulnerable to label-flipping attacks. Models often fail to recognize when a single logical operator or a specific word swap completely changes the truth value of the relationship, confirming that they are often pattern-matching rather than reasoning.
Limitations and Future Work
While NatLogAttack represents a significant step forward, it has limitations. Natural logic is less expressive than first-order logic and cannot currently handle complex multi-step deductions like modus ponens. Additionally, the current framework focuses primarily on modifying the hypothesis sentence; modifying the premise remains a more complex challenge for future research.
Ultimately, the authors suggest that the high-quality adversarial examples generated by NatLogAttack can be used for adversarial training, helping to develop a new generation of NLI models that are truly robust and capable of formal logical reasoning.
Summary updated