通过联合优化缓存与量化,实现扩散模型的高效加速。
CacheQuant: Comprehensively Accelerated Diffusion Models
- 动态规划确定最优缓存策略,兼顾缓存与量化特性。
- 在MS-COCO上实现5.18倍加速、4倍压缩,CLIP分数仅降0.02。
- 无需训练,适合部署于低延迟图像生成场景。
扩散模型在图像生成中表现出色,但其缓慢的推理速度和复杂的网络结构因时空冗余而限制了实际应用。现有加速方法分别针对时间与结构层级优化,但独立优化后简单集成会导致性能显著下降。我们发现这两类优化并非完全正交,直接合并效果不佳。为此,提出CacheQuant——一种无需训练的联合优化范式,同时优化模型缓存与量化。采用动态规划确定最优缓存调度,综合考虑缓存与量化特性以最小化误差;并设计解耦误差校正机制,逐步缓解累积误差。实验表明,在MS-COCO数据集上,CacheQuant使Stable Diffusion实现5.18倍加速、4倍压缩,仅损失0.02的CLIP分数。代码已开源:https://github.com/BienLuky/CacheQuant。
原文摘要 · Abstract (English)
Diffusion models have gradually gained prominence in the field of image synthesis, showcasing remarkable generative capabilities. Nevertheless, the slow inference and complex networks, resulting from redundancy at both temporal and structural levels, hinder their low-latency applications in real-world scenarios. Current acceleration methods for diffusion models focus separately on temporal and structural levels. However, independent optimization at each level to further push the acceleration limits results in significant performance degradation. On the other hand, integrating optimizations at both levels can compound the acceleration effects. Unfortunately, we find that the optimizations at these two levels are not entirely orthogonal. Performing separate optimizations and then simply integrating them results in unsatisfactory performance. To tackle this issue, we propose CacheQuant, a novel training-free paradigm that comprehensively accelerates diffusion models by jointly optimizing model caching and quantization techniques. Specifically, we employ a dynamic programming approach to determine the optimal cache schedule, in which the properties of caching and quantization are carefully considered to minimize errors. Additionally, we propose decoupled error correction to further mitigate the coupled and accumulated errors step by step. Experimental results show that CacheQuant achieves a 5.18 speedup and 4 compression for Stable Diffusion on MS-COCO, with only a 0.02 loss in CLIP score. Our code are open-sourced: https://github.com/BienLuky/CacheQuant .
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。