Skip to main content
QUICK REVIEW

[Paper Review] Q-HyViT: Post-Training Quantization of Hybrid Vision Transformers with Bridge Block Reconstruction for IoT Systems

Jemin Lee, Yongin Kwon|arXiv (Cornell University)|Mar 22, 2023
CCD and CMOS Imaging SensorsEngineering5 citations
TL;DR

This paper proposes Q-HyViT, the first post-training quantization method tailored for efficient hybrid vision transformers (e.g., MobileViTv1/2, EfficientFormer), addressing four key challenges: dynamic activation ranges, zero-point overflow in bridge blocks, diverse normalization, and small model size (<5M parameters). By introducing a novel hybrid reconstruction error minimization technique that jointly optimizes scaling factors, quantization granularity (channel-wise/layer-wise), and scheme (symmetric/asymmetric), Q-HyViT achieves an average accuracy gain of 8.32% (8-bit) and 26.02% (6-bit) over existing PTQ methods.

ABSTRACT

Recently, vision transformers (ViTs) have superseded convolutional neural networks in numerous applications, including classification, detection, and segmentation. However, the high computational requirements of ViTs hinder their widespread implementation. To address this issue, researchers have proposed efficient hybrid transformer architectures that combine convolutional and transformer layers with optimized attention computation of linear complexity. Additionally, post-training quantization has been proposed as a means of mitigating computational demands. For mobile devices, achieving optimal acceleration for ViTs necessitates the strategic integration of quantization techniques and efficient hybrid transformer structures. However, no prior investigation has applied quantization to efficient hybrid transformers. In this paper, we discover that applying existing post-training quantization (PTQ) methods for ViTs to efficient hybrid transformers leads to a drastic accuracy drop, attributed to the four following challenges: (i) highly dynamic ranges, (ii) zero-point overflow, (iii) diverse normalization, and (iv) limited model parameters ($&lt;$5M). To overcome these challenges, we propose a new post-training quantization method, which is the first to quantize efficient hybrid ViTs (MobileViTv1, MobileViTv2, Mobile-Former, EfficientFormerV1, EfficientFormerV2). We achieve a significant improvement of 17.73% for 8-bit and 29.75% for 6-bit on average, respectively, compared with existing PTQ methods (EasyQuant, FQ-ViT, PTQ4ViT, and RepQ-ViT)}. We plan to release our code at https://gitlab.com/ones-ai/q-hyvit.

Motivation & Objective

  • To address the lack of effective post-training quantization (PTQ) methods for efficient hybrid vision transformers (HyViTs), which combine convolutional and transformer layers.
  • To identify and resolve four key challenges in quantizing HyViTs: highly dynamic activation ranges, zero-point overflow in bridge blocks, diverse normalization techniques, and limited model parameters (<5M).
  • To develop a unified, end-to-end PTQ framework that jointly optimizes quantization parameters (scaling factors, granularity, scheme) for both bridge and non-bridge layers.
  • To achieve high-accuracy quantization of small HyViT models (e.g., MobileViTv1-xxs) without retraining, enabling efficient deployment on resource-constrained IoT devices.

Proposed method

  • Proposes a hybrid reconstruction error minimization technique that adapts differently for bridge blocks versus non-bridge layers, enabling joint optimization of quantization parameters.
  • Extends second-order reconstruction error minimization to incorporate bridge blocks, allowing precise calibration of scaling factors and zero points.
  • Introduces a dual-optimization strategy: channel-wise quantization for non-bridge layers and layer-wise quantization for bridge blocks to mitigate zero-point overflow.
  • Employs a unified framework that dynamically selects quantization granularity and scheme (symmetric/asymmetric) per layer based on activation statistics.
  • Uses a small, unlabeled calibration dataset to compute optimal quantization parameters without retraining, ensuring high applicability to real-world IoT deployments.
  • Reuses and extends existing second-order reconstruction error minimization to handle the unique activation distributions in hybrid architectures, particularly in bridge blocks.
Figure 1: Overall quantization process of Q-HyViT on the representative structure of hybrid vision transformers, including local, global, and bridge representation.
Figure 1: Overall quantization process of Q-HyViT on the representative structure of hybrid vision transformers, including local, global, and bridge representation.

Experimental results

Research questions

  • RQ1Why do existing post-training quantization methods fail when applied to efficient hybrid vision transformers, despite their success on pure ViTs?
  • RQ2How does zero-point overflow in bridge blocks contribute to accuracy degradation in small HyViT models, and what quantization strategy can mitigate this?
  • RQ3What is the optimal trade-off between quantization granularity (channel-wise vs. layer-wise) and quantization scheme (symmetric vs. asymmetric) for minimizing reconstruction error in HyViTs?
  • RQ4How do diverse normalization techniques in hybrid ViTs affect the robustness of post-training quantization, and how can they be harmonized in the quantization process?
  • RQ5Can a unified PTQ framework achieve significant accuracy gains on small HyViT models (<5M parameters) without retraining, and how does it compare to state-of-the-art PTQ methods?

Key findings

  • Q-HyViT achieves an average accuracy improvement of 8.32% over existing PTQ methods (EasyQuant, FQ-ViT, PTQ4ViT) when quantizing to 8-bit precision across multiple hybrid ViT models.
  • For 6-bit quantization, Q-HyViT shows a remarkable 26.02% average accuracy gain, demonstrating its effectiveness in low-precision regimes.
  • The method successfully mitigates zero-point overflow in bridge blocks by switching from channel-wise to layer-wise quantization, which prevents clamping of negative zero-point values.
  • Histogram analysis confirms that layer-wise quantization in bridge blocks leads to significantly better overlap between real and quantized activations compared to channel-wise quantization.
  • Experiments show that increasing calibration data size from 32 to 128 images has minimal impact on accuracy, indicating that Q-HyViT is robust to small calibration sets.
  • The accuracy degradation due to zero-point overflow is most severe in small models (e.g., MobileViTv1-xxs), but is effectively reduced by layer-wise quantization in bridge blocks, with minimal performance drop even at 8-bit precision.
Figure 2: Discrepancy in activation ranges between the calibration and validation datasets in 1st bridge block of MobileViTv2-100
Figure 2: Discrepancy in activation ranges between the calibration and validation datasets in 1st bridge block of MobileViTv2-100

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.