Structured Pruning Learns Compact and Accurate Models

Mengzhou Xia, Zexuan Zhong, Danqi Chen
4/1/2022
278 citations
cs.CLcs.LG
distillationquantization-pruning

Official code: princeton-nlp/CoFiPruning (199 stars, Python, MIT, last commit 2023-05-09).

Abstract

The growing size of neural language models has led to increased attention in model compression. The two predominant approaches are pruning, which gradually removes weights from a pre-trained model, and distillation, which trains a smaller compact model to match a larger one.

Show full abstract

Pruning methods can significantly reduce the model size but hardly achieve large speedups as distillation. However, distillation methods require large amounts of unlabeled data and are expensive to train. In this work, we propose a task-specific structured pruning method CoFi (Coarse- and Fine-grained Pruning), which delivers highly parallelizable subnetworks and matches the distillation methods in both accuracy and latency, without resorting to any unlabeled data. Our key insight is to jointly prune coarse-grained (e.g., layers) and fine-grained (e.g., heads and hidden units) modules, which controls the pruning decision of each parameter with masks of different granularity. We also devise a layerwise distillation strategy to transfer knowledge from unpruned to pruned models during optimization. Our experiments on GLUE and SQuAD datasets show that CoFi yields models with over 10x speedups with a small accuracy drop, showing its effectiveness and efficiency compared to previous pruning and distillation approaches.

View on arXivView PDF

Code Implementations(1)

MIT

[ACL 2022] Structured Pruning Learns Compact and Accurate Models https://arxiv.org/abs/2204.00408

19931Python, Jupyter NotebookMar 30, 20223 years agoMIT
bertmodel-compressionnlppruning

Similar Papers

Cite this paper

@article{xia2022structured,
  title  = {Structured Pruning Learns Compact and Accurate Models},
  author = {Mengzhou Xia and Zexuan Zhong and Danqi Chen},
  year   = {2022},
  eprint = {2204.00408},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2204.00408}
}

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

Discussion