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

SNP:保留注意力分数的结构化神经元级剪枝

SNP: Structured Neuron-level Pruning to Preserve Attention Scores

Nota Inc(诺塔公司)

Kyunghwan Shim, Jaewoong Yun, Shinkook Choi

AI总结:

针对ViT中MSA模块传统头剪枝粒度粗的问题,提出图感知的结构化神经元级剪枝方法SNP,通过剪枝低信息量注意力分数的神经元实现高效压缩加速,可兼容传统剪枝方案,在多个模型与硬件上取得优异性能。

摘要:

多头自注意力(MSA)是Vision Transformers(ViTs)的核心组件,已在各类视觉任务中取得巨大成功。但其高昂的计算成本与内存占用阻碍了在资源受限设备上的部署。传统剪枝方法仅能通过头剪枝对MSA模块进行压缩与加速,而注意力头并非原子单元。为解决该问题,我们提出一种新型图感知神经元级剪枝方法——Structured Neuron-level Pruning(SNP,结构化神经元级剪枝)。SNP剪枝注意力分数信息量较低的神经元,消除头间冗余。具体而言,该方法在保留整体注意力分数的前提下,剪枝注意力分数信息量最低、存在图连接关系的查询层与键层;可独立剪枝的值层则被用于消除头间冗余。我们提出的方法可有效压缩并加速基于Transformer的模型,适用于边缘设备与服务器处理器。例如,搭载SNP的DeiT-Small运行速度是原始模型的3.1倍,性能比DeiT-Tiny快21.94%且准确率高1.12%。此外,SNP可与传统的头剪枝或块剪枝方法成功结合。结合头剪枝的SNP可将DeiT-Base的参数量与计算成本压缩80%,在RTX3090上推理速度提升3.85倍,在Jetson Nano上提升4.93倍。

英文摘要:

Multi-head self-attention (MSA) is a key component of Vision Transformers (ViTs), which have achieved great success in various vision tasks. However, their high computational cost and memory footprint hinder their deployment on resource-constrained devices. Conventional pruning approaches can only compress and accelerate the MSA module using head pruning, although the head is not an atomic unit. To address this issue, we propose a novel graph-aware neuron-level pruning method, Structured Neuron-level Pruning (SNP). SNP prunes neurons with less informative attention scores and eliminates redundancy among heads. Specifically, it prunes graphically connected query and key layers having the least informative attention scores while preserving the overall attention scores. Value layers, which can be pruned independently, are pruned to eliminate inter-head redundancy. Our proposed method effectively compresses and accelerates Transformer-based models for both edge devices and server processors. For instance, the DeiT-Small with SNP runs 3.1$\times$ faster than the original model and achieves performance that is 21.94\% faster and 1.12\% higher than the DeiT-Tiny. Additionally, SNP combine successfully with conventional head or block pruning approaches. SNP with head pruning could compress the DeiT-Base by 80\% of the parameters and computational costs and achieve 3.85$\times$ faster inference speed on RTX3090 and 4.93$\times$ on Jetson Nano.

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

↑