arXiv:2409.09708cs.CVcs.LG2024-09CVPR被引 11

为视觉Transformer设计分层稀疏配置,显著降低计算量且几乎不损失精度。

ELSA: Exploiting Layer-wise N:M Sparsity for Vision Transformer Acceleration

  • 按层定制N:M稀疏度,适配支持混合稀疏的加速器
  • Swin-B与DeiT-B模型推理耗时减少2.9倍,精度损失极小
  • 适合部署在支持稀疏计算的硬件上的ViT模型优化

N:M稀疏是近年来一种受越来越多加速器支持的模型压缩方法,可加速深度神经网络中的稀疏矩阵乘法。现有方法通常对网络所有层采用统一的稀疏设置,或仅根据每层参数量启发式确定分层配置。然而,针对视觉变换器(ViTs)的分层定制化N:M稀疏配置研究仍较少,尤其是当其由参数量相同的变换块组成时。为此,本文提出ELSA(Exploiting Layer-wise N:M Sparsity for ViTs),综合考虑加速器支持的所有N:M稀疏级别及预期吞吐量提升,实现对混合稀疏的支持。该方法在牺牲微小精度的前提下,显著降低内存占用和推理时间。例如,在ImageNet上,ELSA使Swin-B和DeiT-B模型的FLOPs降低2.9倍,同时保持极低的精度下降。代码将在论文接收后公开。

原文摘要 · Abstract (English)

$N{:}M$ sparsity is an emerging model compression method supported by more and more accelerators to speed up sparse matrix multiplication in deep neural networks. Most existing $N{:}M$ sparsity methods compress neural networks with a uniform setting for all layers in a network or heuristically determine the layer-wise configuration by considering the number of parameters in each layer. However, very few methods have been designed for obtaining a layer-wise customized $N{:}M$ sparse configuration for vision transformers (ViTs), which usually consist of transformer blocks involving the same number of parameters. In this work, to address the challenge of selecting suitable sparse configuration for ViTs on $N{:}M$ sparsity-supporting accelerators, we propose ELSA, Exploiting Layer-wise $N{:}M$ Sparsity for ViTs. Considering not only all $N{:}M$ sparsity levels supported by a given accelerator but also the expected throughput improvement, our methodology can reap the benefits of accelerators supporting mixed sparsity by trading off negligible accuracy loss with both memory usage and inference time reduction for ViT models. For instance, our approach achieves a noteworthy 2.9$\times$ reduction in FLOPs for both Swin-B and DeiT-B with only a marginal degradation of accuracy on ImageNet. Our code will be released upon paper acceptance.

视觉Transformer稀疏加速模型压缩N:M稀疏

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