Table of Contents
Fetching ...

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

Ning-Chi Huang, Chi-Chih Chang, Wei-Cheng Lin, Endri Taka, Diana Marculescu, Kai-Chiang Wu

TL;DR

This work proposes ELSA, Exploiting Layer-wise N:M Sparsity for ViTs, which 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.

Abstract

$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.

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

TL;DR

This work proposes ELSA, Exploiting Layer-wise N:M Sparsity for ViTs, which 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.

Abstract

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 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 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 sparsity-supporting accelerators, we propose ELSA, Exploiting Layer-wise Sparsity for ViTs. Considering not only all 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 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.
Paper Structure (32 sections, 2 equations, 13 figures, 6 tables, 3 algorithms)

This paper contains 32 sections, 2 equations, 13 figures, 6 tables, 3 algorithms.

Figures (13)

  • Figure 1: Three categories of methodologies for $N{:}M$ semi-structured pruning
  • Figure 2: Accelerator for mixed sparsity where weight matrix are pruned by $N{:}M$ semi-structured pruning
  • Figure 3: A classic transformer block and the matrices to be sparsified in our methodology
  • Figure 4: Shared weight values and dynamic masking for each layer in a transformer-based model (including all linear projection and multi-layer perceptron layers)
  • Figure 5: Example of updating the shared weight with 2:4 sparsity being applied
  • ...and 8 more figures