BEVERLY QIN

Back to Projects

Diffusion Sampling & Guidance

my role

Developer

year

2026

contribution

Generative Modeling, Model Implementation, Training

tools

Python, PyTorch, DeepFloyd IF, Diffusers

team

Individual project

Overview

This project explores the DeepFloyd IF diffusion model through text-to-image generation, forward noising, denoising, iterative sampling, and classifier-free guidance.

The implementation choices, parameter sweeps, observations, and visual results below reflect the original report.

Text-to-Image Generation

With random seed 88 and provided T5 prompt embeddings, I generated a walking building, a painting of the Colosseum, and desalination infrastructure occupied by flamingos. Each prompt is evaluated at 5, 20, and 100 inference steps.

Read each row from left to right as increasing denoising steps: 5, 20, then 100. Five steps produced muted or incomplete scenes; 20 improved coherence; and 100 gave the Colosseum more detail and gave the flamingo scene more architectural context. The walking-building prompt remained difficult at every setting.

Stage 1 · Low-resolution generation

The first-stage outputs establish the composition and semantic content before upsampling.

Walking building · low-resolution stage 1 · stage1 0 steps5
Walking building · low-resolution stage 1 · stage1 0 steps5
Walking building · low-resolution stage 1 · stage1 0 steps20
Walking building · low-resolution stage 1 · stage1 0 steps20
Walking building · low-resolution stage 1 · stage1 0 steps100
Walking building · low-resolution stage 1 · stage1 0 steps100
Colosseum · low-resolution stage 1 · stage1 1 steps5
Colosseum · low-resolution stage 1 · stage1 1 steps5
Colosseum · low-resolution stage 1 · stage1 1 steps20
Colosseum · low-resolution stage 1 · stage1 1 steps20
Colosseum · low-resolution stage 1 · stage1 1 steps100
Colosseum · low-resolution stage 1 · stage1 1 steps100
Flamingo infrastructure · low-resolution stage 1 · stage1 2 steps5
Flamingo infrastructure · low-resolution stage 1 · stage1 2 steps5
Flamingo infrastructure · low-resolution stage 1 · stage1 2 steps20
Flamingo infrastructure · low-resolution stage 1 · stage1 2 steps20
Flamingo infrastructure · low-resolution stage 1 · stage1 2 steps100
Flamingo infrastructure · low-resolution stage 1 · stage1 2 steps100

Stage 2 · Upsampled results

These are the corresponding stage-2 outputs, with stage 2 fixed at 20 steps.

Walking building · upsampled stage 2 · stage2 0 steps5
Walking building · upsampled stage 2 · stage2 0 steps5
Walking building · upsampled stage 2 · stage2 0 steps20
Walking building · upsampled stage 2 · stage2 0 steps20
Walking building · upsampled stage 2 · stage2 0 steps100
Walking building · upsampled stage 2 · stage2 0 steps100
Colosseum · upsampled stage 2 · stage2 1 steps5
Colosseum · upsampled stage 2 · stage2 1 steps5
Colosseum · upsampled stage 2 · stage2 1 steps20
Colosseum · upsampled stage 2 · stage2 1 steps20
Colosseum · upsampled stage 2 · stage2 1 steps100
Colosseum · upsampled stage 2 · stage2 1 steps100
Flamingo infrastructure · upsampled stage 2 · stage2 2 steps5
Flamingo infrastructure · upsampled stage 2 · stage2 2 steps5
Flamingo infrastructure · upsampled stage 2 · stage2 2 steps20
Flamingo infrastructure · upsampled stage 2 · stage2 2 steps20
Flamingo infrastructure · upsampled stage 2 · stage2 2 steps100
Flamingo infrastructure · upsampled stage 2 · stage2 2 steps100

Diffusion Denoising

The forward process adds scaled Gaussian noise to the Campanile test image. At t=250 the building remains recognizable; at t=500 it is severely degraded; and at t=750 it is close to pure noise.

Gaussian blur establishes why a classical baseline is insufficient: it softens low-noise inputs but cannot recover structure at higher noise levels. The DeepFloyd UNet one-step estimate is substantially better at t=250, but loses detail at t=500 and t=750. Iterative DDPM denoising, using strided timesteps from 990 to 0 with stride 30, progressively restores a sharper and more coherent image.

Forward noise

Forward-noised Campanile · campanile noisy 250
Forward-noised Campanile · campanile noisy 250
Forward-noised Campanile · campanile noisy 500
Forward-noised Campanile · campanile noisy 500
Forward-noised Campanile · campanile noisy 750
Forward-noised Campanile · campanile noisy 750

Gaussian-blur baseline

Gaussian denoising baseline · campanile gaussian 250
Gaussian denoising baseline · campanile gaussian 250
Gaussian denoising baseline · campanile gaussian 500
Gaussian denoising baseline · campanile gaussian 500
Gaussian denoising baseline · campanile gaussian 750
Gaussian denoising baseline · campanile gaussian 750

One-step DeepFloyd denoising

DeepFloyd one-step denoising · campanile onestep 250
DeepFloyd one-step denoising · campanile onestep 250
DeepFloyd one-step denoising · campanile onestep 500
DeepFloyd one-step denoising · campanile onestep 500
DeepFloyd one-step denoising · campanile onestep 750
DeepFloyd one-step denoising · campanile onestep 750

Iterative denoising and final comparison

Iterative DDPM denoising · campanile iterative step0
Iterative DDPM denoising · campanile iterative step0
Iterative DDPM denoising · campanile iterative step5
Iterative DDPM denoising · campanile iterative step5
Iterative DDPM denoising · campanile iterative step10
Iterative DDPM denoising · campanile iterative step10
Iterative DDPM denoising · campanile iterative step15
Iterative DDPM denoising · campanile iterative step15
Iterative DDPM denoising · campanile iterative step20
Iterative DDPM denoising · campanile iterative step20
Final reconstruction comparison · campanile iterative final
Final reconstruction comparison · campanile iterative final
Final reconstruction comparison · campanile onestep final
Final reconstruction comparison · campanile onestep final
Final reconstruction comparison · campanile gaussian final
Final reconstruction comparison · campanile gaussian final

Sampling & Classifier-Free Guidance

Starting iterative denoising from pure noise produces recognizable but somewhat incoherent images. Classifier-free guidance (CFG) with γ=7 combines conditional and unconditional noise estimates, producing sharper, more coherent samples that better follow the prompt. The comparison below preserves both output sets.

Plain diffusion samples

Plain iterative sampling · sample1
Plain iterative sampling · sample1
Plain iterative sampling · sample2
Plain iterative sampling · sample2
Plain iterative sampling · sample3
Plain iterative sampling · sample3
Plain iterative sampling · sample4
Plain iterative sampling · sample4
Plain iterative sampling · sample5
Plain iterative sampling · sample5

CFG samples

Classifier-free guidance γ=7 · cfg sample1
Classifier-free guidance γ=7 · cfg sample1
Classifier-free guidance γ=7 · cfg sample2
Classifier-free guidance γ=7 · cfg sample2
Classifier-free guidance γ=7 · cfg sample3
Classifier-free guidance γ=7 · cfg sample3
Classifier-free guidance γ=7 · cfg sample4
Classifier-free guidance γ=7 · cfg sample4
Classifier-free guidance γ=7 · cfg sample5
Classifier-free guidance γ=7 · cfg sample5