arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2402.04239cs.LG
收藏

CAST:使用代理令牌的聚类自注意力用于高效Transformer

CAST: Clustering Self-Attention using Surrogate Tokens for Efficient Transformers

Department of Computer Science(计算机科学系);University of Twente(特文特大学)

Adjorn van Engelenhoven, Nicola Strisciuglio, Estefanía Talavera

AI总结:

本文提出CAST,一种基于代理令牌的聚类自注意力机制,将复杂度从二次降至线性,在长序列任务中性能不逊于基线,且时间与内存效率更高。

摘要:

Transformer架构已被证明是处理广泛任务的有力工具。它基于自注意力机制,而自注意力本质上是一种计算成本高昂的操作,具有二次计算复杂度:内存使用和计算时间随输入序列长度的增加而二次增长,从而限制了Transformer的应用。在这项工作中,我们提出了一种新颖的基于代理令牌的聚类自注意力机制(CAST),以优化注意力计算并实现高效Transformer。CAST利用可学习的代理令牌构建聚类亲和矩阵,用于对输入序列进行聚类并生成新颖的聚类摘要。每个聚类内部的自注意力随后与其他聚类的聚类摘要相结合,使得信息能够在整个输入序列中流动。CAST通过将复杂度从$O(N^2)$降低到$O(αN)$来提高效率,其中N是序列长度,α是根据聚类数量和每个聚类的样本数确定的常数。我们表明,在长序列建模任务上,CAST的表现优于或与基线Transformer相当,同时在时间和内存效率方面也取得了比其他高效Transformer更高的结果。

英文摘要:

The Transformer architecture has shown to be a powerful tool for a wide range of tasks. It is based on the self-attention mechanism, which is an inherently computationally expensive operation with quadratic computational complexity: memory usage and compute time increase quadratically with the length of the input sequences, thus limiting the application of Transformers. In this work, we propose a novel Clustering self-Attention mechanism using Surrogate Tokens (CAST), to optimize the attention computation and achieve efficient transformers. CAST utilizes learnable surrogate tokens to construct a cluster affinity matrix, used to cluster the input sequence and generate novel cluster summaries. The self-attention from within each cluster is then combined with the cluster summaries of other clusters, enabling information flow across the entire input sequence. CAST improves efficiency by reducing the complexity from $O(N^2)$ to $O(αN)$ where N is the sequence length, and α is constant according to the number of clusters and samples per cluster. We show that CAST performs better than or comparable to the baseline Transformers on long-range sequence modeling tasks, while also achieving higher results on time and memory efficiency than other efficient transformers.

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

↑