arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2504.06949cs.LGcs.AIcs.CL
收藏

Forgetting Transformer的自适应计算剪枝

Adaptive Computation Pruning for the Forgetting Transformer

Mila - Quebec AI Institute(魁北克人工智能研究所);Université de Montréal(蒙特利尔大学)

Zhixuan Lin, Johan Obando-Ceron, Xu Owen He, Aaron Courville

AI总结:

针对Forgetting Transformer注意力头快速遗忘的特性,提出自适应计算剪枝(ACP)方法,动态剪枝被遗忘门强烈衰减的依赖计算,在无性能损失下将注意力运行时间减少50%至70%,显著提升训练吞吐量。

摘要:

最近提出的Forgetting Transformer(FoX)将遗忘门引入softmax注意力中,与基于RoPE的标准Transformer相比,表现出持续更好或持平的性能。值得注意的是,FoX中的许多注意力头倾向于快速遗忘,导致它们在每个时间步的输出主要依赖局部上下文。基于这一观察,我们为FoX提出了自适应计算剪枝(ACP),该方法动态剪枝那些被遗忘门强烈衰减的输入-输出依赖计算。具体而言,我们的方法通过动态设置剪枝阈值执行可证明安全的剪枝,保证被剪枝的注意力权重微乎其微。我们将ACP应用于使用FoX的语言模型预训练,结果表明在不同模型规模和上下文长度下,它持续将softmax注意力中的FLOPs和内存访问次数减少约70%,从而使注意力运行时间减少约50%至70%(即2-3倍加速),端到端训练吞吐量提升约10%至40%。此外,更长的上下文长度能带来更大的计算节省。所有这些速度提升均未造成任何性能下降。我们的代码可在https://github.com/zhixuan-lin/forgetting-transformer获取。

英文摘要:

The recently proposed Forgetting Transformer (FoX) incorporates a forget gate into softmax attention and has shown consistently better or on-par performance compared to the standard RoPE-based Transformer. Notably, many attention heads in FoX tend to forget quickly, causing their output at each timestep to rely primarily on local context. Based on this observation, we propose Adaptive Computation Pruning (ACP) for FoX, a method that dynamically prunes computations involving input-output dependencies that are strongly decayed by the forget gate. In particular, our method performs provably safe pruning via a dynamically set pruning threshold that guarantees the pruned attention weights are negligible. We apply ACP to language model pretraining with FoX and show it consistently reduces the number of FLOPs and memory accesses in softmax attention by around 70% across different model sizes and context lengths, resulting in a roughly 50% to 70% reduction in attention runtime (or a 2-3$\times$ speedup) and a roughly 10% to 40% increase in end-to-end training throughput. Furthermore, longer context lengths yield greater computational savings. All these speed improvements are achieved without any performance degradation. Our code is available at https://github.com/zhixuan-lin/forgetting-transformer.

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

↑