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

注意力机制即混合深度路由的全部所需

Attention Is All You Need For Mixture-of-Depths Routing

Bosch Center for Artificial Intelligence(博世人工智能中心);CISPA Helmholtz Center for Information Security(CISPA亥姆霍兹信息安全中心);University of Stuttgart(斯图加特大学);University of Tübingen(蒂宾根大学)

Advait Gadhikar, Souptik Kumar Majumdar, Niclas Popp, Piyapat Saranrittichai, Martin Rapp, Lukas Schott

AI总结:

本文提出基于注意力的混合深度路由机制 A-MoD,利用前一层注意力图进行路由决策,无需额外可训练参数,在 ImageNet 上准确率最高提升 2%,迁移学习速度最高提升 2 倍。

摘要:

深度学习的进步依赖于训练参数量越来越大的模型,这反过来又提高了计算需求。为了解决这一问题,混合深度(Mixture-of-Depths, MoD)模型被提出,其目的是仅对输入中最相关的部分动态分配计算,从而在推理和训练期间以高效率部署大参数模型。这些 MoD 模型利用路由机制来决定哪些 token 应由某一层处理,或应被跳过。然而,传统的 MoD 模型采用额外的网络层专门用于路由,这些层难以训练,并且增加了模型的复杂性和部署开销。在本文中,我们引入了一种新颖的基于注意力的路由机制 A-MoD,它利用前一层已有的注意力图来在当前层内进行路由决策。与标准路由相比,A-MoD 不引入额外的可训练参数,因此训练更高效,并且可以容易地从预训练的 transformer 模型适配而来。此外,它还能提高 MoD 模型的性能。例如,我们观察到与标准路由和 isoFLOP ViT 基线相比,在 ImageNet 上的准确率最高可提高 2%。此外,A-MoD 改善了 MoD 的训练收敛性,使迁移学习速度最高提升 2 倍。

英文摘要:

Advancements in deep learning are driven by training models with increasingly larger numbers of parameters, which in turn heightens the computational demands. To address this issue, Mixture-of-Depths (MoD) models have been proposed to dynamically assign computations only to the most relevant parts of the inputs, thereby enabling the deployment of large-parameter models with high efficiency during inference and training. These MoD models utilize a routing mechanism to determine which tokens should be processed by a layer, or skipped. However, conventional MoD models employ additional network layers specifically for the routing which are difficult to train, and add complexity and deployment overhead to the model. In this paper, we introduce a novel attention-based routing mechanism A-MoD that leverages the existing attention map of the preceding layer for routing decisions within the current layer. Compared to standard routing, A-MoD allows for more efficient training as it introduces no additional trainable parameters and can be easily adapted from pretrained transformer models. Furthermore, it can increase the performance of the MoD model. For instance, we observe up to 2% higher accuracy on ImageNet compared to standard routing and isoFLOP ViT baselines. Furthermore, A-MoD improves the MoD training convergence, leading to up to 2x faster transfer learning.

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

↑