Table of Contents
Fetching ...

Interpreting Negation in GPT-2: Layer- and Head-Level Causal Analysis

Abdullah Al Mofael, Lisa M. Kuhn, Ghassan Alkadi, Kuo-Pao Yang

Abstract

Negation remains a persistent challenge for modern language models, often causing reversed meanings or factual errors. In this work, we conduct a causal analysis of how GPT-2 Small internally processes such linguistic transformations. We examine its hidden representations at both the layer and head level. Our analysis is based on a self-curated 12,000-pair dataset of matched affirmative and negated sentences, covering multiple linguistic templates and forms of negation. To quantify this behavior, we define a metric, the Negation Effect Score (NES), which measures the model's sensitivity in distinguishing between affirmative statements and their negations. We carried out two key interventions to probe causal structure. In activation patching, internal activations from affirmative sentences were inserted into their negated counterparts to see how meaning shifted. In ablation, specific attention heads were temporarily disabled to observe how logical polarity changed. Together, these steps revealed how negation signals move and evolve through GPT-2's layers. Our findings indicate that this capability is not widespread; instead, it is highly concentrated within a limited number of mid-layer attention heads, primarily within layers 4 to 6. Ablating these specific components directly disrupts the model's negation sensitivity: on our in-domain, ablation increased NES (indicating weaker negation sensitivity), and re-introducing cached affirmative activations (rescue) increased NES further, confirming that these heads carry affirmative signal rather than restoring baseline behavior. On xNot360, ablation slightly decreased NES and rescue restored performance above baseline. This pattern demonstrates that these causal patterns are consistent across various negation forms and remain detectable on the external xNot360 benchmark, though with smaller magnitude.

Interpreting Negation in GPT-2: Layer- and Head-Level Causal Analysis

Abstract

Negation remains a persistent challenge for modern language models, often causing reversed meanings or factual errors. In this work, we conduct a causal analysis of how GPT-2 Small internally processes such linguistic transformations. We examine its hidden representations at both the layer and head level. Our analysis is based on a self-curated 12,000-pair dataset of matched affirmative and negated sentences, covering multiple linguistic templates and forms of negation. To quantify this behavior, we define a metric, the Negation Effect Score (NES), which measures the model's sensitivity in distinguishing between affirmative statements and their negations. We carried out two key interventions to probe causal structure. In activation patching, internal activations from affirmative sentences were inserted into their negated counterparts to see how meaning shifted. In ablation, specific attention heads were temporarily disabled to observe how logical polarity changed. Together, these steps revealed how negation signals move and evolve through GPT-2's layers. Our findings indicate that this capability is not widespread; instead, it is highly concentrated within a limited number of mid-layer attention heads, primarily within layers 4 to 6. Ablating these specific components directly disrupts the model's negation sensitivity: on our in-domain, ablation increased NES (indicating weaker negation sensitivity), and re-introducing cached affirmative activations (rescue) increased NES further, confirming that these heads carry affirmative signal rather than restoring baseline behavior. On xNot360, ablation slightly decreased NES and rescue restored performance above baseline. This pattern demonstrates that these causal patterns are consistent across various negation forms and remain detectable on the external xNot360 benchmark, though with smaller magnitude.
Paper Structure (16 sections, 5 equations, 4 figures, 1 table)

This paper contains 16 sections, 5 equations, 4 figures, 1 table.

Figures (4)

  • Figure 1: End-to-end methodology showing the pipeline from behavioral scoring to causal validation. Starting from aligned affirmative and negated prefixes, the process computes the Negation Effect Score (NES), performs activation patching at layer and head levels, ranks top-$k$ influential heads, and conducts ablation–rescue and generalization analyses to identify and verify the negation circuit.
  • Figure 2: Localization of negation representation within GPT-2 Small. (a) Layer-wise activation patching identifies strongest causal shifts in mid-layer (4--5). (b) Head-level analysis highlights a compact set of attention heads, most notably L5H11 and L4H4, as principal carriers of polarity information.
  • Figure 3: Causal verification through ablation and rescue. (a) Removing top heads increases NES (indicating weaker negation sensitivity), confirming their causal importance. (b) Restoring those heads via activation patching increases NES further relative to the ablated state in-domain — confirming sufficiency under affirmative re-injection — while on xNot360, rescue restores toward baseline.
  • Figure 4: Cross-form and external validation of the identified negation circuit. (a) Positive $\Delta \mathrm{NES}$ (ablated - baseline) across all morphological variants indicates that removing the key heads increases NES (affirmative drift; weaker negation sensitivity). (b) External validation on the xNot360 dataset ($k=8$). Ablating the discovered heads slightly decreases mean NES, while rescue restores it above baseline, revealing a smaller but consistent effect size on natural text. The $y$–axis in (b) is zoomed to make these differences visible.