#149DDPM Reverse (Denoise) StepMediumNeural NetworksAsked atOpenAI · Google · Anthropic
DDPM Reverse (Denoise) Step
Background
DDPM (Denoising Diffusion Probabilistic Models) sample by iteratively denoising: given the current noisy and the model's noise prediction , compute using the closed-form reverse update. Apply this to to sample from the model. This problem isolates one reverse step.
Problem statement
Implement ddpm_reverse_step(x_t, eps_theta, t, betas, seed=None) using:
where , , and . At , no noise is added (deterministic).
Input
x_t—np.ndarrayof any shape, the current noisy sample.eps_theta—np.ndarraysame shape, the model's noise prediction.t—int >= 0, the current diffusion step (inbetasindex).betas— 1-D array of values for .seed— optionalintfor reproducibility.
Output
Returns np.ndarray of the same shape as x_t.
Examples
Example 1 — shape preserved
Input: x_t=(3, 4) array, eps=(3, 4) array, betas=length-20, t=5
Output: (3, 4) array
Example 2 — t=0 is deterministic
Input: any x, t=0
Output: identical across seeds (no noise term added)
Constraints
tmust be a valid index intobetas.- Use
np.random.default_rng(seed)for the noise term so output is reproducible. - At
t = 0, return the mean term only.
Notes
- Variance scheduler. is the simpler choice; some implementations use . Either gives valid samples.
- Iterating. A full sampler calls this times starting from .
Python
Loading...
▶ Run executes the 3 visible sample tests below in your browser. Submit runs the full suite — including hidden tests — on the server for an official verdict.
- •reference: full reverse update at t=7 is deterministic given the seed
- •example: t=0 returns the deterministic mean term only
- •sample: 1-D input at t=3 matches the seeded reference