Abstract
Latent Diffusion Models (LDMs) have emerged as powerful generative models, known for delivering remarkable results under constrained computational resources. However, deploying LDMs on resource-limited devices remains a complex issue, presenting challenges such as memory consumption and inference speed. To address this issue, we introduce LD-Pruner, a novel performance-preserving structured pruning method for compressing LDMs. Traditional pruning methods for deep neural networks are not tailored to the unique characteristics of LDMs, such as the high computational cost of training and the absence of a fast, straightforward and task-agnostic method for evaluating model performance. Our method tackles these challenges by leveraging the latent space during the pruning process, enabling us to effectively quantify the impact of pruning on model performance, independently of the task at hand. This targeted pruning of components with minimal impact on the output allows for faster convergence during training, as the model has less information to re-learn, thereby addressing the high computational cost of training. Consequently, our approach achieves a compressed model that offers improved inference speed and reduced parameter count, while maintaining minimal performance degradation. We demonstrate the effectiveness of our approach on three different tasks: text-to-image (T2I) generation, Unconditional Image Generation (UIG) and Unconditional Audio Generation (UAG). Notably, we reduce the inference time of Stable Diffusion (SD) by 34.9% while simultaneously improving its FID by 5.2% on MS-COCO T2I benchmark. This work paves the way for more efficient pruning methods for LDMs, enhancing their applicability.
Introduction
Latent Diffusion Models (LDMs), such as Stable Diffusion, have revolutionized the field of generative AI by producing high-fidelity content. Despite their success, these models are characterized by massive U-Net architectures that impose heavy computational burdens, making deployment on edge devices or mobile hardware difficult. Traditional model compression techniques face significant hurdles in the diffusion domain, primarily due to the high cost of evaluation metrics like Fréchet Inception Distance (FID) and the lack of task-agnostic methodologies. LD-Pruner addresses these challenges by shifting the focus from the final pixel-level output to the model's internal latent space.
Methodology
LD-Pruner introduces a structured pruning framework that identifies and removes redundant components based on their impact on latent representations.
The Latent Proxy Scoring
Instead of generating thousands of full images to evaluate a pruned model—a process that can take hours—LD-Pruner analyzes the divergence in the latent space. The algorithm systematically modifies operators (convolutional or attention layers) and calculates an importance score based on the shift in the mean (avg_dist) and variability (std_dist) of the resulting latent vectors. This approach ensures that both the structural content and the fine-grained texture of the information are preserved.
Weight-Preserving Fine-Tuning
Unlike traditional methods that often reset weights after pruning, LD-Pruner retains the pre-trained weights of the remaining operators. This strategy significantly accelerates the fine-tuning phase, allowing the model to recover performance much faster than training a smaller architecture from scratch.
Experimental Evaluation
The researchers validated LD-Pruner across three distinct generative domains to prove its task-agnostic nature:
- Text-to-Image (T2I): Evaluated on MS-COCO 256×256 using Stable Diffusion v1.4.
- Unconditional Image Generation (UIG): Tested on CelebA-HQ 256×256 using LDM-4.
- Unconditional Audio Generation (UAG): Evaluated on the AudioDiffusion dataset using Mel spectrograms.
Key Results and Discussion
LD-Pruner demonstrates that LDMs are often over-parameterized, particularly in layers near the model output. By targeting these redundant areas, the method achieves substantial speedups without sacrificing quality.
As shown in the results, Stable Diffusion (SD-v1.4) achieved a 34.9% inference speedup, reducing the parameter count from 1.04B to 0.71B. Remarkably, the FID score improved from 13.05 to 12.37, suggesting that the pruning process may provide a regularizing effect. For unconditional image generation (LDM-4), the model achieved a 28.21% speedup. In the audio domain, LD-Pruner improved the Fréchet Audio Distance (FAD) from 2.3 to 2.0 while delivering a 19.2% speedup.
Conclusion
LD-Pruner offers a robust, efficient, and task-agnostic solution for compressing Latent Diffusion Models. By leveraging the latent space as a proxy for performance, it bypasses the computational bottlenecks of traditional pruning. While current work focuses on the U-Net architecture, future research will look toward pruning the VAE decoder and accounting for complex operator inter-dependencies to further optimize LDMs for resource-constrained environments.
Summary updated