Introduction
Recurrent Neural Networks (RNNs), such as LSTMs and GRUs, are essential for sequence-based tasks like language translation and speech recognition. However, their high memory requirements and sequential processing nature pose significant challenges for deployment on resource-constrained devices. While 1-bit binarization offers extreme compression, it often results in unacceptable accuracy loss. This paper introduces "Alternating Multi-bit Quantization," a method that achieves up to 16x memory savings and 6x faster inference on standard CPUs with minimal impact on performance.
The Quantization Challenge
Quantization aims to approximate high-precision weights ($w$) using a combination of scaled binary vectors ($\sum \alpha_i b_i$, where $b_i \in \{-1, +1\}$). Existing multi-bit approaches often rely on heuristic rules or greedy approximations that fail to capture data nuances, leading to a performance gap compared to full-precision models. The authors frame this as an optimization problem: minimizing the reconstruction error between the original weights and their quantized representation.
Proposed Method: Alternating Multi-bit Quantization
The core innovation lies in treating quantization as an alternating optimization problem. The algorithm toggles between two primary phases:
- Optimal Binary Codes via BST: When scaling coefficients ($\alpha$) are fixed, finding the optimal binary codes ($b$) is typically a hard discrete optimization problem. The authors discovered that this can be solved efficiently using a Binary Search Tree (BST). This transformation from a "brute force" search to a structured search makes multi-bit quantization mathematically grounded.
- Alternating Minimization: With binary codes fixed, the scaling coefficients are updated using a standard least-squares approach. In practice, only two cycles of this alternating process are required to achieve high-precision approximations. For LSTMs, weights are quantized row-by-row to provide additional flexibility, while activations are quantized on-the-fly during inference.
Experimental Results
The method was evaluated on language modeling (PTB, WikiText-2, Text8) and image classification (MNIST, CIFAR-10) benchmarks. The "Alternating" approach consistently outperformed state-of-the-art quantization methods across all bit-widths.
Performance and Efficiency
As shown in the comparative results, the proposed method significantly reduces the Relative Mean Squared Error (MSE) compared to uniform or greedy methods. For instance, 2-bit quantization achieved ~16x memory savings and ~6x real-world speedup on CPUs. Notably, 3-bit models sometimes outperformed full-precision originals, suggesting that quantization can act as a form of regularization.
On a standard Intel Xeon CPU, the quantization overhead is minimal, accounting for only 1.7% to 20% of total inference time, making it highly suitable for real-time applications.
Conclusion
Alternating Multi-bit Quantization provides a robust framework for shrinking RNNs without sacrificing accuracy. By leveraging BSTs for efficient code discovery and an alternating optimization strategy, the method bridges the gap between low-bit compression and high-precision performance. Future work includes extending these optimizations to specialized hardware like GPUs and FPGAs to further approach theoretical speedup limits.
Summary updated