SnapFusion: Text-to-Image Diffusion Model on Mobile Devices within Two Seconds

Text-to-image diffusion models can create stunning images from natural language descriptions that rival the work of professional artists and photographers. However, these models are large, with complex network architectures and tens of denoising iterations, making them computationally expensive and slow to run. As a result, high-end GPUs and cloud-based inference are required to run diffusion models at scale. This is costly and has privacy implications, especially when user data is sent to a third party. To overcome these challenges, we present a generic approach that, for the first time, unlocks running text-to-image diffusion models on mobile devices in less than $2$ seconds. We achieve so by introducing efficient network architecture and improving step distillation. Specifically, we propose an efficient UNet by identifying the redundancy of the original model and reducing the computation of the image decoder via data distillation. Further, we enhance the step distillation by exploring training strategies and introducing regularization from classifier-free guidance. Our extensive experiments on MS-COCO show that our model with $8$ denoising steps achieves better FID and CLIP scores than Stable Diffusion v$1.5$ with $50$ steps. Our work democratizes content creation by bringing powerful text-to-image diffusion models to the hands of users.

Paper

Similar papers

Peer review

Reviewer oXj25/10 · confidence 4/52023-06-12

Summary

This paper propose a system of model compression methods for text-to-image models such as stable diffusion. Authors propose to apply robust training (i.e. stochastic depth training) to train a network robust to architecture change and propose CFG-free knowledge distillation during the compression of the u-net. Besides, author also give in-depth study on the computation cost of different layers.

Strengths

1. This paper focus on a hot and an interesting topic - compression of large generative models. 2. This paper have good evalution and good experimental results. 3. Good writing. 3. I like the video in the supplementary material.

Weaknesses

1. The main model compression methods are borrowed from previous methods. Robust training is totally same as stochastic depth training. Their evaluation methods for architecture search is also well used in NAS. In the knowledge distillation part, simply adding knowledge distillation loss CFG guidance does not show enough novelty. 2. About the experimental results. Their have been many KD methods for stable diffusion (e.g. On Distillation of Guided Diffusion Models). No enough comparison is provided. Besides, although the appendix gives some qualitative results, it still will be better to provide more. 3. One of the main obstacles in compression of large-scale generative models is the overlarge training cost. Although authors provide their training settings in the manuscript, it will be better to provide more information about the training costs of robust training and the architecture optimization.

Questions

Please refer to the weakness.

Rating

5: Borderline accept: Technically solid paper where reasons to accept outweigh reasons to reject, e.g., limited evaluation. Please use sparingly.

Confidence

4: You are confident in your assessment, but not absolutely certain. It is unlikely, but not impossible, that you did not understand some parts of the submission or that you are unfamiliar with some pieces of related work.

Soundness

3 good

Presentation

4 excellent

Contribution

2 fair

Limitations

n/a

Reviewer 3k2m7/10 · confidence 5/52023-07-05

Summary

This work develops a lightweight Stable Diffusion model with architecture compression and step reduction. For architectural compression, an efficient UNet architecture is obtained from evaluating the importance of individual residual and attention blocks, and an efficient image decoder is obtained via channel reduction and conventional knowledge distillation. For step reduction, a distillation that applies classifier-free guidance (CFG) during the training phase is introduced. Unlike previous methods that apply CGF during the inference, the proposed approach achieves a better tradeoff between FID and CLIP score.

Strengths

* This work successfully compresses Stable Diffusion, one of the most famous foundation models, and enables their deployment on mobile devices with a two-second latency. I think this study can receive significant attention in both academia and industry fields. * The results of the proposed architectural compression are impressive, although some questions regarding training computations and resources exist (described below). * The improved step distillation is well-motivated and novel. I think this can be broadly applicable to diffusion-based large models beyond Stable Diffusion. * I appreciate Figure 2 and Table 1, which effectively explain the compute cost of SD. In particular, Figure 2 is very informative and well illustrates architectural bottlenecks in parameters (inner stages) and latency (outer stages). * The paper is very well-written and easy-to-follow. The terms and equations are properly described.

Weaknesses

