[论文解读] DeepCache: Accelerating Diffusion Models for Free
DeepCache 通过在 U-Net 架构中缓存扩散模型在连续去噪步骤间的高层特征,在推理时重用这些特征以减少冗余计算,从而实现加速。该方法在不微调或重新训练模型的前提下,使 Stable Diffusion v1.5 的推理速度提升 2.3 倍,CLIP Score 仅下降 0.05;使 LDM-4-G 的推理速度提升 4.1 倍,FID 增加 0.22。
Diffusion models have recently gained unprecedented attention in the field of image synthesis due to their remarkable generative capabilities. Notwithstanding their prowess, these models often incur substantial computational costs, primarily attributed to the sequential denoising process and cumbersome model size. Traditional methods for compressing diffusion models typically involve extensive retraining, presenting cost and feasibility challenges. In this paper, we introduce DeepCache, a novel training-free paradigm that accelerates diffusion models from the perspective of model architecture. DeepCache capitalizes on the inherent temporal redundancy observed in the sequential denoising steps of diffusion models, which caches and retrieves features across adjacent denoising stages, thereby curtailing redundant computations. Utilizing the property of the U-Net, we reuse the high-level features while updating the low-level features in a very cheap way. This innovative strategy, in turn, enables a speedup factor of 2.3$ imes$ for Stable Diffusion v1.5 with only a 0.05 decline in CLIP Score, and 4.1$ imes$ for LDM-4-G with a slight decrease of 0.22 in FID on ImageNet. Our experiments also demonstrate DeepCache's superiority over existing pruning and distillation methods that necessitate retraining and its compatibility with current sampling techniques. Furthermore, we find that under the same throughput, DeepCache effectively achieves comparable or even marginally improved results with DDIM or PLMS. The code is available at https://github.com/horseee/DeepCache
研究动机与目标
- 解决扩散模型推理过程中因序列化去噪和大模型规模带来的高计算成本问题。
- 克服现有压缩方法(如剪枝和知识蒸馏)需要重新训练的局限性。
- 通过利用去噪步骤间高层特征的固有时间冗余性,实现无需训练的加速。
- 在保持或略微提升生成质量的前提下,实现显著的速度提升,优于 DDIM 和 PLMS 等快速采样器。
提出的方法
- 在 U-Net 架构中缓存前序去噪步骤的高层特征,避免在后续步骤中重复计算。
- 利用 U-Net 的跳跃连接机制,在每一步仅更新低层特征,同时重用缓存中的高层特征。
- 引入一种非均匀的 1:N 缓存策略,允许在完整模型推理步骤之间设置更长的间隔,以优化效率。
- 在推理过程中动态应用缓存机制,无需修改预训练模型权重,也无需微调。
- 使用浅层 U-Net 头对缓存特征执行轻量级推理,最大限度减少额外计算开销。
- 可无缝集成至现有的采样方法(如 DDIM 和 PLMS)中,作为互补的加速层。

实验结果
研究问题
- RQ1能否在不重新训练的前提下,利用去噪步骤间高层特征的时间冗余性来加速扩散模型的推理?
- RQ2特征缓存对减少扩散模型计算开销的效率如何,同时保持生成质量?
- RQ3在速度提升与图像质量退化之间取得最佳平衡的最优缓存间隔(N)是多少?
- RQ4与基于重新训练的压缩方法(如剪枝和蒸馏)相比,DeepCache 在速度和质量方面表现如何?
- RQ5DeepCache 能否与 DDIM 和 PLMS 等快速采样器有效结合,进一步提升吞吐量和质量?
主要发现
- DeepCache 在 Stable Diffusion v1.5 上实现了 2.3 倍的速度提升,CLIP Score 仅下降 0.05,表明质量损失极小。
- 在 ImageNet 上的 LDM-4-G 上,DeepCache 实现了 4.1 倍的速度提升,FID 增加 0.22,优于基于重新训练的压缩方法。
- 在相同吞吐量下,该方法在 FID 和 sFID 指标上保持或略微提升了生成质量,优于 DDIM 和 PLMS。
- 消融实验证实,缓存特征至关重要——若移除缓存,性能显著下降,Cifar10 上的 FID 从 4.35 上升至 192.98。
- 对缓存特征进行浅层网络推理优于基线 DDIM,在 10 步推理中将 FID 降低了 2.98。
- 当缓存间隔过大时(如 N=20),性能会下降,表明由于特征漂移,存在可实现速度提升的上限。

更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。