Skip to content

Menu

WorksComputer Science

Beyond Similarity Entropy: A Rank-Guided Data-Free Quantization Framework for Vision Transformers

Download PDFView on arXiv

Ask your agent about this work

Your agent reads this work through Valency, with its citations and similar works. Paste this at the start of a chat.

Use the Valency MCP. Work: W_t7bsekpf. Fetch it with get_paper_by_id, then find its nearest works with find_similar_papers and tell me what it adds.

Works with any MCP client. Not connected yet? Connect your agent

Abstract

Vision Transformers (ViTs) have demonstrated remarkable performance, yet their computational and memory demands pose significant challenges for deployment on mobile devices. Data-free quantization (DFQ) enables the compression of ViTs without access to their original training data. Existing DFQ methods often synthesize calibration samples by maximizing the entropy of patch similarity. However, similarity entropy describes the dispersion of similarity values without ensuring that the generated samples cover diverse feature directions, potentially limiting their effectiveness for quantization calibration. To address this limitation, we propose RankQ-ViT, a rank-guided DFQ framework for ViTs. We first observe that patch similarity matrices derived from Gaussian noise tend to have lower ranks than those derived from real images. Motivated by this observation, we introduce a block-aware self-contrastive objective that promotes feature diversity during synthetic data generation without explicitly computing matrix rank at each optimization step. We then select calibration samples based on their rank and semantic consistency and use them for block-wise reconstruction of the quantized model. Experiments on ImageNet, COCO, ModelNet40, and ShapeNet demonstrate the effectiveness of RankQ-ViT across multiple architectures and tasks, particularly under low-bit quantization. The code is available at https://github.com/Runqing-forMost/rankq-vit.git

Introduction

Vision Transformers (ViTs) have recently shown impressive performance in a wide range of computer vision tasks [1], [2], [3]. Despite their success, the cutting-edge ViT models are often characterized by intricate architectures and a substantial number of parameters, which severely hinders their deployment on resource-constrained edge devices. To improve the efficiency of ViTs, numerous model compression works have been developed, including compact architecture design [3], [4], [5], network pruning [6], [7], [8], knowledge distillation [9], [10], [11], and model quantization [12], [13], [14], [15]. These works significantly speed up and reduce the storage requirements of ViT models, while maintaining stable performance.

Model quantization, which involves mapping floating-point numbers to fixed-point counterparts, has experienced growing interest due to its hardware-agnostic versatility. Existing works [18], [19], [20], [21] typically assume access to training datasets for calibrating quantized models, a paradigm known as quantization-aware training (QAT). While QAT achieves superior performance, it incurs massive training costs, especially for complex models like ViTs. Some other works [22], [23], [24] adopt the post-training quantization (PTQ) paradigm, which only uses a small part of the training data, and learns the quantization parameters without the end-to-end retraining. However, the training datasets are not always available due to data privacy concerns [16], [25], rendering these methods inapplicable. To address this, a handful of recent studies [26], [27], [28] have begun to explore data-free quantization (DFQ), a paradigm that seeks to quantize pre-trained networks without relying on original training data.

The prevalent pipeline of DFQ involves generating synthetic samples from a pre-trained model, which are carefully crafted to mimic the distribution of the original training data, and then performing quantization with these synthetic samples. Some DFQ-based works [26], [29] leverage statistics embedded in batch normalization (BN) layers as priors to guide synthetic sample generation. However, this strategy falters when applied to ViTs quantization, due to the absence of BN layers. To exploit the information encoded in pretrained ViTs, PSAQ-ViT and its successor [16], [17] synthesize calibration samples by maximizing the entropy of patch similarity. However, the dispersion of similarity values does not ensure that the generated patch features cover diverse directions, potentially limiting their effectiveness for quantization calibration. Moreover, applying the same entropy objective across transformer blocks overlooks differences in their feature representations, while repeated probability density estimation increases the cost of data generation.

To handle these issues, this paper proposes RankQ-ViT, an efficient and effective DFQ method for ViTs. Specifically, RankQ-ViT involves a two-step optimization framework. First, since the matrix rank of realistic images is consistently higher than that of noise ones (Figure 1(a)), we propose a block-aware rank promotion mechanism that explicitly raises the rank of the similarity matrix for generated images during optimization. This is achieved via a self-contrastive learning framework: patches from the same region (intra-patch) are pulled together, whereas patches from different regions (inter-patch) are pushed apart. This contrastive operation reduces linear correlations among patch features, increasing the matrix rank. We additionally provide a theoretical justification that this contrastive learning formulation effectively promotes the rank of the similarity matrix. Second, we propose a sample selection strategy on the generated samples to select reliable samples for the subsequent model quantization. We evaluate the quality of each generated sample using rank information and semantic consistency, and then select a portion of samples with highest quality score. These samples are then used for a block-wise reconstruction procedure, where the outputs of quantized ViTs are encouraged to mimic their full-precision counterparts in a block-wise manner, achieving both high training efficiency and better generalization performance, as indicated in Figure 1(b).

Figure 1. Motivation and performance overview. (a) Rank distribution of the patch similarity matrix across different blocks, indicating that realistic images have higher ranks than noise ones. It motivates us to explicitly increase the ranks of the synthetic samples during sample generation. (b) Test accuracy (%) and time cost of data generation of RankQ-ViT, PSAQ-ViT v1 [16], and PSAQ-ViT v2 [17] on DeiT-T and DeiT-S.

To summarize, our key contributions are listed as follows:

  • We first reveal that the rank of the similarity matrix serves as an effective indicator of image quality. Building on this insight, we propose RankQ-ViT, which incorporates a block-aware rank promotion mechanism along with a sample selection strategy to enable accurate quantization.

  • We develop a block-aware rank promotion mechanism based on self-contrastive learning to mitigate the distribution discrepancy between realistic images and generated samples.

  • We propose a sample selection strategy, which utilizes the rank information and semantic consistency as the metric to select reliable samples for the model quantization.

  • Experiments on four benchmark datasets (including ImageNet, COCO, ModelNet40, and ShapeNet) with various quantization regimes demonstrate the effectiveness and efficiency of our RankQ-ViT. Specifically, compared with the PSAQ-ViT, our method obtains over 10% better results on ImageNet with W4/A4 quantization, while achieving around 5×5 \times faster data generation speed.

Related Work

Vision Transformers and Their Applications

Dosovitskiy et al. [30] designate the original ViT, which employs a pure transformer architecture and demonstrates superior performance to several off-the-shelf CNNs in image classification tasks. Later, Touvron et al. [1] propose DeiT,

which introduces a novel distillation strategy, wherein a well-trained CNN model serves as a teacher to guide the training of a transformer model. Such an approach enables the transformer to inherit valuable representations from the teacher model, achieving competitive performance with the top-tier CNN architectures. Based on this, Liu et al. [3] propose the Swin-Transformer. Swin-Transformer innovatively involves a window attention mechanism, which confines self-attention to a local window, significantly reducing computational costs and achieving superior performance.

In addition to 2D images, several recent studies [31, 32] have demonstrated the great potential of transformer architecture in the realm of 3D point cloud processing. For example, Zhao et al. [31] propose Point Cloud Transformer (PCT), which pioneeringly introduces the transformer architecture into 3D point cloud analysis, and achieves cutting-edge performance on point cloud classification and part segmentation tasks. Despite their impressive performance on various vision tasks, the intensive computation burden of these complicated ViTs significantly impedes their widespread applications on resource-constrained devices. In this paper, we are motivated to develop a quantization framework tailored for ViTs that operates without access to training data, thereby ensuring privacy and flexibility in real-world applications.

Model Quantization

In this section, we mainly recap the works on the post-training quantization and data-free quantization, which are closely related to our method.

Post-training Quantization (PTQ)

  1. Post-training Quantization (PTQ): PTQ-based works quantize the neural networks using a small-scale calibration set, without heavily end-to-end retraining. Nagel et al. [22] design AdaRound to learn the rounding function adaptively, with a layer-wise reconstruction paradigm. Li et al. [20] propose to perform reconstruction in a block-wise manner, attaining impressive image classification accuracy with 4-bit ResNet. In addition, some recent works have explored the PTQ for vision transformers. Liu et al. [33] first explore the challenges of post-training quantization for ViTs, and devise a ranking-

aware distillation loss to preserve the ranking information after quantization. Li et al. [19] propose RepQ-ViT, which uses scale reparameterization to decouple quantization from inference, applying complex quantizers for accurate calibration and transforming them into hardware-friendly simplified quantizers for efficient deployment. Jiang et al. [34] use an architecture-informed mechanism to compensate for the quantization error of weights in ViTs, achieving superior performance on 2D and 3D recognition tasks. Despite their effectiveness, these methods still rely on a small amount of data for calibration.

Data-free Quantization

