Answers · How models work
How do you turn the predicted noise into the mean of the previous image?
In shortSubtract a small scheduled fraction of the predicted noise from the current image, then rescale to undo the forward step's shrinkage.
The mean of the previous image is with a small scheduled fraction of the predicted noise removed, then divided by . The network does not hand you the mean directly; it hands you , and the schedule supplies the two coefficients that turn that guess into the mean.
Where the conditioning goes
Conditioning backwards is not the forward step run in reverse. The forward step tells you how to add noise to one particular previous image. Once you condition on a particular , many previous images could have produced it, so on its own is not the simple Gaussian you started with. Bayes' rule combines the forward step with the marginal , and the product of those two Gaussians is another Gaussian. That product is why a reverse step has a usable mean at all. The step being small is what keeps the product close to the true reverse conditional; with large steps the product is still Gaussian but it is no longer a good description of the reverse step.
The expression above still contains , which is exactly what you do not have at sampling time. The cumulative forward relation rearranges to . Put that into the mean and collect the terms multiplying and . The coefficient collapses to , and the noise coefficient collapses to . That is the whole conversion: the predicted noise is scaled by before it is subtracted, and the result is divided by .
A number in the middle of the walk
Take on the linear schedule . Then , so and . The product of the first 500 alphas is approximately , so . The noise coefficient is therefore . If and the network predicts , subtract to get , then divide by to get . If the prediction were , the same arithmetic gives . The mean barely moves, and the coefficient doing the moving is roughly one hundredth, not one.
The natural guess that fails
The natural guess is to subtract the predicted noise from and stop. That fails for two separate reasons. First, is the network's estimate of the total noise sitting in , not the increment of noise that the single step from to added. The factor converts the total into the small increment relevant to one reverse step. Second, the forward step multiplied the signal by , so the reverse mean has to divide by to restore the scale. Skip that division and every step leaves the image slightly shrunk. Conditioning on alone does not give a Gaussian either; the Gaussian comes from conditioning on and and then replacing with the estimate above.
The formula is a Gaussian mean only under the small step assumption. Make the steps large and is broad and lumpy, so a single mean and variance no longer describe it. The last step is also special: there is no later step to correct added grain, so is omitted at . The size of is not pinned down by the forward process. Two standard choices differ by a few percent, and that difference is invisible in a thousand step sampler but becomes visible when the number of steps is cut.
Worth keeping
- The reverse mean is the current image minus a scheduled fraction of the predicted noise, all divided by the square root of that step's alpha.
- The predicted noise is the total noise in the current image, so it must be scaled by the step's noise coefficient before it can correct one reverse step.
- The reverse step is Gaussian only because the forward steps are small; large steps destroy the single mean and variance description.
Where this goes next
This question is one step of How Noise Becomes a Picture, a course that works through its subject from the beginning. The page that teaches this part of it is Walking the Path Backwards, and it reads the whole way through whether or not you have an account.
What an account changes is the practice: problems standing under every idea, marked with a reason rather than a tick, in a copy of the course that is yours.
Read that pageThe whole courseOther questions people ask about this
- Why does diffusion add Gaussian noise instead of any random corruption?Diffusion adds Gaussian noise because Gaussian errors combine exactly: each step keeps the spread fixed and gives a closed-form noisy picture at any later step, which makes the reverse step learnable.
- Why does the forward noising process have to be a Markov chain?The forward process is made memoryless so that each step is a fixed random rule and any later state can be computed straight from the original picture.
- What does classifier-free guidance actually add together, and why does it make the prompt stronger?It adds the unconditional prediction to several times the gap between the conditional and unconditional predictions, pushing past the conditional answer so the prompt is obeyed more strictly.
- Why is the model's noise prediction really the score of the noised image distribution?The network's noise prediction, divided by the noise level and given a minus sign, is the direction that makes a noised image more plausible.
- Why does the model get stuck repeating the same sentence over and over?The model is not stuck in a memory loop: once it has written a phrase, that phrase is in its context and makes writing it again more likely, so a decoder that always picks the top word cannot leave.
- Why does the same request cost more tokens in some languages than in others?A token is learned from a corpus, so a language that was rare in the training text is split into many more pieces for the same meaning, and the price multiplier follows.