Abstract: Transformers yield state-of-the-art results across many tasks. However, their heuristically designed architecture impose huge computational costs during inference. This work aims on challenging the common design philosophy of the Vision Transformer (ViT) model with uniform dimension across all the stacked blocks in a model stage, where we redistribute the parameters both across transformer blocks and between different structures within the block via the first systematic attempt on global structural pruning. Dealing with diverse ViT structural components, we derive a novel Hessian-based structural pruning criteria comparable across all layers and structures, with latency-aware regularization for direct latency reduction. Performing iterative pruning on the DeiT-Base model leads to a new architecture family called NViT (Novel ViT), with a novel parameter redistribution that utilizes parameters more efficiently. On ImageNet-1K, NViT-Base achieves a 2.6x FLOPs reduction, 5.1x parameter reduction, and 1.9x run-time speedup over the DeiT-Base model in a near lossless manner. Smaller NViT variants achieve more than 1% accuracy gain at the same throughput of the DeiT Small/Tiny variants, as well as a lossless 3.3x parameter reduction over the SWIN-Small model. These results outperform prior art by a large margin. Further analysis is provided on the parameter redistribution insight of NViT, where we show the high prunability of ViT models, distinct sensitivity within ViT block, and unique parameter distribution trend across stacked ViT blocks. Our insights provide viability for a simple yet effective parameter redistribution rule towards more efficient ViTs for off-the-shelf performance boost.
Introduction: Challenging the Uniform Blueprint
Most Vision Transformers (ViTs), such as the standard ViT and DeiT, follow a design heuristic inherited from Natural Language Processing: every transformer block within a stage maintains the same embedding dimension, number of attention heads, and MLP expansion ratio. While this uniformity simplifies architecture design, it is inherently inefficient for computer vision tasks where different layers may capture features of varying complexity.
This research challenges the "uniform dimension" status quo by introducing a framework for Global Structural Pruning. The authors argue that different components—such as Query/Key projections, Value projections, and Feed-Forward Networks (MLPs)—contribute disproportionately to the model's final performance. By systematically redistributing parameters across the entire model, they aim to maximize the accuracy-efficiency trade-off.
Methodology: Global Structural Pruning
The proposed pruning pipeline moves beyond simple magnitude-based weight removal, which often fails to account for the complex interactions between transformer layers. The framework consists of three core innovations:
- Hessian-Based Importance Ranking: The researchers derive an importance score ($I_S$) based on the Hessian matrix (second-order derivatives) of the loss function. This metric measures the model's sensitivity to removing specific parameter groups. To keep this computationally feasible, they utilize a Taylor expansion trick during the fine-tuning process.
- Head Alignment and Reshaping: To maintain hardware efficiency, Multi-Head Self-Attention (MSA) weights are reshaped. This allows for pruning entire heads or specific dimensions (like QK or V) while keeping the remaining structure consistent, avoiding the "fragmented" computation that often plagues pruned models on GPUs.
- Latency-Aware Regularization: Pruning is guided by a hardware-latency lookup table. This directly penalizes components that are computationally expensive but contribute little to accuracy, steering the model toward a specific latency target on target hardware like the NVIDIA V100.
By iteratively applying this process to the DeiT-Base model, the authors discovered a new architecture family: NViT (Novel ViT).
Key Insights: The "Less-More-Less" Trend
The pruning process revealed several critical insights into how Vision Transformers actually utilize their capacity:
- Non-Uniform Sensitivity: ViTs exhibit a "less-more-less" sensitivity trend across stacked blocks. The model is most sensitive in its middle layers, suggesting that dimensions should be larger in the center of the stack and smaller at the beginning and end.
- QK vs. V Asymmetry: In the attention mechanism, Query/Key (QK) dimensions are significantly more prunable than Value (V) dimensions. This indicates that the model requires more capacity to represent features than it does to compute the attention maps themselves.
- MLP Dominance: MLP layers often demonstrate higher importance than attention components for the same latency cost, justifying a shift in parameter budget from attention heads to MLP blocks.
Performance and Results
The resulting NViT models set new benchmarks for efficient vision transformers:
- NViT-Base: Achieves 83.3% Top-1 accuracy on ImageNet-1K, matching the original DeiT-Base while delivering a 1.9× run-time speedup and a massive 5.1× reduction in parameters.
- SOTA Comparison: NViT consistently outperforms existing compression methods like AutoFormer and S2ViTE. For instance, NViT-H is 1.5× faster than AutoFormer-B while maintaining higher accuracy.
- Generalization: The pruned backbones show strong transferability, maintaining performance on downstream tasks like semantic segmentation on Cityscapes and ADE20K.
Conclusion
By moving away from uniform architectures and adopting a global, Hessian-aware pruning strategy, NViT demonstrates that current ViTs are significantly more redundant than previously thought. The discovered "less-more-less" distribution provides a simple yet effective rule for designing future, more efficient Vision Transformers. While the pruning process is computationally intensive, the resulting architectural insights offer an "off-the-shelf" performance boost for the next generation of vision models.
Summary updated