Paper Reading AI Learner

SNP: Structured Neuron-level Pruning to Preserve Attention Scores

2024-04-18 03:21:28
Kyunghwan Shim, Jaewoong Yun, Shinkook Choi

Abstract

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.

Abstract (translated)

多头自注意(MSA)是 Vision Transformers(ViTs)的关键组件,已经在各种视觉任务中取得了巨大的成功。然而,它们的高计算成本和内存开销阻碍了它们在资源受限设备上的部署。传统的剪枝方法仅通过头剪枝来压缩和加速 MSA 模块,尽管头不是原子的单位。为解决这个问题,我们提出了一种新的基于图的神经元级剪枝方法,结构化神经元级剪枝(SNP)。SNP 通过剪除具有较低信息性注意分数的神经元来截断图形连接的查询和键层,同时保留整体注意分数。价值层(可以独立剪除)被剪除以消除头之间的冗余。我们提出的方法既有效地压缩了基于 Transformer 的模型,又加速了边缘设备和服务器处理器的运行速度。例如,使用 SNP 的 DeiT-Small 比原始模型快 3.1 倍,实现了性能比原模型快 21.94% 和更高的速度。此外,SNP 成功地与传统的头或块剪枝方法结合使用。使用头剪枝的 SNP 可以将 DeiT-Base 的参数压缩 80%,并在 RTX3090 上实现 3.85 倍的推理速度,在 Jetson Nano 上实现 4.93 倍的推理速度。

URL

https://arxiv.org/abs/2404.11630

PDF

https://arxiv.org/pdf/2404.11630.pdf


Tags
3D Action Action_Localization Action_Recognition Activity Adversarial Agent Attention Autonomous Bert Boundary_Detection Caption Chat Classification CNN Compressive_Sensing Contour Contrastive_Learning Deep_Learning Denoising Detection Dialog Diffusion Drone Dynamic_Memory_Network Edge_Detection Embedding Embodied Emotion Enhancement Face Face_Detection Face_Recognition Facial_Landmark Few-Shot Gait_Recognition GAN Gaze_Estimation Gesture Gradient_Descent Handwriting Human_Parsing Image_Caption Image_Classification Image_Compression Image_Enhancement Image_Generation Image_Matting Image_Retrieval Inference Inpainting Intelligent_Chip Knowledge Knowledge_Graph Language_Model LLM Matching Medical Memory_Networks Multi_Modal Multi_Task NAS NMT Object_Detection Object_Tracking OCR Ontology Optical_Character Optical_Flow Optimization Person_Re-identification Point_Cloud Portrait_Generation Pose Pose_Estimation Prediction QA Quantitative Quantitative_Finance Quantization Re-identification Recognition Recommendation Reconstruction Regularization Reinforcement_Learning Relation Relation_Extraction Represenation Represenation_Learning Restoration Review RNN Robot Salient Scene_Classification Scene_Generation Scene_Parsing Scene_Text Segmentation Self-Supervised Semantic_Instance_Segmentation Semantic_Segmentation Semi_Global Semi_Supervised Sence_graph Sentiment Sentiment_Classification Sketch SLAM Sparse Speech Speech_Recognition Style_Transfer Summarization Super_Resolution Surveillance Survey Text_Classification Text_Generation Tracking Transfer_Learning Transformer Unsupervised Video_Caption Video_Classification Video_Indexing Video_Prediction Video_Retrieval Visual_Relation VQA Weakly_Supervised Zero-Shot