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

MLP 可以成为优秀的 Transformer 学习者

MLP Can Be A Good Transformer Learner

RMIT University(RMIT大学);Shanghai AI Laboratory(上海人工智能实验室);Shanghai Jiao Tong University(上海交通大学);Shenzhen Campus of Sun Yat-sen University(中山大学深圳校区);DarkMatter AI Research(DarkMatter AI研究院);University of Technology Sydney(悉尼科技大学);MBZUAI(穆罕默德·本·扎耶德人工智能大学)

Sihao Lin, Pumeng Lyu, Dongrui Liu, Tao Tang, Xiaodan Liang, Andy Song, Xiaojun Chang

AI总结:

本文提出基于熵的注意力层退化方法,将 ViT 底部块中非必要注意力层变为恒等映射并由后续 MLP 承担学习,从而在 DeiT-B 上移除40%注意力层且不损失精度。

摘要:

自注意力机制是 Transformer 的关键,但常因其计算需求而受到批评。以往的 token pruning(令牌剪枝)工作从计算冗余的角度为其方法提供依据,但仍需加载完整网络,并需要相同的内存开销。本文介绍了一种新颖策略,通过在熵考量的指导下选择性移除非必要注意力层,来简化 vision transformer 并降低计算负载。我们发现,对于底部块中的注意力层,其后续 MLP 层(即两个前馈层)能够引出相同的熵量。同时,伴随的 MLP 未被充分利用,因为与顶部块中的 MLP 相比,它们表现出更小的特征熵。因此,我们建议将无信息量的注意力层退化为恒等映射,从而将其整合到后续对应层中,使某些 transformer 块中仅保留 MLP。在 ImageNet-1k 上的实验结果表明,所提方法可移除 DeiT-B 中 40% 的注意力层,在不损失性能的情况下提高吞吐量并改善内存限制。代码可在 https://github.com/sihaoevery/lambda_vit 获取。

英文摘要:

Self-attention mechanism is the key of the Transformer but often criticized for its computation demands. Previous token pruning works motivate their methods from the view of computation redundancy but still need to load the full network and require same memory costs. This paper introduces a novel strategy that simplifies vision transformers and reduces computational load through the selective removal of non-essential attention layers, guided by entropy considerations. We identify that regarding the attention layer in bottom blocks, their subsequent MLP layers, i.e. two feed-forward layers, can elicit the same entropy quantity. Meanwhile, the accompanied MLPs are under-exploited since they exhibit smaller feature entropy compared to those MLPs in the top blocks. Therefore, we propose to integrate the uninformative attention layers into their subsequent counterparts by degenerating them into identical mapping, yielding only MLP in certain transformer blocks. Experimental results on ImageNet-1k show that the proposed method can remove 40% attention layer of DeiT-B, improving throughput and memory bound without performance compromise. Code is available at https://github.com/sihaoevery/lambda_vit.

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

↑