Introduction
Vision Transformers (ViTs) have set new benchmarks in computer vision, but their high computational and memory requirements pose significant challenges for deployment on edge devices. Post-Training Quantization (PTQ) offers a solution by converting high-precision weights and activations into low-bit integers without requiring extensive retraining. However, ViTs are notoriously difficult to quantize due to their imbalanced and non-uniform activation distributions. FIMA-Q addresses these challenges by introducing a more accurate approximation of the Fisher Information Matrix (FIM), enabling state-of-the-art performance even at ultra-low bit-widths.
The Challenge of ViT Quantization
Standard PTQ methods often rely on a "quantization loss" to guide the optimization of discrete parameters. This loss is typically formulated using the Hessian matrix, which describes the local curvature of the loss surface. Because calculating the full Hessian is computationally prohibitive for large models, many existing frameworks (such as BRECQ) utilize a diagonal approximation of the Fisher Information Matrix as a proxy.
The authors of FIMA-Q identify a critical flaw in this approach: diagonal approximations ignore the "off-diagonal" elements that represent correlations between different tokens and channels. In the context of Transformers, where self-attention mechanisms inherently rely on inter-element dependencies, discarding this information leads to significant accuracy degradation, particularly when moving to 3-bit or 4-bit precision.
Methodology: DPLR-FIM Approximation
FIMA-Q operates within a block-wise reconstruction framework, optimizing one Transformer block at a time to minimize the discrepancy between the full-precision and quantized outputs. The core innovation lies in the Diagonal Plus Low-Rank (DPLR) approximation of the FIM.
The DPLR-FIM combines two components:
- Diagonal Component: Captures the individual importance of each output element, similar to traditional methods.
- Low-Rank Component: Efficiently models the collective dependencies and correlations between elements that are typically lost.
Furthermore, the authors provide a theoretical correction to the FIM application. They demonstrate that the FIM is linearly proportional to the gradient of the KL divergence between the original and quantized distributions, rather than the square of the gradient. This insight allows for a more theoretically sound and computationally efficient loss function. To balance accuracy and speed, the method employs a Progressive Rank Increase strategy, starting with a rank-1 approximation and gradually increasing complexity during optimization.
Key Insights: Beyond Diagonal Approximations
The motivation for the DPLR approach is clearly visible when examining the structure of the Fisher Information Matrix.
As shown in the heatmaps, while the diagonal elements are the most prominent, the off-diagonal regions contain non-negligible values. A purely diagonal approximation (Figure 1b) leaves a vast amount of information on the table. By incorporating a low-rank component (Figure 1c), the DPLR-FIM (Figure 1d) much more closely resembles the complete FIM (Figure 1a), capturing the essential correlations necessary for high-fidelity quantization.
Experimental Results
FIMA-Q was evaluated on ImageNet (classification) and COCO (object detection and segmentation) across a wide range of ViT architectures, including DeiT and Swin Transformers.
- Ultra-Low Bit-Widths: The most significant gains were observed at 3-bit quantization (W3/A3). For instance, on ViT-S, FIMA-Q achieved 64.09% top-1 accuracy, outperforming previous state-of-the-art methods like DopQ-ViT (~54%) and QDrop (~41%) by a wide margin.
- Standard Precision: At 4-bit (W4/A4), FIMA-Q consistently remained within 1-3% of the full-precision baseline.
- Hardware Friendliness: Because the FIMA-Q loss function is highly effective, it achieves these results using standard uniform quantizers. This makes the resulting models much easier to deploy on existing hardware compared to methods requiring specialized, non-uniform quantization formats.
Discussion and Conclusion
While FIMA-Q introduces some computational overhead—taking approximately 8 hours to calibrate a Swin-B model compared to roughly 3 hours for simpler methods—the trade-off is a massive leap in accuracy for compressed models. The success of FIMA-Q suggests that the primary bottleneck in ViT quantization was not the hardware format, but the mathematical precision of the importance metrics used during reconstruction.
Future work may involve extending this FIM-based approach to Large Language Models (LLMs), which share similar architectural bottlenecks with Vision Transformers. By better capturing the correlations inherent in self-attention, FIMA-Q paves the way for efficient, high-performance deployment of Transformers on resource-constrained devices.
Summary updated