In this paper, we propose an accurate data-free post-training quantization framework of diffusion models (ADP-DM) for efficient image generation. Conventional data-free quantization methods learn shared quantization functions for tensor discretization regardless of the generation timesteps, while the activation distribution differs significantly across various timesteps. The calibration images are acquired in random timesteps which fail to provide sufficient information for generalizable quantization function learning. Both issues cause sizable quantization errors with obvious image generation performance degradation. On the contrary, we design group-wise quantization functions for activation discretization in different timesteps and sample the optimal timestep for informative calibration image generation, so that our quantized diffusion model can reduce the discretization errors with negligible computational overhead. Specifically, we partition the timesteps according to the importance weights of quantization functions in different groups, which are optimized by differentiable search algorithms. We also select the optimal timestep for calibration image generation by structural risk minimizing principle in order to enhance the generalization ability in the deployment of quantized diffusion model. Extensive experimental results show that our method outperforms the state-of-the-art post-training quantization of diffusion model by a sizable margin with similar computational cost.
翻译:本文提出了一种精确的无数据扩散模型后训练量化框架(ADP-DM),用于高效图像生成。传统无数据量化方法在张量离散化时学习共享量化函数,忽略了生成时间步的差异,而不同时间步的激活分布存在显著差异。校准图像在随机时间步中获取,无法为泛化量化函数学习提供足够信息。这两个问题导致量化误差显著增大,图像生成性能明显下降。相反,我们针对不同时间步的激活离散化设计了分组量化函数,并采样最优时间步以生成信息丰富的校准图像,从而在几乎不增加计算开销的前提下降低量化扩散模型的离散化误差。具体而言,我们根据量化函数在不同分组中的重要性权重划分时间步,并通过可微分搜索算法优化这些权重。同时,我们基于结构风险最小化原则选取最优时间步生成校准图像,以增强量化扩散模型部署时的泛化能力。大量实验结果表明,在相似计算成本下,我们的方法显著优于现有的扩散模型后训练量化技术。