Abstract
Vision Transformers (ViTs) have emerged as powerful alternatives to Convolutional Neural Networks (CNNs) in computer vision, yet their deployment is often hindered by significant computational and memory requirements. This survey explores the synergy between model quantization and hardware acceleration as a solution for efficient ViT inference. We categorize current research into algorithmic innovations—such as specialized Post-Training Quantization (PTQ) and Quantization-Aware Training (QAT)—and hardware-algorithm co-design strategies aimed at mitigating the "computational tax" of self-attention mechanisms and non-linear operations.
The Computational Tax of Vision Transformers
While ViTs have surpassed CNNs in various tasks, they introduce a heavy computational burden. Their core self-attention mechanism possesses quadratic complexity relative to image resolution, leading to massive memory footprints and high latency. Standard quantization techniques that work effectively for CNNs often fail when applied to ViTs. This failure stems from the unique non-linear operations within ViTs—Softmax, LayerNorm, and GELU—which produce activation distributions characterized by extreme outliers and high variance.
Taxonomy of Quantization and Acceleration
The research landscape for efficient ViT inference is built upon three main pillars: quantization algorithms, activation optimization, and hardware-algorithm co-design.
Quantization Algorithms
- Post-Training Quantization (PTQ): These methods quantize pre-trained models using minimal calibration data. Techniques like PTQ4ViT utilize "twin uniform quantization" to manage the distinct ranges of GELU activations.
- Quantization-Aware Training (QAT): By integrating quantization into the training process, QAT allows models to adapt to precision loss. Distillation-assisted Training is a prominent approach where a full-precision teacher model guides a low-bit student model to recover accuracy.
- Binary Quantization: This represents the extreme limit of compression, using 1-bit weights and activations, though it currently faces significant accuracy challenges in the context of ViTs.
The Non-Linear Bottleneck
A critical insight in ViT optimization is the distinction between linear MatMul operations and non-linearities. In many hardware implementations, linear layers are easily accelerated, but non-linearities like Softmax and LayerNorm often remain in FP32. This creates a bottleneck where data must constantly move between integer and floating-point units, negating the benefits of quantization.
Researchers address this through Hardware-Algorithm Co-design, replacing expensive floating-point non-linearities with integer-only approximations. For instance, frameworks like I-ViT and SOLE enable hardware to perform "Shift-Softmax" or "Shift-GELU" using simple bit-shifting instead of complex exponential calculations.
Key Results and the 4-bit Frontier
Evaluation on the ImageNet benchmark shows that 8-bit quantization (W8/A8) is now considered "near-lossless," with most PTQ methods achieving >81% Top-1 accuracy (compared to an 81.85% FP32 baseline). However, the 4-bit (W4/A4) level remains a significant challenge. While standard PTQ might see accuracy drop to ~67%, advanced QAT methods like Q-ViT can maintain an impressive 83.0% through distillation.
Specialized hardware, such as FPGA accelerators like Auto-ViT-Acc, has demonstrated the potential of these methods, achieving throughputs of up to 1181.5 GOP/S by utilizing mixed-scheme quantization.
Future Directions
Despite progress, several hurdles remain:
- Sub-2-bit Accuracy: Binarizing the attention mechanism still leads to unacceptable accuracy loss (>10%), making "lossless" binary ViTs a long-term goal.
- Hardware Availability: There is a pressing need for commodity hardware that natively supports sub-8-bit (4-bit or 2-bit) operations to realize theoretical speedups.
- Multi-Task Robustness: Future research must expand beyond ImageNet classification to ensure quantized ViTs remain robust in complex, real-time scenarios like autonomous driving and object detection.
Summary updated