DFQ-based works aim to quantize models without accessing the original training data, offering a more flexible way for model compression [35, 36, 37]. To achieve this, several methods [27, 26] generate samples with the guidance of statistics hidden in BN layers, and subsequently use these generated images to fine-tune the quantized models to recover their accuracy. However, these methods are originally designed for CNN models, which cannot be directly applied to ViTs due to the absence of BN layers. To account for ViT models, Li et al. [16] propose PSAQ-ViT, which pioneers the study of data-free quantization on ViTs, introducing a metric called “patch similarity” which is used for guiding the optimization of Gaussian noise images. PSAQ-ViT regularizes the image generation by adding an entropy maximization constraint to enrich the texture information of synthetic images. Later, Li et al. [17] devise PSAQ-ViT v2, which improves the PSAQ-ViT by introducing a cyclic training framework that switches between generating training samples and training quantized models. Such a cyclic training framework largely improves the performance on both image classification and detection tasks. More recently, Ramachandran et al. [38] propose CLAMP-ViT, which introduces a patch-level contrastive learning strategy to generate high-fidelity data, followed by a mixed-precision quantization schema.

While PSAQ-ViT v1 [16] pioneered the use of patch-similarity statistics for data-free quantization of ViTs, our method differs from them in three respects. First, our RankQ-ViT differs from PSAQ-ViT in terms of the information metric. PSAQ-ViT maximizes entropy, a measure of distribution dispersion, which only captures the scatter of similarity values. As shown in Figure 2, RankQ-ViT instead directly promotes the rank of the similarity matrix, with a more fundamental indicator of the effective dimensionality of feature representations to encode richer structural information. Second, the optimization strategies are different. PSAQ optimizes synthetic samples by explicitly maximizing entropy, which uniformly applies a costly entropy estimation for all blocks during data generation. Our RankQ-ViT, in turn, uses a self-contrastive rank promotion mechanism to increase matrix rank by reducing patch correlations, supported by a theoretical lower-bound analysis, and a block-aware scheduling strategy that applies stronger promotion to shallow layers for better alignment with realistic images. Third, our RankQ-ViT achieves superior performance to PSAQ-ViT, which is detailed in Sec. V.

Illustration of the distinction between patch-similarity entropy and feature-space rank

Figure 2. Illustration of the distinction between patch-similarity entropy and feature-space rank. On the left, four normalized patch features lie in a two-dimensional plane and yield dispersed pairwise cosine similarities. On the right, four features span three dimensions despite having identical pairwise cosine similarities distributions. This example shows that dispersion of similarity values alone does not guarantee coverage of independent feature directions, motivating rank-aware synthetic data generation for quantization calibration.

XGX_Ggenerated image
YYlabel for XGX_G
FXG(l)F_{X_G}^{(l)}features in the ll-th block
SSpatch similarity matrix
τ\tautemperature parameter
γ\gammaA small positive number
Dp(⋅)D_p(\cdot)dropout with probability pp

Table 1. Key symbols in this work.

Preliminaries

Architecture of Vision Transformers

Let X(l)∈RN×DX^{(l)} \in\mathbb{R}^{N \times D} denote the input tensor for the ll-th transformer block, where NN represents the number of patches and DD represents the patch dimension, respectively. Then the X(l)X^{(l)} is fed into the transformer block, which comprises two primary components: a multi-head self-attention (MHSA) mechanism, and a multilayer perceptron (MLP) module. This process can be formally defined:

X^(l)=MHSA⁡(l)(LN⁡(X(l)))+X(l),(1)\hat{X}^{(l)} = \operatorname{MHSA}^{(l)}(\operatorname{LN}(X^{(l)})) + X^{(l)}, \tag*{(1)}
X(l+1)=MLP⁡(LN⁡(X^(l)))+X^(l),(2)X^{(l+1)} = \operatorname{MLP}(\operatorname{LN}(\hat{X}^{(l)})) + \hat{X}^{(l)}, \tag*{(2)}

where LN denotes the LayerNorm layer, and MHSA is:

Attn⁡i(Qi,Ki,Vi)=Softmax⁡(QiKiTDh)Vi,(3)\operatorname{Attn}_i(Q_i, K_i, V_i) = \operatorname{Softmax}\left(\frac{Q_iK_i^{T}}{\sqrt{D_h}}\right)V_i, \tag*{(3)}
MHSA⁡(x)=concat⁡(Attn⁡1,Attn⁡2,…,Attn⁡H)Wo,(4)\operatorname{MHSA}(x) = \operatorname{concat}(\operatorname{Attn}_1, \operatorname{Attn}_2, \ldots, \operatorname{Attn}_H)W^o, \tag*{(4)}

where QiQ_i, KiK_i, and ViV_i denote the query, key, and value matrix transformed from input for the ii-head. The DhD_h denotes the embedding dimension for each head. The HH stands for the number of heads, and Wo∈RDh×DW^o \in\mathbb{R}^{D_h \times D} is used for feature aggregation across heads. Subsequently, the MLP module encodes each patch feature independently, which is:

MLP⁡(x)=FC⁡2(ϕ(FC⁡1(x))),(5)\operatorname{MLP}(x) = \operatorname{FC}_2(\phi(\operatorname{FC}_1(x))), \tag*{(5)}

where FC⁡1\operatorname{FC}_1 and FC⁡2\operatorname{FC}_2 are two consecutive linear layers, and ϕ(⋅)\phi(\cdot) represents the activation function.

Data-free Quantization

Mainstream data-free quantization methods [17, 39, 26] mainly consist of two steps: data generation and model quantization, which are detailed below.

Data Generation

This step aims to generate synthetic samples for quantized model training. Specifically, the generated samples XGX_G are treated as trainable parameters and optimized via the following objective:

min⁡XGLtarget(M(XG),Y)+Lprior(XG),(6)\min_{X_G} \mathcal{L}_{\text{target}}(\mathcal{M}(X_G),Y) + \mathcal{L}_{\text{prior}}(X_G), \tag*{(6)}

where M\mathcal{M} and YY denote the pre-trained model and the corresponding labels, respectively. The term Ltarget(⋅,⋅)\mathcal{L}_{\text{target}}(\cdot,\cdot) is typically instantiated as the cross-entropy loss, while Lprior(⋅)\mathcal{L}_{\text{prior}}(\cdot) is often implemented using batch normalization (BN) statistics matching [26] or entropy regularization [16].

Model Quantization

In line with previous works [16], [38], we quantize all the weights and activations with the widely used uniform quantizer, which is defined as:

Quant⁡(xFP,s,z,k)=clip⁡(⌊xFPs−z⌉,0,2k−1)(7)\operatorname{Quant}(x_{\mathrm{FP}},s,z,k)=\operatorname{clip}\left(\left\lfloor\frac{x_{\mathrm{FP}}}{s}-z\right\rceil,0,2^k-1\right) \tag*{(7)}

where xFPx_{\mathrm{FP}}, ss, zz, and kk denote the full-precision input, quantization scale, quantization zero-point, and bit-width, respectively. Consistent with common practice [16], [38], we employ channel-wise quantization for weights and layer-wise quantization for activations.

Method

Block-aware Rank Promotion Mechanism

Motivation

In this paper, we uncover an intriguing phenomenon related to the ranks of the patch similarity matrix. As shown in Figure 1, it is evident that realistic images tend to produce patch similarity matrices with higher ranks compared to Gaussian noise images. In matrix theory, a higher-rank matrix is typically associated with a greater amount of information, while a lower-ranked matrix contains less information. In addition, we also observe that ranks significantly vary across network blocks, that is, ranks in the shallow blocks are generally higher than those of deeper ones. Therefore, according to the discussion above, the rank of the patch similarity matrix can be viewed as a metric to differentiate between the Gaussian noise images and realistic images, which can be further used to guide the sample generation, detailed in Figure 3. However, as indicated in Proposition 1, the training objective in [16] cannot ensure high ranks during optimization, which motivates us to design new training paradigm to promote ranks effectively.

Figure 3. Overview of RankQ-ViT. The workflow of RankQ-ViT involves two consecutive steps, namely block-aware rank promotion (the left panel) and block-wise training with sample selection (the right panel). First, the Gaussian noise images are encouraged to learn the high-rank similarity matrix by minimizing the Lrp\mathcal{L}_{rp}. Then, generated samples with higher ranks (see Eq. (14)) and minimal Jensen-Shannon Divergence (JSD) (see Eq. (15)) are selected to form the training set D\mathcal{D}. Finally, the quantized model is forced to mimic the outputs of its full-precision version, recovering the accuracy degradation of quantization.

Block-aware Rank Promotion Mechanism

In this work, we propose a block-aware rank promotion mechanism to guide synthetic data generation. To be specific, let XG∈R3×H×WX_G \in\mathbb{R}^{3 \times H \times W} denote the input image initialized by the Gaussian distribution, and FXG(l)∈RN×DF_{X_G}^{(l)} \in\mathbb{R}^{N \times D} denote the features of XGX_G after the ll-th MHSA module. According to [16], the patch similarity matrix SS is defined as:

S[i,j]=FXG(l)[i,:]⋅FXG(l)[j,:]T∥FXG(l)[i,:]∥⋅∥FXG(l)[j,:]∥(8)S[i,j]=\frac{F_{X_G}^{(l)}[i,:]\cdot F_{X_G}^{(l)}[j,:]^{\mathsf{T}}}{\left\lVert F_{X_G}^{(l)}[i,:]\right\rVert\cdot\left\lVert F_{X_G}^{(l)}[j,:]\right\rVert} \tag*{(8)}

