LEAP: Learnable Pruning for Transformer-based Models

Zhewei Yao, Xiaoxia Wu, Linjian Ma, Sheng Shen, Kurt Keutzer +2 more
5/30/2021
cs.CLcs.LG
transformer-attentionquantization-pruning

Official code: yaozhewei/MLPruning (20 stars, Python, MIT, last commit 2021-06-29).

Abstract

Pruning is an effective method to reduce the memory footprint and computational cost associated with large natural language processing models. However, current pruning algorithms either only focus on one pruning category, e.g., structured pruning and unstructured, or need extensive hyperparameter tuning in order to get reasonable accuracy performance.

Show full abstract

To address these challenges, we propose LEArnable Pruning (LEAP), an effective method to gradually prune the model based on thresholds learned by gradient descent. Different than previous learnable pruning methods, which utilize $L_0$ or $L_1$ penalty to indirectly affect the final pruning ratio, LEAP introduces a novel regularization function, that directly interacts with the preset target pruning ratio. Moreover, in order to reduce hyperparameter tuning, a novel adaptive regularization coefficient is deployed to control the regularization penalty adaptively. With the new regularization term and its associated adaptive regularization coefficient, LEAP is able to be applied for different pruning granularity, including unstructured pruning, structured pruning, and hybrid pruning, with minimal hyperparameter tuning. We apply LEAP for BERT models on QQP/MNLI/SQuAD for different pruning settings. Our result shows that for all datasets, pruning granularity, and pruning ratios, LEAP achieves on-par or better results as compared to previous heavily hand-tuned methods.

View on arXivView PDF

Code Implementations(1)

MIT

MLPruning, PyTorch, NLP, BERT, Structured Pruning

202PythonMay 13, 20215 years agoMIT

Similar Papers

Cite this paper

@article{yao2021leap,
  title  = {LEAP: Learnable Pruning for Transformer-based Models},
  author = {Zhewei Yao and Xiaoxia Wu and Linjian Ma and Sheng Shen and Kurt Keutzer and Michael W. Mahoney and Yuxiong He},
  year   = {2021},
  eprint = {2105.14636},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2105.14636}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2105.14636.svg)](https://codeofpaper.com/paper/2105.14636)

Discussion