arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2305.10657cs.CV
收藏

PTQD:面向扩散模型的精确训练后量化

PTQD: Accurate Post-Training Quantization for Diffusion Models

Zhejiang University(浙江大学);Monash University(莫纳什大学)

Yefei He, Luping Liu, Jing Liu, Weijia Wu, Hong Zhou, Bohan Zhuang

AI总结:

本文提出PTQD方法,通过分解并校正量化噪声、校准方差调度及混合精度方案,在显著降低扩散模型推理计算量的同时保持生成质量,FID仅增加0.06且节省19.9倍位运算。

摘要:

扩散模型近年来在图像合成任务中占据主导地位。然而,迭代去噪过程在推理时计算开销很大,使得扩散模型难以用于低延迟和可扩展的实际应用。扩散模型的训练后量化(PTQ)可以在无需重新训练的情况下显著减小模型规模并加速采样过程。尽管如此,将现有PTQ方法直接应用于低位扩散模型会严重损害生成样本的质量。具体而言,在每个去噪步骤中,量化噪声会导致估计均值出现偏差,并与预定的方差调度不匹配。随着采样过程的进行,量化噪声可能不断累积,导致后期去噪步骤中信噪比(SNR)较低。为解决这些挑战,我们针对量化去噪过程中的量化噪声和扩散扰动噪声提出了一种统一表述。具体来说,我们首先将量化噪声分解为相对于其全精度对应部分的相关部分和残差非相关部分。相关部分可以通过估计相关系数轻松校正。对于非相关部分,我们从量化结果中减去偏置以校正均值偏差,并校准去噪方差调度以吸收量化带来的超额方差。此外,我们引入了一种混合精度方案,用于为每个去噪步骤选择最优位宽。大量实验表明,我们的方法优于以往的训练后量化扩散模型,在ImageNet 256x256上,与全精度LDM-4相比,FID分数仅增加了0.06,同时节省了19.9倍的位运算。代码可在 https://github.com/ziplab/PTQD 获取。

英文摘要:

Diffusion models have recently dominated image synthesis 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 (PTQ) of diffusion models can significantly reduce the model size and accelerate the sampling process without re-training. Nonetheless, applying existing PTQ 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. As the sampling process proceeds, the quantization noise may accumulate, resulting in a low signal-to-noise ratio (SNR) during the later denoising steps. To address these challenges, we propose a unified formulation for the quantization noise and diffusion perturbed noise in the quantized denoising process. Specifically, 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 subtract the bias from the quantized results to correct the mean deviation and calibrate the denoising variance schedule to absorb the excess variance resulting from quantization. Moreover, we introduce a mixed-precision scheme for selecting the optimal bitwidth for each denoising step. Extensive experiments demonstrate that our method outperforms previous post-training quantized diffusion models, with only a 0.06 increase in FID score compared to full-precision LDM-4 on ImageNet 256x256, while saving 19.9x bit operations. Code is available at https://github.com/ziplab/PTQD.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