arXiv:2506.22977cs.CLcs.LG2025-06

研究大模型如何处理事实与反事实信息的机制竞争,发现其效果受模型规模和提示结构影响。

On the Generalizability of "Competition of Mechanisms: Tracing How Language Models Handle Facts and Counterfactuals"

  • 通过注意力头消融实验,分析模型在事实与反事实之间的机制竞争。
  • 在GPT-2、Pythia 6.9B和Llama 3.1 8B上验证结果,发现大模型注意力头分工减弱。
  • 提示结构与领域偏差显著影响结论可靠性,提示设计需谨慎。

我们复现了Ortu等人(2024)关于语言模型中事实回忆与反事实上下文重复之间机制竞争的研究。该研究成功再现了原论文中关于事实与反事实信息定位、注意力层主导竞争、注意力头功能专化的核心发现,并在GPT-2和Pythia 6.9B上验证。我们进一步拓展了三个方向:首先,在Llama 3.1 8B上复现实验,发现注意力头分工显著降低;其次,通过改变提示结构(如不逐字重复反事实陈述或替换前提词),观察到反事实标记的对数几率明显下降;最后,测试特定领域提示的有效性,发现部分类别提示因将事实预测词作为句子主语而扭曲结果。总体表明,原论文提出的注意力头消融方法在数据集覆盖不足的领域无效,且效果随模型架构、提示结构、领域与任务变化而异。

原文摘要 · Abstract (English)

We present a reproduction study of "Competition of Mechanisms: Tracing How Language Models Handle Facts and Counterfactuals" (Ortu et al., 2024), which investigates competition of mechanisms in language models between factual recall and counterfactual in-context repetition. Our study successfully reproduces their primary findings regarding the localization of factual and counterfactual information, the dominance of attention blocks in mechanism competition, and the specialization of attention heads in handling competing information. We reproduce their results on both GPT-2 (Radford et al., 2019) and Pythia 6.9B (Biderman et al., 2023). We extend their work in three significant directions. First, we explore the generalizability of these findings to even larger models by replicating the experiments on Llama 3.1 8B (Grattafiori et al., 2024), discovering greatly reduced attention head specialization. Second, we investigate the impact of prompt structure by introducing variations where we avoid repeating the counterfactual statement verbatim or we change the premise word, observing a marked decrease in the logit for the counterfactual token. Finally, we test the validity of the authors' claims for prompts of specific domains, discovering that certain categories of prompts skew the results by providing the factual prediction token as part of the subject of the sentence. Overall, we find that the attention head ablation proposed in Ortu et al. (2024) is ineffective for domains that are underrepresented in their dataset, and that the effectiveness varies based on model architecture, prompt structure, domain and task.

语言模型机制竞争注意力头提示工程

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。