LPViT: Low-Power Semi-structured Pruning for Vision Transformers

Kaixin Xu, Zhe Wang, Chunyun Chen, Xue Geng, Jie Lin, Xulei Yang, Min Wu, Xiaoli Li, Weisi Lin · OpenReview

Abstract

Vision transformers (ViTs) have emerged as a promising alternative to convolutional neural networks for various image analysis tasks, offering comparable or superior performance. However, one significant drawback of ViTs is their resource-intensive nature, leading to increased memory footprint, computation complexity, and power consumption. To democratize this high-performance technology and make it more environmentally friendly, it is essential to compress ViT models, reducing their resource requirements while maintaining high performance. In this paper, we introduce a new block-structured pruning to address the resource-intensive issue for ViTs, offering a balanced trade-off between accuracy and hardware acceleration. Unlike unstructured pruning or channel-wise structured pruning, block pruning leverages the block-wise structure of linear layers, resulting in more efficient matrix multiplications. To optimize this pruning scheme, our paper proposes a novel hardware-aware learning objective that simultaneously maximizes speedup and minimizes power consumption during inference, tailored to the block sparsity structure. This objective eliminates the need for empirical look-up tables and focuses solely on reducing parametrized layer connections. Moreover, our paper provides a lightweight algorithm to achieve post-training pruning for ViTs, utilizing second-order Taylor approximation and empirical optimization to solve the proposed hardware-aware objective. Extensive experiments on ImageNet are conducted across various ViT architectures, including DeiT-B and DeiT-S, demonstrating competitive performance with other pruning methods and achieving a remarkable balance between accuracy preservation and power savings. Especially, we achieve up to 3.93x and 1.79x speedups on dedicated hardware and GPUs respectively for DeiT-B, and also observe an inference power reduction by 1.4x on real-world GPUs.

The Pruning Dilemma

Vision Transformers (ViTs) have revolutionized computer vision, often outperforming traditional Convolutional Neural Networks (CNNs). However, they come with a heavy "tax": they are incredibly resource-intensive, demanding high memory, massive computational power, and significant electricity. This makes them difficult to deploy on "edge" devices like smartphones or embedded sensors.

To fix this, researchers use pruning—removing redundant parts of the model. But there’s a catch in the existing landscape:

  1. Unstructured Pruning (removing individual neurons) keeps accuracy high but is difficult for hardware to accelerate because the remaining "sparse" math is irregular.
  2. Structured Pruning (removing entire rows/columns) is very fast on hardware but often "breaks" the model's intelligence, leading to sharp drops in accuracy.
Trade-off between accuracy and hardware efficiency for different pruning strategies.

LPViT introduces a "Goldilocks" approach: semi-structured block pruning. By removing small, fixed-size blocks of weights, the method aligns with how modern hardware (like GPUs) performs matrix multiplication, offering a superior trade-off between speed and performance preservation.

The LPViT Framework

The LPViT (Low-Power Vision Transformer) framework focuses on three key technical innovations to optimize model compression:

  • Block-Structured Pruning: Instead of pruning single weights, weights are grouped into 2D blocks (e.g., 16x16 or 32x32). If a block’s importance score is low, the entire block is removed.
  • Hardware-Aware Objective: Most pruning methods only minimize the change in model output. LPViT adds a specific penalty term for power consumption ($\beta \mathcal{L}_{power}$). This allows the algorithm to prioritize pruning layers that contribute most to power drain.
  • Efficient Optimization: To decide which blocks to cut, the authors use a second-order Taylor approximation of the loss function. They approximate the "Hessian" matrix using an Empirical Fisher information matrix, utilizing a lightweight algorithm that updates importance scores in linear time.
The LPViT pruning pipeline, incorporating power constraints and block-structured selection.

Key Insights and Results

The researchers evaluated LPViT on ImageNet-1K for classification and Cityscapes for semantic segmentation. The results across various ViT architectures (DeiT-S, DeiT-B, Swin-T) were significant:

  • Accuracy Boost: On DeiT-Small, the pruned model actually achieved 80.69% Top-1 accuracy, which is higher than the original unpruned model (79.8%), despite having 50% fewer FLOPs.
  • Massive Speedups: The method achieved a 3.93× speedup on dedicated RISC-V hardware (ViTA) and a 1.79× speedup on NVIDIA A100 GPUs for DeiT-Base.
  • Energy Efficiency: Inference power consumption was reduced by 1.4× on real-world GPUs.
  • Layer Sensitivity: The algorithm automatically discovered that "projection layers" in Transformer blocks are highly redundant, while the "classification head" is critical and should remain largely intact.

Conclusion and Future Work

LPViT demonstrates that power consumption can be treated as a first-class citizen in model optimization. By utilizing block-sparse structures, it bridges the gap between theoretical compression and real-world hardware acceleration. While the current work focuses on weight pruning, the authors note that LPViT is compatible with other techniques like token pruning or layer skipping. As hardware and software libraries (like NVIDIA's cuSPARSE) continue to evolve their support for block-sparse operations, methods like LPViT will be essential for deploying high-performance AI on power-constrained devices.

Summary updated

BibTeX
@inproceedings{xu2024lpvit,
  author = {Kaixin Xu and Zhe Wang and Chunyun Chen and Xue Geng and Jie Lin and Xulei Yang and Min Wu and Xiaoli Li and Weisi Lin},
  title = {{LPViT: Low-Power Semi-structured Pruning for Vision Transformers}},
  booktitle = {European Conference on Computer Vision},
  year = {2024},
  doi = {10.1007/978-3-031-73209-6\_16},
}
Figure