用注意力图做路由,让大模型更省力高效
Attention Is All You Need For Mixture-of-Depths Routing
- 用前层注意力图直接决定哪些输入要处理,无需额外参数
- 在ImageNet上比传统路由高2%准确率,相同算力下表现更好
- 训练更快收敛,迁移学习速度提升2倍,适合部署大模型
深度学习的发展依赖于参数量更大的模型,但计算成本随之上升。为应对这一问题,混合深度(Mixture-of-Depths, MoD)模型通过动态分配计算,仅处理输入中相关部分,从而在推理和训练中实现高效部署。传统MoD模型依赖专用路由网络,难以训练且增加复杂性。本文提出基于注意力的路由机制A-MoD,利用前一层的注意力图进行当前层的路由决策。相比标准路由,A-MoD不引入额外可训练参数,可轻松从预训练Transformer模型迁移,训练更高效。实验显示,其在ImageNet上比标准路由最高提升2%准确率,且在同算力条件下优于ViT基线模型;同时显著加速模型训练收敛,迁移学习速度最快提升2倍。
原文摘要 · Abstract (English)
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.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。