arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2603.12423cs.CL
收藏

解读GPT-2中的否定:层和头级别的因果分析

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

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

AI总结:

研究通过自建数据集分析GPT-2处理否定语义的机制,定义Negation Effect Score衡量模型区分肯定与否定的能力,发现否定信号集中在特定中间层注意力头中,通过激活修补和消融实验验证其因果关系。

摘要:

否定仍然是现代语言模型的持续挑战,常导致语义反转或事实错误。本文对GPT-2 Small内部处理否定语言转换进行了因果分析,考察其隐藏表示在层和头级别上的表现。基于自建的12000对匹配肯定与否定句子数据集,涵盖多种语言模板和否定形式,定义了Negation Effect Score(NES)来衡量模型区分肯定陈述与否定的能力。通过激活修补和消融两种干预方法,发现否定信号集中在有限的中间层注意力头中,主要在第4至6层。消融这些特定组件会直接破坏模型的否定敏感性:在领域内数据集上,消融增加了NES(表明更弱的否定敏感性),而重新引入缓存的肯定激活(救援)进一步增加NES,证实这些头携带肯定信号而非恢复基线行为。在xNot360上,消融略微降低了NES,救援恢复了基线以上性能。这种模式表明,这些因果关系在各种否定形式中保持一致,并在外部xNot360基准上可检测,尽管幅度较小。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