arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2407.18601cs.LGcs.AI
收藏

用表达性注意力重组注意力空间的几何结构

Reorganizing attention-space geometry with expressive attention

Claudius Gros

AI总结:

本文提出表达性注意力(EA),基于平方点积重组注意力空间的几何结构,在自回归任务中性能优于标准点积注意力,且无额外计算成本。

摘要:

注意力机制调节标记之间的信息传递。为此,查询向量和键向量被进行比较,通常以标量积 $\mathbf{Q}^T\mathbf{K}$ 的形式,并随后进行 softmax 归一化。在几何上,标准点积注意力(DPA)对平行/反平行的查询和键产生大/小的注意力权重。这里我们研究表达性注意力(EA),它基于 $\mathbf{Q}^T\mathbf{K}$ 的平方,即平方点积。在这种情况下,当查询和键平行或反平行时注意力增强,而在正交配置时被抑制。EA 可以引入任何基于注意力的代码中,而无需额外的计算成本或内存需求。对于一系列自回归预测任务,我们发现表达性注意力的表现至少与标准 DPA 相当。随着任务复杂度的增加,观察到 EA 以越来越大的幅度优于 DPA,这在多任务设置中同样成立。对于给定的模型规模,EA 能够在 DPA 无法达到的一系列复杂度水平上实现 100% 的性能。我们的结果表明,在注意力头的空间中重新组织匹配条件的几何结构是可能的,且不会损失性能。

英文摘要:

Attention regulates information transfer between tokens. For this, query and key vectors are compared, typically in terms of a scalar product, $\mathbf{Q}^T\mathbf{K}$, together with a subsequent softmax normalization. In geometric terms, the standard dot-product attention (DPA) leads to large/small attention weights for parallel/antiparallel queries and keys. Here we study expressive attention (EA), which is based on $(\mathbf{Q}^T\mathbf{K})^2$, the squared dot product. In this case, attention is enhanced when query and key are either parallel or antiparallel, and suppressed for orthogonal configurations. EA can be introduced into any attention-based code without additional compute costs or memory requirements. For a series of autoregressive prediction tasks, we find that expressive attention performs at least as well as vanilla DPA. Increasing task complexity, EA is observed to outperform DPA with increasing margins, which also holds for multi-task settings. For a given model size, EA manages to achieve 100% performance for a range of complexity levels not accessible to DPA. Our results show that it is possible to reorganize the geometry of the matching condition in the space of attention heads without loss of performance.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