arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2510.18148cs.CLcs.LG
收藏

提取Transformer中注意力特征的基于规则的描述

Extracting Rule-based Descriptions of Attention Features in Transformers

Princeton Language and Intelligence (PLI), Princeton University(普林斯顿语言与智能研究所(PLI)、普林斯顿大学)

Dan Friedman, Adithya Bhaskar, Alexander Wettig, Danqi Chen

AI总结:

针对Transformer注意力特征依赖主观样例检视的解读难题,本文提出三类基于规则的特征描述方法,可自动提取规则并在GPT-2 small上验证效果,为机制可解释性研究提供新路径。

摘要:

机制可解释性致力于从自下而上的基元角度解释模型行为,主流范式是将隐藏状态表示为基向量(称为特征)的稀疏线性组合。但该方法仅能识别哪些文本序列(样例)激活哪些特征,对特征的实际解读仍需对这些样例进行主观检视。本文提出一种不同的解决方案:基于规则的描述,这类描述匹配输入中的词元模式,并相应提高或降低特定输出词元的生成概率。具体而言,我们提取了在注意力层输出上训练的SAE(稀疏自编码器)特征的基于规则的描述。现有研究将注意力层视为黑盒,我们则说明其可自然地通过输入与输出特征间的相互作用来表示,我们研究了三类相互作用规则:(1)跳元规则,形式如“[加拿大城市]…说 --> 英语”;(2)缺失规则,形式如“[蒙特利尔]…说 -/-> 英语”;(3)计数规则,仅当某个词的计数超过特定值或超过另一个词的计数时才触发。缺失规则和计数规则无法通过检视样例轻易发现,手动和自动描述常在此类规则上得出具有误导性或不完整的解释。我们随后提出一种从Transformer中自动提取这几类规则的简单方法,并将其应用于GPT-2 small模型。研究发现,大多数特征可通过约100条跳元规则得到良好描述,而缺失规则甚至在第一层就大量存在(超过四分之一的特征包含此类规则)。我们还分离出了少数计数规则的实例。本文通过定义基于规则的特征描述、展示其提取方法,并对其代表的部分行为提供初步分类,为未来基于规则的特征描述研究奠定了基础。

英文摘要:

Mechanistic interpretability strives to explain model behavior in terms of bottom-up primitives. The leading paradigm is to express hidden states as a sparse linear combination of basis vectors, called features. However, this only identifies which text sequences (exemplars) activate which features; the actual interpretation of features requires subjective inspection of these exemplars. This paper advocates for a different solution: rule-based descriptions that match token patterns in the input and correspondingly increase or decrease the likelihood of specific output tokens. Specifically, we extract rule-based descriptions of SAE features trained on the outputs of attention layers. While prior work treats the attention layers as an opaque box, we describe how it may naturally be expressed in terms of interactions between input and output features, of which we study three types: (1) skip-gram rules of the form "[Canadian city]... speaks --> English", (2) absence rules of the form "[Montreal]... speaks -/-> English," and (3) counting rules that toggle only when the count of a word exceeds a certain value or the count of another word. Absence and counting rules are not readily discovered by inspection of exemplars, where manual and automatic descriptions often identify misleading or incomplete explanations. We then describe a simple approach to extract these types of rules automatically from a transformer, and apply it to GPT-2 small. We find that a majority of features may be described well with around 100 skip-gram rules, though absence rules are abundant even as early as the first layer (in over a fourth of features). We also isolate a few examples of counting rules. This paper lays the groundwork for future research into rule-based descriptions of features by defining them, showing how they may be extracted, and providing a preliminary taxonomy of some of the behaviors they represent.

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

↑