Skip to main content
QUICK REVIEW

[论文解读] Automatic Attention Pruning: Improving and Automating Model Pruning using Attentions

Kaiqi Zhao, A. Jain|arXiv (Cornell University)|Mar 14, 2023
Advanced Neural Network ApplicationsComputer Science被引用 3
一句话总结

该论文提出了一种名为自动注意力剪枝(Automatic Attention Pruning, AAP)的新颖结构化剪枝方法,利用基于激活的注意力图来识别不重要的滤波器,并应用自适应剪枝策略,自动满足用户定义的精度、模型大小和延迟目标。AAP在CIFAR-10和ImageNet基准上实现了最先进性能,参数量最多减少89.11%,FLOPs减少80.60%,同时精度损失极小。

ABSTRACT

Pruning is a promising approach to compress deep learning models in order to deploy them on resource-constrained edge devices. However, many existing pruning solutions are based on unstructured pruning, which yields models that cannot efficiently run on commodity hardware; and they often require users to manually explore and tune the pruning process, which is time-consuming and often leads to sub-optimal results. To address these limitations, this paper presents Automatic Attention Pruning (AAP), an adaptive, attention-based, structured pruning approach to automatically generate small, accurate, and hardware-efficient models that meet user objectives. First, it proposes iterative structured pruning using activation-based attention maps to effectively identify and prune unimportant filters. Then, it proposes adaptive pruning policies for automatically meeting the pruning objectives of accuracy-critical, memory-constrained, and latency-sensitive tasks. A comprehensive evaluation shows that AAP substantially outperforms the state-of-the-art structured pruning works for a variety of model architectures. Our code is at: https://github.com/kaiqi123/Automatic-Attention-Pruning.git.

研究动机与目标

  • 解决非结构化剪枝的局限性,后者阻碍硬件加速并需要手动调参。
  • 开发一种自动化、结构化的剪枝框架,可适应多样化的用户目标,如精度、内存和延迟约束。
  • 超越仅依赖权重大小的滤波器重要性估计方法,通过利用基于激活的注意力图提升估计精度。
  • 通过基于逐层贡献的自适应阈值设定,消除迭代剪枝中的人工超参数调优。
  • 为资源受限的边缘设备部署提供硬件高效、小型化且高精度的模型。

提出的方法

  • 提出一种新颖的基于激活的注意力映射函数,通过其2D激活特征图为每个滤波器计算1D重要性得分。
  • 通过移除注意力得分最低的滤波器,实施迭代结构化剪枝,由随剪枝目标自适应调整的全局阈值引导。
  • 引入逐层阈值调整机制,通过将每层剩余参数或FLOPs相对于总模型进行归一化,实现按层差异化剪枝强度。
  • 实现三种自适应剪枝策略:FLOPs保障型、模型大小保障型和精度保障型,每种策略动态调整剪枝强度以满足用户定义的约束。
  • 使用全局阈值,根据目标指标(如FLOPs、大小、精度)迭代更新,以控制剪枝进度。
  • 在每次剪枝轮次后执行微调阶段,以恢复精度,遵循彩票结构假设(Lottery Ticket Hypothesis)框架。

实验结果

研究问题

  • RQ1基于激活的注意力图是否能为结构化剪枝提供比权重大小更准确且对输入变化更鲁棒的滤波器重要性度量?
  • RQ2如何实现结构化剪枝的自动化,以满足多样化的用户目标(精度、大小、延迟),而无需人工调参?
  • RQ3基于对模型大小和FLOPs相对贡献的逐层阈值设定,是否能提升剪枝效率与模型性能?
  • RQ4自适应剪枝策略是否在精度、参数量减少和FLOPs减少方面优于固定或启发式剪枝策略?
  • RQ5AAP在Raspberry Pi等边缘设备上能在多大程度上实现硬件效率与实际推理速度提升?

主要发现

  • 在CIFAR-10上的ResNet-56上,AAP实现79.11%的参数量减少且精度无损失,相比先前工作在减少量上领先22.81%至66.07%。
  • 在ImageNet上的ResNet-50上,相同FLOPs和参数量减少水平下,AAP相比最先进方法将精度损失减少0.08%至2.61%。
  • 在CIFAR-10上的VGG-19上,AAP在1%精度损失约束下实现89.11%的参数量减少和62.51%的FLOPs减少,相比先前方法在参数量减少上领先6.45%至29.61%。
  • 在Raspberry Pi 3B+上,VGG-16实现最高达3.60倍的推理加速,FLOPs减少73.89%,精度仅下降0.59%。
  • 注意力值对输入变化具有鲁棒性,在不同输入批次间保持稳定,验证了重要性度量的可靠性。
  • AAP支持多目标优化,在参数量减少83.11%、FLOPs减少80.60%的同时,将精度损失控制在80%减少约束下。

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。