Abstract
Recent advancements in diffusion models, particularly the architectural transformation from UNet-based models to Diffusion Transformers (DiTs), significantly improve the quality and scalability of image and video generation. However, the substantial computational costs of these large-scale models pose significant challenges for real-world deployment. Post-Training Quantization (PTQ) enables model compression without costly retraining, but existing frameworks often suffer from biased quantization in DiTs. We propose Q-DiT, which integrates automatic quantization granularity allocation and sample-wise dynamic activation quantization to address spatial and temporal variance. Extensive experiments on ImageNet and VBench demonstrate that Q-DiT achieves near-lossless performance at W6A8 and maintains high fidelity even at W4A8.
The Problem: Spatial and Temporal Variance in DiTs
Diffusion Transformers (DiTs) offer superior scalability compared to traditional UNet structures but come with high inference costs. While Post-Training Quantization (PTQ) is a standard solution for model compression, standard methods fail to maintain quality in DiTs. The authors identify two primary culprits:
- Spatial Variance: Unlike CNNs where variance is often across output channels, DiTs exhibit massive variance in weights and activations across input channels.
- Temporal and Sample Variance: Activation distributions shift drastically across different denoising timesteps and between different generated samples.
Methodology: The Q-DiT Framework
To address these challenges, Q-DiT introduces a two-pronged approach split between offline search and online execution:
1. Automatic Quantization Granularity Allocation
Instead of uniform layer-wise quantization, Q-DiT employs fine-grained group quantization. The authors observed a "non-monotonicity trap" where simply reducing group sizes doesn't always improve performance. To navigate this, they use an evolutionary search algorithm to find the optimal group-size configuration for each layer, guided by visual quality metrics like FID and FVD.
2. Sample-wise Dynamic Activation Quantization
To handle temporal and sample-specific variance, Q-DiT calculates quantization parameters (min-max values) dynamically for every sample at every timestep. This "on-the-fly" adjustment ensures the quantizer remains perfectly calibrated to the data distribution throughout the denoising process, providing resilience against activation outliers.
Key Results and Insights
Q-DiT sets a new benchmark for efficient DiT deployment across image and video tasks:
- Near-Lossless 6-bit Quantization: On ImageNet 256×256, Q-DiT (W6A8) achieved an FID of 12.21, nearly matching the full-precision baseline (12.40) and significantly outperforming previous methods like PTQ4DiT.
- Robust 4-bit Performance: In the challenging W4A8 setting, Q-DiT maintained high fidelity (FID 15.76), whereas other baselines collapsed (FIDs > 200).
- Video Generation Excellence: On the VBench benchmark for video generation (STDiT3 model), Q-DiT (W4A8) outperformed robust baselines in 15 out of 16 metrics, preserving temporal consistency and motion smoothness.
Conclusion and Future Work
Q-DiT demonstrates that high-quality, low-bit quantization is achievable for Diffusion Transformers by accounting for their unique spatial and temporal characteristics. While the evolutionary search process is currently computationally intensive, it provides a vital blueprint for future optimization. Future research may explore faster proxy metrics for the search process and even lower bit-widths to further reduce the deployment barrier for massive generative models.
Summary updated