where FXG(l)[i,:]F_{X_G}^{(l)}[i,:] and FXG(l)[j,:]F_{X_G}^{(l)}[j,:] denote the ii-th and jj-th patch feature of FXG(l)F_{X_G}^{(l)}, respectively. As shown in Figure 1, since the Gaussian noise contains less information, the rank of SS (denoted as Rank⁡(S)\operatorname{Rank}(S) for short) is lower than the realistic images. Therefore, the key question lies in how to increase the Rank⁡(S)\operatorname{Rank}(S) efficiently. A straightforward approach is to leverage advanced deep learning frameworks (e.g., PyTorch) or Singular Value Decomposition (SVD) to compute the ranks, followed by optimization techniques to maximize Rank⁡(S)\operatorname{Rank}(S). Unfortunately, these methods are often computationally expensive, as they typically involve extensive matrix computations (e.g., matrix inversion) at every iteration and block, leading to significant time overhead.

To remedy this, we introduce a rank promotion method with self-contrastive learning [40] on a patch level, which is:

Lrpl=∑i=1N−log⁡exp⁡((FXG(l)[i,:]⋅FXG(l)[i,:]augT)/τ)∑jDp(exp⁡((FXG(l)[i,:]⋅FXG(l)[j,:]augT)/τ))+γ(9)\mathcal{L}_{rp}^{l}=\sum_{i=1}^{N}-\log\frac{\exp\left((F_{X_G}^{(l)}[i,:]\cdot F_{X_G}^{(l)}[i,:]_{\mathrm{aug}}^{\mathsf{T}})/\tau\right)}{\sum_j D_p\left(\exp\left((F_{X_G}^{(l)}[i,:]\cdot F_{X_G}^{(l)}[j,:]_{\mathrm{aug}}^{\mathsf{T}})/\tau\right)\right)+\gamma} \tag*{(9)}

where Dp(⋅)D_p(\cdot) denotes the dropout operation with probability pp, which is set to 0.5 in our experiments to achieve diversity. τ\tau is the temperature parameter to control the smoothness of similarity, which is set to 0.1. The constant γ\gamma is set to 0.1 to avoid division by zero. FXG(l)[i,:]augTF_{X_G}^{(l)}[i,:]_{\mathrm{aug}}^{\mathsf{T}} denotes the features extracted from the augmented images (e.g., those processed by image rolling).

Unlike the optimization strategy use in PSAQ-ViT, which captures only the dispersion of similarity values and does not ensure coverage of diverse feature directions, potentially limiting the representational diversity of synthetic samples and their effectiveness for quantization calibration. Our method, in turn, by minimizing Eq. (9), each patch is forced to learn distinctive features, achieving low cosine similarity between different patches, which effectively increases the rank of the patch similarity matrix (see Proposition 2).

Proposition 1. A high entropy in PSAQ [16] does not necessarily imply a high-rank similarity matrix. Specifically, for a small positive integer rr, there exists a similarity matrix SS such that Rank⁡(S)=r\operatorname{Rank}(S)=r, while their entropy remains non-trivial.

Proof. Please refer to the Appendix.

Proposition 2. Let xix_i is normalized patch feature, and X=[x1,…,xN]⊤∈RN×DX=[x_1,\ldots,x_N]^\top\in\mathbb{R}^{N\times D} be a matrix whose rows are normalized such that ∥xi∥2=1\lVert x_i\rVert_2=1. Assume the pairwise cosine similarities satisfy

∣xi⊤xj∣≤ϵ,∀i≠j.(10)\left|x_i^\top x_j\right|\le\epsilon,\quad\forall i\ne j. \tag*{(10)}

Then the rank of XX is lower bounded by

rank⁡(X)≥N1+(N−1)ϵ2.(11)\operatorname{rank}(X)\ge\frac{N}{1+(N-1)\epsilon^2}. \tag*{(11)}

Proof. Please refer to the Appendix.

Moreover, as shown in Figure 1, we observe that the ranks decrease when the model goes deeper for realistic images. Therefore, we force the generated images to mimic this behavior by imposing a smaller weight for rank promotion loss on deeper blocks. Finally, we sum up the rank promotion loss across all blocks to formulate the overall loss:

Lrp=∑l=1L1w(l)Lrpl,(12)\mathcal{L}_{rp}=\sum_{l=1}^{L}\frac{1}{w(l)}\mathcal{L}_{rp}^{l}, \tag*{(12)}

where LL is the total number of blocks, w(l)=lLw(l)=\frac{l}{L} is a weight factor for the ll-th ViT block, which prioritizes the shallow layers to learn more distinct feature representations. To stabilize the training process, in the early optimization iterations, we only use the standard cross-entropy loss Lce\mathcal{L}_{ce} to initialize the semantic information. After that, the rank promotion loss is introduced, and the total loss becomes:

Lall=Lrp+αLce,(13)\mathcal{L}_{all}=\mathcal{L}_{rp}+\alpha\mathcal{L}_{ce}, \tag*{(13)}

where α\alpha is set to 1. In this stage, all the model parameters are frozen, only the generated images are updated by backpropagation.

Block-wise Training with Sample Selection

Till now, we have obtained a handful of generated samples by optimizing random noise images according to Eq. (13). However, as highlighted in previous studies [28], the reliability of these generated samples can be compromised due to the inherent instability of the generation process. As a consequence, using all generated samples indiscriminately may adversely affect the learning of quantized models. To

address this issue, we propose a sample selection strategy aimed to identify reliable samples, facilitating subsequent reconstruction procedures. Specifically, we first compute the averaged rank of the patch similarity matrix across blocks for each sample, defined as:

ri=1L∑l=1LRank⁡(Sl),(14)r_i=\frac{1}{L}\sum_{l=1}^{L}\operatorname{Rank}(S_l), \tag*{(14)}

where SlS_l is the patch similarity matrix of the ll-th block. As mentioned previously, the rank serves as a measure of the fidelity of a generated sample, and the higher ranks generally imply better image fidelity. Furthermore, to incorporate semantic information, we propose to use the Jensen-Shannon divergence (JSD) [41] to evaluate the semantic consistency between the one-hot label yiy_i and the predicted probability distribution pip_i. This is formulated as:

di=JSD⁡π(yi,pi)=π⋅KL⁡(yi∥m)+(1−π)⋅KL⁡(pi∥m),d_i=\operatorname{JSD}_{\pi}(y_i,p_i)=\pi\cdot\operatorname{KL}(y_i\Vert m)+(1-\pi)\cdot\operatorname{KL}(p_i\Vert m),
m=π⋅yi+(1−π)⋅pi,(15)m=\pi\cdot y_i+(1-\pi)\cdot p_i, \tag*{(15)}

where KL⁡(⋅)\operatorname{KL}(\cdot) denotes the KL-Divergence, and π\pi is set to 0.5. Finally, we pick samples with smaller JSD and higher ranks for the following adopted fine-tuning process. In this stage, a block-wise reconstruction paradigm [20], [34] is adopted:

Lft=1∣D∣∑Xi∈D∥Mql(Xl)−MFPl(Xl)∥F,(16)\mathcal{L}_{ft}=\frac{1}{|\mathcal{D}|}\sum_{X_i\in\mathcal{D}}\left\lVert\mathcal{M}_{q}^{l}(X^l)-\mathcal{M}_{FP}^{l}(X^l)\right\rVert_F, \tag*{(16)}
D=argmax⁡∣D^∣≤Nsel∑Xi∈D^rXi−dXi,\mathcal{D}=\underset{|\hat{\mathcal{D}}|\le N_{sel}}{\operatorname{argmax}}\sum_{X_i\in\hat{\mathcal{D}}}r_{X_i}-d_{X_i},

where ∣D∣|\mathcal{D}| denotes the size of D\mathcal{D}. Mql(⋅)\mathcal{M}_{q}^{l}(\cdot) and MFPl(⋅)\mathcal{M}_{FP}^{l}(\cdot) represent the outputs of ll-th quantized block and full-precision block, respectively. NselN_{sel} is the number of selected samples. Here, we omit the normalization procedure of dXid_{X_i} and rXir_{X_i} for simplicity. XlX^l denotes the input for the ll-th block, and the ∥⋅∥F\lVert\cdot\rVert_F represents the Frobenius norm.

