ApX logoApX logo
ModelsCalculatorHardwareCoursesPricing
ApX logoApX logo
ModelsCalculatorHardwareCoursesPricing

All Courses

Advanced Synthetic Data Generation: GANs and Diffusion Models
Chapter 1: Foundations of Generative Modeling Revisited
Probabilistic Modeling for Generation
Taxonomy of Generative Models
Challenges in High-Dimensional Data Synthesis
GAN Fundamentals
Introduction to Diffusion Model Concepts
Chapter 2: Advanced GAN Architectures and Techniques
Progressive Growing of GANs (ProGAN)
Style-Based Generators (StyleGAN variants)
Unpaired Image-to-Image Translation (CycleGAN)
Conditional GANs: Architectures and Control
Attention Mechanisms in GANs
Analyzing and Manipulating GAN Latent Spaces
Hands-on Practical: Implementing StyleGAN Components
Chapter 3: GAN Training Stability and Optimization
Diagnosing Training Instability: Oscillations and Divergence
Mode Collapse: Causes and Mitigation Strategies
Alternative Loss Functions (WGAN, WGAN-GP, LSGAN)
Regularization Techniques for GANs
Two Time-Scale Update Rule (TTUR)
Hyperparameter Tuning Strategies for GANs
Hands-on Practical: Implementing WGAN-GP
Chapter 4: Diffusion Models: Theory and Advanced Implementation
Mathematical Foundations: Stochastic Differential Equations
Denoising Diffusion Probabilistic Models (DDPM)
Score-Based Generative Modeling
Improved Techniques: DDIM and Variance Schedules
Classifier Guidance and Classifier-Free Guidance
Architectural Considerations for Diffusion Models (U-Net)
Hands-on Practical: Implementing a Basic DDPM
Chapter 5: Evaluating Synthetic Data Quality
Challenges in Generative Model Evaluation
Quantitative Metrics: IS, FID, Precision, Recall
Distributional Metrics: Kernel Inception Distance (KID)
Perceptual Path Length (PPL) for GANs
Qualitative Evaluation Methods
Evaluating Conditional Generation Models
Hands-on Practical: Calculating FID Scores
Chapter 6: Advanced Applications and Integration
High-Resolution Synthesis Strategies
Text-to-Image Synthesis Architectures
Synthetic Data for Augmentation and Privacy
Video Generation with Generative Models
Combining GANs and Diffusion Models
Computational Considerations and Scaling
Hands-on Practical: Conditional Image Generation

Score-Based Generative Modeling

Denoising Diffusion Probabilistic Models (DDPMs) represent one primary approach to diffusion models, focusing on parameterized forward and reverse Markov chains. Score-Based Generative Modeling offers an alternative, yet closely related, viewpoint. This approach centers on directly modeling the gradient of the logarithm of the data probability density function, known as the score function, at various noise levels. Understanding this perspective illuminates the connection between diffusion models and established techniques like score matching and Langevin dynamics.

The Score Function: Gradient of Log-Probability

For a given data distribution p(x)p(\mathbf{x})p(x), the score function is defined as the gradient of its log-probability with respect to the data x\mathbf{x}x:

∇xlog⁡p(x)\nabla_{\mathbf{x}} \log p(\mathbf{x})∇x​logp(x)

This vector field is significant because it points in the direction of the steepest ascent of the log-probability density at any given point x\mathbf{x}x. Intuitively, it tells us how to modify x\mathbf{x}x to make it slightly more probable under the distribution p(x)p(\mathbf{x})p(x).

In the context of diffusion models, we are interested in the score function of the perturbed data distributions pt(xt)p_t(\mathbf{x}_t)pt​(xt​) at different noise levels ttt. Recall that xt\mathbf{x}_txt​ is the data point x0\mathbf{x}_0x0​ after ttt steps of the forward noising process. The score function ∇xtlog⁡pt(xt)\nabla_{\mathbf{x}_t} \log p_t(\mathbf{x}_t)∇xt​​logpt​(xt​) indicates how to adjust a noisy sample xt\mathbf{x}_txt​ to increase its likelihood under the marginal distribution at time ttt.

Connecting Scores to the Reverse Diffusion Process

The reverse process in diffusion models aims to denoise a sample xt\mathbf{x}_txt​ to estimate xt−1\mathbf{x}_{t-1}xt−1​. It turns out that the optimal reverse transition, which maximizes the likelihood of the data, is closely related to the score function ∇xtlog⁡pt(xt)\nabla_{\mathbf{x}_t} \log p_t(\mathbf{x}_t)∇xt​​logpt​(xt​).

Specifically, Tweedie's formula provides a link showing that the conditional expectation of the original data point x0\mathbf{x}_0x0​ given the noisy version xt\mathbf{x}_txt​ involves the score of the noisy distribution ptp_tpt​. The mean of the reverse transition pθ(xt−1∣xt)p_\theta(\mathbf{x}_{t-1} | \mathbf{x}_t)pθ​(xt−1​∣xt​) depends on estimating this score.

