arXiv:2510.18148cs.CLcs.LG2025-10被引 2

用规则描述注意力特征,让模型解释更清晰可读。

Extracting Rule-based Descriptions of Attention Features in Transformers

  • 提出三类规则:跳词、缺失、计数,描述输入与输出的模式关联。
  • 在GPT-2小模型中发现多数特征可用约100条跳词规则描述,首层超四分之一含缺失规则。
  • 自动提取规则方法可揭示人工检查遗漏的深层行为,适合可解释性研究者。

机制可解释性致力于用底层原语解释模型行为。主流方法是将隐藏状态表示为基向量(特征)的稀疏线性组合,但仅能识别哪些文本序列激活哪些特征,特征的实际含义仍需主观分析示例。本文提出新方案:基于规则的描述,匹配输入中的词元模式,并相应影响特定输出词元的概率。具体地,我们对注意力层输出训练的SAE特征提取规则描述。不同于以往将注意力视为黑箱,我们揭示其可自然表达为输入与输出特征间的交互,包括三类规则:(1) 跳词规则如「[加拿大城市]...讲 → 英语」;(2) 缺失规则如「[蒙特利尔]...讲 -/→ 英语」;(3) 计数规则,仅当某词出现次数超过阈值或另一词计数变化时触发。缺失与计数规则难以通过示例人工发现,常导致误判或不完整解释。本文提出简单方法自动提取这些规则并应用于GPT-2 small,发现多数特征可用约100条跳词规则良好描述,且首层超过四分之一特征含缺失规则,也识别出少数计数规则。本工作为未来基于规则的特征描述奠定基础,定义规则类型,展示提取方法,并提供初步行为分类体系。

原文摘要 · Abstract (English)

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.

可解释性注意力机制规则提取Transformer

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