arXiv:2410.04798cs.CL2024-10ACL被引 14

将注意力分数视为特征图,用卷积提升长序列外推能力

DAPE V2: Process Attention Score as Feature Map for Length Extrapolation

  • 把注意力分数当特征图,用卷积处理跨头相邻分数
  • 在多个数据集上显著提升长序列外推性能
  • 适合关注Transformer可扩展性与结构改进的研究者

注意力机制是Transformer的核心组件,用于不同词元间的交互。传统方法仅通过键-查询点积计算注意力分数,但本文实验发现,即使不使用位置编码,仅在注意力分数上增加MLP也能带来性能提升,暗示了点积方式存在表达能力局限。本文将注意力视为特征图,引入卷积操作(对不同注意力头间相邻分数进行处理),将其长序列外推问题转化为可理解的特征图处理问题。大量实验证明,该方法显著提升Transformer性能,为模型演化提供了新思路。

原文摘要 · Abstract (English)

The attention mechanism is a fundamental component of the Transformer model, contributing to interactions among distinct tokens, in contrast to earlier feed-forward neural networks. In general, the attention scores are determined simply by the key-query products. However, this work's occasional trial (combining DAPE and NoPE) of including additional MLPs on attention scores without position encoding indicates that the classical key-query multiplication may limit the performance of Transformers. In this work, we conceptualize attention as a feature map and apply the convolution operator (for neighboring attention scores across different heads) to mimic the processing methods in computer vision. Specifically, the main contribution of this paper is identifying and interpreting the Transformer length extrapolation problem as a result of the limited expressiveness of the naive query and key dot product, and we successfully translate the length extrapolation issue into a well-understood feature map processing problem. The novel insight, which can be adapted to various attention-related models, reveals that the current Transformer architecture has the potential for further evolution. Extensive experiments demonstrate that treating attention as a feature map and applying convolution as a processing method significantly enhances Transformer performance.

注意力机制长序列外推Transformer

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。