Few steps by consistency distillation
A diffusion sampler follows a curved path from noise to an image in many small steps, because the network was only ever asked to remove a little noise at a time. A consistency model (Song et al.) is trained to jump: given any point on a sampling trajectory, it predicts the trajectory's end directly. Latent consistency models (LCM, Luo et al.) distil Stable Diffusion into such a model in its latent space, with classifier-free guidance folded in, and LCM-LoRA learns the same thing as a low-rank update of the U-Net's weights that can be added to SD 1.5 or models fine-tuned from it.
This tab records LCM-LoRA on Stable Diffusion 1.5 drawing the SD 1.5 tab's prompt, a red apple on a wooden table, at 384 × 384 pixels in four steps, against SD 1.5's own DDIM at 25 and at 4 steps, with seed 0 throughout.
The consistency function
The deterministic sampler of a diffusion model follows the probability-flow ODE, and each starting noise traces one trajectory to one image. A consistency function maps every point of a trajectory to the same output, its end, and equals the identity at the end:
LCM builds the boundary condition into the parametrisation. The U-Net still predicts noise, which gives a clean estimate , and the output blends it with the input:
with . At this is ; at the four timesteps the page uses, is between and , so the output is to eight decimal places.
Distillation enforces consistency between neighbouring points. Take , run the teacher, SD 1.5 with guidance, for one DDIM step back to , and train the student so that its outputs at the two points agree; the target side uses an exponential moving average of the student's weights. Luo et al. report that a 2–4-step LCM takes 32 A100 GPU hours to train.
Consistency steps
One jump from pure noise gives a usable image; a few more give a better one. The Consistency steps strip shows the multistep sampler: predict the clean latent, then noise it again to a lower timestep and predict once more,
at , four points of a 50-step grid; the last prediction is the output. Each step is one U-Net pass, four in all, against the 50 passes of DDIM's 25 guided steps.
Same zₜ, two U-Nets shows why SD 1.5 cannot do this alone. Fed the same , SD 1.5's from a high is a blur, the average of every image that could lie under that noise; LCM-LoRA's is a single sharp image, the end of this trajectory. Steps for one image compares the runs side by side: DDIM with 25 and with 4 steps, SD 1.5 itself under the LCM sampler, and LCM-LoRA with 4 and with 2 steps.
LoRA
LoRA (Hu et al.) fine-tunes a weight matrix by learning a low-rank change to it, leaving the original fixed:
starts at zero, so training starts from the unchanged model. LCM-LoRA uses rank with , a factor of 0.125, in 278 layers: 67 M parameters against the U-Net's 860 M. The LoRA panel shows one layer, a 320 × 320 cross-attention output projection: , , their product , and the sum. is 5.3 %, and the singular values show that has only 64 that are not negligible. Convolutions get LoRAs too, with a 3 × 3 convolution to 64 channels and a 1 × 1 one. All 278 LoRA layers maps the relative size of the update by block and kind of layer.
Before sampling the update is merged into the weights, so it costs nothing per step; the panel also shows the four-step image at (SD 1.5 itself under the LCM sampler), 0.5 and 1. U-Net with the LoRA merged shows each block's output; the toolbar switches it to SD 1.5's own U-Net on the same input, or to the difference between the two, which grows block by block.
Guidance
Classifier-free guidance doubles the cost of a step. A full LCM avoids it: following Meng et al.'s guided distillation, it learns the guided teacher for a range of guidance scales and takes as an input, embedded with sines and cosines like the timestep (Guidance as an input). This U-Net has no such input, and a LoRA can only change weights that exist, so LCM-LoRA learned the teacher's guided predictions directly and runs with guidance off, one pass per step.
The Guidance panel shows what happens when guidance is applied on top anyway, at , 2 and 4, each run costing 8 U-Net calls; the page recommends none, or at most 2, since the guidance is already in the weights.
Where LCM came from
Salimans and Ho's progressive distillation halved a sampler's steps again and again, and Meng et al. extended it to guided models. Song et al.'s consistency models (2023) replaced halving with one self-consistency objective; the Consistency tab shows one on ImageNet 64 × 64. LCM (October 2023) and LCM-LoRA (November 2023) brought it to Stable Diffusion. Adversarial distillation, on the Turbo tab, reaches one to four steps by a different route, and FLUX.1-schnell (the FLUX tab) by its latent version.
Papers
- Latent Consistency Models: Synthesizing High-Resolution Images with Few-Step Inference LCM: consistency distillation in Stable Diffusion's latent space, with guidance folded into the teacher.
- LCM-LoRA: A Universal Stable-Diffusion Acceleration Module The LoRA this tab records: LCM distillation as a low-rank update that plugs into SD 1.5 and its fine-tunes.
- Consistency Models The consistency function, its boundary-condition parametrisation, consistency distillation and multistep sampling.
- LoRA: Low-Rank Adaptation of Large Language Models Low-rank updates of frozen weight matrices, the form LCM-LoRA takes.
- On Distillation of Guided Diffusion Models Distilling a classifier-free-guided model into one that takes the guidance scale as an input.
- Denoising Diffusion Implicit Models DDIM: the teacher's ODE solver in distillation and the baseline sampler on the page.
- High-Resolution Image Synthesis with Latent Diffusion Models Latent diffusion, the Stable Diffusion model LCM-LoRA accelerates.