Introduction
Vision Transformers (ViTs) have established themselves as state-of-the-art architectures for a wide array of computer vision tasks. However, their deployment in resource-constrained environments remains challenging due to high computational costs. While previous research has largely focused on the self-attention mechanism as the primary bottleneck—leading to various token-pruning and token-merging strategies—this paper identifies a different culprit: the Feedforward Network (FFN) layers.
As ViTs scale, the number of tokens typically remains constant while the channel dimensions expand. Because FFN complexity scales quadratically with these feature channels, they become the dominant latency bottleneck in large models, accounting for over 53% of inference time in architectures like ViT-Large. RePaViT addresses this by applying structural reparameterization to FFN layers, allowing for significant inference-time acceleration without sacrificing accuracy.
Methodology: The Channel Idle Mechanism
Structural reparameterization involves training a complex architecture and mathematically collapsing it into a simpler, more efficient form for inference. While successful in Convolutional Neural Networks (CNNs), ViTs have resisted this because the non-linear activation functions (such as GELU) situated between linear projections in an FFN prevent weight merging.
RePaViT overcomes this through a novel "channel idle mechanism":
- Partial Activation: During training, only a subset of feature channels (e.g., 25%) passes through the non-linear activation function.
- The Linear Bypass: The remaining channels (e.g., 75%) bypass the activation function entirely, creating a purely linear pathway.
- Normalization Adjustments: Standard LayerNorms are replaced with BatchNorms, and an additional BatchNorm is placed before the second linear projection to stabilize training.
- Post-Training Reparameterization: Because the idle pathway is entirely linear, the two consecutive linear projections can be mathematically multiplied and collapsed into a single, smaller linear transformation during inference.
This approach allows RePaViT to be the first method to directly reparameterize the intrinsic FFN layers of a standard ViT, rather than just auxiliary convolutional layers.
Experimental Results
Image Classification and Scalability
Evaluated on ImageNet-1k, RePaViT demonstrates remarkable scaling properties. In large-scale models, the parameter redundancy is high enough that the channel idle mechanism acts as an effective regularizer. RePa-ViT-Large and RePa-ViT-Huge achieved inference speedups of 66.8% and 68.7%, respectively. Surprisingly, these speedups were accompanied by accuracy gains of +1.7% and +1.1% over vanilla baselines. With a 75% idle ratio, the FFN computational complexity (GMACs) drops to just 37.5% of the original count.
Downstream Tasks and Foundation Models
The benefits of RePaViT extend beyond classification. On the MSCOCO dataset for object detection, RePa-Swin-Base reduced latency by 18.7% while improving Average Precision (AP). In semantic segmentation on ADE20K, the method maintained competitive performance with significantly lower latency. Furthermore, when applied to CLIP (RePa-CLIP-ViT-B/16) trained on LAION-400M, the method improved inference speed by 24.7% and boosted zero-shot ImageNet accuracy by 0.8%.
Discussion and Limitations
Unlike sparse pruning methods that require specialized hardware to realize speedups, RePaViT produces a dense, structurally regular model that works out-of-the-box on general-purpose GPUs.
However, the authors note a significant limitation regarding model size. RePaViT is not suitable for "tiny" architectures; for instance, RePa-DeiT-Tiny saw a sharp accuracy drop from 72.1% to 64.2%. Small models lack the channel redundancy required to sacrifice 75% of their non-linear transformations.
Conclusion
RePaViT provides a scalable solution for accelerating large-scale Vision Transformers by targeting the FFN bottleneck. By leveraging structural reparameterization and the channel idle mechanism, it achieves substantial speedups and accuracy improvements in large models. Future work may involve extending this mechanism to other massive architectures, such as the Segment Anything Model (SAM) or Large Language Models (LLMs), which share similar FFN-heavy structures.
Summary updated