PTQD: Accurate Post-Training Quantization for Diffusion Models

05/18/2023
by   Yefei He, et al.
0

Diffusion models have recently dominated image synthesis and other related generative tasks. However, the iterative denoising process is expensive in computations at inference time, making diffusion models less practical for low-latency and scalable real-world applications. Post-training quantization of diffusion models can significantly reduce the model size and accelerate the sampling process without requiring any re-training. Nonetheless, applying existing post-training quantization methods directly to low-bit diffusion models can significantly impair the quality of generated samples. Specifically, for each denoising step, quantization noise leads to deviations in the estimated mean and mismatches with the predetermined variance schedule. Moreover, as the sampling process proceeds, the quantization noise may accumulate, resulting in a low signal-to-noise ratio (SNR) in late denoising steps. To address these challenges, we propose a unified formulation for the quantization noise and diffusion perturbed noise in the quantized denoising process. We first disentangle the quantization noise into its correlated and residual uncorrelated parts regarding its full-precision counterpart. The correlated part can be easily corrected by estimating the correlation coefficient. For the uncorrelated part, we calibrate the denoising variance schedule to absorb the excess variance resulting from quantization. Moreover, we propose a mixed-precision scheme to choose the optimal bitwidth for each denoising step, which prefers low bits to accelerate the early denoising steps while high bits maintain the high SNR for the late steps. Extensive experiments demonstrate that our method outperforms previous post-training quantized diffusion models in generating high-quality samples, with only a 0.06 increase in FID score compared to full-precision LDM-4 on ImageNet 256x256, while saving 19.9x bit operations.

READ FULL TEXT
research
11/28/2022

Post-training Quantization on Diffusion Models

Denoising diffusion (score-based) generative models have recently achiev...
research
06/04/2023

Temporal Dynamic Quantization for Diffusion Models

The diffusion model has gained popularity in vision applications due to ...
research
05/15/2023

Common Diffusion Noise Schedules and Sample Steps are Flawed

We discover that common diffusion noise schedules do not enforce the las...
research
02/08/2023

Q-Diffusion: Quantizing Diffusion Models

Diffusion models have achieved great success in synthesizing diverse and...
research
09/15/2023

Denoising Diffusion Probabilistic Models for Hardware-Impaired Communications

Generative AI has received significant attention among a spectrum of div...
research
06/01/2023

Addressing Negative Transfer in Diffusion Models

Diffusion-based generative models have achieved remarkable success in va...
research
06/08/2023

Multi-Architecture Multi-Expert Diffusion Models

Diffusion models have achieved impressive results in generating diverse ...

Please sign up or login with your details

Forgot password? Click here to reset