Classifier-free guided diffusion models have recently been shown to be highly effective at high-resolution image generation, and they have been widely used in large-scale diffusion frameworks including DALLE-2, Stable Diffusion and Imagen. However, a downside of classifier-free guided diffusion models is that they are computationally expensive at inference time since they require evaluating two diffusion models, a class-conditional model and an unconditional model, tens to hundreds of times. To deal with this limitation, we propose an approach to distilling classifier-free guided diffusion models into models that are fast to sample from: Given a pre-trained classifier-free guided model, we first learn a single model to match the output of the combined conditional and unconditional models, and then we progressively distill that model to a diffusion model that requires much fewer sampling steps. For standard diffusion models trained on the pixel-space, our approach is able to generate images visually comparable to that of the original model using as few as 4 sampling steps on ImageNet 64x64 and CIFAR-10, achieving FID/IS scores comparable to that of the original model while being up to 256 times faster to sample from. For diffusion models trained on the latent-space (e.g., Stable Diffusion), our approach is able to generate high-fidelity images using as few as 1 to 4 denoising steps, accelerating inference by at least 10-fold compared to existing methods on ImageNet 256x256 and LAION datasets. We further demonstrate the effectiveness of our approach on text-guided image editing and inpainting, where our distilled model is able to generate high-quality results using as few as 2-4 denoising steps.
翻译:无分类器引导的扩散模型最近被证明在高分辨率图像生成方面非常有效,并已广泛应用于包括DALLE-2、Stable Diffusion和Imagen在内的大规模扩散框架中。然而,无分类器引导扩散模型的一个缺点是推理时计算成本高昂,因为它需要评估两个扩散模型(一个类条件模型和一个无条件模型),重复数十到数百次。为应对这一限制,我们提出了一种将无分类器引导扩散模型蒸馏为快速采样模型的方法:给定一个预训练的无分类器引导模型,我们首先学习单个模型以匹配组合的条件和无条件模型的输出,然后逐步将该模型蒸馏为需要更少采样步骤的扩散模型。对于在像素空间上训练的标准扩散模型,我们的方法能够在ImageNet 64x64和CIFAR-10上仅用4个采样步骤生成与原始模型视觉上相当的图像,FID/IS分数与原始模型相当,同时采样速度提升高达256倍。对于在潜在空间上训练的扩散模型(例如Stable Diffusion),我们的方法能够在ImageNet 256x256和LAION数据集上仅用1到4个去噪步骤生成高保真图像,与现有方法相比,推理加速至少10倍。我们进一步在文本引导的图像编辑和修复任务中展示了该方法的有效性,其中蒸馏模型仅需2-4个去噪步骤即可生成高质量结果。