arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2108.09193cs.CL
收藏

Smart Bird:可学习稀疏注意力的高效和有效的Transformer

Smart Bird: Learnable Sparse Attention for Efficient and Effective Transformer

Tsinghua University(清华大学);Microsoft Research Asia(微软亚洲研究院);Microsoft STC Asia(微软亚太研发集团)

Chuhan Wu, Fangzhao Wu, Tao Qi, Binxing Jiao, Daxin Jiang, Yongfeng Huang, Xing Xie

摘要:

Transformer在NLP方面取得了巨大的成功。但是,Transformer中自注意力机制的二次复杂性使其在处理长序列时效率低下。许多现有的作品都在探索通过计算稀疏的自我注意力而不是密集的自我注意力来加速Transformers,后者通常关注某些位置的代币或随机选择的代币。然而,手动选择的或随机的令牌对于上下文建模可能是无信息的。在本文中,我们提出了智能鸟,这是一个高效和有效的Transformer与可学习的稀疏注意。在Smart Bird中,我们首先使用单头低维Transformer计算草图注意力矩阵,旨在发现令牌之间潜在的重要交互。然后,我们根据从草图的注意力矩阵导出的概率得分对标记对进行采样,以针对不同的注意力头部生成不同的稀疏注意力索引矩阵。最后,我们根据索引矩阵选择标记嵌入,形成稀疏注意网络的输入。在六个不同任务的基准数据集上进行的大量实验验证了Smart Bird在文本建模中的效率和有效性。

英文摘要:

Transformer has achieved great success in NLP. However, the quadratic complexity of the self-attention mechanism in Transformer makes it inefficient in handling long sequences. Many existing works explore to accelerate Transformers by computing sparse self-attention instead of a dense one, which usually attends to tokens at certain positions or randomly selected tokens. However, manually selected or random tokens may be uninformative for context modeling. In this paper, we propose Smart Bird, which is an efficient and effective Transformer with learnable sparse attention. In Smart Bird, we first compute a sketched attention matrix with a single-head low-dimensional Transformer, which aims to find potential important interactions between tokens. We then sample token pairs based on their probability scores derived from the sketched attention matrix to generate different sparse attention index matrices for different attention heads. Finally, we select token embeddings according to the index matrices to form the input of sparse attention networks. Extensive experiments on six benchmark datasets for different tasks validate the efficiency and effectiveness of Smart Bird in text modeling.

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

↑