Abstract
Vision Transformers (ViTs) have revolutionized computer vision but are computationally demanding, complicating deployment on edge devices. Post-training quantization (PTQ) is a key technique for model compression, yet standard linear methods struggle with the "power-law" activation distributions typical of ViTs at low bit-widths (≤4 bits). This paper introduces AdaLog, an adaptive logarithm quantizer that optimizes the quantization base for each layer. Combined with a Fast Progressive Combining Search (FPCS) strategy, AdaLog enables high-accuracy 3-bit and 4-bit quantization. Experiments on ImageNet show that AdaLog significantly outperforms existing PTQ methods, maintaining functional accuracy even at 3-bit widths where previous state-of-the-art methods collapse.
Introduction
Vision Transformers (ViTs) come with a heavy computational price tag. While Post-Training Quantization (PTQ) is a popular solution for compression without retraining, it typically fails for ViTs at low bit-widths. The primary challenge lies in the activations following Softmax and GELU layers, which follow a "power-law-like" distribution where most values are very small and only a few are large. Standard linear quantizers, which space levels evenly, are highly inefficient for such distributions. Existing logarithmic quantizers often use fixed bases (like 2 or $\sqrt{2}$), which lack the flexibility to fit different layers, leading to massive accuracy drops at 3 or 4 bits.
Methodology
The authors propose two primary innovations to address these limitations: the Adaptive Logarithm (AdaLog) Quantizer and the Fast Progressive Combining Search (FPCS) strategy.
Adaptive Logarithm (AdaLog) Quantizer
Unlike previous methods that use a fixed base, AdaLog searches for an optimal base $b$ for each layer. To ensure this remains hardware-friendly, the log base is approximated using rational numbers, and the de-quantization process is implemented via table lookups and bit-shifts. Furthermore, the authors introduce Bias Reparameterization to handle GELU activations, which are often slightly negative. By shifting the distribution by approximately 0.17, the inputs are made non-negative before quantization, preventing information loss.
Fast Progressive Combining Search (FPCS)
Finding optimal quantization parameters (scaling factors and log bases) usually requires an expensive brute-force grid search. FPCS is inspired by beam search; it starts with a coarse search and progressively narrows the search space in stages. This achieves high precision with linear complexity $O(pn)$ rather than quadratic $O(n^2)$, making the calibration process significantly faster.
Experimental Results
The method was evaluated on ImageNet using ViT, DeiT, and Swin Transformer architectures, utilizing a tiny calibration set of only 32 unlabeled images. AdaLog significantly outperforms existing state-of-the-art PTQ methods like RepQ-ViT and APQ-ViT, especially as bit-width decreases:
- 4-bit (W4/A4): On ViT-B, AdaLog achieved 79.68% accuracy, outperforming the previous best by over 11%.
- 3-bit (W3/A3): While previous methods collapsed to ~0.1% accuracy, AdaLog maintained 37.91% on ViT-B and 69.75% on Swin-B.
- Efficiency: FPCS reached higher accuracy than alternating search methods while being significantly faster than brute-force approaches (e.g., 4.1 minutes vs. 183 minutes on a single GPU).
Conclusion
AdaLog demonstrates that non-uniform, adaptive logarithmic quantization is essential for low-bit ViT deployment. By optimizing the base per layer and utilizing efficient search strategies, it pushes the boundaries of PTQ into the 3-bit regime. While a gap remains compared to full-precision models at extreme low bits, AdaLog provides a robust framework for hardware-friendly Transformer compression. Future work involves validating these gains on specific ASIC or FPGA hardware and extending the method to other non-Gaussian activation distributions.
Summary updated