← Back to list

Denoising Diffusion Probabilistic Models

Paper Review

Eleventh Hour Enthusiast · 2024-09-09 00:09 · 4 claps · 7.8 min read
#diffusion-models #langevin-dynamics #denoising-score-matching #progressive-decoding #image-compression
Open on Medium ↗
Wiki topics: MM · Multimodal & Generative Media 💻 · Programming 📰 · Journalism & News

Denoising Diffusion Probabilistic Models

Paper Review

Introduction

Denoising Diffusion Probabilistic Models (DDPMs), proposed by Ho et al., have gained attention as a notable class of generative models, showing strong performance on image generation tasks. DDPMs are distinguished by their connections to various concepts in physics and machine learning. This blog post discusses several key aspects of DDPMs that contribute to their approach, including theoretical links to Langevin dynamics and denoising score matching, the process of generating images through progressive denoising, and their application in lossy compression.

Overview of Denoising Diffusion Probabilistic Models

DDPMs are a class of latent variable models designed to learn the data distribution through a diffusion process. The key idea behind DDPMs is to define a forward diffusion process that gradually adds noise to the data, and a reverse process that learns to remove this noise, ultimately generating samples from the data distribution.

Source: https://learnopencv.com/denoising-diffusion-probabilistic-models/

Source: https://learnopencv.com/denoising-diffusion-probabilistic-models/

The above image provides a visual representation of the forward and reverse processes in DDPMs. The forward process, denoted by q(x_tx_{t-1}), progressively adds Gaussian noise to the original data sample x₀​​, transforming it into pure noise x_T​ over T timesteps. This process is defined as:

where β_t​ controls the amount of noise introduced at each step.

The reverse process aims to undo this, denoted by pθ (*x{t-1}∣ x_t*), where a neural network learns to denoise the sample step by step, eventually reconstructing a sample that approximates the original data. This is described by:

During training, the model optimizes its ability to reverse the forward diffusion process by minimizing the Kullback-Leibler (KL) divergence between the forward process and the learned reverse process. Specifically, the objective is to bring the reverse process pθ (*x{t-1}∣ xt) as close as possible to the true posterior distribution q(x{t-1}∣ x_t, x_0*), which defines how the original data transitions through the noisy states.

Source: https://learnopencv.com/denoising-diffusion-probabilistic-models/

Source: https://learnopencv.com/denoising-diffusion-probabilistic-models/

DDPMs represent a fundamental departure from traditional generative models like Generative Adversarial Networks (GANs) and Variational Autoencoders (VAEs) in their approach to learning the data distribution. GANs involve an adversarial framework where a generator creates samples and a discriminator tries to distinguish between real and generated data. VAEs, on the other hand, learn an explicit mapping between the data and a lower-dimensional latent space by encoding the data into this space and then decoding it back to reconstruct the original data. In contrast, DDPMs define a diffusion process that gradually destroys structure in the data and a reverse process that learns to recover this structure. By framing the generative modeling problem as a denoising task, DDPMs create new opportunities for understanding and improving generative models without the need for adversarial training or explicit latent variable inference.

The reverse process is trained by predicting both the mean μ_θ(x_t) and the variance Σ_θ of the Gaussian distribution that models each transition from x_t​ to x{t-1}​. The neural network learns to estimate these parameters at every timestep, ensuring that the noise added during the forward process is accurately removed in reverse.

To achieve this, the training objective can be framed as a variational lower bound on the log-likelihood of the data, which is minimized by reducing the KL divergence at each timestep. This means the model gradually improves its ability to reconstruct the original data by learning to model the noise at various levels of the diffusion process. Over time, this allows the model to generate samples from a simple Gaussian distribution (pure noise) and transform them into highly realistic data samples that resemble the original data distribution.

Connection to Langevin Dynamics and Score Matching

One of the novel contributions of the DDPM paper is explaining the connection between diffusion models and denoising score matching over multiple noise levels. This connection links DDPMs to well-established techniques in generative modeling and statistical physics.

Score matching, a key part of this approach, is a training objective where the model learns the gradient of the log-density (the score function) of the data distribution. Denoising score matching, a variant of this method, estimates the score function for noisy versions of the data distribution. In DDPMs, the reverse process is parameterized in a way that makes the training objective equivalent to denoising score matching over various noise levels.

The animation below illustrates how noise is added to the original data distribution as variance σ² increases. The original distribution p(x) is progressively corrupted by noise to form the noisy distribution q_σ(x~). Denoising score matching enables the model to estimate the gradient of the noisy distribution and guide the reverse process back to the original data. The model learns to remove the added noise at each step, allowing it to reconstruct the data more accurately as σ² decreases.

