提出新型位置编码PaTH,让注意力随输入内容动态调整位置信息。
PaTH Attention: Position Encoding via Accumulating Householder Transformations
- 用累积的Householder变换实现数据相关的位置编码
- 在合成任务和真实语言模型中均优于RoPE等基线
- 可对预训练的RoPE模型进行持续训练转换
注意力机制是现代大语言模型的核心组件。由于注意力本身具有置换不变性,位置编码对建模语言等结构化数据至关重要。旋转位置编码(RoPE)已成为主流位置编码方法,广泛应用于多种大模型中。然而,RoPE中键/查询之间的变换仅依赖于相对位置,与实际输入无关,限制了其表达能力。本文提出PaTH,一种基于累积的Householder(类似)变换的灵活数据相关位置编码方案,其中每个变换均依赖于输入。我们推导出高效的并行训练算法,利用霍尔荷德矩阵乘积的紧凑表示,并实现了类似FlashAttention的块状计算。在针对合成任务和中等规模真实语言建模实验中,PaTH表现优于RoPE及其他近期基线方法。最后,我们证明可通过继续预训练将预训练的RoPE模型转化为PaTH模型。
原文摘要 · Abstract (English)
The attention mechanism is a core primitive in modern large language models (LLMs) and AI more broadly. Since attention by itself is permutation-invariant, position encoding is essential for modeling structured domains such as language. Rotary position encoding (RoPE) has emerged as the de facto standard approach for position encoding and is part of many modern LLMs. However, in RoPE the key/query transformation between two elements in a sequence is only a function of their relative position and otherwise independent of the actual input. This limits the expressivity of RoPE-based transformers. This paper describes PaTH, a flexible data-dependent position encoding scheme based on accumulated products of Householder(like) transformations, where each transformation is data-dependent, i.e., a function of the input. We derive an efficient parallel algorithm for training through exploiting a compact representation of products of Householder matrices, and implement a FlashAttention-style blockwise algorithm. Across both targeted synthetic benchmarks and moderate-scale real-world language modeling experiments, we find that PaTH improves upon RoPE and other recent baselines. Finally, we show that we can convert pretrained RoPE transformers into PaTH with continued pretraining.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。