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),用于高效图像生成。传统无数据量化方法学习的是与生成时间步无关的张量离散化共享量化函数,而不同时间步的激活分布差异显著。校准图像在随机时间步获取,无法为泛化量化函数学习提供充足信息。这两个问题会导致显著量化误差,并伴随明显的图像生成性能下降。为此,我们为不同时间步的激活离散化设计分组量化函数,并采样最优时间步生成信息丰富的校准图像,使量化扩散模型能够以可忽略的计算开销降低离散化误差。具体而言,我们根据不同分组中量化函数的重要性权重对时间步进行划分,并通过可微搜索算法优化这些权重。同时,我们采用结构风险最小化原则选择最优时间步生成校准图像,以增强量化扩散模型部署时的泛化能力。大量实验结果表明,在计算成本相近的情况下,我们的方法显著超越了当前最先进的扩散模型训练后量化方法。