Block Pruning For Faster Transformers

François Lagunas, Ella Charlaix, Victor Sanh, Alexander M. Rush
9/10/2021
cs.LGcs.CL
transformer-attention

Official code: huggingface/nn_pruning (409 stars, Jupyter Notebook, Apache-2.0, last commit 2022-06-21).

Abstract

Pre-training has improved model accuracy for both classification and generation tasks at the cost of introducing much larger and slower models. Pruning methods have proven to be an effective way of reducing model size, whereas distillation methods are proven for speeding up inference.

Show full abstract

We introduce a block pruning approach targeting both small and fast models. Our approach extends structured methods by considering blocks of any size and integrates this structure into the movement pruning paradigm for fine-tuning. We find that this approach learns to prune out full components of the underlying model, such as attention heads. Experiments consider classification and generation tasks, yielding among other results a pruned model that is a 2.4x faster, 74% smaller BERT on SQuAD v1, with a 1% drop on F1, competitive both with distilled models in speed and pruned models in size.

View on arXivView PDF

Code Implementations(1)

Apache-2.0

Prune a model while finetuning or training.

40962Jupyter Notebook, JavaScriptDec 22, 20204 years agoApache-2.0

Similar Papers

Cite this paper

@article{lagunas2021block,
  title  = {Block Pruning For Faster Transformers},
  author = {François Lagunas and Ella Charlaix and Victor Sanh and Alexander M. Rush},
  year   = {2021},
  eprint = {2109.04838},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2109.04838}
}

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/2109.04838.svg)](https://codeofpaper.com/paper/2109.04838)

Discussion