arXiv:2507.19175cs.CV2025-07被引 1

用注意力权重方差识别冗余图像块,高效提升ViT推理速度

Patch Pruning Strategy Based on Robust Statistical Measures of Attention Weight Diversity in Vision Transformers

  • 基于多头注意力权重方差评估图像块重要性,实现动态剪枝
  • 在保持准确率前提下,推理吞吐量显著提升,支持训练与推理阶段应用
  • 采用鲁棒统计量如中位数绝对偏差,对噪声更敏感,适合实际部署

视觉变换器(Vision Transformers)的核心机制是多头自注意力,通过计算所有输入图像块之间的成对关系来提取特征,但其计算复杂度随图像块数量呈二次增长。为缓解此问题,本文提出一种基于注意力权重多样性的块剪枝策略:通过分析不同注意力头间权重的方差,判断每个图像块的重要性。该方法利用多头设计中捕捉多子空间注意力模式的思路,可无缝应用于训练与推理阶段,在微调预训练模型等场景下既提升吞吐量又保持分类精度。进一步发现,使用中位数绝对偏差等鲁棒统计量替代方差,同样能获得优异性能。此外,引入重叠图像块嵌入后,模型性能优于传统全块方法,且吞吐量相当。

原文摘要 · Abstract (English)

Multi-head self-attention is a distinctive feature extraction mechanism of vision transformers that computes pairwise relationships among all input patches, contributing significantly to their high performance. However, it is known to incur a quadratic computational complexity with respect to the number of patches. One promising approach to address this issue is patch pruning, which improves computational efficiency by identifying and removing redundant patches. In this work, we propose a patch pruning strategy that evaluates the importance of each patch based on the variance of attention weights across multiple attention heads. This approach is inspired by the design of multi-head self-attention, which aims to capture diverse attention patterns across different subspaces of feature representations. The proposed method can be easily applied during both training and inference, and achieves improved throughput while maintaining classification accuracy in scenarios such as fine-tuning with pre-trained models. In addition, we also found that using robust statistical measures, such as the median absolute deviation in place of variance, to assess patch importance can similarly lead to strong performance. Furthermore, by introducing overlapping patch embeddings, our method achieves better performance with comparable throughput to conventional approaches that utilize all patches.

视觉Transformer注意力剪枝高效推理图像块

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。