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

具有线性复杂度的自适应多分辨率注意

Adaptive Multi-Resolution Attention with Linear Complexity

Institute of Informatics, LMU Munich(慕尼黑大学信息学研究所);Corporate Technology, Siemens AG(西门子公司企业技术部)

Yao Zhang, Yunpu Ma, Thomas Seidl, Volker Tresp

摘要:

Transformers在序列建模的众多任务中改进了最先进的技术。除了关于序列长度的二次计算和存储器复杂度之外,自注意机制仅处理相同尺度的信息,即,所有注意力头的分辨率相同,导致Transformer的功率有限。为了解决这个问题,我们提出了一种新的和有效的结构,称为自适应多分辨率注意力(AdaMRA),它线性缩放到序列长度的时间和空间。具体来说,我们利用多分辨率的多头注意力机制,使注意力头捕捉长距离的上下文信息,在一个由粗到细的方式。此外,为了捕捉不同注意粒度的查询表示和线索之间的潜在关系,我们留下了使用哪种注意分辨率来查询的决定,这进一步提高了模型的容量相比,香草Transformer。为了降低复杂度,我们采用内核注意力而不降低性能。在几个基准测试上的大量实验证明了我们的模型的有效性和效率,实现了最先进的性能效率内存权衡。为了促进科学界对AdaMRA的利用,代码的实现将公开提供。

英文摘要:

Transformers have improved the state-of-the-art across numerous tasks in sequence modeling. Besides the quadratic computational and memory complexity w.r.t the sequence length, the self-attention mechanism only processes information at the same scale, i.e., all attention heads are in the same resolution, resulting in the limited power of the Transformer. To remedy this, we propose a novel and efficient structure named Adaptive Multi-Resolution Attention (AdaMRA for short), which scales linearly to sequence length in terms of time and space. Specifically, we leverage a multi-resolution multi-head attention mechanism, enabling attention heads to capture long-range contextual information in a coarse-to-fine fashion. Moreover, to capture the potential relations between query representation and clues of different attention granularities, we leave the decision of which resolution of attention to use to query, which further improves the model's capacity compared to vanilla Transformer. In an effort to reduce complexity, we adopt kernel attention without degrading the performance. Extensive experiments on several benchmarks demonstrate the effectiveness and efficiency of our model by achieving a state-of-the-art performance-efficiency-memory trade-off. To facilitate AdaMRA utilization by the scientific community, the code implementation will be made publicly available.

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

↑