Abstract
Stable Diffusion Models (SDMs) have shown remarkable proficiency in image synthesis. However, their broad application is impeded by their large model sizes and intensive computational requirements, which typically require expensive cloud servers for deployment. On the flip side, while there are many compact models tailored for edge devices that can reduce these demands, they often compromise on semantic integrity and visual quality when compared to full-sized SDMs. To bridge this gap, we introduce Hybrid SD, an innovative, training-free SDMs inference framework designed for edge-cloud collaborative inference. Hybrid SD distributes the early steps of the diffusion process to the large models deployed on cloud servers, enhancing semantic planning. Furthermore, small efficient models deployed on edge devices can be integrated for refining visual details in the later stages. Acknowledging the diversity of edge devices with differing computational and storage capacities, we employ structural pruning to the SDMs U-Net and train a lightweight VAE. Empirical evaluations demonstrate that our compressed models achieve state-of-the-art parameter efficiency (225.8M) on edge devices with competitive image quality. Additionally, Hybrid SD reduces the cloud cost by 66% with edge-cloud collaborative inference.
Introduction
Stable Diffusion Models (SDMs) have revolutionized image synthesis, yet their deployment is hindered by substantial computational requirements. Operating these billion-parameter models typically necessitates high-end cloud GPUs, incurring significant costs for providers and raising privacy concerns for users. While on-device AI offers privacy and cost benefits, current compressed models often suffer from poor semantic integrity, failing to accurately follow user prompts. We identify a "semantic-perceptual" gap: smaller models struggle with high-level semantic planning but remain effective at fine-grained visual refinement. To address this, we propose Hybrid SD, a framework that bridges the gap between cloud power and edge efficiency.
The Hybrid SD Framework
The core innovation of Hybrid SD is Edge-Cloud Collaborative Inference. The diffusion process is split into two distinct phases. In the first phase, a large cloud-based model ($\theta_{large}$) performs the initial $k$ denoising steps. These early steps are crucial for "semantic planning"—establishing the overall composition and alignment with the text prompt.
Once the semantic foundation is established, the intermediate noisy latent representation is transmitted to the edge device. In the second phase, a lightweight, pruned model ($\theta_{small}$) on the edge device completes the remaining denoising steps to refine visual details. This approach exploits the observation that later diffusion steps are primarily for "fidelity improvement," which smaller models can handle effectively. Notably, transmitting the 148KB latent representation is significantly faster than downloading a full high-resolution image, making the collaborative approach viable even on standard network connections.
Model Compression and Optimization
To make edge deployment feasible, Hybrid SD employs two primary optimization techniques:
- Strategic Structural Pruning: We developed a significance-based pruning method for the SDM U-Net. Our analysis revealed that not all layers are equally important throughout the diffusion process. For instance, cross-attention layers are vital early on but can be pruned more aggressively in later stages. By using a significance evaluation score, we prune less impactful layers (up to 75%) while preserving critical components like the initial ResNet blocks.
- Lightweight VAE: The Variational Autoencoder (VAE) decoder is often a bottleneck in SD inference. We trained a tiny VAE, distilled from the original SD-v1.4 VAE, which is significantly faster and smaller, specifically optimized for the resource constraints of mobile hardware.
Experimental Results
We evaluated Hybrid SD using the MS-COCO and LAION-Aesthetics datasets. Our compressed "Ours-Tiny" model achieves a state-of-the-art parameter count of 225.8M, a significant reduction from the ~860M parameters of the standard SD-v1.4 U-Net.
Key empirical findings include:
- Cost Efficiency: Hybrid SD achieved a 66% reduction in cloud computational costs by offloading the majority of denoising steps to the edge.
- Latency and Throughput: On an iPhone 15 Pro, the hybrid approach (with $k=4$ cloud steps) reduced cloud FLOPs by 49% and cloud latency by 42% compared to full cloud inference.
- Image Quality: With $k=10$ cloud steps, Hybrid SD achieved an FID score of 13.75, significantly outperforming standalone tiny models (FID 16.71) and nearing the performance of the full SD-v1.4 (FID 12.22).
Conclusion
Hybrid SD effectively bridges the gap between cloud-scale performance and edge-side efficiency. By strategically splitting the diffusion process and employing targeted structural pruning, we enable high-quality image generation with significantly reduced cloud overhead and improved user privacy. Future work will explore combining this framework with quantization techniques and dynamic step adjustment to further enhance accessibility on a wider range of edge devices.
Summary updated