ModelMethodNo DataData Num.PrecisionTop-1 Acc. (%)PrecisionTop-1 Acc. (%)
ViT-SFull-Precision--W32/A3281.39W32/A3281.39
Standard [16]×\times32W4/A819.91W8/A830.28
PSAQ-ViT v1 [16]✓\checkmark32W4/A820.84W8/A831.45
PSAQ-ViT v2 [17]✓\checkmark-W4/A877.84W8/A881.05
RepQ-ViT [19]×\times32W4/A875.60W8/A881.17
RankQ-ViT (ours)✓\checkmark32W4/A878.76±0.12\mathbf{78.76}\pm0.12W8/A881.19±0.08\mathbf{81.19}\pm0.08
ViT-BFull-Precision--W32/A3284.53W32/A3284.53
Standard[16]×\times32W4/A824.76W8/A836.65
PSAQ-ViT v1 [16]✓\checkmark32W4/A825.31W8/A837.36
PSAQ-ViT v2 [17]✓\checkmark-W4/A881.64W8/A884.01
RepQ-ViT [19]×\times32W4/A876.29W8/A881.45
CLAMP-ViT [38]✓\checkmark32W4/A878.73W8/A884.19
RankQ-ViT (ours)✓\checkmark32W4/A882.44±0.14\mathbf{82.44}\pm0.14W8/A884.25±0.07\mathbf{84.25}\pm0.07
DeiT-TFull-Precision--W32/A3272.21W32/A3272.21
Standard [16]×\times32W4/A865.20W8/A871.27
PSAQ-ViT v1 [16]✓\checkmark32W4/A865.57W8/A871.56
PSAQ-ViT v2 [17]✓\checkmark32W4/A868.61W8/A872.17
RepQ-ViT [19]×\times32W4/A867.40W8/A871.94
DFQ-ViT [42]✓\checkmark16W4/A865.84W8/A871.64
CLAMP-ViT [38]✓\checkmark32W4/A869.93\mathbf{69.93}W8/A872.17
RankQ-ViT (ours)✓\checkmark32W4/A868.55±0.1268.55\pm0.12W8/A872.22±0.06\mathbf{72.22}\pm0.06
DeiT-SFull-Precision--W32/A3279.85W32/A3279.85
Standard [16]×\times32W4/A872.10W8/A876.00
PSAQ-ViT v1 [16]✓\checkmark32W4/A873.23W8/A876.92
PSAQ-ViT v2 [17]✓\checkmark-W4/A876.36W8/A879.56
RepQ-ViT [19]×\times32W4/A875.19W8/A879.72
DFQ-ViT [42]✓\checkmark16W4/A873.69W8/A877.04
CLAMP-ViT [38]✓\checkmark32W4/A877.03W8/A879.55
RankQ-ViT (ours)✓\checkmark32W4/A877.86±0.15\mathbf{77.86}\pm0.15W8/A879.59±0.05\mathbf{79.59}\pm0.05
DeiT-BFull-Precision--W32/A3281.80W32/A3281.80
Standard [16]×\times32W4/A876.25W8/A878.61
PSAQ-ViT v1 [16]✓\checkmark32W4/A877.05W8/A879.10
PSAQ-ViT v2 [17]✓\checkmark-W4/A879.49W8/A881.52
RepQ-ViT [19]×\times32W4/A877.16W8/A880.50
DFQ-ViT [42]✓\checkmark16W4/A877.23W8/A879.51
RankQ-ViT (ours)✓\checkmark32W4/A880.63±0.10\mathbf{80.63}\pm0.10W8/A881.63±0.04\mathbf{81.63}\pm0.04
Swin-TFull-Precision--W32/A3281.35W32/A3281.35
Standard [16]×\times32W4/A870.16W8/A874.22
PSAQ-ViT v1 [16]✓\checkmark32W4/A871.79W8/A875.35
PSAQ-ViT v2 [17]✓\checkmark-W4/A876.28W8/A880.21
RepQ-ViT [19]×\times32W4/A872.92W8/A881.20\mathbf{81.20}
DFQ-ViT [42]✓\checkmark16W4/A874.01W8/A876.85
RIEM [43]✓\checkmark-W4/A876.28W8/A880.85
CLAMP-ViT [38]✓\checkmark32W4/A880.28\mathbf{80.28}W8/A881.17
RankQ-ViT (ours)✓\checkmark32W4/A879.24 ±0.10\pm0.10W8/A881.14 ±0.05\pm0.05
Swin-SFull-Precision--W32/A3283.20W32/A3283.20
Standard [16]×\times32W4/A873.33W8/A875.19
PSAQ-ViT v1 [16]✓\checkmark32W4/A875.14W8/A876.64
PSAQ-ViT v2 [17]✓\checkmark-W4/A878.86W8/A882.13
RepQ-ViT [19]×\times32W4/A881.31W8/A883.02
DFQ-ViT [42]✓\checkmark16W4/A876.24W8/A877.21
RIEM [43]✓\checkmark-W4/A879.84W8/A882.96
CLAMP-ViT [38]✓\checkmark32W4/A882.51\mathbf{82.51}W8/A882.57
RankQ-ViT (ours)✓\checkmark32W4/A882.36±0.1582.36\pm0.15W8/A883.19±0.09\mathbf{83.19}\pm0.09

Table 2. Quantization results on the ImageNet dataset with W4/A8 and W8/A8 quantization. “No Data” means that no realistic images are used. “Data Num.” means the number of images used for calibration. “Precision” denotes the bit-width of weights and activations. The top-1 accuracy (%) is reported as the evaluation metric.

Experiments

Experimental Setups

Datasets and Models

1) Datasets and Models: We utilize the ImageNet [44], COCO [45], ModelNet40 [46], and ShapeNet [47] benchmarks to evaluate the performance of our method on four computer vision tasks (including image classification, object detection, instance segmentation, and point cloud classification). Besides, to assess the efficacy of our RankQ-ViT, we employ a diverse range of Transformer architectures, including ViT [30], DeiT [1], Swin Transformer [3], and Point Transformer [31].

Experimental Details

2) Experimental Details: For the image classification task, we generate 128 synthetic samples with resolutions of 224 ×\times 224, and then select 32 samples from these with the sample selection strategy defined in Eq. (16) for the following optimization. We then perform a block-wise fine-tuning paradigm with a batch size of 32 and train for 2,000 iterations, employing the Adam optimizer with an initial learning rate of 4×10−44 \times10^{-4} for all the network variants. Specifically, we select Standard [16], PSAQ-ViT v1 [16], PSAQ-ViT v2 [17], CLAMP-ViT [38], BRECQ [20], RepQ-ViT [19], DFQ-ViT [42] and RIEM [43] as competing methods. For the object detection and instance segmentation task, we generate 128 synthetic samples and then select 32 samples for calibration. We then perform a block-wise fine-tuning paradigm with a batch size of 1 and train for 2,000 iterations, employing the Adam optimizer with an initial learning rate of 2×10−42 \times10^{-4} for all the network variants. All experiments are implemented in PyTorch and evaluated on a single NVIDIA RTX-4090 GPU with 24GB memory. The system runs on Ubuntu 22.04, with a total memory of 64GB. As for the point cloud classification task, we also generate 128 point clouds and then select 32 point clouds for block-wise optimization, each comprising 1,024 points. During block-wise fine-tuning, each block is trained for 2,000 iterations using the Adam optimizer with an initial learning rate of 1×10−41 \times10^{-4}. The batch size is set to 32 for both ModelNet40 and ShapeNet in our experiments. Note that, since there is no published work

on data-free quantization for 3D point cloud understanding, we compare our method with quantized models calibrated using realistic point clouds and Gaussian point clouds. Additionally, we also reproduce the RepQ-ViT [19], BRECQ [20], PSAQ-ViT v1 [16], PSAQ-ViT v2 [17], and AdaRound [22] for the point cloud classification task using their official code for comparison.

Competing with the State-of-the-art Methods

Results on Image Classification

1) Results on Image Classification: As shown in Tab. II, RankQ-ViT consistently outperforms other competing methods in most quantization settings, demonstrating its effectiveness in preserving the accuracy of ViT models under various quantization scenarios. Notably, our method surpasses CLAMP-ViT by a significant margin of 3.71% on ViT-B with W4/A8 quantization, primarily attributed to the effectiveness of our rank promotion mechanism and sample selection strategy. These results demonstrate the effectiveness of carefully designed quantization techniques in preserving the accuracy of ViT models. Furthermore, for most quantization cases, our RankQ-ViT closely approximates the results of full-precision models, indicating its potential for real-world applications where model accuracy and efficiency are crucial. Notably, our RankQ-ViT outperforms the Full-Precision model on DeiT-T with W8/A8 quantization. Meanwhile, PSAQ-ViT v1 consistently exhibits the poorest performance in most cases, likely caused by the absence of fine-tuning, which results in inaccurate quantization parameters. In addition, CLAMP-ViT performs better than RankQ-ViT on Swin-T, since it uses the cyclically adaptive data generation process, which requires a significantly longer runtime, as suggested by [38].

We also evaluate our methods on more challenging quantization regimes (i.e., W4/A4 and W5/A5), which are shown in Table III. Specifically, as for W5/A5 quantization, the PSAQ-ViT v1 method struggles due to the lack of training. In addition, the results suggest that most competing methods lose their ability in W4/A4 quantization. For instance, the PSAQ-ViT v1 and PSAQ-ViT v2 only achieve 0.12% and 9.78% accuracy on ViT-S quantization, which is far from the practical applications. Note that Standard obtains the best performance in some cases (i.e., ViT-B with W5/A5 quantization), but it still requires additional realistic images for calibration. Instead, our method generally outperforms the competing methods by a large margin in a data-free fashion.

