[论文解读] On Identifiability in Transformers
本论文分析变换器中注意力权重和令牌嵌入的可辨识性,提出有效注意力和隐藏令牌归因,并显示在深度下由于上下文混合,令牌身份保持较显著但并非完全。
In this paper we delve deep in the Transformer architecture by investigating two of its core components: self-attention and contextual embeddings. In particular, we study the identifiability of attention weights and token embeddings, and the aggregation of context into hidden tokens. We show that, for sequences longer than the attention head dimension, attention weights are not identifiable. We propose effective attention as a complementary tool for improving explanatory interpretations based on attention. Furthermore, we show that input tokens retain to a large degree their identity across the model. We also find evidence suggesting that identity information is mainly encoded in the angle of the embeddings and gradually decreases with depth. Finally, we demonstrate strong mixing of input information in the generation of contextual embeddings by means of a novel quantification method based on gradient attribution. Overall, we show that self-attention distributions are not directly interpretable and present tools to better understand and further investigate Transformer models.
研究动机与目标
- 评估注意力权重是否能被模型输出唯一决定(注意力可辨识性)。
- 评估输入令牌身份在跨层的上下文嵌入中是否仍然存在(令牌可辨识性)。
- 使用基于梯度的归因量化上下文对隐藏嵌入的影响(上下文贡献)。
- 提出工具以提升注意力可解释性(有效注意力)。
- 提供经验证据,说明身份信息和上下文如何在 Transformer 层中演变。
提出的方法
- 理论推导变换值矩阵 T = E W_V H 的秩的上界,以在序列长度超过 dv 的注意力头维度时显示不可辨识。
- 表征左零空间 LN(T) 并证明存在 LN(T) 中的非平凡 Ã 满足单纯形约束,意味着注意力权重非唯一性。
- 引入有效注意力 A⊥ = A − ProjectionLN(T)(A),以隔离对输出有影响的注意力分量。
- 通过在各层用隐藏嵌入到输入令牌的最近邻映射(基于余弦相似度和 L2 距离)来实证地验证令牌可辨识性。
- 基于梯度归因定义隐藏令牌归因,以量化输入令牌对中间嵌入的贡献。
- 使用基于梯度的分析研究上下文如何贡献于隐藏嵌入,并量化局部与远处令牌的影响。
实验结果
研究问题
- RQ1对于给定输入序列,Transformer 输出是否可辨识地确定注意力权重分布?
- RQ2上下文嵌入在跨层中是否保留输入令牌的身份信息?
- RQ3上下文如何聚合到隐藏嵌入,以及随着深度的增加,令牌与上下文混合的程度有多大?
- RQ4我们能否开发诊断工具(有效注意力)以在超越原始权重的情况下更好地解释注意力?
- RQ5随着深度加深,上下文对令牌嵌入的贡献是局部还是全局的?
主要发现
- 当序列长度超过注意力头维度时,注意力权重不可辨识;存在无数种注意力配置能够产生相同的输出。
- 随着序列长度增大,有效注意力偏离原始注意力,提供对输出影响因素更为真实的诊断。
- 输入令牌在跨层中在很大程度上保留身份信息,可以通过线性映射和最近邻查找恢复,尤其在较早的层。
- 身份信息主要编码在嵌入角度中,且在更深的层中降低,表明令牌身份的精确保持逐渐丧失。
- 隐藏令牌归因揭示令牌与上下文信息在嵌入中的强混合;上下文聚合以局部为主,更远的贡献在更深层出现。
- 总体而言,自注意分布并不可直接解释;本文提供工具以更好地理解 Transformer 内部。
更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。