让扩散Transformer变瘦,推理快一倍还更准
TinyFusion: Diffusion Transformers Learned Shallow
- 用可学习的剪枝方法,动态移除冗余层
- 仅需7%预训练成本,速度提升2倍,FID达2.86
- 通用性强,适合各类扩散模型轻量化部署
扩散Transformer在图像生成中表现优异,但参数量过大,导致实际应用中推理开销高。本文提出TinyFusion,一种端到端可学习的深度剪枝方法,通过创建高可恢复性的剪枝模型,使其在微调后能快速恢复性能。核心是引入可微分采样机制,并协同优化一个模拟未来微调的参数。与以往关注剪枝后损失或误差的方法不同,本方法直接优化剪枝模型在微调后的表现。实验表明,该方法显著优于基于重要性或误差的剪枝策略。在DiT-XL上,仅需7%预训练成本即可构建浅层模型,实现2倍加速,FID为2.86,优于同类高效方案。该方法在DiTs、MARs和SiTs等架构上均表现良好。代码已开源。
原文摘要 · Abstract (English)
Diffusion Transformers have demonstrated remarkable capabilities in image generation but often come with excessive parameterization, resulting in considerable inference overhead in real-world applications. In this work, we present TinyFusion, a depth pruning method designed to remove redundant layers from diffusion transformers via end-to-end learning. The core principle of our approach is to create a pruned model with high recoverability, allowing it to regain strong performance after fine-tuning. To accomplish this, we introduce a differentiable sampling technique to make pruning learnable, paired with a co-optimized parameter to simulate future fine-tuning. While prior works focus on minimizing loss or error after pruning, our method explicitly models and optimizes the post-fine-tuning performance of pruned models. Experimental results indicate that this learnable paradigm offers substantial benefits for layer pruning of diffusion transformers, surpassing existing importance-based and error-based methods. Additionally, TinyFusion exhibits strong generalization across diverse architectures, such as DiTs, MARs, and SiTs. Experiments with DiT-XL show that TinyFusion can craft a shallow diffusion transformer at less than 7% of the pre-training cost, achieving a 2$\times$ speedup with an FID score of 2.86, outperforming competitors with comparable efficiency. Code is available at https://github.com/VainF/TinyFusion.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。