在仅解码器Transformer中,绝对位置从何而来?
Where does Absolute Position come from in decoder-only Transformers?
AI总结:
本文研究了RoPE训练的仅解码器Transformer中绝对位置信息的来源,发现因果掩码和残差流是导致绝对位置泄露的两个关键组件,并提出了通过替换BOS嵌入来减少残差流成分的方法。
摘要:
RoPE训练的Transformer在其注意力模式中区分绝对位置,尽管RoPE在内积中仅编码相对偏移。我们将这种泄露追溯到两个架构组件。因果掩码是第一个:其每个查询的softmax分母按构造依赖于绝对查询位置。残差流提供第二个。在因果注意力下,位置$0$处的激活仅关注自身,并作为封闭动力系统从该位置token的嵌入运行;下游注意力通过sink-reading头读取该轨迹。这两个组件在我们研究的所有三种架构中都存在,但以架构特定的平衡出现:NTK缩放抑制残差流组件,滑动窗口注意力使其随深度累积,而标准RoPE介于两者之间。在前向传播前替换\texttt{BOS}嵌入可消除早期查询中$40\%$的残差流组件。注意力sink是锚定在token上的稳定器,传递位置$0$处token的确定性指纹,当该token是自动预置的\texttt{BOS}时,该指纹跨输入恒定,否则随其变化。
英文摘要:
RoPE-trained transformers distinguish absolute position in their attention patterns, even though RoPE encodes only relative offsets in the inner product. We trace this leakage to two architectural components, The causal mask is responsible for the first: its per-query softmax denominator depends on the absolute query position by construction. The residual stream supplies the second. Under causal attention the activation at position $0$ attends only to itself and runs as a closed dynamical system from the embedding of the token at that position; downstream attention reads this trajectory through sink-reading heads. Both components appear in all three architectures we study, in architecturally specific balance: NTK scaling suppresses the residual-stream component, sliding-window attention allows it to accumulate with depth, and standard RoPE sits between. Replacing the \texttt{BOS} embedding before the forward pass removes $40\%$ of the residual-stream component at early queries. Attention sinks are token-anchored stabilizers that pass forward a deterministic fingerprint of the token at position $0$, constant across inputs when that token is the auto-prepended \texttt{BOS} and varying with it otherwise.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。