Introduction
Stable Diffusion Models (SDMs) have set a new standard for high-fidelity text-to-image generation. However, their widespread adoption is hindered by a significant "computational tax." With over a billion parameters, these models demand substantial GPU memory and exhibit high latency, making them difficult to deploy on consumer edge devices like smartphones. While previous optimization efforts focused on reducing sampling steps or applying quantization, the challenge of architectural compression remained largely unaddressed due to the perceived need for massive retraining resources.
Researchers have introduced BK-SDM, a compressed framework that reduces model size and latency by 30% to 50% through strategic block pruning and efficient knowledge distillation. By retraining on a fraction of the original data, BK-SDM maintains competitive image quality while becoming truly mobile-ready.
Architectural Compression: Pruning the U-Net
The core of BK-SDM's efficiency lies in compressing the U-Net, which is the most compute-heavy component of the diffusion process. Unlike width pruning, which thins out layers, the authors utilized depth pruning to remove entire residual and attention blocks. This approach is more effective for real-world latency on modern hardware.
Three variants were developed: BK-SDM-Base, Small, and Tiny. Key architectural insights include:
- Stage-wise Pruning: Removing the second pair of residual-attention blocks in both the "Down" and "Up" stages of the U-Net.
- Mid-Block Redundancy: In the "Small" and "Tiny" versions, the entire middle stage of the U-Net was removed. Surprisingly, this had a negligible impact on image quality, suggesting that the innermost layers of generative models are more redundant than previously assumed.
Efficient Training via Knowledge Distillation
To recover performance lost during pruning without retraining on billions of images, the researchers employed a Teacher-Student distillation framework. The original SDM (Teacher) guided the compressed BK-SDM (Student) using two primary loss functions:
- Output-level KD: The student learns to predict the same noise patterns as the teacher.
- Feature-level KD: The student mimics the intermediate feature maps of the teacher at the end of each U-Net stage, providing a rich "hint" for the learning process.
This method allowed the models to be retrained in just 13 days on a single A100 GPU, using a tiny subset of 0.22M image-text pairs from LAION-Aesthetics V2—a massive reduction from the thousands of GPU days required for the original model.
Key Results and Mobile Deployment
BK-SDM achieves significant efficiency gains without sacrificing the versatility of the original foundation model.
- Efficiency: BK-SDM-Tiny achieves a 51% reduction in parameters and a 43% improvement in latency compared to SDM-v1.4.
- Performance: The BK-SDM-Base variant achieved a CLIP score of 0.2878 on MS-COCO, remarkably close to the original model's 0.2958.
- Edge Readiness: These models can generate a 512x512 image in less than 4 seconds on devices like the iPhone 14 or NVIDIA Jetson AGX Orin.
- Downstream Compatibility: The compressed backbones remain fully compatible with existing techniques like DreamBooth for personalization and SDEdit for image-to-image translation.
Conclusion
BK-SDM proves that foundation models can be significantly shrunk without "losing their soul." By focusing on depth pruning and feature-level distillation, the researchers have made high-quality generative AI accessible for edge computing. While the models still inherit some limitations regarding complex human anatomy, they provide a robust blueprint for making future large-scale models lean, mean, and mobile-ready.
Summary updated