Skip to main content
Back

ByteDance's SDXL-Lightning Generates 1024px Images in Just 2 Steps

ByteDance open sourced a distilled SDXL variant that produces 1024px images in as few as one step, with UNet and LoRA checkpoints.

Pro

  • ByteDance released SDXL-Lightning, a distilled SDXL for 1024px generation in 1, 2, 4, or 8 steps.
  • Uses progressive adversarial diffusion distillation to balance image quality with output diversity.
  • Ships full UNet checkpoints and LoRA adapters compatible with other SDXL-based models.
  • Authors flag 2/4/8-step models as production-ready; 1-step remains experimental with sample prediction.
  • Diffusers usage requires trailing timestep spacing and guidance_scale=0 to work correctly.
  • Open-sourced under openrail++ license, distilled from stabilityai/stable-diffusion-xl-base-1.0.

ByteDance's research team released SDXL-Lightning, a distilled version of Stable Diffusion XL that squeezes high-resolution image generation into a handful of denoising steps. The model produces 1024px images in as few as one or two passes, and the release ships four checkpoints tuned for different step budgets, in both full-weight and LoRA formats. That combination is unusual for a distillation drop.

Why few-step generation is worth the trouble

Base SDXL typically needs 25 to 50 denoising steps to produce a clean 1024px image. That works for offline batch jobs but hurts interactive tools, on-device generation, or any pipeline that iterates on prompts in real time. Earlier distillation techniques like SDXL Turbo and LCM-LoRA attacked the same problem, but each traded away something: mode coverage, prompt fidelity, or compatibility with the existing SDXL ecosystem.

SDXL-Lightning is a progressive adversarial diffusion distillation method that builds on the groundwork of those earlier approaches while addressing their main limitations.

The distillation trick

The accompanying paper describes the method as a hybrid combining progressive and adversarial distillation to balance quality with mode coverage, and it walks through the theoretical analysis, discriminator design, model formulation, and training procedure.

In plain terms, progressive distillation halves the required steps in stages, with each student learning to match a slower teacher. Adversarial training then uses a discriminator to keep outputs sharp when the step count gets very low. Pure progressive distillation tends to blur; pure adversarial training tends to collapse onto a narrow set of outputs. Combining them lets the team push all the way down to a single step while still producing varied, coherent images.

The models are distilled from stabilityai/stable-diffusion-xl-base-1.0, with checkpoints at 1, 2, 4, and 8 steps. The authors are candid: the 2, 4, and 8-step variants look excellent, while the 1-step is experimental. Treat 2-step as the practical floor.

What is actually in the repo

The Hugging Face repo splits the release into three artifact types so you can pick what fits your stack:

  • sdxl_lightning_Nstep.safetensors: all-in-one full checkpoint for ComfyUI
  • sdxl_lightning_Nstep_unet.safetensors: UNet-only weights for the Diffusers library
  • sdxl_lightning_Nstep_lora.safetensors: LoRA adapters that plug into other SDXL-based models

Full UNet weights deliver the best quality, while the LoRA files can ride on top of other base checkpoints. That LoRA path matters most for anyone already running a fine-tuned SDXL derivative, since you inherit the speedup without giving up your custom base.

ComfyUI workflow using the full SDXL-Lightning checkpoint

Running it

Diffusers usage is straightforward, with two gotchas. The scheduler must use trailing timestep spacing, and classifier-free guidance has to be disabled by setting guidance_scale=0. Skip either and the outputs degrade fast.

from diffusers import StableDiffusionXLPipeline, UNet2DConditionModel, EulerDiscreteScheduler
from huggingface_hub import hf_hub_download
from safetensors.torch import load_file
import torch
base = "stabilityai/stable-diffusion-xl-base-1.0"
repo, ckpt = "ByteDance/SDXL-Lightning", "sdxl_lightning_4step_unet.safetensors"
unet = UNet2DConditionModel.from_config(base, subfolder="unet").to("cuda", torch.float16)
unet.load_state_dict(load_file(hf_hub_download(repo, ckpt), device="cuda"))
pipe = StableDiffusionXLPipeline.from_pretrained(base, unet=unet, torch_dtype=torch.float16, variant="fp16").to("cuda")
pipe.scheduler = EulerDiscreteScheduler.from_config(pipe.scheduler.config, timestep_spacing="trailing")
pipe("A girl smiling", num_inference_steps=4, guidance_scale=0).images[0].save("out.png")

The 1-step variant has a quirk: it uses sample prediction instead of the usual epsilon prediction, so the scheduler needs prediction_type="sample". ComfyUI users get pre-built workflow JSONs for each configuration.

Where it fits

Practical use cases where SDXL-Lightning earns its keep:

  • Real-time prompt exploration UIs where users tweak a prompt and expect near-instant feedback
  • Batch generation for datasets or content pipelines where inference cost dominates
  • Interactive tools that chain image generation with other models and cannot afford 30-step latency
  • Edge or consumer-GPU deployment where each saved step matters for VRAM pressure and thermals

The limits are real. It will not match the peak quality of many-step SDXL on the hardest prompts, especially fine text or intricate compositional scenes. Because it inherits from SDXL base 1.0 rather than a fine-tune, aesthetic quality on stylized outputs still trails specialized community models unless you stack the LoRA on top of one. The license is openrail++, which is permissive enough for most commercial experimentation. With over 2,000 likes and roughly 87,000 downloads on Hugging Face, the model has become a common reference point for anyone benchmarking few-step diffusion, and its ideas keep showing up in newer distillation papers targeting video and interactive generation.