Sobes.tech
Senior

How is the step t sampled during training and inference in Stable Diffusion?

sobes.tech AI

Answer from AI

In Stable Diffusion, step t is a discrete time index indicating the level of noise in the diffusion process. During training, t is usually sampled randomly from a uniform distribution over the entire range of steps (for example, from 1 to T), so that the model learns to reconstruct data from different noise levels.

During inference (generation), steps t are chosen deterministically, usually in reverse order from T to 1, with a fixed step or using special sampling schemes (e.g., DDIM), to gradually remove noise from the image.

Example:

  • Training: t ~ Uniform(1, T)
  • Inference: t = T, T-1, T-2, ..., 1

Thus, training covers the entire spectrum of noise levels, while inference involves sequentially removing noise step by step.