Probability density function of the original univariate Gaussian Mixture Model and the corrupted version for different variance scales. (Source: https://johfischer.com/2022/09/18/denoising-score-matching/)

Probability density function of the original univariate Gaussian Mixture Model and the corrupted version for different variance scales. (Source: https://johfischer.com/2022/09/18/denoising-score-matching/)

The reverse process models the transition from xt to x{t−1}​ using a Gaussian distribution with a mean μ_θ(x_t) and variance Σ_θ​. This allows the variational bound to be optimized as a weighted sum of denoising score matching objectives at each noise level.

This connection provides significant insights into how DDPMs work. The reverse process functions like a score-based generative model, gradually refining its estimate of the score function at different noise scales. During sampling, the model starts from pure noise and improves the sample, closely resembling annealed Langevin dynamics.

Langevin dynamics, a method from statistical physics, samples from complex probability distributions by updating a sample based on the score function and adding Gaussian noise for exploration. As the sampling progresses, the step size decreases, allowing the model to focus on high-probability regions. The animation below illustrates a single chain of Langevin sampling from a Gaussian distribution. The brighter areas represent regions with higher probabilities, while the black dot shows the current sample at each iteration. The trailing dots, representing previous iterations, gradually fade out, showing how the model explores and refines its sample with each step. In DDPMs, this process is mirrored through gradual noise refinement and decreasing variance, explaining their effectiveness in generating high-quality samples.

An example of a single chain of Langevin sampling from a (simple) Gaussian distribution. The brighter areas denote areas with higher probabilities while the black dot is the sample in the current iteration. The trailing dots are previous iterations, which fade out gradually. (Source: https://friedmanroy.github.io/blog/2022/Langevin/)

An example of a single chain of Langevin sampling from a (simple) Gaussian distribution. The brighter areas denote areas with higher probabilities while the black dot is the sample in the current iteration. The trailing dots are previous iterations, which fade out gradually. (Source: https://friedmanroy.github.io/blog/2022/Langevin/)

Progressive Decoding and Compression

Another significant contribution of the DDPM paper is the introduction of a progressive lossy decompression scheme, which generalizes autoregressive decoding. This scheme provides a new perspective on the sampling process in DDPMs and highlights their potential for compressing and progressively generating data.

In the progressive decompression scheme, the reverse process of the DDPM is interpreted as a series of denoising steps that gradually reconstruct the image from a latent representation. Starting with pure Gaussian noise, the model iteratively refines the latent by predicting and removing the noise added during the diffusion process. At each step, the model can output an intermediate reconstructed image, enabling progressive generation.

This progressive reconstruction is related to autoregressive decoding, where images are generated pixel by pixel, with each pixel conditioned on the previous ones. However, DDPM’s approach follows a more flexible order determined by the diffusion process, where each denoising step reconstructs multiple pixels or patches simultaneously rather than in a fixed sequence.

The authors explore the model’s behavior in the context of lossy compression using rate-distortion analysis. They show that the variational bound used to train DDPMs can be decomposed into two terms: the negative log-likelihood of the latent representation (the rate) and the reconstruction error (the distortion). By evaluating this decomposition at different stages of the reverse process, they derive rate-distortion curves that characterize the model’s compression capabilities.

The analysis reveals that DDPMs allocate most of their modeling capacity to capturing perceptually important details while gracefully discarding high-frequency noise. This is evident from the sharp decline in reconstruction error (distortion) during the early stages of decompression, where the model focuses on recovering the primary structures and features of the image. As more denoising steps are applied, the model refines details and textures, though the improvement in perceptual quality becomes marginal.

This behavior suggests that DDPMs can be used as lossy compressors with a controllable trade-off between compression rate and reconstruction quality. By halting the decompression process at an intermediate stage, a compressed image can be obtained that preserves essential content while discarding imperceptible details. This compressed representation can be stored or transmitted efficiently, with the image being progressively reconstructed on demand.

Algorithms for Training, Sampling, and Compression in DDPMs

The DDPM paper introduces four key algorithms that illustrate how the model is trained, how it generates samples, and how it can be used for progressive decompression and reconstruction. These algorithms are essential for understanding the step-by-step procedures that make DDPMs work effectively.

Algorithm 1 Training. The training process begins by sampling a data point x_0​ from the data distribution q(x_0), followed by introducing Gaussian noise over T timesteps. The model then uses gradient descent to minimize the difference between the true noise added to the data and the model’s predicted noise. This process is repeated until the model learns to reconstruct the original data from noisy samples accurately. This algorithm outlines the iterative procedure that optimizes DDPMs to progressively reverse the noise addition process.

Algorithm 2 Sampling. Once the model is trained, sampling from a DDPM starts by generating a random Gaussian noise x_T. From this noisy state, the model runs the reverse process, which progressively removes the noise by predicting the mean and variance at each step. After T steps, the model produces a final sample x_0​, which approximates the data distribution. This algorithm demonstrates how DDPMs generate high-quality data from pure noise, reflecting their capabilities in image generation.

Algorithm 3 Sending x_0 (Progressive Decompression). In the context of lossy compression, this algorithm describes how the DDPM reverse process can be interpreted as a progressive decompression mechanism. The data is compressed by sending noisy latent representations in reverse order, from x_T​ to x_0​. Each step reconstructs the image from the latent by predicting and removing noise. This algorithm is crucial for understanding how DDPMs manage progressive generation and image transmission.

Algorithm 4 Receiving x_0​ (Progressive Reconstruction). This complementary algorithm shows how the model can progressively receive the noisy latent representations and reconstruct the original data. Starting from x_T​, the model applies each step in the reverse process to gradually refine the image. This process enables efficient image reconstruction, allowing DDPMs to serve as powerful lossy compressors with the potential for progressive transmission in real-time applications.

Together, these four algorithms provide a complete picture of how DDPMs operate from training to sampling, and how they can be applied for compression tasks.

Conclusion

DDPMs offer a unique approach to generative modeling by combining denoising score matching with Langevin dynamics, allowing for progressive image generation and lossy compression. Their ability to balance perceptual quality with compression and to reconstruct images in a flexible, stepwise manner highlights their potential across various applications.

Reference: Ho, J., Jain, A., & Abbeel, P. (2020). Denoising diffusion probabilistic models. arXiv preprint arXiv:2006.11239. https://doi.org/10.48550/arXiv.2006.11239


메타데이터
post_id
63b4fd3a3b67
slug
denoising-diffusion-probabilistic-models-63b4fd3a3b67
url
https://medium.com/@EleventhHourEnthusiast/denoising-diffusion-probabilistic-models-63b4fd3a3b67
canonical_url
https://medium.com/@EleventhHourEnthusiast/denoising-diffusion-probabilistic-models-63b4fd3a3b67
author_url
https://medium.com/@EleventhHourEnthusiast
status
ok
fetched_at
2026-06-09 15:37:30