The attention mechanism in a Transformer architecture matches key to query based on both content -- the what -- and position in a sequence -- the where. We present an analysis indicating that what and where are entangled in the popular RoPE rotary position embedding. This entanglement can impair performance particularly when decisions require independent matches on these two factors. We propose an improvement to RoPE, which we call Polar Coordinate Position Embeddings or PoPE, that eliminates the what-where confound. PoPE is far superior on a diagnostic task requiring indexing solely by position or by content. On autoregressive sequence modeling in music, genomic, and natural language domains, Transformers using PoPE as the positional encoding scheme outperform baselines using RoPE with respect to evaluation loss (perplexity) and downstream task performance. On language modeling, these gains persist across model scale, from 124M to 774M parameters. Crucially, PoPE shows strong zero-shot length extrapolation capabilities compared not only to RoPE but even a method designed for extrapolation, YaRN, which requires additional fine tuning and frequency interpolation.


翻译:Transformer 架构中的注意力机制基于内容(即“内容”)与序列中的位置(即“位置”)将键与查询进行匹配。我们提出一项分析,表明在流行的 RoPE 旋转位置嵌入中,内容与位置是相互纠缠的。这种纠缠可能会损害性能,尤其是在决策需要基于这两个因素进行独立匹配时。我们提出了一种对 RoPE 的改进方法,称之为极坐标位置嵌入(PoPE),它消除了内容与位置的混淆。在仅需通过位置或内容进行索引的诊断任务上,PoPE 表现远为优越。在音乐、基因组和自然语言领域的自回归序列建模中,使用 PoPE 作为位置编码方案的 Transformer 在评估损失(困惑度)和下游任务性能方面均优于使用 RoPE 的基线模型。在语言建模中,这些优势在不同模型规模(从 1.24 亿到 7.74 亿参数)上持续存在。至关重要的是,与 RoPE 相比,甚至与专为外推设计且需要额外微调和频率插值的 YaRN 方法相比,PoPE 都展现出强大的零样本长度外推能力。

0
下载
关闭预览

相关内容

【ICCV2023】StyleDiffusion:基于扩散模型的可控解缠风格迁移
【NeurIPS2019】图变换网络:Graph Transformer Network
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
4+阅读 · 2014年12月31日
VIP会员
相关基金
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
4+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员