ModelMethodNo DataData Num.PrecisionTop-1 Acc. (%)PrecisionTop-1 Acc. (%)
ViT-SFull-Precision--W32/A3281.39W32/A3281.39
Standard×\times32W4/A439.42W5/A571.78
PSAQ-ViT v1 [16]✓\checkmark32W4/A40.12W5/A524.78
PSAQ-ViT v2 [17]✓\checkmark-W4/A49.78W5/A560.12
RankQ-ViT (ours)✓\checkmark32W4/A444.06±0.18\pm0.18W5/A568.07±0.17\pm0.17
ViT-BFull-Precision--W32/A3284.53W32/A3284.53
Standard×\times32W4/A414.80W5/A570.92
PSAQ-ViT v1 [16]✓\checkmark32W4/A40.61W5/A514.78
PSAQ-ViT v2 [17]✓\checkmark-W4/A46.30W5/A548.78
RankQ-ViT (ours)✓\checkmark32W4/A417.77±0.22\pm0.22W5/A550.19±0.24\pm0.24
DeiT-TFull-Precision--W32/A3272.21W32/A3272.21
Standard×\times32W4/A431.79W5/A560.42
PSAQ-ViT v1 [16]✓\checkmark32W4/A420.61W5/A552.19
PSAQ-ViT v2 [17]✓\checkmark32W4/A420.20W5/A552.18
RankQ-ViT (ours)✓\checkmark32W4/A444.35±0.20\pm0.20W5/A562.38±0.14\pm0.14
DeiT-SFull-Precision--W32/A3279.85W32/A3279.85
Standard†^{\dagger}×\times32W4/A429.23W5/A561.54
PSAQ-ViT v1 [16]✓\checkmark32W4/A46.23W5/A548.26
PSAQ-ViT v2 [17]✓\checkmark-W4/A434.98W5/A563.21
RankQ-ViT (ours)✓\checkmark32W4/A450.40±0.27\pm0.27W5/A564.13±0.19\pm0.19
DeiT-BFull-Precision--W32/A3281.80W32/A3281.80
Standard×\times32W4/A464.06W5/A577.29
PSAQ-ViT v1 [16]✓\checkmark32W4/A410.26W5/A555.45
PSAQ-ViT v2 [17]✓\checkmark-W4/A445.01W5/A570.23
RankQ-ViT (ours)✓\checkmark32W4/A464.34±0.17\pm0.17W5/A575.16±0.21\pm0.21
Swin-TFull-Precision--W32/A3281.35W32/A3281.35
Standard×\times32W4/A433.59W5/A574.11
PSAQ-ViT v1 [16]✓\checkmark32W4/A422.51W5/A557.78
PSAQ-ViT v2 [17]✓\checkmark-W4/A448.67W5/A567.67
RankQ-ViT (ours)✓\checkmark32W4/A471.57±0.22\pm0.22W5/A579.05±0.20\pm0.20
Swin-SFull-Precision--W32/A3283.20W32/A3283.20
Standard×\times32W4/A478.71W5/A581.64
PSAQ-ViT v1 [16]✓\checkmark32W4/A412.09W5/A577.01
PSAQ-ViT v2 [17]✓\checkmark-W4/A437.89W5/A578.37
RankQ-ViT (ours)✓\checkmark32W4/A477.78±0.23\pm0.23W5/A581.25±0.26\pm0.26

Table III. Quantization results on the ImageNet dataset with W4/A4 and W5/A5 quantization.

Results on Point Cloud Classification

To further demonstrate the effectiveness of RankQ-ViT, we select Point Transformer [31] as the backbone and evaluate its performance on 3D point cloud classification tasks using the ModelNet40 and ShapeNet datasets, with results summarized in Table IV. As clearly shown in Table IV, our RankQ-ViT achieves better or comparable results than methods that leverage realistic point clouds for calibration on both ModelNet40 and ShapeNet datasets, showcasing its ability to generate point clouds that closely approximate the original distribution. PSAQ-ViT v2 performs better than PSAQ-ViT v1 on both W4/A8 and W8/A8 settings, since PSAQ-ViT v2 leverages a recycled training strategy to include more information encoded in the pretrained models.

DatasetsMethodNo DataData Num.PrecisionmAcc (%)OA (%)PrecisionmAcc (%)OA (%)
ModelNet40Full-Precision--W32/A3283.9988.00W32/A3283.9988.00
Gaussian✓32W4/A877.3679.16W8/A882.0182.50
Real×32W4/A880.0084.51W8/A883.6787.18
Baseline✓32W4/A879.8583.98W8/A883.2687.00
PSAQ-ViT v1 [16]✓32W4/A879.6083.65W8/A883.2187.16
PSAQ-ViT v2 [17]✓-W4/A880.0084.65W8/A883.2887.01
RepQ-ViT [19]×32W4/A879.9884.78W8/A883.4786.95
BRECQ [20]×32W4/A879.7884.65W8/A883.4387.09
AdaRound [22]×32W4/A877.8583.26W8/A882.6486.00
RankQ-ViT (ours)✓32W4/A880.24 ± 0.2485.27 ± 0.15W8/A883.55 ± 0.0787.40 ± 0.08
ShapeNetFull-Precision--W32/A3293.9798.16W32/A3293.9798.16
Gaussian✓32W4/A891.2695.78W8/A892.7196.08
Real×32W4/A893.1197.53W8/A895.5197.87
Baseline✓32W4/A892.5196.02W8/A895.0097.21
PSAQ-ViT v1 [16]✓32W4/A892.0096.15W8/A895.1197.18
PSAQ-ViT v2 [17]✓32W4/A892.3796.19W8/A894.8797.03
BRECQ [20]×32W4/A892.6797.78W8/A895.0397.18
AdaRound [22]×32W4/A891.8896.87W8/A894.4896.89
RepQ-ViT [19]×32W4/A892.8897.03W8/A895.0197.22
RankQ-ViT (ours)✓32W4/A893.16 ± 0.1697.81 ± 0.10W8/A895.43 ± 0.0897.95 ± 0.10

Table IV. Quantization results of point cloud classification. “mAcc” and “OA” denote the mean of class-wise accuracy (%) and the overall accuracy (%), respectively.

pretrained models. Furthermore, our RankQ-ViT outperforms the advanced PTQ method RepQ-ViT by a clear margin of 0.49% and 0.45% in terms of W4/A8 and W8/A8 quantization on ModelNet40, respectively. Apart from these, our method also achieves higher results than reconstruction-based methods like BRECQ and AdaRound, which can be ascribed to the usage of the sample selection strategy. In a nutshell, these results demonstrate the superiority of our method in preserving the accuracy of point cloud models under various quantization scenarios. In contrast, calibration by Gaussian point cloud consistently exhibits the poorest performance, suggesting that the random inputs fail to preserve the geometry information of point clouds, degrading quantization efficacy.

Results on Object Detection and Instance Segmentation

The results in Table V demonstrate the effectiveness of the proposed RankQ-ViT across both object detection and instance segmentation tasks on the COCO dataset. Compared with the FP baseline, all quantization methods inevitably introduce performance degradation; however, RankQ-ViT consistently achieves the best trade-off between accuracy and compression. For the Cascade Mask R-CNN with Swin-S backbone, RankQ-ViT achieves 48.3 box AP and 41.7 mask AP under the W4/A8 setting, outperforming Standard quantization by +1.0/+0.8 AP and PSAQ-ViT v2 by +0.4/+0.3 AP, respectively. Notably, while Gaussian quantization suffers from severe accuracy drops (over 10 AP in both metrics), our method effectively mitigates this degradation, indicating stronger robustness to aggressive low-bit quantization. A similar trend is observed for the Mask R-CNN with Swin-S backbone, where RankQ-ViT again achieves the highest performance (45.1 box AP and 37.8 mask AP), surpassing Standard and PSAQ-ViT v2. These consistent improvements across different detection frameworks suggest that RankQ-ViT generalizes well and is not tied to a specific architecture.

ModelMethodPrec.APbox_{\mathrm{box}}APmask_{\mathrm{mask}}
Swin-SFPW32/A3251.948.0
Cascade Mask R-CNNStandardW4/A847.340.9
GaussianW4/A838.135.2
PSAQ v1 [16]W4/A842.636.9
PSAQ v2 [17]W4/A847.941.4
RankQ-ViTW4/A848.3 ± 0.0241.7 ± 0.01
Swin-SFPW32/A3248.543.3
Mask R-CNNStandardW4/A844.337.1
GaussianW4/A837.330.2
PSAQ v1 [16]W4/A840.932.9
PSAQ v2 [17]W4/A844.937.8
RankQ-ViTW4/A845.1 ± 0.0237.8 ± 0.01

Table V. Quantization results on COCO dataset. “APbox_{\mathrm{box}}” means the box average precision for object detection, and “APmask_{\mathrm{mask}}” means the mask average precision for instance segmentation.

Ablation Studies

Effectiveness of Key Components of RankQ-ViT

To demonstrate the efficacy of the key components involved in RankQ-ViT, we conduct ablation experiments on the ImageNet dataset, utilizing DeiT-S as the network architecture.

