Papers
Topics
Authors
Recent
Search
2000 character limit reached

How Language Models Process Negation

Published 4 May 2026 in cs.CL | (2605.03052v1)

Abstract: We study how LLMs process negation mechanistically. First, we establish that even though open-weight models often provide wrong answers to questions involving negation, they do possess internal components that process negation correctly. Their poor accuracy is due to late-layer attention behavior that promotes simple shortcuts; ablating those attention modules greatly improves accuracy on negation-related questions. Second, we uncover how models process negation. We consider two hypotheses: models could use attention heads that attend to the phrase being negated and suppress related concepts, or they could directly construct a representation of the entire negative phrase (e.g., representing "not gas" as a vector that promotes liquids and solids). We apply a range of observational and causal interpretability techniques on Mistral-7B and Llama-3.1-8B to show that models implement both mechanisms, with the "constructive" mechanism being more prominent. Combined, our work deepens the understanding of LLMs' internals, highlighting construction-dominant computations and the coexistence of competing mechanisms within LLMs.

Summary

  • The paper demonstrates that LLMs construct negated representations using mid-layer attention heads rather than only suppressing tokens.
  • It employs ablation experiments with an Attention Sink technique to reveal and mitigate shortcut modules affecting negative accuracy.
  • The study’s findings imply targeted interventions can improve factual reasoning by leveraging internal negation mechanisms.

Mechanistic Insights into Negation Processing in LLMs

Background and Motivation

Negation is a pervasive linguistic operation that poses compositional challenges for Transformer-based LLMs. While additive factual recall mechanisms—those that simply sum token-level evidence—have been extensively characterized, negation requires more sophisticated representations because "not" can apply generically to any concept, demanding compositional manipulation rather than mere suppression or aggregation. This paper presents a detailed mechanistic interpretability analysis targeting prompts of the form "X that is not Y is Z," systematically unpacks the internal circuits LLMs deploy to handle negation, and resolves ambiguity between competing hypotheses documented in both NLP and cognitive science: suppression (directly demote tokens corresponding to Y) versus construction (explicitly construct representations for "not Y"). Figure 1

Figure 1: Competing mechanisms for negation: the constructive pathway computes an explicit negated representation, while the shortcut pathway exploits superficial correlation.

Shortcut Mechanisms and Internal Negation Sensitivity

An initial observation is that open-weight LLMs such as Llama-3.1-8B, Qwen2.5, Mistral-7B-v0.1, Gemma-2, and OLMo2 often provide incorrect answers to negation prompts (e.g., "An animal that cannot fly is a bird"), despite near-perfect accuracy on positive prompts. However, the negative accuracy degradation does not stem from a lack of negation sensitivity—the models' logits remain responsive to negated prompts, as measured by a robust sensitivity metric (probability that the logit difference reverses when prompt polarity is flipped). This decoupling suggests that some internal computation correctly processes negation, but its output is overridden by shortcut circuits in later layers.

Ablation experiments with the newly introduced Attention Sink technique, which disables shortcut attention heads by restricting their receptive fields, demonstrate substantial improvement in negative accuracy (up to 17% absolute and 46% relative for Mistral-7B-v0.1), emphasizing that shortcut modules—likely arising during early pre-training—are responsible for spurious positive answer promotion in negative contexts. As visualized in OLMo2 training trajectories, negative accuracy initially plummets then restabilizes as such shortcuts are established and subsequently mitigated during optimization. Figure 2

Figure 2: Positive and negative accuracies over OLMo2 checkpoints, revealing early emergence of shortcut-induced bias followed by stabilization.

Mechanistic Dissection: Suppression vs. Construction

Fundamentally, the paper resolves the theoretical tension between suppression and construction by tracing internal layer-wise activations. Mid-layer attention heads play a causally pivotal role, with multiple interpretability tools—path patching, windowed Attention Sink, LogitLens projections, and LLM-based semantic annotation—identifying the locus where negated representations are constructed and shuttled forward in the residual stream.

Principal Component Analysis (PCA) and Linear Discriminant Analysis (LDA) show that, as early as layer 4, hidden states at the position of Y become nearly linearly separable by the "not" direction, strongly supporting the constructive hypothesis. Likewise, evidence counts for tokens semantically related to "not Y" (as assessed via LogitLens and LLM annotation) peak at mid-layer attention modules, matching causal ablation results. Figure 3

Figure 3: PCA visualization of positive and negative hidden states from Llama-3.1-8B, revealing a linearly separable "not" direction.

Figure 4

Figure 4: Attention Sink ablation on Llama-3.1-8B; mid-layer window ablating modules around layer 14 demonstrates maximal impact on negation accuracy.

Figure 5

Figure 5: Normalized evidence counts for "not Y" promotion and "Y" suppression across attention layers (Llama-3.1-8B); construction dominates.

These results are robust to multi-answer evaluation protocols and generalized across model architectures (see Mistral-7B-v0.1 results, Figures 7 and 9), establishing that negated concept construction, rather than pure suppression, is the dominant mechanism. Figure 6

Figure 6

Figure 6: Path patching and Attention Sink ablation on Llama-3.1-8B; both methods pinpoint mid-layer attention modules as causally critical.

Figure 7

Figure 7

Figure 7: Path patching and Attention Sink ablation on Mistral-7B; corroborates causal role of mid-layer attention modules in negation processing.

Translation to Output via MLPs and Sparse Autoencoders

Following negated representation construction in attention modules, late-layer MLPs—identified via contrastive attribution scoring between positive and negative prompts, and further via sparse autoencoders trained on MLP outputs—promote output tokens corresponding to the negated concepts. Manual inspection of critical latent features extracted from SAEs reveals interpretable semantic alignments: "not gases at room temp" yields "solid"; "not in Asia" yields "America"; "not biodegradable" produces tokens such as "plastic", again underlining the constructive trajectory.

Suppression of the original concept Y is observable but less pronounced, both in evidence count and interpretability of demoted tokens. Figure 8

Figure 8

Figure 8: LDA model accuracy for decoding "not" from the residual stream at various positions, demonstrating rapid emergence of negation direction.

Implications, Practical and Theoretical

The practical implication is twofold: (1) shortcut modules can be directly targeted for robust reasoning about negation, improving factual reliability without retraining; (2) internal negation capability exists even when output answers fail, so black-box evaluation may underestimate LLM competence. Theoretically, this work establishes that Transformer-based LLMs mechanistically realize compositional negated concepts, achieving a form of structured manipulation analogous to cognitive models in neuroscience.

Future research may exploit these findings to design models less susceptible to shortcut pathologies and better able to generalize logical operations, and to develop improved auditing methods for internal linguistic processes. The Attention Sink ablation and contrastive attribution pipeline deliver generalizable interpretability techniques for circuit analysis.

Conclusion

Through systematic mechanistic interpretability experiments, this study demonstrates that LLMs internally construct negated representations via mid-layer attention heads and translate those constructs to output via late-layer MLPs and SAE features. Although shortcut mechanisms in late layers impair output accuracy on negated prompts, targeted ablation can recover intended behavior, validating the coexistence of suppression and construction mechanisms, with the latter predominating. These insights deepen the understanding of compositional reasoning in neural LLMs and enable improved diagnostics and interventions for logical operations.

Paper to Video (Beta)

No one has generated a video about this paper yet.

Whiteboard

No one has generated a whiteboard explanation for this paper yet.

Open Problems

We haven't generated a list of open problems mentioned in this paper yet.

Collections

Sign up for free to add this paper to one or more collections.

Tweets

Sign up for free to view the 12 tweets with 2306 likes about this paper.