STAT: Shrinking Transformers After Training

Megan Flynn, Alexander Wang, Dean Edward Alvarez, Christopher De Sa, Anil Damle
5/29/2024
cs.LGcs.AIcs.CL

No confident code implementation found for this paper.

Abstract

We present STAT: a simple algorithm to prune transformer models without any fine-tuning. STAT eliminates both attention heads and neurons from the network, while preserving accuracy by calculating a correction to the weights of the next layer. Each layer block in the network is compressed using a series of principled matrix factorizations that preserve the network structure. Our entire algorithm takes minutes to compress BERT, and less than three hours to compress models with 7B parameters using a single GPU. Using only several hundred data examples, STAT preserves the output of the network and improves upon existing gradient-free pruning methods. It is even competitive with methods that include significant fine-tuning. We demonstrate our method on both encoder and decoder architectures, including BERT, DistilBERT, and Llama-2 using benchmarks such as GLUE, Squad, WikiText2.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{flynn2024stat,
  title  = {STAT: Shrinking Transformers After Training},
  author = {Megan Flynn and Alexander Wang and Dean Edward Alvarez and Christopher De Sa and Anil Damle},
  year   = {2024},
  eprint = {2406.00061},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2406.00061v1}
}

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

Discussion