Diffusion models have achieved impressive advancements in various vision tasks. However, these gains often rely on increasing model size, which escalates computational complexity and memory demands, complicating deployment, raising inference costs, and causing environmental impact. While some studies have explored pruning techniques to improve the memory efficiency of diffusion models, most existing methods require extensive retraining to retain the model performance. Retraining a modern large diffusion model is extremely costly and resource-intensive, which limits the practicality of these methods. In this work, we achieve low-cost diffusion pruning without retraining by proposing a model-agnostic structural pruning framework for diffusion models that learns a differentiable mask to sparsify the model. To ensure effective pruning that preserves the quality of the final denoised latent, we design a novel end-to-end pruning objective that spans the entire diffusion process. As end-to-end pruning is memory-intensive, we further propose time step gradient checkpointing, a technique that significantly reduces memory usage during optimization, enabling end-to-end pruning within a limited memory budget. Results on state-of-the-art U-Net diffusion models SDXL and diffusion transformers (FLUX) demonstrate that our method can effectively prune up to 20% parameters with minimal perceptible performance degradation, and notably, without the need for model retraining. We also showcase that our method can still prune on top of time step distilled diffusion models.
翻译:扩散模型已在多种视觉任务中取得显著进展。然而,这些成果往往依赖于增大模型规模,这会导致计算复杂度与内存需求急剧上升,从而增加部署难度、提高推理成本并造成环境影响。尽管已有研究探索通过剪枝技术提升扩散模型的内存效率,但现有方法大多需要进行大量重训练以维持模型性能。重训练现代大型扩散模型成本极高且资源密集,这限制了此类方法的实用性。本研究提出一种与模型无关的扩散模型结构化剪枝框架,通过学习可微分掩码实现模型稀疏化,从而在无需重训练的条件下实现低成本扩散模型剪枝。为确保剪枝在保留最终去噪潜在表示质量的同时保持有效性,我们设计了一种覆盖完整扩散过程的新型端到端剪枝目标函数。由于端到端剪枝对内存要求较高,我们进一步提出时间步梯度检查点技术,该技术能显著降低优化过程中的内存占用,使得在有限内存预算内实现端到端剪枝成为可能。在先进U-Net扩散模型SDXL与扩散Transformer(FLUX)上的实验结果表明,本方法能有效剪除高达20%的参数且仅引起可忽略的性能下降,尤其重要的是无需模型重训练。我们还验证了本方法在时间步蒸馏扩散模型上仍能实现有效剪枝。