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

Hydra Attention:高效的注意力与许多头

Hydra Attention: Efficient Attention with Many Heads

Georgia Tech(佐治亚理工学院);Meta AI

Daniel Bolya, Cheng-Yang Fu, Xiaoliang Dai, Peizhao Zhang, Judy Hoffman

摘要:

虽然Transformers已经开始主导视觉中的许多任务,但将它们应用于大图像在计算上仍然很困难。一个很大的原因是,自我注意力与标记数量成二次方关系,而标记数量又与图像大小成二次方关系。在较大的图像上(例如,1080 p),网络中超过60%的总计算量仅用于创建和应用注意力矩阵。通过引入Hydra Attention,我们朝着解决这个问题迈出了一步,这是一种非常有效的视觉Transformer(ViTs)注意力操作。巧合的是,这种效率来自于将多头注意力发挥到极致:通过使用尽可能多的注意力头,Hydra Attention在令牌和特征中都是计算线性的,没有隐藏常数,这使得它比现成的ViT-B/16中的标准自我注意力快得多。此外,Hydra Attention在ImageNet上保持了很高的准确性,在某些情况下,实际上还提高了准确性。

英文摘要:

While transformers have begun to dominate many tasks in vision, applying them to large images is still computationally difficult. A large reason for this is that self-attention scales quadratically with the number of tokens, which in turn, scales quadratically with the image size. On larger images (e.g., 1080p), over 60% of the total computation in the network is spent solely on creating and applying attention matrices. We take a step toward solving this issue by introducing Hydra Attention, an extremely efficient attention operation for Vision Transformers (ViTs). Paradoxically, this efficiency comes from taking multi-head attention to its extreme: by using as many attention heads as there are features, Hydra Attention is computationally linear in both tokens and features with no hidden constants, making it significantly faster than standard self-attention in an off-the-shelf ViT-B/16 by a factor of the token count. Moreover, Hydra Attention retains high accuracy on ImageNet and, in some cases, actually improves it.

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

↑