The neural network ϵθ(xt,t)\boldsymbol{\epsilon}_\theta(\mathbf{x}_t, t)ϵθ​(xt​,t) trained in DDPMs using the simplified objective:

Lsimple(θ)=Et,x0,ϵ[∥ϵ−ϵθ(αˉtx0+1−αˉtϵ,t)∥2]L_{simple}(\theta) = \mathbb{E}_{t, \mathbf{x}_0, \boldsymbol{\epsilon}} \left[ \| \boldsymbol{\epsilon} - \boldsymbol{\epsilon}_\theta(\sqrt{\bar{\alpha}_t}\mathbf{x}_0 + \sqrt{1-\bar{\alpha}_t}\boldsymbol{\epsilon}, t) \|^2 \right]Lsimple​(θ)=Et,x0​,ϵ​[∥ϵ−ϵθ​(αˉt​​x0​+1−αˉt​​ϵ,t)∥2]

is essentially learning a re-scaled version of the score function of the noisy data distribution pt(xt)p_t(\mathbf{x}_t)pt​(xt​). The relationship is approximately:

ϵθ(xt,t)≈−1−αˉt∇xtlog⁡pt(xt)\boldsymbol{\epsilon}_\theta(\mathbf{x}_t, t) \approx -\sqrt{1-\bar{\alpha}_t} \nabla_{\mathbf{x}_t} \log p_t(\mathbf{x}_t)ϵθ​(xt​,t)≈−1−αˉt​​∇xt​​logpt​(xt​)

This shows that even when training a DDPM to predict the noise ϵ\boldsymbol{\epsilon}ϵ, the model is implicitly learning the score of the intermediate noisy data distributions.

Training Score Models with Score Matching

Instead of implicitly learning the score via noise prediction, score-based models aim to train a neural network, often denoted as sθ(x,t)\mathbf{s}_\theta(\mathbf{x}, t)sθ​(x,t), to directly estimate the score function ∇xlog⁡pt(x)\nabla_{\mathbf{x}} \log p_t(\mathbf{x})∇x​logpt​(x). A naive approach would be to minimize the squared difference between the model's output and the true score:

L(θ)=EtEpt(xt)[∥sθ(xt,t)−∇xtlog⁡pt(xt)∥22]\mathcal{L}(\theta) = \mathbb{E}_{t} \mathbb{E}_{p_t(\mathbf{x}_t)} \left[ \| \mathbf{s}_\theta(\mathbf{x}_t, t) - \nabla_{\mathbf{x}_t} \log p_t(\mathbf{x}_t) \|^2_2 \right]L(θ)=Et​Ept​(xt​)​[∥sθ​(xt​,t)−∇xt​​logpt​(xt​)∥22​]

However, computing the true score ∇xtlog⁡pt(xt)\nabla_{\mathbf{x}_t} \log p_t(\mathbf{x}_t)∇xt​​logpt​(xt​) is generally intractable because pt(xt)p_t(\mathbf{x}_t)pt​(xt​) involves an unknown normalization constant and requires integrating over all possible x0\mathbf{x}_0x0​.

Score Matching provides a way around this. The original score matching objective, equivalent to the one above, involves the trace of the Hessian of the score model, which can be computationally expensive. More practical variants exist:

  1. Denoising Score Matching (DSM): This method perturbs the data slightly with known noise and trains the model to predict the score of the perturbed distribution. Interestingly, the objective function for DSM under Gaussian noise turns out to be closely related to the noise prediction objective used in DDPMs. It trains the score network sθ(x,t)\mathbf{s}_\theta(\mathbf{x}, t)sθ​(x,t) by minimizing an objective related to recovering clean data from noisy versions, effectively connecting score estimation to denoising.
  2. Sliced Score Matching (SSM): This technique avoids computing the full Hessian trace by projecting the score matching objective onto random directions, making it more scalable for high-dimensional data.

Training a score-based model sθ(xt,t)\mathbf{s}_\theta(\mathbf{x}_t, t)sθ​(xt​,t) involves sampling timesteps ttt, sampling data points x0\mathbf{x}_0x0​, generating corresponding noisy samples xt\mathbf{x}_txt​ using the forward process, and then optimizing θ\thetaθ using a suitable score matching objective like DSM.

Generating Samples via Langevin Dynamics

Once a time-dependent score model sθ(x,t)\mathbf{s}_\theta(\mathbf{x}, t)sθ​(x,t) has been trained, we can generate new samples by simulating the reverse diffusion process. A common algorithm for this is Annealed Langevin Dynamics.

Langevin dynamics is an iterative method originally used in physics to sample from a probability distribution p(x)p(\mathbf{x})p(x) using its score function ∇xlog⁡p(x)\nabla_{\mathbf{x}} \log p(\mathbf{x})∇x​logp(x). The update rule combines a gradient ascent step on the log probability (following the score) with Gaussian noise injection:

