From 50 Steps to 1
Standard diffusion models denoise an image over 20 - 50 steps. Each step requires a full forward pass through a multi-billion parameter UNet, making real-time generation impractical. SDXL-Turbo collapses this to 1 - 4 steps using Adversarial Diffusion Distillation (ADD), without the blurry output that plagues earlier distillation attempts.
How Adversarial Diffusion Distillation Works
ADD combines two loss signals:
- Score distillation loss - the student (SDXL-Turbo) is trained to match the multi-step outputs of a frozen SDXL teacher
- Adversarial loss - a discriminator trained on real images pushes the student to produce sharp, photorealistic outputs even in one step
The adversarial component is the key innovation. Score distillation alone tends to produce over-smoothed images; the discriminator restores high-frequency detail.
from diffusers import AutoPipelineForText2Image
import torch
pipe = AutoPipelineForText2Image.from_pretrained(
"stabilityai/sdxl-turbo",
torch_dtype=torch.float16,
variant="fp16",
)
pipe.to("cuda")
# 1-step generation
image = pipe(
prompt="a golden retriever playing in autumn leaves, cinematic lighting",
num_inference_steps=1,
guidance_scale=0.0, # CFG disabled at 1 step
).images[0]
image.save("output_1step.png")
# 4-step for higher quality
image_4step = pipe(
prompt="a golden retriever playing in autumn leaves, cinematic lighting",
num_inference_steps=4,
guidance_scale=0.0,
).images[0]
image_4step.save("output_4step.png")
Note that CFG (classifier-free guidance) is disabled at 1 step - it hurts quality at this extreme distillation level.