更快的扩散:重新思考UNet编码器在扩散模型中的作用
Faster Diffusion: Rethinking the Role of UNet Encoder in Diffusion Models
December 15, 2023
作者: Senmao Li, Taihang Hu, Fahad Shahbaz Khan, Linxuan Li, Shiqi Yang, Yaxing Wang, Ming-Ming Cheng, Jian Yang
cs.AI
摘要
扩散模型中的关键组件之一是用于噪声预测的UNet。虽然有几项研究探讨了UNet解码器的基本特性,但其编码器在很大程度上仍未被探索。在这项工作中,我们进行了对UNet编码器的首次全面研究。我们通过实证分析编码器特征,并就其在推断过程中的变化提供了重要见解。特别是,我们发现编码器特征变化平缓,而解码器特征在不同时间步之间存在显著变化。这一发现启发我们在某些相邻时间步骤中省略编码器,并循环重复利用先前时间步骤中的编码器特征供解码器使用。基于这一观察,我们引入了一种简单而有效的编码器传播方案,以加速各种任务的扩散采样。通过利用我们的传播方案,我们能够在某些相邻时间步骤中并行执行解码器。此外,我们引入了一种先验噪声注入方法,以改善生成图像中的纹理细节。除了标准的文本到图像任务外,我们还在其他任务上验证了我们的方法:文本到视频、个性化生成和参考引导生成。在不使用任何知识蒸馏技术的情况下,我们的方法将稳定扩散(SD)和DeepFloyd-IF模型的采样速度分别提高了41%和24%,同时保持了高质量的生成性能。我们的代码可在https://github.com/hutaiHang/Faster-Diffusion{FasterDiffusion}找到。
English
One of the key components within diffusion models is the UNet for noise
prediction. While several works have explored basic properties of the UNet
decoder, its encoder largely remains unexplored. In this work, we conduct the
first comprehensive study of the UNet encoder. We empirically analyze the
encoder features and provide insights to important questions regarding their
changes at the inference process. In particular, we find that encoder features
change gently, whereas the decoder features exhibit substantial variations
across different time-steps. This finding inspired us to omit the encoder at
certain adjacent time-steps and reuse cyclically the encoder features in the
previous time-steps for the decoder. Further based on this observation, we
introduce a simple yet effective encoder propagation scheme to accelerate the
diffusion sampling for a diverse set of tasks. By benefiting from our
propagation scheme, we are able to perform in parallel the decoder at certain
adjacent time-steps. Additionally, we introduce a prior noise injection method
to improve the texture details in the generated image. Besides the standard
text-to-image task, we also validate our approach on other tasks:
text-to-video, personalized generation and reference-guided generation. Without
utilizing any knowledge distillation technique, our approach accelerates both
the Stable Diffusion (SD) and the DeepFloyd-IF models sampling by 41% and
24% respectively, while maintaining high-quality generation performance. Our
code is available in
https://github.com/hutaiHang/Faster-Diffusion{FasterDiffusion}.