xi+1=xi+η2∇xlog⁡p(xi)+ηzi\mathbf{x}_{i+1} = \mathbf{x}_i + \frac{\eta}{2} \nabla_{\mathbf{x}} \log p(\mathbf{x}_i) + \sqrt{\eta} \mathbf{z}_ixi+1​=xi​+2η​∇x​logp(xi​)+η​zi​

Here, η\etaη is the step size and zi∼N(0,I)\mathbf{z}_i \sim \mathcal{N}(0, \mathbf{I})zi​∼N(0,I) is Gaussian noise.

For score-based generative models, we apply this idea across decreasing noise levels (annealing). We start with a sample from the prior distribution, typically pure Gaussian noise xT∼N(0,I)\mathbf{x}_T \sim \mathcal{N}(0, \mathbf{I})xT​∼N(0,I), and iteratively refine it using the learned score function sθ(xt,t)\mathbf{s}_\theta(\mathbf{x}_t, t)sθ​(xt​,t) for t=T,T−1,…,1t = T, T-1, \dots, 1t=T,T−1,…,1. A typical update step looks like:

xt−1=xt+αtsθ(xt,t)+2αtzt\mathbf{x}_{t-1} = \mathbf{x}_t + \alpha_t \mathbf{s}_\theta(\mathbf{x}_t, t) + \sqrt{2 \alpha_t} \mathbf{z}_txt−1​=xt​+αt​sθ​(xt​,t)+2αt​​zt​

where αt>0\alpha_t > 0αt​>0 is a step size that depends on the noise level ttt, and zt∼N(0,I)\mathbf{z}_t \sim \mathcal{N}(0, \mathbf{I})zt​∼N(0,I). This process gradually moves the sample away from noise and towards regions of high probability under the data distribution, guided by the learned score field. More sophisticated sampling procedures, often involving predictor-corrector steps inspired by numerical methods for solving SDEs, are commonly used to improve sample quality and efficiency. These samplers often resemble the reverse process sampler used in DDPMs.

Unifying Perspectives: DDPMs and Score-Based Models

The score-based perspective highlights the fundamental role of the score function in generative modeling via diffusion. It reveals that:

  • DDPMs, while trained to predict noise, implicitly learn the score function. Their sampling process is a discretized version of simulating the reverse-time SDE governed by the score.
  • Score-based models explicitly train a network to estimate the score using score matching techniques. Sampling is performed using algorithms like annealed Langevin dynamics, which also approximate the reverse-time SDE.

The Stochastic Differential Equation (SDE) formulation, discussed previously, provides a continuous-time framework that naturally encompasses both DDPMs and score-based models. Both approaches can be seen as different ways to discretize and implement the same underlying continuous diffusion process.

Summary

Score-Based Generative Modeling provides a powerful theoretical lens for understanding diffusion models. By focusing on the score function ∇xlog⁡pt(xt)\nabla_{\mathbf{x}} \log p_t(\mathbf{x}_t)∇x​logpt​(xt​), it connects diffusion processes to score matching for training and Langevin dynamics for sampling. This perspective not only clarifies the mechanisms behind DDPMs but also opens avenues for designing new models and samplers based on directly estimating and utilizing the score function of the evolving data distribution under noise. The close relationship between noise prediction in DDPMs and score estimation underscores the deep connections between these seemingly different formulations.

  • Generative Modeling by Estimating Gradients of the Data Distribution, Yang Song, Stefano Ermon, 2019 Advances in Neural Information Processing Systems (NeurIPS), Vol. 32 (Curran Associates, Inc.) DOI: 10.5555/3454287.3455122 - Introduces the framework of score-based generative modeling and proposes annealed Langevin dynamics for sampling.
  • Score-Based Generative Modeling through Stochastic Differential Equations, Yang Song, Jascha Sohl-Dickstein, Diederik P. Kingma, Abhishek Kumar, Stefano Ermon, Ben Poole, 2020 International Conference on Learning Representations (ICLR) (International Conference on Learning Representations) DOI: 10.48550/arXiv.2011.13456 - Provides a unified continuous-time SDE framework for diffusion models, covering both DDPMs and score-based models.
  • Denoising Diffusion Probabilistic Models, Jonathan Ho, Ajay Kumar, Stefano Ermon, 2020 Advances in Neural Information Processing Systems (NeurIPS) DOI: 10.48550/arXiv.2006.11239 - The original paper that popularised DDPMs, providing the background for understanding their connection to score-based models.
  • Denoising Score Matching for Generative Modeling, Pascal Vincent, Hugo Larochelle, Yoshua Bengio, 2011 Journal of Machine Learning Research, Vol. 11 - Presents denoising score matching, a practical method for training score-based models that is closely related to the DDPM objective.

© 2026 ApX Machine Learning