Command Palette
Search for a command to run...
Ofir Zafrir Ariel Larey Guy Boudoukh Haihao Shen Moshe Wasserblat

Abstract
Transformer-based language models are applied to a wide range of applications in natural language processing. However, they are inefficient and difficult to deploy. In recent years, many compression algorithms have been proposed to increase the implementation efficiency of large Transformer-based models on target hardware. In this work we present a new method for training sparse pre-trained Transformer language models by integrating weight pruning and model distillation. These sparse pre-trained models can be used to transfer learning for a wide range of tasks while maintaining their sparsity pattern. We demonstrate our method with three known architectures to create sparse pre-trained BERT-Base, BERT-Large and DistilBERT. We show how the compressed sparse pre-trained models we trained transfer their knowledge to five different downstream natural language tasks with minimal accuracy loss. Moreover, we show how to further compress the sparse models' weights to 8bit precision using quantization-aware training. For example, with our sparse pre-trained BERT-Large fine-tuned on SQuADv1.1 and quantized to 8bit we achieve a compression ratio of $40$X for the encoder with less than $1\%$ accuracy loss. To the best of our knowledge, our results show the best compression-to-accuracy ratio for BERT-Base, BERT-Large, and DistilBERT.
Code Repositories
Benchmarks
| Benchmark | Methodology | Metrics |
|---|---|---|
| natural-language-inference-on-multinli-dev | DistilBERT-uncased-PruneOFA (90% unstruct sparse, QAT Int8) | Matched: 78.8 Mismatched: 80.4 |
| natural-language-inference-on-multinli-dev | BERT-Base-uncased-PruneOFA (85% unstruct sparse, QAT Int8) | Matched: 81.4 Mismatched: 82.51 |
| natural-language-inference-on-multinli-dev | BERT-Base-uncased-PruneOFA (85% unstruct sparse) | Matched: 82.71 Mismatched: 83.67 |
| natural-language-inference-on-multinli-dev | DistilBERT-uncased-PruneOFA (90% unstruct sparse) | Matched: 80.68 Mismatched: 81.47 |
| natural-language-inference-on-multinli-dev | DistilBERT-uncased-PruneOFA (85% unstruct sparse, QAT Int8) | Matched: 80.66 Mismatched: 81.14 |
| natural-language-inference-on-multinli-dev | BERT-Large-uncased-PruneOFA (90% unstruct sparse) | Matched: 83.74 Mismatched: 84.2 |
| natural-language-inference-on-multinli-dev | BERT-Base-uncased-PruneOFA (90% unstruct sparse) | Matched: 81.45 Mismatched: 82.43 |
| natural-language-inference-on-multinli-dev | BERT-Large-uncased-PruneOFA (90% unstruct sparse, QAT Int8) | Matched: 83.47 Mismatched: 84.08 |
| natural-language-inference-on-multinli-dev | DistilBERT-uncased-PruneOFA (85% unstruct sparse) | Matched: 81.35 Mismatched: 82.03 |
| question-answering-on-squad11-dev | DistilBERT-uncased-PruneOFA (90% unstruct sparse, QAT Int8) | EM: 75.62 F1: 83.87 |
| question-answering-on-squad11-dev | BERT-Large-uncased-PruneOFA (90% unstruct sparse, QAT Int8) | EM: 83.22 F1: 90.02 |
| question-answering-on-squad11-dev | BERT-Base-uncased-PruneOFA (85% unstruct sparse) | EM: 81.1 F1: 88.42 |
| question-answering-on-squad11-dev | DistilBERT-uncased-PruneOFA (85% unstruct sparse) | EM: 78.1 F1: 85.82 |
| question-answering-on-squad11-dev | BERT-Base-uncased-PruneOFA (85% unstruct sparse, QAT Int8) | EM: 80.84 F1: 88.24 |
| question-answering-on-squad11-dev | BERT-Large-uncased-PruneOFA (90% unstruct sparse) | EM: 83.35 F1: 90.2 |
| question-answering-on-squad11-dev | DistilBERT-uncased-PruneOFA (85% unstruct sparse, QAT Int8) | EM: 77.03 F1: 85.13 |
| question-answering-on-squad11-dev | DistilBERT-uncased-PruneOFA (90% unstruct sparse) | EM: 76.91 F1: 84.82 |
| question-answering-on-squad11-dev | BERT-Base-uncased-PruneOFA (90% unstruct sparse) | EM: 79.83 F1: 87.25 |
Build AI with AI
From idea to launch — accelerate your AI development with free AI co-coding, out-of-the-box environment and best price of GPUs.