* According to the implementation details, this work seems to use the following datasets and compute machines. The training cost feels VERY HUGE, in contrast to the authors’ initial claim at the introductory paragraph of Section 3 (i.e., pruning and architecture search require significant training compute, whereas the authors propose some methods to alleviate the issue). It seems like a training cost comparable to building the original SD model from scratch. * [49] Coyo-700m: Image-text pair dataset. https://github.com/kakaobrain/coyo-dataset, 2022. * [38] Laion-5b: An open large-scale dataset for training next generation image-text models. arXiv preprint arXiv:2210.08402, 2022. * [+] an internal dataset with high-resolution images to fine-tune our model for more pleasing visual quality. * At least, 16 nodes x 8 GPUs per node = 128 A100 GPUs (We use 16 or 32 nodes for most of the training. Each node has 8 NVIDIA A100 GPUs with 40GB or 80GB memory) * Would you clarify the number of training pairs AND the training hours used for each of (1) Robust Training in Section 3.1, (2) Image Decoder Compression in Section 3.2, and (3) Step Distillation in Section 4? I think the detailed description of training data/hours is quite important for readers and future research, especially under the popularity of large foundation models. * Furthermore, are there any supporting materials or results to argue “From our empirical observation, the operator changes resulting from network pruning or searching lead to degraded synthesized images, asking for significant training costs to recover the performance.” at the introductory paragraph of Section 3? A recent, concurrent work* claims that it would be possible to obtain a small pruned UNet in SD with very small retraining cost. * On Architectural Compression of Text-to-Image Diffusion Models, https://arxiv.org/abs/2305.15798 * Is there any overlap between the data used for architecture evolving (a smaller subset (2K images) of MS-COCO validation set [48] in line 130 at page 4) and the zero-shot MS-COCO set for final evaluation? If yes, it cannot be considered as the zero-shot evaluation, because the development data for selecting proper blocks were already used and seen. Furthermore, I was wondering the type and quantity of data for architecture evolving would matter and affect the performance. * Robust Training in Section 3.1 - Would you clarify whether random block dropping is applied to training from scratch (i.e., random initialization) or to retraining from the pretrained SD-v1.5? * It would be better to describe the method details about compressing the image decoder. Could you describe the channel reduction and the type of synthetic data in detail? I was not able to find them although I have checked the supplementary material (e.g., Supple Section 2.2 VAE Decoder). * It would be good to analyze the impact of gamma in Eqn (11), the loss weighting between the vanilla step distillation loss and the proposed CFG-aware distillation loss. How did the authors set this parameter? How did different gamma values affect the generation performance? I have checked Figure (6)-b to analyze the effect of CFG range of w in Eqn (10) and the CFG probability p of the loss mixing in Eqn (11), but the effect of gamma in Eqn (11) is not explained.

Questions

Please check the above weakness section.

Rating

7: Accept: Technically solid paper, with high impact on at least one sub-area, or moderate-to-high impact on more than one areas, with good-to-excellent evaluation, resources, reproducibility, and no unaddressed ethical considerations.

Confidence

5: You are absolutely certain about your assessment. You are very familiar with the related work and checked the math/other details carefully.

Soundness

3 good

Presentation

4 excellent

Contribution

3 good

Limitations

n/a

Reviewer vQqa7/10 · confidence 3/52023-07-07

Summary

This paper introduces a novel framework that significantly reduces the inference speed of text-to-image diffusion models to under two seconds on mobile devices. The authors propose two key techniques. Firstly, they introduce Efficient U-Net which enhances inference speed by eliminating redundant architectural components without compromising performance. Secondly, the authors present a novel step distillation method that incorporates a classifier-free guidance loss term, which further improves CLIP score. Extensive experiments are conducted on the MS-COCO dataset to validate the effectiveness of the proposed approach.

Strengths

- The paper tackles a timely and practically-relevant problem supported by a fair amount of experiments, and stands as the pioneering study in attempting to reduce the latency of text-to-diffusion models on mobile devices. - The paper covers a good amount of relevant previous studies.

Weaknesses

- In lines 232-233, the authors mention the use of an additional dataset for the fine-tuning purpose. It is crucial for the authors to provide further clarification regarding the fair comparison issue in relation to this additional dataset. - The proposed distillation scheme appears to involve a series of intricate choices, making it less readily applicable to other settings. For instance, can this distillation scheme be applied to SD-v2.0? - The clarity of Algorithm 1 should be improved. For instance, the condition “T is not satisfied” and $\hat{A}$ needs clarification. Also, please write the details regarding removing a group of actions in line 136. - The readability of Section 4.1 can be enhanced, particularly by providing an explicit distillation algorithm. Further, the reason as to how step distillation and cfg loss trade off FID/CLIP score is unclear. - While the image generation speed has been enhanced, the model still carries a memory burden. I am willing to raise my score if above concerns are properly addressed during rebuttal.

Questions

