Skip to content
tezvyn:
Menu

Diffusion Models: Generating Data by Reversing Noise

Source: Wikipedia: Diffusion modelMediumHow cards are made

Think of diffusion models as learning to reverse a "random walk." They take a clean data point, gradually add noise until it's unrecognizable, and then train a model to reverse that process step-by-step. This allows them to start with pure noise and guide it back into a coherent sample that resembles the original dataset. The footgun is that this multi-step reversal makes generation computationally intensive compared to single-pass models.

The mental model

A diffusion model learns to create data by reversing a process of gradual noising. Think of it as learning how to restore a photograph that has been slowly degraded by static. The model doesn't see the original, clean photo during restoration; it only learns the statistical path from pure static back to something that looks like a photo from its training set. It models data generation as a guided "random walk" from chaos to structure.

How it works

A diffusion model has two core processes: 1. Forward Diffusion Process: A fixed, predefined process that gradually adds noise to a sample from the dataset over a series of steps. This is the "random walk" away from clean data into pure noise. 2. Reverse Sampling Process: This is the trained neural network. Its job is to predict and reverse one step of the noising process. Given a noisy sample, it learns to estimate the slightly less noisy version.

To generate new data, the model starts with a tensor of pure random noise and repeatedly applies the learned reverse process, stepping it back towards the learned data distribution until a clean, new sample emerges.

When to use it

• When the goal is to generate high-quality, novel data that closely matches the distribution of a complex dataset. • For tasks where the quality and diversity of generated samples are more critical than the speed of generation.

When not to use it

• In applications requiring real-time or very fast generation. The iterative sampling process is computationally expensive and slow. • When you need a simple latent space. The path from noise to data is complex and not easily interpretable.

One canonical example

Imagine a model trained on a dataset of handwritten digits. The forward process takes an image of a '7' and adds noise to it over 500 steps until it's just static. The model is trained to predict the noise added at any given step. To generate a new digit, the model starts with a random static image and runs its reverse process 500 times. At each step, it subtracts its predicted noise, slowly forming a coherent image of a digit that never existed in the original dataset.

Interview question

What is the core mechanism diffusion models use to generate new data?

  • a.A. Iteratively reversing a fixed process that gradually adds noise to data.Correct
  • b.B. Directly transforming a random latent vector into a high-dimensional data sample.
  • c.C. Predicting the next data element based on the sequence of previously generated elements.
  • d.D. Decompressing a learned compact representation back into its original data form.
Why?

The card explains that diffusion models learn to reverse a gradual noising process, iteratively transforming pure noise into a coherent data sample. Option B describes models like GANs or VAEs, which map a latent code directly to data, differing from diffusion models' step-by-step noise reduction.

Just read this? Test yourself on what you have been reading.

Read the original → en.wikipedia.org

Put your scrolling time to good use

Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Open roles that interview on generative ai — each one lists the topics its interview covers.

See open roles