NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Q-Diffusion: Quantizing Diffusion Models

Xiuyu Li, Long Lian, Yijiang Liu, Huanrui Yang, Zhen Dong, Daniel Kang, Shanghang Zhang, Kurt Keutzer

Abstract

Diffusion models have transformed image synthesis but remain computationally demanding due to their iterative denoising process. We present Q-Diffusion, a post-training quantization (PTQ) framework tailored for diffusion models. Q-Diffusion enables 4-bit weight quantization with minimal quality loss by addressing two primary challenges: the temporal evolution of activation distributions and the bimodal activation scales in U-Net shortcuts. Our approach achieves near-lossless performance on benchmarks like Stable Diffusion while reducing model size by approximately 8x.

Introduction

The iterative nature of diffusion models, requiring 50 to 1,000 timesteps to generate a single image, imposes a significant "computational tax." While quantization is a standard compression technique, traditional methods fail on diffusion models, often producing "garbage" outputs at low bit-widths. This failure stems from the violation of two core assumptions: static input distributions and uniform activation scales. In diffusion, data shifts from pure noise to clean images over time, and U-Net architectures mix features with wildly different scales.

Methods

Q-Diffusion introduces two main technical innovations to enable effective 4-bit quantization:

Timestep-aware Calibration

Unlike standard PTQ that uses a static calibration set, Q-Diffusion samples intermediate inputs across the entire denoising trajectory. By uniformly sampling from different timesteps, the calibration set reflects the evolving activation distributions the model encounters during inference.

Comparison of traditional PTQ and Q-Diffusion (Ours) calibration and inference.

Shortcut-Splitting Quantization

The authors identified that U-Net shortcut layers concatenate "shallow" and "deep" feature channels with activation scales differing by up to 200x. This creates bimodal distributions that a single quantizer cannot represent accurately. Q-Diffusion quantizes these channels separately before merging, preventing high-magnitude signals from overwhelming finer details.

Analysis of activation ranges across layers, highlighting abnormal ranges in shortcut layers.

Key Results

Q-Diffusion was evaluated on CIFAR-10, LSUN, and Stable Diffusion (LAION-5B).

  • High Fidelity: On CIFAR-10, Q-Diffusion maintained an FID of 5.09 (vs. 4.22 FP32), whereas traditional PTQ exceeded 100.
  • Stable Diffusion: It is the first framework to achieve high-quality text-to-image generation with 4-bit weights. The resulting images are qualitatively indistinguishable from full-precision versions.
  • Efficiency: Reducing weights to 4-bit (W4A8) results in an 8x reduction in model size compared to FP32, facilitating deployment on memory-constrained devices.

Conclusion

Q-Diffusion successfully bridges the gap between efficiency and quality for diffusion models. While it shows slight performance drops with "fast samplers" like DPM-Solver, it provides a robust foundation for 4-bit deployment. Future work will focus on optimizing text encoders and developing hardware-specific kernels for mobile deployment.

Summary updated

BibTeX
@inproceedings{li2023q,
  author = {Xiuyu Li and Long Lian and Yijiang Liu and Huanrui Yang and Zhen Dong and Daniel Kang and Shanghang Zhang and Kurt Keutzer},
  title = {{Q-Diffusion: Quantizing Diffusion Models}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2023},
}
Figure