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

DynamicViT:具有动态令牌稀疏化的高效视觉Transformer

DynamicViT: Efficient Vision Transformers with Dynamic Token Sparsification

Tsinghua University(清华大学);UCLA(加州大学洛杉矶分校);University of Washington(华盛顿大学)

Yongming Rao, Wenliang Zhao, Benlin Liu, Jiwen Lu, Jie Zhou, Cho-Jui Hsieh

摘要:

注意力在视觉Transformer中是稀疏的。我们观察到,视觉Transformer的最终预测仅基于信息量最大的令牌的子集,这足以用于准确的图像识别。基于这一观察,我们提出了一个动态的令牌稀疏化框架,逐步修剪冗余令牌和动态的基础上的输入。具体来说,我们设计了一个轻量级的预测模块来估计每个令牌的重要性分数,给定当前的功能。该模块被添加到不同的层,以分层地修剪冗余令牌。为了以端到端的方式优化预测模块,我们提出了一种注意力掩蔽策略,通过阻止令牌与其他令牌的交互来区分修剪令牌。得益于自注意的性质,非结构化稀疏令牌仍然是硬件友好的,这使得我们的框架很容易实现实际的加速。通过对66%的输入标记进行分层修剪,该方法大大降低了31%~37%的FLOP,提高了40%以上的吞吐量,而对于各种视觉Transformer,准确率的下降在0.5%以内。配备了动态令牌稀疏化框架,与ImageNet上最先进的CNN和视觉Transformer相比,DynamicViT模型可以实现非常有竞争力的复杂性/准确性权衡。代码可在https://github.com/raoyongming/DynamicViT上获得

英文摘要:

Attention is sparse in vision transformers. We observe the final prediction in vision transformers is only based on a subset of most informative tokens, which is sufficient for accurate image recognition. Based on this observation, we propose a dynamic token sparsification framework to prune redundant tokens progressively and dynamically based on the input. Specifically, we devise a lightweight prediction module to estimate the importance score of each token given the current features. The module is added to different layers to prune redundant tokens hierarchically. To optimize the prediction module in an end-to-end manner, we propose an attention masking strategy to differentiably prune a token by blocking its interactions with other tokens. Benefiting from the nature of self-attention, the unstructured sparse tokens are still hardware friendly, which makes our framework easy to achieve actual speed-up. By hierarchically pruning 66% of the input tokens, our method greatly reduces 31%~37% FLOPs and improves the throughput by over 40% while the drop of accuracy is within 0.5% for various vision transformers. Equipped with the dynamic token sparsification framework, DynamicViT models can achieve very competitive complexity/accuracy trade-offs compared to state-of-the-art CNNs and vision transformers on ImageNet. Code is available at https://github.com/raoyongming/DynamicViT

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

↑