Making Language Models Robust Against Negation

MohammadHossein Rezaei, Eduardo Blanco

Abstract

Despite their impressive capabilities, large language models (LLMs) often struggle with the fundamental logic of negation. This "negation blindness" leads to significant errors in reasoning and discourse coherence. We present a self-supervised "booster shot" for models like BERT and RoBERTa, utilizing two novel pre-training tasks: Next Sentence Polarity Prediction (NSPP) and a modified Next Sentence Prediction (NSP) using polarity-reversed "hard negatives." Our approach significantly improves performance on challenging benchmarks like CondaQA and enhances group consistency, demonstrating a deeper structural understanding of negation without the need for human-labeled data.

Introduction

A well-documented failure mode of modern Language Models (LMs) is their inability to distinguish between a statement and its negation. For instance, BERT often predicts the same token for "A beagle is a type of [MASK]" and "A beagle is not a type of [MASK]." This occurs because standard pre-training objectives, such as Masked Language Modeling (MLM), often treat negation cues as low-information "stop words" or fail to capture the global semantic shift caused by a single "not."

This research addresses the challenge of making smaller, efficient models robust against negation. While massive models like GPT-4 show better performance, they are computationally expensive to deploy. We propose a method to inject negation awareness into existing models through targeted, self-supervised further pre-training.

Methodology: Negation-Aware Pre-training

We introduce two new self-supervised tasks designed to force models to attend to negation cues and their impact on discourse:

  1. Next Sentence Polarity Prediction (NSPP): The model is given a sentence $S_1$ and must predict whether the subsequent sentence $S_2$ in the original text contains a negation. This task encourages the model to learn the logical "rhythm" and expectations set by negation in natural discourse.
  2. Modified Next Sentence Prediction (NSP): Standard NSP requires a model to distinguish between a true next sentence and a random one. We make this task significantly harder by using "hard negatives": the "fake" sentence is the actual next sentence, but with its polarity reversed (e.g., "The screen stayed blank" followed by "It displayed images" instead of "It didn't display images").
Figure 5: Illustration of the Next Sentence Polarity Prediction (NSPP) and Modified Next Sentence Prediction (NSP) tasks.

To generate the training data, we developed a rule-based engine using spaCy's dependency parsing. This engine automatically adds or removes negation cues ("not," "n't," "never") while maintaining grammatical correctness. Interestingly, we found that using LLMs like GPT-4 for this task was less effective, as they often refused to generate "factually incorrect" negated sentences based on Wikipedia data, highlighting a bias toward truth over linguistic mechanics.

Experimental Results

We further pre-trained BERT and RoBERTa (base and large variants) on a dataset of approximately 6.4 million sentence pairs from English Wikipedia. The models were evaluated on several benchmarks including CondaQA, NLI subsets, and knowledge probes like LAMA-Neg.

Learning Efficiency

The models successfully learned the new tasks, with validation loss decreasing steadily as the pre-training size increased. The joint training of both NSPP and the modified NSP tasks proved particularly effective across all model architectures.

Figure 4: Validation loss vs. pre-training size for the NSP, NSPP, and joint task training.

Performance Gains

Our negation-aware pre-training yielded substantial improvements:

  • CondaQA: RoBERTa-large achieved an accuracy boost of up to 9.3%.
  • Group Consistency: This metric measures a model's ability to remain consistent across original, paraphrased, and negated versions of a story. RoBERTa-base's consistency score soared from 2.4% to 17.6%, indicating a more robust structural understanding.
  • Zero-Shot Knowledge: On the LAMA-Neg benchmark, error rates dropped by an average of 6.19 points, showing that the models stopped blindly predicting the same tokens for positive and negative prompts.

Conclusion

By introducing self-supervised tasks that treat negation as a core component of discourse logic rather than a simple local flip, we can significantly enhance the robustness of language models. Our "booster shot" approach allows smaller models to outperform much larger counterparts on negation-heavy tasks. Future work will focus on expanding the rule-based engine to handle more complex linguistic negations (e.g., "fail to," "unhappy") and extending the methodology to non-English languages.

Summary updated

BibTeX
@inproceedings{rezaei2025making,
  author = {MohammadHossein Rezaei and Eduardo Blanco},
  title = {{Making Language Models Robust Against Negation}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2025},
  doi = {10.18653/v1/2025.naacl-long.413},
}
Figure