Adapting by Pruning: A Case Study on BERT

Yang Gao, Nicolo Colombo, Wei Wang
5/7/2021
cs.LGcs.CL

Official code: yg211/bert_nli (139 stars, Python, last commit 2024-02-04).

Abstract

Adapting pre-trained neural models to downstream tasks has become the standard practice for obtaining high-quality models. In this work, we propose a novel model adaptation paradigm, adapting by pruning, which prunes neural connections in the pre-trained model to optimise the performance on the target task; all remaining connections have their weights intact.

Show full abstract

We formulate adapting-by-pruning as an optimisation problem with a differentiable loss and propose an efficient algorithm to prune the model. We prove that the algorithm is near-optimal under standard assumptions and apply the algorithm to adapt BERT to some GLUE tasks. Results suggest that our method can prune up to 50% weights in BERT while yielding similar performance compared to the fine-tuned full model. We also compare our method with other state-of-the-art pruning methods and study the topological differences of their obtained sub-networks.

View on arXivView PDF

Code Implementations(1)

yg211/bert_nliOfficial100%

A Natural Language Inference (NLI) model based on Transformers (BERT and ALBERT)

13927PythonOct 24, 20192 years ago
albertbertmixed-precision-trainingnatural-language-inferencenatural-language-processing+2 more

Similar Papers

Cite this paper

@article{gao2021adapting,
  title  = {Adapting by Pruning: A Case Study on BERT},
  author = {Yang Gao and Nicolo Colombo and Wei Wang},
  year   = {2021},
  eprint = {2105.03343},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2105.03343}
}

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

Discussion