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

RePaViT:基于前馈网络层结构重参数化的可扩展视觉Transformer加速

RePaViT: Scalable Vision Transformer Acceleration via Structural Reparameterization on Feedforward Network Layers

DATA61, CSIRO(澳大利亚联邦科学与工业研究组织数据61研究所)

Xuwei Xu, Yang Li, Yudong Chen, Jiajun Liu, Sen Wang

AI总结:

本文发现FFN层是ViT推理延迟的主因,提出通道闲置机制实现FFN层训练后结构重参数化,构建RePaViT模型家族,在大规模模型上显著降低延迟并提升精度。

摘要:

我们发现,前馈网络(FFN)层而非注意力层,是视觉Transformer(ViT)推理延迟的主要来源,且其影响随模型尺寸增加而显著。这一发现突显了通过聚焦FFN层来优化大规模ViT效率的关键机会。在本研究中,我们提出了一种新颖的通道闲置机制,该机制在测试期间为高效的FFN层促进了训练后结构重参数化。具体而言,在每一个FFN层中,一组特征通道保持闲置并绕过非线性激活函数,从而形成一条线性路径,使得在推理期间能够进行结构重参数化。该机制产生了一系列可重参数化视觉Transformer(RePaViT),它们在各种ViT上实现了显著的延迟降低,同时伴随着可接受的精度牺牲(有时甚至是精度提升)。我们方法的收益随模型尺寸持续扩大,在更大的模型上展现出更高的速度提升,并逐步缩小精度差距甚至获得更高精度。特别地,在相同的训练策略下,RePa-ViT-Large和RePa-ViT-Huge分别享受了66.8%和68.7%的加速,以及+1.7%和+1.1%更高的top-1精度。据我们所知,RePaViT是首个在FFN层上采用结构重参数化来加速ViT的方法,我们相信它代表了高效ViT的一个极具前景的方向。源代码可在https://github.com/Ackesnal/RePaViT获取。

英文摘要:

We reveal that feedforward network (FFN) layers, rather than attention layers, are the primary contributors to Vision Transformer (ViT) inference latency, with their impact signifying as model size increases. This finding highlights a critical opportunity for optimizing the efficiency of large-scale ViTs by focusing on FFN layers. In this work, we propose a novel channel idle mechanism that facilitates post-training structural reparameterization for efficient FFN layers during testing. Specifically, a set of feature channels remains idle and bypasses the nonlinear activation function in each FFN layer, thereby forming a linear pathway that enables structural reparameterization during inference. This mechanism results in a family of ReParameterizable Vision Transformers (RePaViTs), which achieve remarkable latency reductions with acceptable sacrifices (sometimes gains) in accuracy across various ViTs. The benefits of our method scale consistently with model sizes, demonstrating greater speed improvements and progressively narrowing accuracy gaps or even higher accuracies on larger models. In particular, RePa-ViT-Large and RePa-ViT-Huge enjoy 66.8% and 68.7% speed-ups with +1.7% and +1.1% higher top-1 accuracies under the same training strategy, respectively. RePaViT is the first to employ structural reparameterization on FFN layers to expedite ViTs to our best knowledge, and we believe that it represents an auspicious direction for efficient ViTs. Source code is available at https://github.com/Ackesnal/RePaViT.

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

↑