← Latest papers
💬 NLP

A Tutorial on Diffusion Theory: From Differential Equations to Diffusion Models

This tutorial provides a unified framework for diffusion models by deriving their forward and reverse dynamics from differential equations, demonstrating the equivalence between standard training objectives and score matching, and clarifying the theoretical connections between various sampling methods like DDPM, DDIM, and guided generation.

Original authors: Jiayi Fu, Yuxia Wang

Published 2026-05-22
📖 6 min read🧠 Deep dive

Original authors: Jiayi Fu, Yuxia Wang

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you have a beautiful, high-resolution photograph of a cat. Now, imagine slowly turning up the static on an old TV until that picture is completely lost in a sea of white noise. That is the Forward Process.

Now, imagine you have a super-smart detective who can look at that static and say, "If I remove just a tiny bit of noise from this specific spot, the cat's ear will start to peek through." If this detective can do that step-by-step, over and over, they can turn the static back into a clear picture of a cat. That is the Reverse Process, and it's how Diffusion Models generate images.

This paper by Jiayi Fu and Yuxia Wang is essentially a "user manual" written in the language of differential equations (the math that describes how things change over time). It unifies several different ways scientists have been thinking about these models into one big, coherent story.

Here is the breakdown of their story, using simple analogies:

1. The Two Ways to Describe the Journey (ODE vs. SDE)

The paper starts by saying that the process of turning a clear image into noise (and back again) can be described in two different mathematical languages:

  • The Stochastic Path (SDE): Think of this as a hiker walking through a foggy forest. They have a map (the direction they should go), but the wind (random noise) keeps blowing them slightly off course. Every step is a mix of a planned direction and a random gust. This is the Stochastic Differential Equation (SDE).
  • The Deterministic Path (ODE): Now, imagine the same hiker, but this time the wind is perfectly predictable, or they are walking on a giant, smooth conveyor belt that moves them exactly where they need to go with no randomness. This is the Ordinary Differential Equation (ODE).

The Big Insight: The paper proves that even though these two paths look different (one is wobbly, one is smooth), they both start at the same place (a clear image) and end at the same place (pure noise). More importantly, they both follow the exact same "density map" at any given moment. You can switch between the wobbly path and the smooth path without changing the final result.

2. The "Score" (The Detective's Instinct)

How does the detective know which way to go? They use something called a Score.

In math, the "score" is just the gradient of the probability. In plain English, think of it as a slope.

  • If you are standing on a hill, the slope tells you which way is "up" (where the data is) and which way is "down" (where the noise is).
  • The model's job is to learn this slope. It learns to look at a noisy image and say, "The 'uphill' direction (towards a real image) is this way."

The paper shows that the standard way we train these models (by asking them to guess the noise that was added) is mathematically identical to asking them to learn this "slope" or Score. It's like teaching a student to solve a math problem by asking them to find the answer, rather than teaching them the formula directly. The paper proves these two teaching methods are actually the same thing.

3. The Training: Learning to Denoise

The paper explains that we don't need to teach the model the complex math of the "slope" directly. Instead, we can just show it a noisy picture and ask, "What was the noise we added?"

  • If the model learns to predict the noise perfectly, it automatically learns the slope.
  • Once it knows the slope, it can reverse the process: start with pure noise and walk "uphill" to create a new, realistic image.

4. The Different "Walkers" (DDPM, DDIM, DPM-Solver)

The paper unifies several famous algorithms that people use to generate images. It explains that they are all just different ways of taking steps along that "slope":

  • DDPM (The Careful Hiker): This method takes small, cautious steps. It adds a little bit of randomness at every step (like the SDE). It's accurate but slow.
  • DDIM (The Smooth Slider): This method ignores the random wind and just follows the smooth conveyor belt (the ODE). It's much faster because it doesn't waste time reacting to random gusts, but it requires a very good map (a well-trained model).
  • DPM-Solver (The Express Elevator): This is a fancy new method that uses math tricks to take huge, efficient leaps up the hill instead of small steps. It gets to the top (the final image) in record time.

The paper shows that DDPM is essentially a discrete version of the wobbly path (SDE), and DDIM is a discrete version of the smooth path (ODE). They are two sides of the same coin.

5. Guiding the Process (Classifier Guidance)

Sometimes you don't just want a cat; you want a black cat. How do you steer the detective?

  • Classifier Guidance: You bring in a second expert (a classifier) who shouts, "More black! Less white!" The detective listens to both the slope of the image and the expert's shout, adjusting their path to make a black cat.
  • Classifier-Free Guidance: Instead of hiring a second expert, you train the main detective to be able to say "I don't know what you want" (no condition) and "I know you want a black cat" (condition). During generation, you mix these two answers to steer the result. The paper explains the math behind why this "mixing" works so well.

6. The Grand Unification: Flow Matching

Finally, the paper connects Diffusion Models to a newer field called Flow Matching.

  • Flow Matching is like drawing a straight line from a noise cloud to a data cloud.
  • Diffusion is like a winding river path.

The paper proves that even though they look different, if you train them the same way (predicting noise/score), they end up describing the exact same journey. The "noise prediction" loss function is actually a "flow matching" loss function in disguise. It's like realizing that whether you drive a car or ride a bike, if you follow the same GPS coordinates, you end up at the same destination.

Summary

This paper is a bridge. It takes the messy, complex world of different diffusion algorithms (DDPM, DDIM, Flow Matching) and shows that they are all just different ways of solving the same differential equation.

  • Forward: Turn data into noise (easy).
  • Reverse: Turn noise into data (hard).
  • The Secret: Learn the "slope" (score) by guessing the noise.
  • The Result: Whether you walk with a wobbly stick (SDE) or slide on a smooth rail (ODE), if you follow the slope, you will generate beautiful images.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →