Glossary term
Diffusion Models
What are diffusion models?
Diffusion models are like artists that turn a blank canvas into a masterpiece. They start with random scribbles and gradually refine them into detailed images.
Diffusion models, also known as diffusion probabilistic models or score-based generative models, are a class of latent variable generative models used in machine learning. They consist of three major components: the forward process, the reverse process, and the sampling procedure.
The forward process, also known as the diffusion process, involves progressively adding noise to a data point, such as an image, until it becomes a simple, easily generated data sample. This process is inspired by the natural phenomenon of diffusion, where particles move from areas of high concentration to low concentration.
The reverse process, or reverse diffusion process, involves learning to recover the original data from the noised data. This is achieved by training a model to find the reverse Markov transitions that maximize the likelihood of the training data. After training, the diffusion model can generate new data by passing randomly sampled noise through the reverse process.
The sampling procedure involves generating new data samples by starting with simple, easily generated data and then gradually transforming it into more complex and realistic data.
Diffusion models have diverse applications across several domains, such as text-to-video synthesis, image-to-image translation, image search, and reverse image search. They are known for their ability to generate high-quality, realistic data, and are robust to overfitting. However, they can be computationally expensive due to the long Markov chain of diffusion steps required to generate samples.
In Generative AI, diffusion models have shown great promise, with popular models including Stable Diffusion, DALL-E 2, and Imagen. They have also been used to generate diverse and realistic human motions by incorporating physical constraints into the diffusion process.
How do diffusion models work?
Diffusion models are a type of generative model that work by gradually adding and removing noise to learn the underlying distribution of training data. They consist of three major components: the forward process, the reverse process, and the sampling procedure.
In the forward process, Gaussian noise is successively introduced into the data until it becomes all noise. This process is modeled by a stochastic differential equation (SDE) that does not depend on the original data. The forward diffusion process can be visualized as turning an image into noise.
The reverse process, also known as the reconstruction process, aims to convert the noise back into the original data. In practical terms, the exact reverse process is intractable since it requires computations involving the data distribution. Therefore, it is approximated with a parameterized model, such as a neural network. If the diffusion step sizes are small enough, the reverse process is also Gaussian.
The sampling procedure involves generating new samples from the learned distribution. Early diffusion samplers were slow, requiring on the order of 1,000 sequential denoising steps per sample; faster samplers and distillation techniques have since reduced this to as few as a handful of steps in many implementations.
Diffusion models have been applied in various fields, including image synthesis, video generation, molecule design, and natural language generation. Despite their power, they do have limitations, such as slow sampling speed. However, recent research has explored methods to accelerate the sampling process, such as parallelizing the denoising steps.
What are the components of diffusion models?
Diffusion models are a class of generative models that gradually add and remove noise to learn the underlying distribution of training data. They consist of three key components: the forward process, the reverse process, and the sampling procedure.
-
Forward Process — This is the diffusion process where a datum (generally an image) is gradually transformed into pure Gaussian noise. This is achieved by defining a Markov chain of diffusion steps to slowly add random noise to the data.
-
Reverse Process — The goal of training a diffusion model is to learn this reverse process. It involves training the model to recover the original data from the noise. This is done by traversing backwards along the Markov chain. The reverse diffusion process maps the complex data distribution back to a simple distribution, allowing the latent space to represent meaningful features, patterns, and latent variables present in the data.
-
Sampling Procedure — After training, the diffusion model can generate new data by simply passing randomly sampled noise through the learned reverse process. This allows the model to generate diverse samples.
Diffusion models are typically formulated as Markov chains and trained using variational inference. They have been used in various applications, including computer vision and generative art. However, it's worth noting that diffusion models can be computationally expensive due to the long Markov chain of diffusion steps required to generate samples.
What are some limitations of diffusion models compared to other generative models?
Diffusion models, while powerful, do have several limitations compared to other generative models:
-
Computational Expense — Diffusion models are more computationally expensive than GANs due to the iterative diffusion process they employ. They require more time and larger datasets to train, necessitating substantial computational resources.
-
Sampling Speed — Sampling from diffusion models is slower than GANs in terms of wall-clock time due to the use of multiple denoising steps. This can make them less suitable for applications that require real-time or near-real-time generation.
-
Noise Artifacts — Due to the nature of the diffusion process, the generated samples are prone to noise artifacts.
-
Mode Collapse — Similar to GANs, diffusion models can suffer from mode collapse, a phenomenon where the model generates a limited variety of samples.
-
Hyperparameter Tuning — Diffusion models require careful tuning of hyperparameters and longer training times.
-
Quality Consistency — The probabilistic nature of diffusion models means that they produce varying results even with identical inputs, which can create challenges in maintaining consistent quality.
Despite these limitations, diffusion models have shown great promise in the field of generative AI, particularly in the domain of image and video synthesis. They offer fine-grained control over the generation process and are known for their ability to produce high-quality images. However, like all tools, they should be chosen based on the specific requirements and constraints of the task at hand.
What are some unique advantages of GANs over diffusion models?
Generative Adversarial Networks (GANs) have some unique advantages over diffusion models in the context of image generation:
-
Data Efficiency — GANs tend to make more efficient use of data than diffusion models, often yielding better results on smaller datasets.
-
Faster Inference — GANs generally offer faster inference times, which can be crucial for applications that require real-time or near-real-time generation.
-
Latent Space Interpolation — GANs, particularly models like StyleGAN, allow for continuous interpolation within the latent space, enabling smooth transitions and manipulations of generated samples.
-
Embedding Real Data — GANs can embed real data into their latent space, allowing for direct manipulation of real images within the generative model.
-
Performance on Narrow Distributions — GANs work well on narrow distributions, such as aligned faces, even with smaller models.
-
Computational Efficiency — Generally, GANs are considered to be more computationally efficient compared to diffusion models, which require a more iterative process for sample generation.
These advantages make GANs particularly suitable for certain applications where quick generation, data efficiency, and specific manipulations of the latent space are important. However, the choice between GANs and diffusion models ultimately depends on the specific requirements of the task at hand, including the desired level of control over the generation process, the quality of the generated samples, and the computational resources available.
What are the open research directions for diffusion models?
Diffusion models continue to face several practical challenges. One is computational cost: the iterative nature of the process can be resource-intensive, especially for high-resolution tasks, which complicates real-time or large-scale deployment in environments with limited computing power.
Another is generalizing to unseen data. Models can struggle to produce coherent, realistic outputs for inputs that deviate from the training distribution, and adapting pre-trained diffusion models to new domains or tasks often requires resource-intensive fine-tuning with domain-specific data.
Researchers have explored alternative formulations to address these limitations. Poisson Flow Generative Models (PFGMs), for example, take inspiration from physics in a similar way to diffusion models, and have shown scalability to higher dimensions with faster inference on image generation tasks at comparable quality. Follow-on work such as PFGM++ has aimed to balance robustness with ease of use. Techniques like distillation and improved samplers have also targeted faster inference without sacrificing sample quality. Applications in areas such as VR and AR content and synthetic data generation for data science remain active areas of development.
FAQs
What is a latent diffusion model?
A latent diffusion model is a diffusion model that encodes data into a lower-dimensional latent space before applying the forward and reverse diffusion processes there, rather than operating directly on raw pixel data. This reduces computational cost and typically results in faster training and sampling compared to running diffusion directly in pixel space, while still producing high-quality images. Stable Diffusion is a well-known example of this approach.
What is classifier-free guidance?
Classifier-free guidance is a technique that lets a diffusion model generate conditioned outputs (for example, images matching a text prompt) without relying on a separate classifier model to steer the denoising process. It works by jointly training a single model on both conditional and unconditional objectives, then combining their predictions at sampling time to strengthen adherence to the condition. This approach is widely used in text-to-image diffusion models.
More terms
Continue exploring the glossary.
Glossary term
What is a heuristic?
It's time to build
Collaborate with your team on reliable Generative AI features.
Want expert guidance? Book a 1:1 onboarding session from your dashboard.