First, we evaluate the effectiveness of the loss functions used in our method, as shown in Table VI. The model exhibits the worst performance when all loss variants are excluded, highlighting the importance of each component in achieving optimal results. Notably, the PSAQ loss performs slightly better than the sole usage of LceL_{ce} due to the entropy maximization operation. Our LrpL_{rp} outperforms the PSAQ by 0.48% and 0.28% in terms of W4/A8 and W8/A8, showing the superiority of our rank promotion strategy in preserving the nuances of patch relationships. Integrating LrpL_{rp} with PSAQ yields superior performance compared to the baseline PSAQ, as LrpL_{rp} facilitates the extraction of more discriminative features. We also note that combining LrpL_{rp} with PSAQ does not yield better improvement over rank alone, but rank alone already outperforms PSAQ alone, which suggests that rank is a more direct and effective optimization target.

MethodPrec.
LrpL_{rp}LceL_{ce}BAPSAQ4/88/8
××××13.3018.16
×✓××76.5779.03
×××✓76.8879.12
✓×××77.3679.40
✓××✓77.6279.31
×✓×✓77.3279.47
✓✓××77.6879.42
✓✓✓✓77.7679.51
✓✓✓×77.8679.59

Table VI. Results of various loss components in RankQ-ViT. “BA” means the usage of block-aware mechanism. “PSAQ” denote the usage of losses in PSAQ-ViT v1 [16].

Next, we validate the sample selection and training strategies used in our method, as shown in Table VII. Specifically, the NF and BF aim to match the features between the original network and its low-bit counterpart in a network-wise and block-wise respectively. When replacing BF with NF, the test accuracy decreases by 0.32% and 0.16% for W4/A8 and W8/A8, respectively. This can be attributed to the overfitting that occurs during FT [20]. Moreover, using rank in sample selection improves the accuracy, indicating that samples with higher ranks tend to have better quality. By incorporating JSD and rank together, our method achieves the best results for both W4/A8 and W8/A8 quantization. This suggests that the quality of generated images can be effectively assessed through intermediate feature distribution and semantic consistency.

MethodPrec.
BFNFJSDRank4/88/8
××××77.3279.47
✓×××77.5879.46
×✓××77.2879.36
✓×✓×77.6579.46
✓××✓77.7079.55
×✓✓✓77.5479.43
✓×✓✓77.8679.59

Table VII. Results of various sample selection and training strategies in RankQ-ViT. “BF” and “NF” mean the usage of block-wise and network-wise fine-tuning.

Sensitivity Analysis of Hyper-parameters

We first investigate the influence of varied α\alpha in Eq. (13). From Figure 5 (a), it can be easily observed that models receive the best performance when α=1\alpha= 1. When α=0\alpha= 0, which means the absence of LceL_{ce}, the models have the worst performance since the loss of semantic supervision. In addition, when shifting the α\alpha from 1 to 2, there is a slight accuracy loss, indicating the robustness of α\alpha during training. We also evaluate the impact of different NselN_{sel}, which is shown in Figure 5 (b). We observe that selecting too few samples for calibration leads to suboptimal results, due to the overfitting during block-wise reconstruction. However, exclusively using all the generated samples also shows limited results, as it overlooks the quality of the samples. Therefore, we use a moderate portion of generated samples for fine-tuning stage.

Figure 5. Hyperparameter sensitivity analysis on W4/A8 quantization of DeiT-S. (a) Effect of different α\alpha values. (b) Effect of different NselN_{sel} values.

Visualization Analysis of Generated samples

We visualize the samples generated by DeiT-T in Figure 4. The images produced by PSAQ-ViT exhibit lower fidelity than those generated by RankQ-ViT. Moreover, images generated by PSAQ-ViT contain less semantic information than our RankQ-ViT. For instance, a clear outline of the object labeled “minivan” is discernible in the generated image by RankQ-ViT. These results suggest that our rank promotion strategy effectively preserves feature independence, thereby leading to improved image generation quality.

Figure 4. The synthetic samples (224x224 pixels) shown in the figure are generated by PSAQ-ViT v1 and our proposed RankQ-ViT. The label associated with each generated image is indicated in the upper-right corner. The results demonstrate that images produced by PSAQ-ViT contain obscure semantic information, whereas those generated by our RankQ-ViT exhibit significantly stronger semantic content. Furthermore, the images from RankQ-ViT show richer texture details compared to those from PSAQ-ViT.

Effectiveness of Cross-Architecture Evaluation

To assess the generalization capability of the generated images, we further conduct cross-architecture calibration experiments, using images generated by DeiT-T as source data to calibrate other network variants. Specifically, we fix the synthetic samples produced by DeiT-T and directly apply them to fine-tune the quantized versions of DeiT-S, DeiT-B, and ViT-S without any further data generation. As shown in Figure 6, the results demonstrate that data generated by DeiT-T consistently improves the performance of DeiT-S, DeiT-B, and ViT-S. This finding validates the robustness and generalization of the proposed method across different architectures, suggesting that our rank-promoted synthetic data captures transferable feature distributions rather than model-specific artifacts.

Results of data generated by DeiT-T for other model quantization

Figure 6. Results of data generated by DeiT-T for other model quantization. W4/A8 quantization is used here for comparison. The results clearly indicate that our RankQ-ViT has superior cross-architecture generalization ability.

Efficiency Analysis of RankQ-ViT

In addition to the test performance, the quantization efficiency is also critical in realistic applications. To ensure a fair comparison, we fix the batch size at 32 and the total iterations at 2,000 for all variants. The results are detailed in Table VIII. The PSAQ-ViT v2 struggles in efficiency due to the two-stream learning in data generation. The data generation process in RankQ-ViT is approximately 5 times faster than PSAQ-ViT v1, since it eliminates the need for complex entropy computation. Overall, our RankQ-ViT strikes a good balance between efficiency and performance, offering great potential for practical usage.

ModelMethodGen.FT.Tot.
DeiT-TPSAQ v1150-150
PSAQ v2202216418
Baseline28216244
ours30216246
DeiT-SPSAQ v1288-288
PSAQ v2414474888
Baseline46474520
ours54474528

Table VIII. Runtime (seconds) comparison on NVIDIA RTX-4090 GPU. “Gen.”, “FT.”, and “Tot.” denote the data generation, fine-tuning, and overall time, respectively.

Deployment of Quantized Models

To evaluate the deployment efficiency of quantized ViT models on general-purpose computation platforms (i.e., CPU/GPU), we benchmark ViT-B and DeiT-B using W8/A8 quantization during inference. For CPU deployment, we use 8 CPU inference threads for implementation. For GPU deployment, we use TensorRT-based inference with FP32 and INT8 engines, and report throughput and peak GPU memory usage measured during deployment. We use 20 warm-up iterations followed by 100 timed inference runs, and throughput was computed from the median latency.

On CPU, INT8 quantization improves both throughput and memory efficiency. For ViT-B, throughput increases from 15.0 FPS to 34.8 FPS, giving a 2.31× speedup, while peak memory decreases from 729 MB to 537 MB. For DeiT-B, throughput increases from 20.6 FPS to 28.1 FPS, corresponding to a 1.36× speedup, while peak memory decreases from 737 MB to 547 MB. The GPU TensorRT results show a similar but much larger absolute throughput advantage. For ViT-B, INT8 TensorRT inference improves throughput from 598 FPS to 829 FPS and reduces peak memory from 798 MB to 554 MB. For DeiT-B, throughput increases from 571 FPS to 758 FPS, while peak memory decreases from 798 MB to 552 MB. These results demonstrate that INT8 quantization consistently reduces memory consumption and improves inference throughput across both CPU and GPU deployment backends.

Conclusion and Future Work

This paper proposes RankQ-ViT, an efficient data-free quantization method tailored for Vision Transformers (ViTs). RankQ-ViT employs a two-step training framework, which first generates training samples and then fine-tunes the model using these samples. Specifically, we use a novel block-aware rank promotion mechanism, which encourages the generated images to closely mimic the rank distribution of realistic ones in a block-aware fashion. In this way, high-quality samples can be generated efficiently. After that, RankQ-ViT selects high-quality samples with the highest semantic consistency and fidelity, thereby enhancing the quantization performance effectively. Extensive experiments on four datasets (including ImageNet, COCO, ModelNet40, and ShapeNet) for image classification, object detection, instance segmentation, and 3D point cloud classification tasks demonstrate the effectiveness of the proposed RankQ-ViT. With the W4/A8 quantization setting, the proposed RankQ-ViT achieves 82.44% and 77.86% test accuracy on ViT-B and DeiT-S, which significantly outperforms the state-of-the-art PTQ method RepQ-ViT by 6.15% and 2.67%. As future work, we plan to explore data-free quantization methods for large-scale foundation models (e.g., SAM), to facilitate the deployment of these models.

Acknowledgments

This work was partially supported by the Guangdong S&T Programme (No. 2025B0101130003), the National Natural Science Foundation of China (No. 62372491), the Guangdong Basic and Applied Basic Research Foundation (2023B1515120087), the Aeronautical Science Fund of China (2025L0150M1001), and the Science and Technology Planning Project of Key Laboratory of Advanced IntelliSense Technology, Guangdong Science and Technology Department (2023B1212060024).

References

Appendix

The proof of Proposition 1

