[Paper Review] Alternating Multi-bit Quantization for Recurrent Neural Networks
The paper introduces alternating multi-bit quantization for RNNs to quantize both weights and activations into multiple binary codes, enabling significant memory savings and CPU inference speedups with minimal accuracy loss. It demonstrates 2-bit and 3-bit quantization on LSTM/GRU with notable improvements over prior methods and extends to image classification.
Recurrent neural networks have achieved excellent performance in many applications. However, on portable devices with limited resources, the models are often too large to deploy. For applications on the server with large scale concurrent requests, the latency during inference can also be very critical for costly computing resources. In this work, we address these problems by quantizing the network, both weights and activations, into multiple binary codes {-1,+1}. We formulate the quantization as an optimization problem. Under the key observation that once the quantization coefficients are fixed the binary codes can be derived efficiently by binary search tree, alternating minimization is then applied. We test the quantization for two well-known RNNs, i.e., long short term memory (LSTM) and gated recurrent unit (GRU), on the language models. Compared with the full-precision counter part, by 2-bit quantization we can achieve ~16x memory saving and ~6x real inference acceleration on CPUs, with only a reasonable loss in the accuracy. By 3-bit quantization, we can achieve almost no loss in the accuracy or even surpass the original model, with ~10.5x memory saving and ~3x real inference acceleration. Both results beat the exiting quantization works with large margins. We extend our alternating quantization to image classification tasks. In both RNNs and feedforward neural networks, the method also achieves excellent performance.
Motivation & Objective
- Reduce memory footprint and latency of recurrent neural networks for deployment on resource-constrained devices and servers with high concurrency.
- Quantize both weights and activations into multi-bit binary codes using a principled optimization approach.
- Show that alternating minimization yields high-precision quantization with low computational overhead and competitive accuracy across tasks.
- Demonstrate effectiveness on LSTM and GRU language models and extend to image classification tasks.
Proposed method
- Formulate multi-bit quantization as an optimization problem with binary codes {-1,+1} and learn coefficients and codes.
- Observation that once quantization coefficients are fixed, binary codes can be efficiently derived by binary search tree (BST).
- Apply alternating minimization: fix coefficients to optimize codes, then fix codes to optimize coefficients; use greedy initialization and two alternating cycles in practice.
- Quantize weights row-by-row in RNNs, and quantize activations online during inference.
- Implement binary multiplication kernels on CPUs and exploit parallelism by concatenating binary codes for efficient matrix-vector products.
- Train with straight-through estimates for gradients in a bi-level optimization setup and apply clipping to keep weights within [-1,1].
Experimental results
Research questions
- RQ1Can alternating multi-bit quantization close the performance gap between quantized and full-precision RNNs for language modeling?
- RQ2How do 2-bit and 3-bit quantizations affect memory, speed, and perplexity across LSTM/GRU on PTB, WikiText-2, and Text8 datasets?
- RQ3Is the approach generalizable to image classification tasks beyond RNNs?
- RQ4What are the computational trade-offs and practical acceleration gains on CPU hardware?
Key findings
- 2-bit quantization yields ~16x memory savings and ~6x CPU inference speed-up with reasonable accuracy loss on LSTM/GRU language models.
- 3-bit quantization achieves almost no accuracy loss (or improvement in some cases) with ~10.5x memory saving and ~3x speed-up.
- Alternating quantization consistently outperforms prior multi-bit methods (Uniform, Balanced, Greedy, Refined) across PTB, WikiText-2, and Text8 datasets.
- Row-wise quantization of weights plus online activation quantization enables practical acceleration on CPU hardware.
- The approach also yields favorable results on image classification, indicating method generality beyond RNNs.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.