arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2404.13648cs.CVcs.LG

用于分层视觉Transformer的数据无关模块感知剪枝

Data-independent Module-aware Pruning for Hierarchical Vision Transformers

CFAR, Agency for Science, Technology and Research, Singapore(新加坡科技研究局CFAR);IHPC, Agency for Science, Technology and Research, Singapore(新加坡科技研究局IHPC)

Yang He, Joey Tianyi Zhou

AI总结:

针对分层ViT剪枝忽略局部权重重要性和层级分布的问题,提出数据无关模块感知剪枝方法DIMAP,通过分析模块信息失真引入无需输入的新型权重度量,在Swin Transformer上实现高压缩率且几乎不损失甚至提升准确率。

摘要:

与传统ViT相比,分层视觉Transformer(ViTs)具有两大优势。首先,分层ViT通过局部自注意力机制实现了相对于图像尺寸的线性计算复杂度。其次,分层ViT通过在深层网络中合并图像块来创建分层特征图,以用于密集预测。然而,现有的剪枝方法忽略了分层ViT的独特属性,并使用权重幅值作为重要性指标。这种方法导致了两个主要缺陷。首先,“局部”注意力权重在“全局”层面进行比较,这可能导致一些“局部”重要的权重由于其“全局”相对较小的幅值而被剪枝。幅值剪枝的第二个问题是,它未能考虑网络独特的权重分布,而这些分布对于在不同分层级别提取从粗到细的特征至关重要。为了解决上述问题,我们开发了一种数据无关模块感知剪枝方法(DIMAP)来压缩分层ViT。为了确保不同分层级别的“局部”注意力权重在贡献度方面得到公平比较,我们将它们视为一个模块,并通过分析其信息失真来检验它们的贡献。此外,我们引入了一种仅基于权重且不需要输入图像的新型权重度量,从而消除了对图像块合并过程的依赖。我们的方法在ImageNet-1k分类任务上,针对不同规模的Swin Transformer验证了其有效性和优势。值得注意的是,当我们移除Swin-B的52.5% FLOPs和52.7%参数时,top-5准确率仅下降0.07%。当我们减少Swin-S的33.2% FLOPs和33.2%参数时,我们甚至能获得比原始模型相对高出0.8%的top-5准确率。代码可在:https://github.com/he-y/Data-independent-Module-Aware-Pruning 获取。

英文摘要:

Hierarchical vision transformers (ViTs) have two advantages over conventional ViTs. First, hierarchical ViTs achieve linear computational complexity with respect to image size by local self-attention. Second, hierarchical ViTs create hierarchical feature maps by merging image patches in deeper layers for dense prediction. However, existing pruning methods ignore the unique properties of hierarchical ViTs and use the magnitude value as the weight importance. This approach leads to two main drawbacks. First, the "local" attention weights are compared at a "global" level, which may cause some "locally" important weights to be pruned due to their relatively small magnitude "globally". The second issue with magnitude pruning is that it fails to consider the distinct weight distributions of the network, which are essential for extracting coarse to fine-grained features at various hierarchical levels. To solve the aforementioned issues, we have developed a Data-independent Module-Aware Pruning method (DIMAP) to compress hierarchical ViTs. To ensure that "local" attention weights at different hierarchical levels are compared fairly in terms of their contribution, we treat them as a module and examine their contribution by analyzing their information distortion. Furthermore, we introduce a novel weight metric that is solely based on weights and does not require input images, thereby eliminating the dependence on the patch merging process. Our method validates its usefulness and strengths on Swin Transformers of different sizes on ImageNet-1k classification. Notably, the top-5 accuracy drop is only 0.07% when we remove 52.5% FLOPs and 52.7% parameters of Swin-B. When we reduce 33.2% FLOPs and 33.2% parameters of Swin-S, we can even achieve a 0.8% higher relative top-5 accuracy than the original model. Code is available at: https://github.com/he-y/Data-independent-Module-Aware-Pruning

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

↑