Generative models: factorization and denoising
Compare autoregressive and diffusion objectives through their assumptions, training signals, and sampling procedures.
On this page
The question for today
What you’ll understand
- Factor a sequence distribution into conditional probabilities.
- Explain the forward-noising objective of a DDPM.
- Separate sample plausibility from factual correctness and coverage.
A generative model specifies or learns a distribution from which new examples can be sampled. It is not just a classifier run backward. Autoregressive models build a joint distribution through ordered conditionals; diffusion models learn a reverse process related to a chosen noising process. Both can produce compelling samples, but their objectives, computational costs, and failure modes are different enough to deserve separate mental models.
Autoregression makes a joint distribution tractable
The probability chain rule expresses a sequence's joint probability as a product of next-element conditional probabilities. Choosing an ordering is a modeling decision; the identity itself does not assume independence. A neural network parameterizes each conditional using an allowed prefix. Training on observed prefixes can evaluate many token losses in parallel with a causal mask, while ordinary left-to-right sampling must choose earlier tokens before conditioning on them to generate later ones.
Negative log likelihood sums the negative logarithms of conditional probabilities. This teaches the model to assign probability to observed sequences, not to verify the truth of every sentence. At generation time, a model may condition on its own earlier mistakes rather than the clean prefixes seen during training. Sampling temperature or truncation changes the generation policy and its output distribution. A fluent sample can still be false, unsafe for a particular use, or unrepresentative of rare training modes.
Diffusion learns to reverse a specified corruption
A standard Gaussian DDPM defines a forward process that gradually adds noise to continuous data. A useful property is that a noisy sample at any chosen timestep can be generated directly from a clean example and Gaussian noise, without simulating every earlier step. The cumulative noise schedule determines how much original signal remains. A network receives the noisy sample and timestep and can be trained to predict the added noise under a commonly used simplified squared-error objective.
Generation begins from an approximate terminal noise distribution and applies a learned reverse procedure. The reverse conditionals depend on the data distribution; simply negating the forward noise does not recover an unknown original. Finite-step DDPMs use a parameterized reverse model, and alternative samplers can trade step count against error and sample behavior. Do not generalize the continuous Gaussian formula to discrete tokens without changing the corruption model and associated derivation. Conditioning, such as text guidance, also changes the learned or sampling distribution.
Objectives and samples answer different questions
A denoising objective tells the network which noise component to estimate at each corruption level. A small training loss alone does not establish high-quality generation or complete coverage of the data distribution. A sampler can generate visually appealing common cases while missing uncommon modes. Likelihood-based scores, perceptual measures, diversity tests, and human or task-specific evaluations probe different properties and may disagree. State which failure would matter in the intended application before choosing a metric.
Inspect training-data provenance and evaluation contamination. A generator may reproduce a memorized item rather than create a meaningfully new one. Compare near-duplicates and evaluate on cases separated from training sources where possible. Generated data can support simulation or prototyping, but a plausible sample is not an observation of the world. For a scientific or operational claim, require external evidence or a validated generative model with clearly stated assumptions, uncertainty, and a defined domain of use.
Work it through
Follow signal and noise numerically
For one scalar coordinate, let x₀=2, cumulative alpha=0.64, and sampled noise epsilon=−1. Construct x_t and compare the signal and noise contributions.
The signal coefficient is sqrt(0.64)=0.8, so the clean-data contribution is 0.8×2=1.6.
The noise coefficient is sqrt(1−0.64)=0.6, so the sampled noise contribution is 0.6×(−1)=−0.6.
Add the contributions to obtain x_t=1.0. Given x_t alone, the network does not know x₀ or epsilon uniquely; it learns a statistical noise estimate from many training pairs and the timestep.
The noisy coordinate equals 1.0. This constructed pair gives a known training target, not an exact inversion algorithm for an arbitrary unseen noisy coordinate.
The living notebook
Explore the model
Interactive lab · probability
A distribution is more than one sample
Change p and n in the exact binomial lab to compare probability mass across possible outcomes. This discrete model illustrates coverage and distribution shape; it is not a DDPM, Gaussian noising process, or text generator.
- Mean · np
- 5
- Variance · np(1−p)
- 2.5
- Total probability
- 1
These are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forA generative model must be assessed as a distribution, not only through a few attractive selected samples.
Pause & reason
Check your understanding
Your turn
Try it yourself
An autoregressive binary sequence model has p(x₁=1)=0.6 and p(x₂=0|x₁=1)=0.25. Find the probability and negative log likelihood of the sequence (1,0).
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Multiply conditional probabilities before taking the negative natural logarithm, or add their negative logs.
Compare with the solution
The joint probability is 0.6×0.25=0.15. The negative log likelihood is −ln(0.15), approximately 1.897. No independence assumption was made: the second probability is explicitly conditioned on the first outcome. A different prefix can have a different second-step distribution.
Keep the idea
Take it with you
- Autoregressive likelihood is a sum of conditional log losses.
- A DDPM learns a reverse model tied to a specified forward corruption.
- Plausibility, novelty, coverage, and truth require different evidence.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.