Abstract
Network quantization is arguably one of the most practical network compression approaches for reducing the enormous resource consumption of modern deep neural networks. They usually require diverse and subtle design choices for specific architecture and tasks. Instead, the QwT method is a simple and general approach which introduces lightweight additional structures to improve quantization. But QwT incurs extra parameters and latency. More importantly, QwT is not compatible with many hardware platforms. In this paper, we propose QwT-v2, which not only enjoys all advantages of but also resolves major defects of QwT. By adopting a very lightweight channel-wise affine compensation (CWAC) module, QwT-v2 introduces significantly less extra parameters and computations compared to QwT, and at the same time matches or even outperforms QwT in accuracy. The compensation module of QwT-v2 can be integrated into quantization inference engines with little effort, which not only effectively removes the extra costs but also makes it compatible with most existing hardware platforms.
Introduction
Deep Learning models are becoming increasingly massive, making them difficult to deploy on edge devices like smartphones or embedded sensors. Network Quantization—the process of converting high-precision numbers (FP32) into low-bit integers (like INT8 or INT4)—is the primary solution for saving memory and power. However, practitioners often face a trade-off: Quantization-Aware Training (QAT) offers high accuracy but requires massive compute resources, while Post-Training Quantization (PTQ) is fast but often leads to significant accuracy degradation, particularly at 4-bit widths.
The original QwT framework attempted to bridge this gap by adding compensation matrices. However, it increased model size by up to 30% and introduced latency that many specialized AI chips could not handle. QwT-v2 evolves this framework to provide the accuracy of QwT with almost zero inference overhead.
Methodology: Channel-Wise Affine Compensation
The breakthrough of QwT-v2 lies in Channel-Wise Affine Compensation (CWAC). The authors identified two key architectural shifts that simplify the error correction process:
- From Pre to Post-Compensation: While the original QwT tried to predict block errors based on inputs, QwT-v2 focuses on the output. This "post-compensation" bypasses complex non-linearities like Attention or ReLU, making the error significantly easier to model.
- The "Diagonal" Discovery: By visualizing error distributions, the researchers found that quantization errors are primarily concentrated on the diagonal of the compensation matrix. This allows the replacement of massive $N \times N$ matrices with simple $1 \times N$ vectors for channel-wise scaling ($\alpha$) and shifting ($\beta$).
Architectural Integration and Hardware Compatibility
To ensure broad applicability, CWAC modules are integrated into standard Transformer components, specifically within the Multi-Head Self-Attention (MHSA) and Feed-Forward Network (FFN) blocks. Because the compensation is a simple linear transformation ($y = \alpha x + \beta$), it can be mathematically absorbed into existing quantization parameters (scale and zero-point) during deployment. This results in zero extra latency on standard hardware platforms.
Key Results
QwT-v2 consistently matches or outperforms the original QwT across a variety of domains while maintaining a significantly smaller footprint:
- Image Classification: On 4-bit Swin-T, QwT-v2 achieved 77.1% Top-1 accuracy, a notable improvement over the base quantization (73.0%).
- Storage Efficiency: For a Swin-T model, QwT-v2 added only 0.3 MB of extra parameters, a 14x reduction compared to the 4.3 MB required by the original QwT.
- Large Language Models: On LLaMA3-8B, QwT-v2 improved average scores across eight common-sense reasoning tasks compared to standard GPTQ baselines.
- Generative Models: In 4-bit Diffusion models (DiT), QwT-v2 achieved a state-of-the-art FID score of 5.72, significantly enhancing image quality.
Conclusion and Future Work
QwT-v2 demonstrates that complex linear algebra is not required to fix quantization errors; simple per-channel scaling and shifting are sufficient. While highly effective, the authors note that compensation is currently more impactful in earlier network layers than deeper ones. Future research will investigate this layer sensitivity to further optimize module placement and efficiency. By ensuring compatibility with standard integer-only arithmetic, QwT-v2 provides a "plug-and-play" solution for modern inference engines.
Summary updated