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

Zero-TPrune:通过利用预训练 Transformer 中的注意力图实现零样本 Token 剪枝

Zero-TPrune: Zero-Shot Token Pruning through Leveraging of the Attention Graph in Pre-Trained Transformers

Princeton University(普林斯顿大学)

Hongjie Wang, Bhishma Dedhia, Niraj K. Jha

AI总结:

本文提出零样本 token 剪枝方法 Zero-TPrune,利用预训练 Transformer 注意力图和 WPR 算法综合评估 token 重要性与相似性,无需微调即可显著降低视觉 Transformer 的 FLOPs 并提升吞吐量。

摘要:

由于推理成本随输入序列中 token 数量呈二次方增长,Transformer 模型在边缘设备上的部署正变得越来越具有挑战性。Token 剪枝因其易于部署到各种 Transformer 主干网络上,正在成为应对这一挑战的新兴解决方案。然而,大多数 token 剪枝方法都需要计算成本高昂的微调,这在许多边缘部署场景中并不可取。在本研究中,我们提出 Zero-TPrune,这是首个在执行 token 剪枝时同时考虑 token 重要性和相似性的零样本方法。该方法利用预训练 Transformer 模型的注意力图,通过我们提出的 Weighted Page Rank(WPR)算法生成 token 的重要性分布。该分布进一步指导 token 划分,以实现高效的基于相似性的剪枝。由于消除了微调开销,Zero-TPrune 能够以可忽略的计算成本剪枝大型模型,在不同剪枝配置之间切换而无需任何计算成本,并高效执行超参数调优。我们通过将 Zero-TPrune 应用于多种视觉 Transformer 主干网络并在 ImageNet 上进行测试,评估其在视觉任务上的性能。在不进行任何微调的情况下,Zero-TPrune 将 DeiT-S 的 FLOPs 成本降低 34.7%,并将其吞吐量提高 45.3%,而精度损失仅为 0.4%。与需要微调的最先进剪枝方法相比,Zero-TPrune 不仅消除了剪枝后的微调需求,而且这样做时精度损失仅为 0.1%。与最先进的免微调剪枝方法相比,在相似的 FLOPs 预算下,Zero-TPrune 将精度损失最高降低 49%。项目网页:https://jha-lab.github.io/zerotprune。

英文摘要:

Deployment of Transformer models on edge devices is becoming increasingly challenging due to the exponentially growing inference cost that scales quadratically with the number of tokens in the input sequence. Token pruning is an emerging solution to address this challenge due to its ease of deployment on various Transformer backbones. However, most token pruning methods require computationally expensive fine-tuning, which is undesirable in many edge deployment cases. In this work, we propose Zero-TPrune, the first zero-shot method that considers both the importance and similarity of tokens in performing token pruning. It leverages the attention graph of pre-trained Transformer models to produce an importance distribution for tokens via our proposed Weighted Page Rank (WPR) algorithm. This distribution further guides token partitioning for efficient similarity-based pruning. Due to the elimination of the fine-tuning overhead, Zero-TPrune can prune large models at negligible computational cost, switch between different pruning configurations at no computational cost, and perform hyperparameter tuning efficiently. We evaluate the performance of Zero-TPrune on vision tasks by applying it to various vision Transformer backbones and testing them on ImageNet. Without any fine-tuning, Zero-TPrune reduces the FLOPs cost of DeiT-S by 34.7% and improves its throughput by 45.3% with only 0.4% accuracy loss. Compared with state-of-the-art pruning methods that require fine-tuning, Zero-TPrune not only eliminates the need for fine-tuning after pruning but also does so with only 0.1% accuracy loss. Compared with state-of-the-art fine-tuning-free pruning methods, Zero-TPrune reduces accuracy loss by up to 49% with similar FLOPs budgets. Project webpage: https://jha-lab.github.io/zerotprune.

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

↑