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

通过保留谱特性的令牌合并加速Transformer

Accelerating Transformers with Spectrum-Preserving Token Merging

University of Science - VNUHCM(胡志明市国家大学自然科学大学);Max Planck Research School for Intelligent Systems (IMPRS-IS)(马克斯·普朗克智能系统研究院(IMPRS-IS));University of Stuttgart(斯图加特大学);Dublin City University(都柏林城市大学);University of Queensland(昆士兰大学);University of Arkansas(阿肯色大学);MBZUAI(穆罕默德·本·扎耶德人工智能大学);German Research Center for Artificial Intelligence (DFKI)(德国人工智能研究中心);UC San Diego(加利福尼亚大学圣地亚哥分校);Oldenburg University(奥尔登堡大学);Stanford University(斯坦福大学)

Hoai-Chau Tran, Duy M. H. Nguyen, Duy M. Nguyen, Trung-Tin Nguyen, Ngan Le, Pengtao Xie, Daniel Sonntag, James Y. Zou, Binh T. Nguyen, Mathias Niepert

AI总结:

针对现有令牌合并方法损伤信息令牌、性能下降大的问题,本文提出PiToMe方法,通过能量分数识别合并高能量相似令牌簇、保留低能量孤立令牌,在减少40%-60%FLOPs的同时显著降低多任务性能下降,且理论上可保留令牌空间谱特性。

摘要:

提升Transformer架构的吞吐量是机器学习领域的重要问题,该架构是视觉与语言任务中众多前沿模型(如GPT、LLaVa)的基础组件。近期一种有效的策略是合并Transformer模型内的令牌表示,旨在降低计算与内存需求同时保持精度。已有工作提出了基于二分软匹配(BSM)的算法,该算法将令牌划分为不同集合并合并前k个最相似的令牌,但这类方法存在明显缺陷,例如对令牌划分策略敏感,且会在深层网络中损伤信息量大的令牌。本文提出了名为PiToMe的新范式,它通过一种称为能量分数的额外指标,优先保留信息量大的令牌。该分数将大的相似令牌簇识别为高能量,即潜在的合并候选对象,而较小的(独特且孤立的)簇被视为低能量并予以保留。实验结果表明,PiToMe可减少基础模型40%-60%的浮点运算量(FLOPs),同时在多项任务上展现出更优的即插即用性能:图像分类任务中,ViT-MAE-H的平均性能下降0.5%,而基线方法下降2.6%;图文检索任务中,CLIP在Flickr30k上的平均性能下降0.3%,其他方法下降4.5%;在使用LLaVa-7B的视觉问答任务中也有类似表现。此外,理论证明PiToMe在温和条件下可保留原始令牌空间的固有谱特性。

英文摘要:

Increasing the throughput of the Transformer architecture, a foundational component used in numerous state-of-the-art models for vision and language tasks (e.g., GPT, LLaVa), is an important problem in machine learning. One recent and effective strategy is to merge token representations within Transformer models, aiming to reduce computational and memory requirements while maintaining accuracy. Prior works have proposed algorithms based on Bipartite Soft Matching (BSM), which divides tokens into distinct sets and merges the top k similar tokens. However, these methods have significant drawbacks, such as sensitivity to token-splitting strategies and damage to informative tokens in later layers. This paper presents a novel paradigm called PiToMe, which prioritizes the preservation of informative tokens using an additional metric termed the energy score. This score identifies large clusters of similar tokens as high-energy, indicating potential candidates for merging, while smaller (unique and isolated) clusters are considered as low-energy and preserved. Experimental findings demonstrate that PiToMe saved from 40-60\% FLOPs of the base models while exhibiting superior off-the-shelf performance on image classification (0.5\% average performance drop of ViT-MAE-H compared to 2.6\% as baselines), image-text retrieval (0.3\% average performance drop of CLIP on Flickr30k compared to 4.5\% as others), and analogously in visual questions answering with LLaVa-7B. Furthermore, PiToMe is theoretically shown to preserve intrinsic spectral properties of the original token space under mild conditions

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

↑