Proof. For brevity, we use r=2r = 2 in the proof process. Consider feature vectors xi∈RDx_i \in\mathbb{R}^D, which is defined as

xi=(cos⁡θi,sin⁡θi,0,…,0),θi=2πiN,i=1,…,N,(17)x_i = (\cos\theta_i, \sin\theta_i, 0, \ldots, 0), \qquad\theta_i = \frac{2\pi i}{N}, \qquad i = 1, \ldots, N, \tag*{(17)}

where only the first two coordinates are nonzero, and represented in a triangle function style. Then, let

X=[x1T,…,xNT]T∈RN×D,(18)X = [x_1^{\mathsf{T}}, \ldots, x_N^{\mathsf{T}}]^{\mathsf{T}} \in\mathbb{R}^{N \times D}, \tag*{(18)}

and define the similarity matrix

SN=XXT.(19)S_N = XX^{\mathsf{T}}. \tag*{(19)}

Since all feature vectors lie in a two-dimensional subspace of RD\mathbb{R}^D, we have

rank⁡(X)≤2.(20)\operatorname{rank}(X) \le2. \tag*{(20)}

Therefore,

rank⁡(SN)=rank⁡(XXT)≤rank⁡(X)≤2.(21)\operatorname{rank}(S_N) = \operatorname{rank}(XX^{\mathsf{T}}) \le\operatorname{rank}(X) \le2. \tag*{(21)}

For any pair (i,j)(i,j), the similarity entry satisfies

Sij=xiTxj=cos⁡(θi−θj).(22)S_{ij} = x_i^{\mathsf{T}}x_j = \cos(\theta_i - \theta_j). \tag*{(22)}

As N→∞N \to\infty, the angle differences θi−θj\theta_i - \theta_j become dense in [0,2π][0, 2\pi], implying that the similarity values {Sij}\{S_{ij}\} become dense in [−1,1][-1,1]. Therefore, although SNS_N remains low-rank, its entries are highly dispersed across the entire similarity range, leading to high entropy.

The proof of Proposition 2

Proof. We first define the Gram matrix as

G=XXT.(23)G = XX^{\mathsf{T}}. \tag*{(23)}

Since each row is normalized (feature is normalized), the diagonal entries of GG satisfy

Gii=xiTxi=1.(24)G_{ii} = x_i^{\mathsf{T}}x_i = 1. \tag*{(24)}

For every i≠ji \ne j, according to the assumption, it gives:

∣Gij∣=∣xiTxj∣≤ϵ.(25)|G_{ij}| = |x_i^{\mathsf{T}}x_j| \le\epsilon. \tag*{(25)}

Thus the Frobenius norm of GG satisfies

∥G∥F2=∑i,jGij2(26)\lVert G \rVert_F^2 = \sum_{i,j} G_{ij}^2 \tag*{(26)}
=∑iGii2+∑i≠jGij2(27)= \sum_i G_{ii}^2 + \sum_{i \ne j} G_{ij}^2 \tag*{(27)}
≤N+N(N−1)ϵ2.(28)\le N + N(N-1)\epsilon^2. \tag*{(28)}

Let λ1,…,λr\lambda_1, \ldots, \lambda_r denote the non-zero eigenvalues of GG, where

r=rank⁡(G)=rank⁡(X).(29)r = \operatorname{rank}(G) = \operatorname{rank}(X). \tag*{(29)}

We have

tr⁡(G)=∑i=1rλi=N,∥G∥F2=∑i=1rλi2.(30)\operatorname{tr}(G) = \sum_{i=1}^{r} \lambda_i = N, \qquad\lVert G \rVert_F^2 = \sum_{i=1}^{r} \lambda_i^2. \tag*{(30)}

And according to the Cauchy–Schwarz inequality, we have

(∑i=1rλi)2≤r∑i=1rλi2.(31)\left(\sum_{i=1}^{r} \lambda_i\right)^2 \le r \sum_{i=1}^{r} \lambda_i^2. \tag*{(31)}

Then, substituting the above identities yields

N2≤r∥G∥F2.(32)N^2 \le r\lVert G \rVert_F^2. \tag*{(32)}

Therefore

r≥N2∥G∥F2.(33)r \ge\frac{N^2}{\lVert G \rVert_F^2}. \tag*{(33)}

Finally, combining with the bound on ∥G∥F2\lVert G \rVert_F^2, we have

r≥N2N+N(N−1)ϵ2=N1+(N−1)ϵ2.(34)r \ge\frac{N^2}{N + N(N-1)\epsilon^2} = \frac{N}{1 + (N-1)\epsilon^2}. \tag*{(34)}

Since r=rank⁡(X)=rank⁡(G)r = \operatorname{rank}(X) = \operatorname{rank}(G), the theorem follows.

