Instance-Aware Group Quantization for Vision Transformers
Jaehyeon Moon, Dohyung Kim, Junyong Cheon, Bumsub Ham
TL;DR
This work tackles the challenge of post-training quantization for Vision Transformers, where per-channel activation distributions and token-wise attentions vary significantly across inputs, undermining traditional layer-wide quantization. The authors introduce IGQ-ViT, which dynamically partitions activation channels and softmax attentions into instance-aware groups and applies separate quantizers per group, coupled with a group-size allocation strategy under a bit-operation budget. The approach yields state-of-the-art PTQ performance across ViT variants on ImageNet, COCO, and DETR benchmarks, achieving near full-precision accuracy with modest group counts and limited calibration data. Overall, IGQ-ViT enables efficient, accurate quantization of ViTs for deployment on resource-constrained devices, addressing a critical gap in transformer quantization.
Abstract
Post-training quantization (PTQ) is an efficient model compression technique that quantizes a pretrained full-precision model using only a small calibration set of unlabeled samples without retraining. PTQ methods for convolutional neural networks (CNNs) provide quantization results comparable to full-precision counterparts. Directly applying them to vision transformers (ViTs), however, incurs severe performance degradation, mainly due to the differences in architectures between CNNs and ViTs. In particular, the distribution of activations for each channel vary drastically according to input instances, making PTQ methods for CNNs inappropriate for ViTs. To address this, we introduce instance-aware group quantization for ViTs (IGQ-ViT). To this end, we propose to split the channels of activation maps into multiple groups dynamically for each input instance, such that activations within each group share similar statistical properties. We also extend our scheme to quantize softmax attentions across tokens. In addition, the number of groups for each layer is adjusted to minimize the discrepancies between predictions from quantized and full-precision models, under a bit-operation (BOP) constraint. We show extensive experimental results on image classification, object detection, and instance segmentation, with various transformer architectures, demonstrating the effectiveness of our approach.
