arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2601.11667cs.LGcs.AI
收藏

Distill-then-Replace: 高效的任务特定混合注意力模型构建

Distill-then-Replace: Efficient Task-Specific Hybrid Attention Model Construction

Fujitsu Research & Development Center CO., LTD(富士通研发中心有限公司);Fujitsu Research, FUJITSU LTD(富士通研究所,富士通有限公司)

Xiaojie Xia, Huigang Zhang, Chaoliang Zhong, Jun Sun, Yusuke Oishi

AI总结:

提出Distill-then-Replace (DtR)方法,通过逐块局部蒸馏和贪婪层替换策略,将预训练的全注意力模型高效转换为任务特定的混合注意力模型,无需重新训练或神经架构搜索。

摘要:

Transformer架构通过密集的全注意力机制实现了最先进的准确性,但其相对于序列长度的二次时间和内存复杂度限制了实际部署。线性注意力机制提供线性或接近线性的缩放,但通常会导致性能下降。集成全注意力和线性注意力层的混合模型有望在效率和表达能力之间取得平衡,但面临两个主要挑战:从头训练此类混合模型计算成本高,且手动设计注意力类型的最佳放置位置非常困难。我们提出DtR(Distill-then-Replace),首先通过逐块局部蒸馏将预训练的全注意力模块的权重转移到其线性注意力对应模块,然后应用贪婪层替换策略,迭代地用线性注意力块替换全注意力块,同时监控目标任务的验证性能。DtR在单次高效过程中生成任务特定的混合模型,无需昂贵的重新训练或神经架构搜索,并可应用于任何预训练的全注意力骨干网络以处理各种下游任务。

英文摘要:

Transformer architectures deliver state-of-the-art accuracy via dense full-attention, but their quadratic time and memory complexity with respect to sequence length limits practical deployment. Linear attention mechanisms offer linear or near-linear scaling yet often incur performance degradation. Hybrid models that integrate full and linear attention layers promise a balance between efficiency and expressiveness, but face two major challenges: training such hybrid models from scratch is computationally expensive, and manually designing the optimal placement of attention types is highly nontrivial. We propose DtR (Distill-then-Replace), which first transfers weights from the pretrained full-attention modules to its linear attention counterparts through blockwise local distillation, and then applies a greedy layer replacement strategy that iteratively substitutes full attention blocks with linear ones while monitoring validation performance on the target task. DtR yields a task-specific hybrid model in a single efficient pass, without costly re-training or neural architecture search, and can be applied to any pretrained full-attention backbone for diverse downstream tasks.

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

↑