Abstract
Natural Language Inference (NLI) models often rely on statistical shortcuts rather than genuine logical reasoning, leading to poor generalization on out-of-distribution data. This paper introduces SLR-NLI, a framework that decomposes NLI labels into logical rules applied to individual hypothesis spans. By evaluating spans in isolation, SLR-NLI provides built-in explanations and maintains high accuracy while significantly improving robustness. In low-data settings, the framework improves out-of-distribution performance by up to 16% relative to standard BERT baselines.
Introduction
Natural Language Inference (NLI) requires determining the logical relationship—entailment, contradiction, or neutral—between a premise and a hypothesis. While modern transformer-based models like BERT achieve high benchmark scores, they frequently exploit dataset biases (annotation artifacts) rather than learning logical principles. For instance, a model might incorrectly associate the presence of negation words with contradiction regardless of context.
To address this, researchers from Imperial College London, the University of Edinburgh, and Queen Mary University of London proposed the Span Logical Reasoning (SLR-NLI) framework. This approach forces models to "show their work" by breaking sentences into logical "atoms" and aggregating their relationships through explicit logical rules.
The SLR-NLI Framework
The SLR-NLI framework adopts a bottom-up approach to classification, moving from individual spans to the full sentence label.
1. Span Selection and Encoding
The hypothesis is first segmented into spans based on noun phrases (e.g., "a man in a wetsuit" is split into "a man" and "in a wetsuit"). Each span $i$ is then fed into a BERT model alongside the full premise. To ensure the model evaluates the span in isolation, the remainder of the hypothesis is masked. This produces a CLS representation $h_i$ for each span.
2. Dual Detection and Logical Aggregation
The model utilizes two distinct attention mechanisms to identify "neutral" and "contradiction" spans. The final sentence-level label is derived from these span-level predictions using a strict logical hierarchy:
- Contradiction: Triggered if any individual span contradicts the premise.
- Neutral: Triggered if no spans contradict, but at least one span introduces information not present in the premise (neutral).
- Entailment: Triggered only if every span is supported by the premise (i.e., no neutral or contradiction spans are detected).
3. Training and Auxiliary Losses
The model is trained using a semi-supervised approach. While sentence-level labels are available, span-level labels are often latent. The framework employs auxiliary losses—Sentence-loss and Span-loss—to guide the learning of span representations. These losses are calculated based on the aggregated span predictions and the ground truth sentence label.
Experimental Evaluation
The framework was evaluated on several key benchmarks:
- SNLI & e-SNLI: Used for primary training and verification of span-level decisions against human rationales.
- SICK: Tested the model's compositional knowledge.
- OOD Sets: MNLI, SNLI-hard, and HANS were used to assess robustness against common dataset biases.
Key Results and Insights
The researchers found that incorporating logical constraints does not necessitate an "interpretability tax." SLR-NLI achieved 90.33% accuracy on SNLI, comparable to the 90.77% of a standard black-box BERT baseline.
Robustness in Low-Data Regimes
The framework's primary strength lies in its robustness. When trained on a limited set of 1,000 examples, SLR-NLI significantly outperformed the baseline on out-of-distribution (OOD) data. Specifically, it improved performance on MNLI matched and mismatched sets by 13% and 16% respectively. This suggests that the logical structure acts as a powerful regularizer, preventing the model from over-fitting to shallow statistical cues.
Interpretability and Span Accuracy
Using human-written explanations from e-SNLI as a gold standard, the model's span-level predictions reached 88.29% accuracy. This demonstrates that the model's internal reasoning aligns closely with human logic, even when span-level supervision is minimal.
Conclusion
SLR-NLI demonstrates that it is possible to build NLI models that are both high-performing and inherently interpretable. By grounding sentence-level predictions in span-level logic, the framework achieves superior generalization, particularly when data is scarce. Future work may extend this methodology to more complex reasoning tasks such as multi-sentence fact-checking or long-form question answering.
Summary updated