I-BERT: Integer-only BERT Quantization
arXiv:2101.01321
Abstract
Transformer based models, like BERT and RoBERTa, have achieved state-of-the-art results in many Natural Language Processing tasks. However, their memory footprint, inference latency, and power consumption are prohibitive efficient inference at the edge, and even at the data center. While quantization can be a viable solution for this, previous work on quantizing Transformer based models use floating-point arithmetic during inference, which cannot efficiently utilize integer-only logical units such as the recent Turing Tensor Cores, or traditional integer-only ARM processors. In this work, we propose I-BERT, a novel quantization scheme for Transformer based models that quantizes the entire inference with integer-only arithmetic. Based on lightweight integer-only approximation methods for nonlinear operations, e.g., GELU, Softmax, and Layer Normalization, I-BERT performs an end-to-end integer-only BERT inference without any floating point calculation. We evaluate our approach on GLUE downstream tasks using RoBERTa-Base/Large. We show that for both cases, I-BERT achieves similar (and slightly higher) accuracy as compared to the full-precision baseline. Furthermore, our preliminary implementation of I-BERT shows a speedup of 2.4-4.0x for INT8 inference on a T4 GPU system as compared to FP32 inference. The framework has been developed in PyTorch and has been open-sourced.
References in corpus (39)
- Distilling the Knowledge in a Neural Network
- MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications
- EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks
- Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer
- Gaussian Error Linear Units (GELUs)
- Language Models are Few-Shot Learners
- Binarized Neural Networks: Training Deep Neural Networks with Weights and Activations Constrained to +1 or -1
- FitNets: Hints for Thin Deep Nets
- DoReFa-Net: Training Low Bitwidth Convolutional Neural Networks with Low Bitwidth Gradients
- Pruning Convolutional Neural Networks for Resource Efficient Inference
- Megatron-LM: Training Multi-Billion Parameter Language Models Using Model Parallelism
- SQuAD: 100,000+ Questions for Machine Comprehension of Text
- Quantizing deep convolutional networks for efficient inference: A whitepaper
- Ternary Weight Networks
- PACT: Parameterized Clipping Activation for Quantized Neural Networks
- Pruning Filters for Efficient ConvNets
- MiniLM: Deep Self-Attention Distillation for Task-Agnostic Compression of Pre-Trained Transformers
- Q8BERT: Quantized 8Bit BERT
- Well-Read Students Learn Better: On the Importance of Pre-training Compact Models
- Distilling Task-Specific Knowledge from BERT into Simple Neural Networks
- Learned Step Size Quantization
- Reducing Transformer Depth on Demand with Structured Dropout
- Model compression via distillation and quantization
- Exploring the Regularity of Sparse Structure in Convolutional Neural Networks
- Fine-Tuning Pretrained Language Models: Weight Initializations, Data Orders, and Early Stopping
- Mixed Precision Quantization of ConvNets via Differentiable Neural Architecture Search
- Apprentice: Using Knowledge Distillation Techniques To Improve Low-Precision Network Accuracy
- TVM: An Automated End-to-End Optimizing Compiler for Deep Learning
- Training with Quantization Noise for Extreme Model Compression
- MobileBERT: a Compact Task-Agnostic BERT for Resource-Limited Devices
- Efficient 8-Bit Quantization of Transformer Neural Machine Language Translation Model
- HAWQ-V2: Hessian Aware trace-Weighted Quantization of Neural Networks
- BinaryBERT: Pushing the Limit of BERT Quantization
- Are Sixteen Heads Really Better than One?
- Movement Pruning: Adaptive Sparsity by Fine-Tuning
- LadaBERT: Lightweight Adaptation of BERT through Hybrid Model Compression
- HAWQV3: Dyadic Neural Network Quantization
- KDLSQ-BERT: A Quantized Bert Combining Knowledge Distillation with Learned Step Size Quantization
- Co-Design of Deep Neural Nets and Neural Net Accelerators for Embedded Vision Applications
Cited by in corpus (4)
- Applications and Techniques for Fast Machine Learning in Science
- Integer-Only Neural Network Quantization Scheme Based on Shift-Batch-Normalization
- On the Distribution, Sparsity, and Inference-time Quantization of Attention Values in Transformers
- Understanding and Overcoming the Challenges of Efficient Transformer Quantization