Adaptive Circuit Behavior and Generalization in Mechanistic Interpretability

📄 arXiv: 2411.16105v2 📥 PDF

作者: Jatin Nainani, Sankaran Vaidyanathan, AJ Yeung, Kartik Gupta, David Jensen

分类: cs.LG, cs.AI, cs.CL

发布日期: 2024-11-25 (更新: 2024-12-05)

备注: 10 pages, 8 figures


💡 一句话要点

研究揭示GPT-2小型模型IOI电路在不同提示下的泛化能力与适应性

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 机制可解释性 电路泛化 大型语言模型 GPT-2 间接对象识别 S2 Hacking 提示工程

📋 核心要点

  1. 现有机制可解释性研究通常基于狭义的提示格式,忽略了大型语言模型在不同提示下完成相同任务的泛化能力。
  2. 该研究通过分析GPT-2 small模型中的IOI电路,探究其在不同提示变体下的泛化行为,揭示电路组件的复用和适应性。
  3. 实验发现IOI电路具有很强的泛化能力,即使在原始算法失效的提示下也能通过S2 Hacking机制进行适应,表明电路比预期更灵活。

📝 摘要(中文)

本文旨在通过机制可解释性方法,研究大型语言模型(LLM)内部工作机制,特别是模型中负责执行特定任务的电路(最小子图)的泛化能力。研究聚焦于GPT-2 small模型中已得到充分研究的间接对象识别(IOI)电路,并评估其在不同提示变体下的性能,这些变体挑战了原始算法的假设。研究发现,该电路具有出色的泛化能力,能够复用所有组件和机制,仅需添加额外的输入边。值得注意的是,即使在原始算法应失效的提示变体中,该电路也能泛化,这归功于一种名为S2 Hacking的机制。研究结果表明,LLM中的电路可能比之前认为的更灵活和通用,强调了研究电路泛化对于理解这些模型更广泛能力的重要性。

🔬 方法详解

问题定义:现有机制可解释性研究主要关注特定提示格式下的电路,缺乏对电路在不同提示下的泛化能力的深入理解。这使得我们难以判断大型语言模型的泛化能力是源于相同电路组件的复用、组件行为的改变,还是完全不同组件的使用。因此,该研究旨在探究电路在不同提示下的泛化能力,从而更好地理解大型语言模型的内在机制。

核心思路:该研究的核心思路是通过分析GPT-2 small模型中已知的IOI电路在不同提示变体下的行为,来评估其泛化能力。通过观察电路组件的激活模式、连接权重等,判断电路是否能够复用、适应不同的提示,以及是否存在新的机制来应对原始算法失效的情况。

技术框架:该研究的技术框架主要包括以下几个步骤:1) 选择GPT-2 small模型和IOI电路作为研究对象;2) 设计一系列提示变体,这些变体挑战了原始IOI算法的假设;3) 使用机制可解释性技术,如激活分析、权重分析等,观察IOI电路在不同提示下的行为;4) 识别并分析新的机制,如S2 Hacking,这些机制能够解释电路在原始算法失效的情况下仍然能够泛化的现象。

关键创新:该研究的关键创新在于发现了IOI电路在不同提示下具有很强的泛化能力,并且揭示了一种名为S2 Hacking的新机制,该机制能够使电路在原始算法失效的情况下仍然能够正常工作。这表明LLM中的电路可能比之前认为的更灵活和通用。

关键设计:该研究的关键设计包括:1) 精心设计的提示变体,这些变体能够有效地挑战原始IOI算法的假设;2) 使用激活分析和权重分析等机制可解释性技术,深入观察电路的行为;3) 对S2 Hacking机制的详细分析,包括其原理、作用和影响。

🖼️ 关键图片

fig_0
fig_1
fig_2

📊 实验亮点

研究发现GPT-2 small模型中的IOI电路在面对挑战原始算法假设的提示变体时,展现出惊人的泛化能力。该电路不仅能够复用其所有组件和机制,而且还发展出一种名为S2 Hacking的新机制,使其即使在原始算法应该失效的情况下也能正常工作。这一发现表明,LLM中的电路可能比之前认为的更加灵活和通用。

🎯 应用场景

该研究成果可应用于提升大型语言模型的可解释性和可靠性。通过理解电路的泛化能力和适应机制,可以更好地控制模型的行为,减少模型产生意外或错误输出的可能性。此外,该研究也有助于开发更高效的模型压缩和优化技术,例如通过识别冗余或不必要的电路组件来减小模型规模。

📄 摘要(原文)

Mechanistic interpretability aims to understand the inner workings of large neural networks by identifying circuits, or minimal subgraphs within the model that implement algorithms responsible for performing specific tasks. These circuits are typically discovered and analyzed using a narrowly defined prompt format. However, given the abilities of large language models (LLMs) to generalize across various prompt formats for the same task, it remains unclear how well these circuits generalize. For instance, it is unclear whether the models generalization results from reusing the same circuit components, the components behaving differently, or the use of entirely different components. In this paper, we investigate the generality of the indirect object identification (IOI) circuit in GPT-2 small, which is well-studied and believed to implement a simple, interpretable algorithm. We evaluate its performance on prompt variants that challenge the assumptions of this algorithm. Our findings reveal that the circuit generalizes surprisingly well, reusing all of its components and mechanisms while only adding additional input edges. Notably, the circuit generalizes even to prompt variants where the original algorithm should fail; we discover a mechanism that explains this which we term S2 Hacking. Our findings indicate that circuits within LLMs may be more flexible and general than previously recognized, underscoring the importance of studying circuit generalization to better understand the broader capabilities of these models.