Vision Transformers (ViT) have shown their competitive advantages performance-wise compared to convolutional neural networks (CNNs) though they often come with high computational costs. To this end, previous methods explore different attention patterns by limiting a fixed number of spatially nearby tokens to accelerate the ViT's multi-head self-attention (MHSA) operations. However, such structured attention patterns limit the token-to-token connections to their spatial relevance, which disregards learned semantic connections from a full attention mask. In this work, we propose a novel approach to learn instance-dependent attention patterns, by devising a lightweight connectivity predictor module to estimate the connectivity score of each pair of tokens. Intuitively, two tokens have high connectivity scores if the features are considered relevant either spatially or semantically. As each token only attends to a small number of other tokens, the binarized connectivity masks are often very sparse by nature and therefore provide the opportunity to accelerate the network via sparse computations. Equipped with the learned unstructured attention pattern, sparse attention ViT (Sparsifiner) produces a superior Pareto-optimal trade-off between FLOPs and top-1 accuracy on ImageNet compared to token sparsity. Our method reduces 48% to 69% FLOPs of MHSA while the accuracy drop is within 0.4%. We also show that combining attention and token sparsity reduces ViT FLOPs by over 60%.


翻译:视觉Transformer(ViT)表现出了它们在性能方面与卷积神经网络(CNN)相比的竞争优势,但往往具有高计算成本。为此,先前的方法通过限制一定数量的空间相邻令牌来探索不同的注意力模式,以加速ViT的多头自注意(MHSA)操作。然而,这些结构化的注意力模式将令牌到令牌的连接限制在它们的空间相关性中,忽视了从完整的注意力蒙版中学习的语义连接。在这项工作中,我们提出了一种学习实例依赖的注意力模式的新方法,通过设计一个轻量级的连接性预测模块来估计每对令牌的连接性得分。直观地说,如果认为特征在空间或语义上相关,则两个标记具有较高的连接得分。由于每个标记仅与少量其他标记相关,因此二值化的连接掩码通常具有很高的稀疏性,并因此提供了通过稀疏计算加速网络的机会。配备了学习的非结构化注意力模式,稀疏注意ViT(Sparsifiner)在ImageNet上的FLOPs和top-1准确性之间产生了优越的 Pareto 最优折衷。与token稀疏相比,我们的方法减少了MHSA的48%到69%的FLOPs,而准确度下降在0.4%以内。我们还表明,注意力和标记稀疏的结合将ViT的FLOPs降低了60%以上。

0
下载
关闭预览

相关内容

【ICML2022】基于自适应上下文池化的高效表示学习
专知会员服务
19+阅读 · 2022年7月9日
CVPR2022 | Sparse Transformer刷新点云目标检测的SOTA
专知会员服务
23+阅读 · 2022年3月9日
【CVPR2022】三元组对比学习的视觉-语言预训练
专知会员服务
31+阅读 · 2022年3月3日
专知会员服务
42+阅读 · 2021年8月20日
近期必读的5篇AI顶会CVPR 2020 GNN (图神经网络) 相关论文
专知会员服务
78+阅读 · 2020年3月3日
强化学习三篇论文 避免遗忘等
CreateAMind
19+阅读 · 2019年5月24日
Hierarchically Structured Meta-learning
CreateAMind
23+阅读 · 2019年5月22日
深度自进化聚类:Deep Self-Evolution Clustering
我爱读PAMI
14+阅读 · 2019年4月13日
逆强化学习-学习人先验的动机
CreateAMind
15+阅读 · 2019年1月18日
强化学习的Unsupervised Meta-Learning
CreateAMind
17+阅读 · 2019年1月7日
Unsupervised Learning via Meta-Learning
CreateAMind
41+阅读 · 2019年1月3日
【推荐】YOLO实时目标检测(6fps)
机器学习研究会
20+阅读 · 2017年11月5日
可解释的CNN
CreateAMind
17+阅读 · 2017年10月5日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2013年12月31日
国家自然科学基金
1+阅读 · 2013年12月31日
国家自然科学基金
1+阅读 · 2013年12月31日
国家自然科学基金
1+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2009年12月31日
国家自然科学基金
0+阅读 · 2008年12月31日
Arxiv
17+阅读 · 2022年2月23日
SlowFast Networks for Video Recognition
Arxiv
19+阅读 · 2018年12月10日
Arxiv
19+阅读 · 2018年3月28日
VIP会员
相关资讯
强化学习三篇论文 避免遗忘等
CreateAMind
19+阅读 · 2019年5月24日
Hierarchically Structured Meta-learning
CreateAMind
23+阅读 · 2019年5月22日
深度自进化聚类:Deep Self-Evolution Clustering
我爱读PAMI
14+阅读 · 2019年4月13日
逆强化学习-学习人先验的动机
CreateAMind
15+阅读 · 2019年1月18日
强化学习的Unsupervised Meta-Learning
CreateAMind
17+阅读 · 2019年1月7日
Unsupervised Learning via Meta-Learning
CreateAMind
41+阅读 · 2019年1月3日
【推荐】YOLO实时目标检测(6fps)
机器学习研究会
20+阅读 · 2017年11月5日
可解释的CNN
CreateAMind
17+阅读 · 2017年10月5日
相关基金
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2013年12月31日
国家自然科学基金
1+阅读 · 2013年12月31日
国家自然科学基金
1+阅读 · 2013年12月31日
国家自然科学基金
1+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2009年12月31日
国家自然科学基金
0+阅读 · 2008年12月31日
Top
微信扫码咨询专知VIP会员