VQ4DiT: Efficient Post-Training Vector Quantization for Diffusion Transformers

Juncan Deng, Shuaiting Li, Zeyu Wang, Hong Gu, Kedong Xu, Kejie Huang

Abstract

Diffusion Transformers (DiTs) have set new standards for high-fidelity generative modeling but suffer from immense computational and memory overhead. We present VQ4DiT, a post-training quantization (PTQ) method that compresses DiTs to as low as 2-bit precision. By simultaneously calibrating quantization codebooks and weight assignments through a "zero-data" block-wise approach, VQ4DiT achieves state-of-the-art performance and significant memory savings without requiring large-scale training datasets.

Introduction

Diffusion Transformers (DiTs) are the backbone of state-of-the-art image and video generation models, such as OpenAI’s Sora. However, their massive parameter counts—often exceeding hundreds of millions—make them computationally expensive and memory-intensive. For instance, a standard DiT-XL/2 model requires over 100 Gflops and substantial VRAM, hindering deployment on edge devices like smartphones or laptops.

Traditional Uniform Quantization (UQ), which maps weights to a fixed grid, often fails at extremely low bit-widths (e.g., 2-bit) because it cannot accurately represent the complex weight distributions of transformers. Vector Quantization (VQ) offers a more flexible alternative by mapping groups of weights (sub-vectors) to a "codebook" of representative patterns. However, conventional VQ methods typically use a fixed assignment (e.g., via K-Means) and only update codebook values. This leads to "gradient conflict," where suboptimal initial assignments prevent the codebook from converging to an effective solution.

Methods: Simultaneous Calibration and Zero-Data Optimization

VQ4DiT addresses these limitations through three primary innovations:

  1. Simultaneous Calibration: Unlike prior methods that only optimize the codebook, VQ4DiT optimizes both the codebook entries and the assignments (the mapping of weights to codebook entries) concurrently.
  2. Candidate Assignment Sets: For each weight sub-vector, the algorithm identifies the top-$n$ closest codebook matches. During calibration, the weight is represented as a softmax-weighted average of these candidates, transforming a discrete selection problem into a differentiable one. As optimization progresses, the model converges on the single best assignment.
  3. Zero-Data Block-wise Calibration: To eliminate the need for massive datasets like ImageNet during quantization, VQ4DiT employs a "zero-data" strategy. Gaussian noise is fed into both the original floating-point model and the quantized model. The algorithm then minimizes the Mean Squared Error (MSE) between their outputs on a block-by-block basis, preventing error accumulation across the transformer's layers.
Overview of the VQ4DiT architecture and the iterative calibration process for codebooks and assignments.

Experimental Setup

The method was evaluated on the ImageNet benchmark at two resolutions: 256×256 and 512×512. While ImageNet was used for final evaluation (calculating FID and Inception Score), the calibration process itself remains "zero-data," requiring only synthetic noise to function.

Key Insights

  • The Assignment Bottleneck: A critical realization is that fixed initial weight-to-codebook mappings are often suboptimal. Allowing the model to re-evaluate these assignments during calibration resolves gradient inconsistencies.
  • Soft-to-Hard Transition: Using a differentiable softmax-weighted average of candidates allows for efficient gradient-based optimization of discrete indices.
  • Efficiency: VQ4DiT can quantize massive models in 20 minutes to 5 hours on a single A100 GPU, demonstrating that high-quality 2-bit performance does not require full model fine-tuning.

Results and Discussion

VQ4DiT demonstrates significant improvements over existing PTQ methods:

  • Superior 2-Bit Performance: On ImageNet 256×256, VQ4DiT achieved an FID of 11.87 at 2-bit precision. In contrast, methods like GPTQ and Q-DiT suffered from complete model collapse, with FIDs exceeding 300.
  • Massive Compression: Model size was reduced from 2553 MB (FP32) to 162 MB (2-bit), representing a ~15x reduction in storage.
  • Visual Fidelity: Qualitative results show that VQ4DiT maintains high image quality even at 2-bit precision, whereas other methods produce significant artifacts or noise.
Qualitative comparison of image generation quality at 3-bit and 2-bit precision across different quantization methods.

Limitations and Future Work

While VQ4DiT effectively quantizes DiT blocks, a fully optimized edge-ready pipeline would also require quantization of VAEs and conditioning MLPs. Furthermore, realizing actual inference speedups requires the development of specialized hardware kernels for efficient codebook lookups. Future research will explore scaling VQ4DiT to large-scale video diffusion models.

Summary updated

BibTeX
@inproceedings{deng2025vq,
  author = {Juncan Deng and Shuaiting Li and Zeyu Wang and Hong Gu and Kedong Xu and Kejie Huang},
  title = {{VQ4DiT: Efficient Post-Training Vector Quantization for Diffusion Transformers}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2025},
  doi = {10.1609/aaai.v39i15.33782},
}
Figure