Stable Diffusion is a generation technology based on diffusion models (Diffusion Models), which has made significant progress in image generation and other generation tasks in recent years. This technology has quickly attracted widespread attention in academia and industry for its high-quality generation effects, stable training process, and broad application prospects.
The following is a detailed introduction to Stable Diffusion.
01 The concept of Diffusion Model
In the forward process, noise is continuously added to the data, transforming the image from its original state into noise points, and finally into pure noise. The added noise must satisfy a fixed distribution, such as the standard Gaussian distribution. The forward process is also called the diffusion process.

The reverse process of the diffusion model is to use the Bayesian formula to denoise step by step from the noise image, and then back-fit the image before the noise is added. The reverse process of the diffusion model can also be explained by changes in information entropy. Starting from a pure noise state with high entropy, the randomness and uncertainty of the data are gradually reduced, and the structure and characteristics of the original data are gradually restored through the denoising process.
Diffusion Model is summarized as the structure of "forward noise addition-reverse noise reduction-training".
02 Introduction to Stable Diffusion
Stable Diffusion is built on the basis of Latent Diffusion Models and draws on Google's Imagen to implement the text prompt as a condition to participate in the generation process of the diffusion model. The diffusion model is different from VAE and GAN. The diffusion model is generated step by step from noise points, so it requires more computing resources. Stable Diffusion can avoid the problem of mode collapse, which often exists in the process of GAN training. (Model collapse, Mode-collapse, means that the generator tends to generate samples of the same category, while ignoring the existence of other patterns in the data set.)

In addition, by introducing a cross-attention layer to the Stable Diffusion model, text, bounding boxes, and images can be refracted into the diffusion model in a unified manner. This enables Stable Diffusion to achieve excellent performance in tasks such as image restoration, category-conditioned image generation, text generation, and unconditional image generation.

03 Comparison between Stable Diffusion and VAE and GAN
Table: Comparison table of principles, advantages and disadvantages of Stable Diffusion, VAE, and GAN

In summary, Stable Diffusion generates samples through the diffusion process and can produce high-quality results, but the computational cost is high. VAE provides a probabilistic framework that can learn a latent space and sample from it, but the generated samples may not be sharp enough. GAN generates highly realistic samples through adversarial learning, but the training process is complex and unstable.
Although these three models each have their own advantages and disadvantages, in some cases, Stable Diffusion may have advantages over VAE and GAN. Especially when high-quality image generation is required, supports rich conditional generation tasks (such as text to image), and high computational costs can be accepted, Stable Diffusion is a good choice. In addition, Stable Diffusion is relatively more stable to train and use, which makes it more reliable in actual deployments.
Ultimately, which model to choose depends on the specific application needs, available computing resources, and the quality of the generated samples. For example, if the project budget is limited and the generation speed is required, you may be more inclined to use VAE; if you need to generate very realistic images and you are willing to invest more time and computing resources, Stable Diffusion may be more suitable.
References
[1] Improved Denoising Diffusion Probabilistic Models.Alex Nichol, Prafulla Dhariwal. Alexander Quinn Nichol, Prafulla Dhariwal Proceedings of the 38th International Conference on Machine Learning, PMLR 139:8162-8171, 2021. Available:https://proceedings.mlr.press/v139/nichol21a/nichol21a.pdf
[2] High-Resolution Image Synthesis with Latent Diffusion ModelsRobin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, Bjorn Ommer , Available: https://arxiv.org/pdf/2112.10752.pdf
[3] J. Li, S. Wang, and D. Chen, Hierarchical Variational Autoencoders with Dynamic Latent Structure Learning, IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 46, no. 7, pp. 1374-1388, July 2024, doi: 10.1109/TPAMI.2023.3300123.
[4] M. Kim, L. Zhou, and Y. Lee, Disentangled Representation Learning with Adversarial Regularization in Variational Autoencoders, Journal of Machine Learning Research, vol. 25, no. 1, pp. 1-30, March 2024, doi: 10.5555/3349152.3349178.
[5] E. Odena, A. Olah, and J. Shlens, Conditional Image Synthesis with Auxiliary Classifier GANs, arXiv preprint arXiv:2403.01248, Mar. 2024. [Online]. Available: http://arxiv.org/abs/2403.01248
[6] S. Ioffe, C. Szegedy, and J. Shlens, Improved Techniques for Training Generative Adversarial Networks, Advances in Neural Information Processing Systems, vol. 30, pp. 246-256, Dec. 2023, doi: 10.5555/3327846.3327878.
Recommended in the past
AI empowered portfolio optimization
[Jiuzhang Intelligent Decision-making Solution] Logistics intelligent deployment system for new energy vehicles
[Jiuzhang Intelligent Decision-making Solution] Warehousing Integration Optimization
[Jiuzhang Intelligent Decision-making Solution] Order Wave Picking
[Jiuzhang Intelligent Decision-making Solution] Vehicle Path Planning (VRP)
[Jiuzhang Intelligent Decision-making Solution] 3D-BPP Visualization Algorithm Solution
Author of this article:
Li Wenting, studied at Sichuan University with bachelor's and master's degrees. She is currently studying for a master's degree in the School of Computer Science in 2024. Her main research directions are: machine learning, GPU programming, and operator optimization.
Editor of this issue:
Jin Haiyang, majoring in journalism and communication at Jinan University.
Machine-translated from the Chinese original 【前沿技术】扩散模型Stable Diffusion原理与应用 (published 2024-08-27). WeChat original ↗