References

  1. [1]H. Touvron, M. Cord, M. Douze, F. Massa, A. Sablayrolles, and H. Jégou, “Training data-efficient image transformers & distillation through attention,” in International Conference on Machine Learning, 2021, pp. 10 347–10 357.
  2. [2]J. Xu, X. Zhang, C. Zhao, Z. Geng, Y. Feng, K. Miao, and Y. Li, “Improving fine-grained image classification with multimodal information,” IEEE Transactions on Multimedia, vol. 26, pp. 2082–2095, 2023.DOI
  3. [3]Z. Liu, Y. Lin, Y. Cao, H. Hu, Y. Wei, Z. Zhang, S. Lin, and B. Guo, “Swin transformer: Hierarchical vision transformer using shifted windows,” in Proceedings of the IEEE/CVF International Conference on Computer Vision, 2021, pp. 10 012–10 022.arxiv.org/abs/2103.14030
  4. [4]Y. Huang, X. Qiao, P. Ren, L. Liu, C. Pu, S. Dustdar, and J. Chen, “A lightweight collaborative deep neural network for the mobile web in edge cloud,” IEEE Transactions on Mobile Computing, vol. 21, pp. 2289–2305, 2020.DOI
  5. [5]G. Xu, Z. Hao, Y. Luo, H. Hu, J. An, and S. Mao, “DeViT: Decomposing vision transformers for collaborative inference in edge devices,” IEEE Transactions on Mobile Computing, vol. 23, pp. 5917–5932, 2023.arxiv.org/abs/2309.05015
  6. [6]H. Li, X. Li, Q. Fan, Q. He, X. Wang, and V. C. Leung, “Aggregate model partitioning and pruning for collaborative dnn inference in mobile edge-cloud computing networks,” IEEE Transactions on Mobile Computing, vol. 25, pp. 3744–3759, 2025.DOI
  7. [7]Z. Xu, Y. Xu, H. Xu, Y. Liao, Z. Yao, and Z. Xie, “Lightweight and post-training structured pruning for on-device large language models,” IEEE Transactions on Mobile Computing, vol. 25, pp. 5377–5392, 2025.DOI
  8. [8]R. Yi, L. Guo, S. Wei, A. Zhou, S. Wang, and M. Xu, “EdgeMoE: Empowering sparse large language models on mobile devices,” IEEE Transactions on Mobile Computing, vol. 24, pp. 7059–7073, 2025.arxiv.org/abs/2308.14352
  9. [9]R. Jiang, Y. Yan, J.-H. Xue, S. Chen, N. Wang, and H. Wang, “Knowledge distillation meets label noise learning: ambiguity-guided mutual label reverier,” IEEE Transactions on Neural Networks and Learning Systems, vol. 36, pp. 939–952, 2023.DOI
  10. [10]J. Rao, X. Meng, L. Ding, S. Qi, X. Liu, M. Zhang, and D. Tao, “Parameter-efficient and student-friendly knowledge distillation,” IEEE Transactions on Multimedia, vol. 26, pp. 4230–4241, 2023.arxiv.org/abs/2205.15308
  11. [11]Y. Chen, Z. Wang, H. Cai, Z. Qin, and S. Deng, “Federated knowledge distillation using hierarchical reinforcement learning in resource-constrained iot edge-cloud computing environments,” IEEE Transactions on Mobile Computing, vol. 25, pp. 326–340, 2025.DOI
  12. [12]R. Chen, L. Li, K. Xue, C. Zhang, M. Pan, and Y. Fang, “Energy efficient federated learning over heterogeneous mobile devices via joint design of weight quantization and wireless transmission,” IEEE Transactions on Mobile Computing, vol. 22, pp. 7451–7465, 2022.arxiv.org/abs/2012.11070
  13. [13]J. Xie, C. Ding, X. Li, S. Ren, Y. Li, and Z. Lu, “Nestquant: Post-training integer-nesting quantization for on-device DNN,” IEEE Transactions on Mobile Computing, vol. 24, pp. 12 088–12 102, 2025.DOI
  14. [14]H. Cui, Z. Qu, B. Ye, B. Tang, T. Zhuang, X. Wang, and Y. Zeng, “Lightweight adaptive quantization algorithms for federated learning with heterogeneous clients,” IEEE Transactions on Mobile Computing, vol. 25, pp. 4409–4424, 2025.DOI
  15. [15]H. Guo, L. Wang, W. Mao, X. Dong, Y. Wang, L. Liu, and W. An, “Deep lookup network,” IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 48, pp. 202–218, 2025.arxiv.org/abs/2509.13662
  16. [16]Z. Li, L. Ma, M. Chen, J. Xiao, and Q. Guo, “Patch similarity aware rate and general data-free quantization for vision transformers,” in European Conference on Computer Vision, 2022, pp. 154–170.DOI
  17. [17]Z. Li, M. Chen, J. Xiao, and Q. Guo, “PSAQ-ViT v2: Toward accurate and general data-free quantization for vision transformers,” IEEE Transactions on Neural Networks and Learning Systems, vol. 35, pp. 17 227–17 238, 2023.DOI
  18. [18]Y. Li, S. Xu, B. Zhang, X. Cao, P. Gao, and G. Guo, “Q-ViT: Accurate and fully quantized low-bit vision transformers,” in Advances in Neural Information Processing Systems, 2022, pp. 34 451–34 463.arxiv.org/abs/2210.06707
  19. [19]Z. Li, J. Xiao, L. Yang, and Q. Gu, “Rep-ViT: Scale reparameterization for post-training quantization of vision transformers,” in Proceedings of the IEEE/CVF International Conference on Computer Vision, 2023, pp. 17 227–17 236.arxiv.org/abs/2212.08254
  20. [20]Y. Li, R. Gong, X. Tan, Y. Yang, P. Hu, Q. Zhang, F. Yu, W. Wang, and S. Gu, “BRECQ: Pushing the limit of post-training quantization by block reconstruction,” in International Conference on Learning Representations, 2021.arxiv.org/abs/2102.05426
  21. [21]L. Wang, X. Dong, Y. Wang, L. Liu, W. An, and Y. Guo, “Learnable lookup table for neural network quantization,” in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2022, pp. 12 423–12 433.DOI
  22. [22]M. Nagel, R. A. Amjad, M. Van Baalen, C. Louizos, and T. Blankevoort, “Up or down? adaptive rounding for post-training quantization,” in International Conference on Machine Learning, 2020, pp. 7197–7206.arxiv.org/abs/2004.10568
  23. [23]Y. Zhong, Y. Huang, J. Hu, Y. Zhang, and R. Ji, “Towards accurate post-training quantization of vision transformers via error reduction,” IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 47, pp. 2676–2692, 2025.DOI
  24. [24]C. Li, R. Jiang, L. Xu, Y. Zhang, Q. Hu, and Y. Guo, “ScalePredictor: Instance-aware scale learning for accurate quantization of vision transformers,” arXiv preprint arXiv:2606.21947, 2026.arxiv.org/abs/2606.21947
  25. [25]W. Zhang, Y. Zhong, Z. Ding, X. Li, and K. Yoshioka, “D4C: Data-free quantization for contrastive language-image pre-training models,” in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2026, pp. 2978–2987.arxiv.org/abs/2511.15411
  26. [26]Y. Cai, Z. Yao, Z. Dong, A. Gholami, M. W. Mahoney, and K. Keutzer, “ZeroQ: A novel zero shot quantization framework,” in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2020, pp. 13 169–13 178.arxiv.org/abs/2001.00281
  27. [27]H. Li, X. Wu, F. Lv, D. Liao, T. H. Li, Y. Zhang, B. Han, and M. Tan, “Hard sample matters a lot in zero-shot quantization,” in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2023, pp. 24 417–24 426.arxiv.org/abs/2303.13826
  28. [28]C. Fan, Z. Wang, D. Guo, and M. Wang, “Data-free quantization via pseudo-label filtering,” in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2024, pp. 5589–5598.DOI
  29. [29]X. He, J. Lu, W. Xu, Q. Hu, P. Wang, and J. Chen, “Generize zero-shot network quantization,” in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2021, pp. 3000–3011.arxiv.org/abs/2101.08430
  30. [30]A. Dosovitsky, L. Beyer, A. Kolesnikov, D. Weissenborn, X. Zhai, T. Unterthiner, M. Dehghani, M. Minderer, G. Heigold, X. Gelly et al., “An image is worth 16x16 words: Transformers for image recognition at scale,” in International Conference on Learning Representations, 2020.
  31. [31]H. Zhao, L. Jiang, J. Jia, P. H. Torr, and V. Koltun, “Point transformer,” in Proceedings of the IEEE/CVF International Conference on Computer Vision, 2021, pp. 16 259–16 268.
  32. [32]M.-H. Guo, J.-X. Cai, Z.-N. Liu, T.-J. Mu, R. R. Martin, and S.-M. Hu, “PCT: Point cloud transformer,” Computational Visual Media, vol. 7, pp. 187–199, 2021.DOI
  33. [33]Z. Liu, Y. Wang, K. Han, W. Zhang, S. Ma, and W. Gao, “Post-training quantization for vision transformer,” in Advances in Neural Information Processing Systems, 2021, pp. 28 092–28 103.arxiv.org/abs/2106.14156
  34. [34]R. Jiang, Y. Zhang, L. Wang, P. Yu, and Y. Guo, “AIQViT: Architecture-informed post-training quantization for vision transformers,” in Proceedings of the AAAI Conference on Artificial Intelligence, 2025, pp. 17 635–17 643.arxiv.org/abs/2502.04628
  35. [35]Z. Li, H. Li, J. Wu, K. Liu, H. Qin, L. Kong, G. Chen, Y. Zhang, and X. Yang, “DVD-quant: data-free video diffusion transformers quantization,” in International Conference on Learning Representations, 2026, pp. 35 463–35 475.arxiv.org/abs/2505.18663
  36. [36]K. Zhao, Z. Huang, M. Zhang, C. Guo, Y. Shu, and B. Yang, “Enhancing diversity for data-free quantization,” in 2025 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2025, pp. 20 969–20 978.DOI
  37. [37]Y. Zhong, Y. Zhou, Y. Zhang, W. Sui, S. Li, Y. Li, F. Chao, and R. Ji, “Semantic alignment and reinforcement for data-free quantization of vision transformers,” in 2025 IEEE/CVF International Conference on Computer Vision (ICCV), 2025, pp. 12 479–12 490.arxiv.org/abs/2412.16553
  38. [38]A. Ramachandran, S. Kundu, and T. Krishna, “CLAMP-ViT: Contrastive data-free learning for adaptive post-training quantization of vits,” in European Conference on Computer Vision, 2025, pp. 307–325.arxiv.org/abs/2407.05266
  39. [39]K. Choi, H. Lee, D. Kwon, S. Park, K. Kim, N. Park, J. Choi, J. Lee, “Mimiq: Low-bit data-free quantization of vision transformers with encouraging inter-head attention similarity,” in Proceedings of the AAAI Conference on Artificial Intelligence, 2025, pp. 16 037–16 045.
  40. [40]A. v. d. Oord, Y. Li, and O. Vinyals, “Representation learning with contrastive predictive coding,” arXiv preprint arXiv:1807.03748, 2018.arxiv.org/abs/1807.03748
  41. [41]E. Englesson and H. Azizpour, “Generalized Jensen-Shannon divergence loss for learning with noisy labels,” in Advances in Neural Information Processing Systems, 2021, pp. 30284–30297.arxiv.org/abs/2105.04522
  42. [42]Y. Tong, J. Yuan, T. Zhang, J. Liu, and C. Hu, “DFQ-ViT: Data-free quantization for vision transformers without fine-tuning,” arXiv preprint arXiv:2507.14481, 2025.arxiv.org/abs/2507.14481
  43. [43]Z. Pei, A. Zhang, S. Wang, X. Ji, and Q. Huang, “Data-free neural representation compression with riemannian neural dynamics,” in Forty-first International Conference on Machine Learning, 2024, pp. 40 129–40 144.
  44. [44]A. Krizhevsky, I. Sutskever, and G. E. Hinton, “ImageNet classification with deep convolutional neural networks,” in Advances in Neural Information Processing Systems, 2012, pp. 1106–1114.
  45. [45]T.-Y. Lin, M. Maire, S. Belongie, J. Hays, P. Perona, D. Ramanan, P. Dollár, and C. L. Zitnick, “Microsoft COCO: Common objects in context,” in European Conference on Computer Vision, 2014, pp. 740–755.arxiv.org/abs/1405.0312
  46. [46]Z. Wu, S. Song, A. Khosla, F. Yu, L. Zhang, X. Tang, and J. Xiao, “3D ShapeNets: A deep representation for volumetric shapes,” in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2015, pp. 1912–1920.DOI
  47. [47]L. Yi, V. G. Kim, D. Ceylan, I.-C. Shen, M. Yan, H. Su, C. Lu, Q. Huang, A. Sheffer, and L. Guibas, “A scalable active framework for region annotation in 3D shape collections,” ACM Transactions on Graphics, vol. 35, pp. 1–12, 2016.DOI

AI tools statement

No AI-use declaration is available for this version in Valency.

The available record does not establish whether AI systems or models contributed to this work.

How AI tools are recorded

Paper details

Cite this paper

Publication

Published
Version
Latest

Data & code

Code, data, proofs and workflows the authors linked for testing, review and reproduction. These links are part of this work’s metadata and are released under the same license as the rest of that metadata. Valency doesn’t host the files; each keeps the license set where it’s hosted.

Pick where to look, or just type