- In Fig 5, can authors provide the generated images under SD without ResBlocks (before robust training)? - Just out of curiosity, did authors conduct experiments on transformer-based diffusion models (e.g., DiT [1]) as well? [1] Peebles, William, and Saining Xie. (2022) "Scalable diffusion models with transformers."

Rating

7: Accept: Technically solid paper, with high impact on at least one sub-area, or moderate-to-high impact on more than one areas, with good-to-excellent evaluation, resources, reproducibility, and no unaddressed ethical considerations.

Confidence

3: You are fairly confident in your assessment. It is possible that you did not understand some parts of the submission or that you are unfamiliar with some pieces of related work. Math/other details were not carefully checked.

Soundness

2 fair

Presentation

2 fair

Contribution

3 good

Limitations

The paper provided limitations along with future research directions in Section 7.

Reviewer 5sgC8/10 · confidence 4/52023-07-09

Summary

Text-to-image generation (T2I) is getting popular and has a vast application value. This paper explores efficient T2I by reducing computational redundancy. They learn an efficient U-Net via data distillation and then decrease the required diffusion steps. They can achieve T2I on an iPhone 14 Pro in 2 seconds.

Strengths

+ This paper is well-written and easy to follow. + The efficiency of T2I models is less explored in previous studies. The proposed efficient U-Net is valuable for future research and can be practical for real-world usage. + They provide an attractive demo video in their supplementary.

Weaknesses

+ Why use ViT to encode the input prompt (Fig. 3)? From my best knowledge, ViT is for encoding images, and StableDiffusion borrows the text encoder (similar to BERT) from CLIP. + Since they aim at T2I on mobile devices, various devices should be compared/discussed. iPhone 14 Pro is currently one of the most powerful mobile phones. How about those mid-level phones? Or older versions of the iPhone. This study can make this paper more robust.

Questions

Please see the Weakness

Rating

8: Strong Accept: Technically strong paper, with novel ideas, excellent impact on at least one area, or high-to-excellent impact on multiple areas, with excellent evaluation, resources, and reproducibility, and no unaddressed ethical considerations.

Confidence

4: You are confident in your assessment, but not absolutely certain. It is unlikely, but not impossible, that you did not understand some parts of the submission or that you are unfamiliar with some pieces of related work.

Soundness

3 good

Presentation

4 excellent

Contribution

4 excellent

Limitations

N/A

Reviewer vQqa2023-08-13

I appreciate the authors for the detailed response and the complementary experiments. - The concern regarding the utilization of additional dataset has been well addressed. - Authors have shown that the work can be extended to other models without heavy hyperparameter tuning. - I now have a clear understanding of Algorithm 1. For the above reasons, I raise my score from 6 to 7.

Authorsrebuttal2023-08-16

Dear Reviewer vQqa, Thanks for your prompt response and positive rating! We are glad to know your concerns are addressed, and we will include the additional discussions and analysis in our final manuscript. Best, Authors

Reviewer 3k2m2023-08-16

Post-rebuttal review

Dear Authors, I sincerely appreciate the time and effort for the rebuttal and would like to increase my score from 6 to 7 for the following reasons: - The authors have thoroughly described the training computational cost. While a concern remains regarding whether many researchers can access to such computing resources and can reproduce this work, it should not be a determining factor in evaluating this work. I also deeply appreciate the detailed discussions on a channel pruning baseline and a concurrent study. - The authors ensured that the evaluation results were genuinely zero-shot and conducted further examinations regarding the impact of different data on architecture evolution. Additionally, the choice of the hyperparameter gamma was investigated during this rebuttal. Thanks for the clarification and additional experiments. - The starting point of robust training, i.e., pretrained SD-v1.5 (not trained from scratch), is understandable, and the details of compressing the image decoder are addressed. - The newly conducted experiments on SD-v2 look impressive, and I believe they can attract attention from the community.

Authorsrebuttal2023-08-17

Thank you for the response

Dear Reviewer 3k2m, Thank you for your positive response! We are glad to know that your questions have been answered. We will include the additional discussions and analysis in our revised paper. Best regards, Authors

Authorsrebuttal2023-08-20

Dear Reviewer oXj2, Thank you for your valuable feedback and positive rating. We provide additional explanations to help clarify our work. As the deadline for Author-Reviewer discussion is approaching, we would like to use this opportunity to see if our responses are sufficient and if any concern remains. Thanks again for your time. Best, Authors

Program Chairsdecision2023-09-21

Decision

Accept (poster)

© 2026 NYSGPT2525 LLC