Abstract
Image Super-Resolution (SR) Transformers, while high-performing, present significant deployment challenges due to their massive computational requirements. We present 2DQuant, a novel two-stage post-training quantization (PTQ) framework designed to compress SR Transformers to 2–4 bits. By utilizing Distribution-Oriented Bound Initialization (DOBI) and Distillation Quantization Calibration (DQC), 2DQuant achieves up to 5.08× speedup and 3.60× compression. Notably, the framework maintains high visual fidelity and occasionally corrects aliasing errors present in full-precision models.
Introduction
Image Super-Resolution (SR) aims to reconstruct high-resolution (HR) images from low-resolution (LR) counterparts. While Vision Transformers (ViTs) like SwinIR have established new benchmarks in this field, their high parameter counts hinder deployment on edge devices. Model quantization, specifically post-training quantization (PTQ), offers a path to efficiency by converting 32-bit floating-point weights and activations into low-bit integers. However, SR is a precision-sensitive task where standard quantization often introduces blurring artifacts and significant PSNR drops. 2DQuant addresses these issues by accounting for the unique, long-tailed, and asymmetric activation distributions inherent in Transformer architectures.
Methodology
2DQuant employs a dual-stage approach to optimize clipping bounds from coarse to fine granularity:
1. Distribution-Oriented Bound Initialization (DOBI)
Standard clipping methods often fail on Transformer activations, which are frequently asymmetric (e.g., after Softmax or GELU layers). DOBI utilizes a fast Mean Squared Error (MSE) search strategy to initialize clipping bounds. By treating symmetric and asymmetric distributions distinctly, DOBI ensures that the critical information in the distribution's center is preserved despite the presence of extreme outliers in the long tails.
2. Distillation Quantization Calibration (DQC)
Following initialization, DQC fine-tunes the clipping bounds using a knowledge distillation framework. The original full-precision (FP) model serves as a teacher, guiding the quantized "student" model. By minimizing the discrepancy between their respective feature maps and final outputs, the quantized model learns to retain the high-frequency details necessary for sharp edge reconstruction.
Experimental Results
2DQuant was evaluated on standard SR benchmarks including Set5, Set14, B100, Urban100, and Manga109 using the DF2K dataset for calibration.
Quantitative results show a massive improvement over previous state-of-the-art (SOTA) PTQ methods. For instance, on the Set5 dataset (×2 scale), 2DQuant at 2-bit quantization achieved a 4.52dB PSNR increase over prior SOTA. Qualitatively, 2DQuant avoids the edge diffusion and distorted artifacts common in other low-bit methods.
Key Insights
- Quantization as a Denoising Filter: A surprising finding is that 2DQuant can produce visually superior results to the full-precision model. In cases of high-frequency aliasing, the restricted bit-width of the quantized model effectively filters out incorrect noise, allowing it to reconstruct the true underlying pattern more accurately than the FP model.
- Layer Sensitivity: The researchers found that shallow layers are significantly more sensitive to quantization than deeper layers, necessitating more precise clipping bounds at the network's entry points to maintain overall image quality.
Conclusion
2DQuant demonstrates that aggressive 2-bit and 4-bit quantization is viable for Transformer-based Super-Resolution. By acknowledging the specific distributional characteristics of Transformers and employing distillation-based calibration, the framework provides a robust solution for deploying high-quality SR models on resource-constrained hardware.
Summary updated