Auto-ViT-Acc: An FPGA-Aware Automatic Acceleration Framework for Vision Transformer with Mixed-Scheme Quantization

Zhengang Li, Mengshu Sun, Alec Lu, Haoyu Ma, Geng Yuan, Yanyue Xie, Hao Tang, Yanyu Li, Miriam Leeser, Zhangyang Wang, Xue Lin, Zhenman Fang

Abstract

Vision Transformers (ViTs) have established a new state-of-the-art in computer vision, yet their deployment on resource-constrained edge devices remains challenging due to high computational demands. This paper presents Auto-ViT-Acc, the first FPGA-aware automated framework designed to accelerate ViTs through a novel mixed-scheme quantization approach. By strategically combining fixed-point and power-of-two (PoT) quantization, the framework optimizes the utilization of heterogeneous FPGA resources. Experimental results on ImageNet demonstrate that Auto-ViT-Acc achieves a 5.6× speedup over floating-point baselines with a negligible accuracy drop of less than 0.71%.

Introduction

While Vision Transformers (ViTs) often outperform traditional Convolutional Neural Networks (CNNs), their massive parameter counts and complex multi-head self-attention (MSA) mechanisms make them notoriously difficult to deploy on edge hardware. Standard model quantization—reducing the precision of weights and activations—is a common remedy, but it faces two primary hurdles in the context of FPGAs:

  1. Hardware Mismatch: Traditional quantization schemes often fail to exploit the heterogeneous nature of FPGAs, which contain specialized Digital Signal Processing (DSP) blocks for multiplication and general-purpose Look-Up Tables (LUTs) for logic.
  2. Optimization Complexity: Manually determining the optimal bit-width and quantization scheme for every layer to balance throughput (FPS) and accuracy is a daunting task for human designers.

Auto-ViT-Acc addresses these challenges by introducing a hardware-software co-design framework that automates the optimization process.

The Auto-ViT-Acc Framework

Mixed-Scheme Quantization

The core innovation of Auto-ViT-Acc is its use of a mixed-scheme quantization strategy within the same layer. Rather than choosing a single precision for the entire model, the framework utilizes:

  • Fixed-point Quantization: Mapped to the FPGA's DSP blocks for high-precision arithmetic.
  • Power-of-Two (PoT) Quantization: Mapped to LUTs. PoT quantization replaces complex multiplications with simple bit-shift operations, allowing LUTs to serve as primary computational units rather than just logic overhead.

This approach effectively doubles the available computational power of the chip by utilizing nearly 100% of the available hardware resources.

Row-Level Assignment and Alignment

To maintain high accuracy, the framework employs a Row-Level Assignment strategy. It assigns the PoT scheme to weight matrix rows with lower variance and the more precise fixed-point scheme to rows with higher variance. To ensure hardware efficiency, the authors implemented an "Output Alignment" trick, where bit-widths of the two schemes are mathematically related (e.g., matching an 8-bit fixed scheme with a 4-bit PoT scheme). This eliminates the need for complex realignment logic after computation.

Automated Hardware-Software Co-Design

Auto-ViT-Acc includes a mathematical resource utilization model that predicts FPS and hardware consumption for any given configuration. Given a target performance metric, the framework automatically searches the design space, shrinking bit-widths and adjusting the ratio of fixed-point to PoT rows until the target is met with the highest possible accuracy.

Hardware Optimizations

Beyond quantization, the framework introduces specific hardware-level enhancements:

  • DSP Packing: This technique fits multiple low-bit multiplications into a single DSP block, further increasing throughput.
  • Specialized MSA Engine: A dedicated compute engine was designed to handle the unique data flow requirements of Multi-Head Self-Attention layers.

Experimental Results

The framework was evaluated on a Xilinx ZCU102 FPGA using the ImageNet dataset with DeiT-small and DeiT-base models.

Key findings include:

  • Throughput: For the DeiT-base model, the accelerator reached 56.8 FPS, representing a 5.6× improvement over the 32-bit floating-point baseline (10.0 FPS).
  • Accuracy: The DeiT-base model maintained high performance with only a 0.71% drop in Top-1 accuracy.
  • Comparison to State-of-the-Art: Auto-ViT-Acc outperformed existing Post-Training Quantization (PTQ) methods, achieving 0.47% to 1.36% higher accuracy at comparable bit-widths.
  • Energy Efficiency: The mixed-scheme approach demonstrated significantly higher energy efficiency (FPS/W) compared to configurations using only fixed-point or only PoT quantization.

Conclusion and Future Work

Auto-ViT-Acc demonstrates that hardware-aware mixed-scheme quantization can bridge the gap between high-performance ViTs and resource-constrained edge devices. By treating LUTs as primary arithmetic units and automating the optimization pipeline, the framework provides a scalable path for deploying Transformers in real-time applications.

Future work aims to integrate weight pruning into the automated pipeline and expand the resource models to support non-linear operations like Softmax and Layer Normalization, which currently remain in 16-bit precision and may eventually become throughput bottlenecks.

Summary updated

BibTeX
@inproceedings{li2022auto,
  author = {Zhengang Li and Mengshu Sun and Alec Lu and Haoyu Ma and Geng Yuan and Yanyue Xie and Hao Tang and Yanyu Li and Miriam Leeser and Zhangyang Wang and Xue Lin and Zhenman Fang},
  title = {{Auto-ViT-Acc: An FPGA-Aware Automatic Acceleration Framework for Vision Transformer with Mixed-Scheme Quantization}},
  booktitle = {FPL},
  year = {2022},
  doi = {10.1109/fpl57034.2022.00027},
}
Figure