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

Router-Tuning:一种在Transformer中实现动态深度的简单有效方法

Router-Tuning: A Simple and Effective Approach for Enabling Dynamic-Depth in Transformers

University of Maryland, College Park(马里兰大学 College Park 分校);Tencent AI Lab(腾讯AI实验室)

Shwai He, Tao Ge, Guoheng Sun, Bowei Tian, Xiaoyang Wang, Dong Yu

AI总结:

提出Router-Tuning方法,仅微调路由器以降低训练成本,并引入MindSkip动态深度注意力机制,在保持性能的同时实现21%加速和仅0.2%性能下降。

摘要:

传统的Transformer模型通常为每个输入token分配固定数量的计算资源,导致计算效率低下且存在不必要的计算。为了解决这一问题,研究者引入了深度混合(Mixture of Depths,MoD)方法,通过跳过较不重要的层来动态调整计算深度。尽管该方法前景广阔,但当前的MoD方法仍探索不足,面临两大主要挑战:(1)训练成本高,因为需要训练整个模型以及决定跳过哪些层的路由器;(2)当重要层被跳过时,存在性能下降的风险。针对第一个问题,我们提出了Router-Tuning方法,该方法仅在小数据集上微调路由器,大幅降低了全模型训练带来的计算开销。针对第二个挑战,我们提出了MindSkip,它部署了具有动态深度的注意力机制(Attention with Dynamic Depths)。该方法在显著提升计算和内存效率的同时,保持了模型的性能。大量实验表明,我们的方法在显著提升计算效率的同时取得了有竞争力的结果,例如实现了21%的加速,且性能仅下降0.2%。代码已发布在https://github.com/CASE-Lab-UMD/Router-Tuning。

英文摘要:

Traditional transformer models often allocate a fixed amount of computational resources to every input token, leading to inefficient and unnecessary computation. To address this, the Mixture of Depths (MoD) was introduced to dynamically adjust the computational depth by skipping less important layers. Despite its promise, current MoD approaches remain under-explored and face two main challenges: (1) high training costs due to the need to train the entire model along with the routers that determine which layers to skip, and (2) the risk of performance degradation when important layers are bypassed. In response to the first issue, we propose Router-Tuning, a method that fine-tunes only the router on a small dataset, drastically reducing the computational overhead associated with full model training. For the second challenge, we propose MindSkip, which deploys Attention with Dynamic Depths. This method preserves the model's performance while significantly enhancing computational and memory efficiency. Extensive experiments demonstrate that our approach delivers competitive results while dramatically improving the computation efficiency, e.g., 21\% speedup and only a 0.2\% performance drop. The code is released at https://github.com/CASE-Lab-UMD/Router-Tuning.

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

↑