arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2406.17759cs.LG
收藏

使用稀疏自编码器解释注意力层输出

Interpreting Attention Layer Outputs with Sparse Autoencoders

Connor Kissane, Robert Krzyzanowski, Joseph Isaac Bloom, Arthur Conmy, Neel Nanda

AI总结:

本研究在高达2B参数的transformer注意力层输出上训练稀疏自编码器(SAEs),发现其可分解出长/短程上下文等可解释特征,并利用SAEs深入分析了模型行为、归纳头冗余现象及间接对象识别电路的语义。

摘要:

将模型激活分解为可解释组件是机制可解释性中的一个关键开放问题。稀疏自编码器(SAEs)是一种流行的方法,用于将训练好的transformers的内部激活分解为稀疏的、可解释的特征,并已应用于MLP层和残差流。在这项工作中,我们在注意力层输出上训练SAEs,并表明在此处SAEs同样能找到稀疏的、可解释的分解。我们在来自多个模型家族且参数量高达2B的transformers上对此进行了演示。\n我们对注意力层计算的特征进行了定性研究,并发现了多个特征家族:长程上下文、短程上下文和归纳特征。我们对GPT-2 Small中每个头的作用进行了定性研究,并估计至少90%的头是多语义的,即具有多个不相关的角色。\n此外,我们表明稀疏自编码器是一种有用的工具,使研究人员能够比先前的工作更详细地解释模型行为。例如,我们探讨了为什么模型有如此多看似冗余的归纳头的谜团,使用SAEs提出了某些是长前缀而另一些是短前缀的假设,并通过更严格的分析证实了这一点。我们使用SAEs分析了间接对象识别电路(Wang et al.)执行的计算,验证了SAEs能找到具有因果意义的中介变量,并加深了我们对电路语义的理解。我们开源了训练好的SAEs以及一个通过注意力输出SAEs视角探索任意提示的工具。

英文摘要:

Decomposing model activations into interpretable components is a key open problem in mechanistic interpretability. Sparse autoencoders (SAEs) are a popular method for decomposing the internal activations of trained transformers into sparse, interpretable features, and have been applied to MLP layers and the residual stream. In this work we train SAEs on attention layer outputs and show that also here SAEs find a sparse, interpretable decomposition. We demonstrate this on transformers from several model families and up to 2B parameters. We perform a qualitative study of the features computed by attention layers, and find multiple families: long-range context, short-range context and induction features. We qualitatively study the role of every head in GPT-2 Small, and estimate that at least 90% of the heads are polysemantic, i.e. have multiple unrelated roles. Further, we show that Sparse Autoencoders are a useful tool that enable researchers to explain model behavior in greater detail than prior work. For example, we explore the mystery of why models have so many seemingly redundant induction heads, use SAEs to motivate the hypothesis that some are long-prefix whereas others are short-prefix, and confirm this with more rigorous analysis. We use our SAEs to analyze the computation performed by the Indirect Object Identification circuit (Wang et al.), validating that the SAEs find causally meaningful intermediate variables, and deepening our understanding of the semantics of the circuit. We open-source the trained SAEs and a tool for exploring arbitrary prompts through the lens of Attention Output SAEs.

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

↑