Source-linked AI summary

InstaFlow: One Step is Enough for High-Quality Diffusion-Based Text-to-Image Generation

Xingchao Liu, Xiwen Zhang, Jianzhu Ma, Jian Peng, Qiang Liu

arXiv:2309.06380v2cs.LGcs.CV

TL;DR

Multi-step diffusion sampling is slow, and prior distillation had not produced a functional one-step model. InstaFlow applies text-conditioned Rectified Flow reflow before distillation and generates high-quality images in 0.09 second, performing on par with StyleGAN-T.

  • Problem

    How to simulate probability-flow ODEs accurately with few inference steps remains a key question because larger step counts increase computational cost.

    Source: §2.2 · p. 4
  • Method

    InstaFlow uses text-conditioned reflow before distillation to regularize and smooth the noise-to-image mapping for one-step text-to-image generation.

    Source: §2.2 · p. 5
  • Results

    0.09 second: InstaFlow generates high-quality images with performance on par with StyleGAN-T.

    Source: §4 · p. 8
  • Takeaways & Limitations

    InstaFlow significantly closes the gap between continuous-time diffusion models and one-step generative models.

    Source: §5 · p. 9

    InstaFlow may encounter challenges with complex compositions in text prompts.

    Source: §5 · p. 9

Abstract

from arXiv · show

Diffusion models have revolutionized text-to-image generation with its exceptional quality and creativity. However, its multi-step sampling process is known to be slow, often requiring tens of inference steps to obtain satisfactory results. Previous attempts to improve its sampling speed and reduce computational costs through distillation have been unsuccessful in achieving a functional one-step model. In this paper, we explore a recent method called Rectified Flow, which, thus far, has only been applied to small datasets. The core of Rectified Flow lies in its \emph{reflow} procedure, which straightens the trajectories of probability flows, refines the coupling between noises and images, and facilitates the distillation process with student models. We propose a novel text-conditioned pipeline to turn Stable Diffusion (SD) into an ultra-fast one-step model, in which we find reflow plays a critical role in improving the assignment between noise and images. Leveraging our new pipeline, we create, to the best of our knowledge, the first one-step diffusion-based text-to-image generator with SD-level image quality, achieving an FID (Frechet Inception Distance) of $23.3$ on MS COCO 2017-5k, surpassing the previous state-of-the-art technique, progressive distillation, by a significant margin ($37.2$ $\rightarrow$ $23.3$ in FID). By utilizing an expanded network with 1.7B parameters, we further improve the FID to $22.4$. We call our one-step models \emph{InstaFlow}. On MS COCO 2014-30k, InstaFlow yields an FID of $13.1$ in just $0.09$ second, the best in $\leq 0.1$ second regime, outperforming the recent StyleGAN-T ($13.9$ in $0.1$ second). Notably, the training of InstaFlow only costs 199 A100 GPU days. Codes and pre-trained models are available at \url{github.com/gnobitab/InstaFlow}.

1 INTRODUCTION

InstaFlow uses Rectified Flow reflow to improve noise–image coupling during distillation of Stable Diffusion, enabling high-quality one-step text-to-image generation.

1 INTRODUCTION

  • Stable Diffusion typically needs more than 20 sampling steps, while prior distillation methods struggle at low step counts and no one-step large-scale diffusion model had been developed.The existing one-step large-scale text-to-image models cited in the introduction, StyleGAN-T [73] and GigaGAN [32], use adversarial training and require careful tuning of both generator and discriminator.Source: §1 · p. 3
  • Reflow straightens flow trajectories, reduces transport cost between noise and image distributions, and improves their coupling to facilitate distillation.The paper treats large-scale text-to-image models as the initial 1-flow and focuses on straightening them through reflow.Source: §1 · p. 3
  • FID 23.4 on MS COCO 2017 (5,000 images) in 0.09 second, versus 37.2 for one-step progressive distillation [58].The paper presents this as the first one-step Stable Diffusion model capable of generating high-quality images with remarkable detail.Source: §1 · p. 3
  • FID 13.1 on MS COCO 2014 (30,000 images) in 0.09 second surpasses StyleGAN-T [73] at 13.9 in 0.1s.The authors describe this as the first distilled one-step Stable Diffusion model to perform on par with GANs using pure supervised learning.Source: §1 · p. 3

2 METHODS

The methods use text-conditioned Rectified Flow and reflow to make diffusion trajectories easier to simulate and distill into a one-step generator, then add classifier-free guidance to trade off diversity and quality.

2.1 EFFICIENT INFERENCE IS NEEDED FOR LARGE-SCALE TEXT-TO-IMAGE GENERATION

  • For large text-to-image models such as Stable Diffusion, existing samplers reduce inference to about 20 steps, while quality degrades below 10 and progressive distillation [58] reaches 2–4 steps.Whether large diffusion models can achieve satisfying quality in one step remains open in this framing.Source: §2.1 · p. 3

2.2 RECTIFIED FLOW AND REFLOW

  • Rectified Flow learns an ODE velocity field that transports samples from a standard Gaussian distribution to the image distribution.Its linear interpolation, Xt = (1 − t)X0 + tX1, has constant velocity X1 − X0.Source: §2.2 · pp. 3–4
  • Straight, uniform-speed trajectories can be simulated perfectly by Euler integration in one step, reducing inference cost.More Euler steps improve ODE approximation but increase computational cost.Source: §2.2 · p. 4
  • Reflow preserves the generated image distribution while straightening trajectories and lowering convex transport costs, making the mapping easier for a student to learn.The paper says this regularization is essential before distillation in practice.Source: §2.2 · pp. 5–6
  • Distillation trains a single Euler step to approximate the reflowed mapping using a differentiable image-similarity loss, without adversarial training or special invertible networks.One or two reflow steps can make trajectories nearly straight; further reflow is costly and can accumulate optimization and statistical error.Source: §2.2 · p. 5
  • Reflow and distillation are orthogonal: reflow regularizes the mapping, while distillation approximates it; the paper finds reflow essential before distillation in practice.Reflow is described as an optional step in principle, despite its practical importance.Source: §2.2 · p. 6
  • Classifier-free guidance combines text-conditioned and null-prompt velocity fields, with α trading off sample diversity and generation quality.At α = 1, the guided field reduces to the original text-conditioned field.Source: §2.2 · p. 6

3 PRELIMINARY RESULTS: REFLOW IS THE KEY TO IMPROVE DISTILLATION

Using Stable Diffusion 1.4, the experiments find direct one-step distillation difficult, while text-conditioned reflow improves noise-image coupling and enables successful one-step distillation.

3.1 GENERAL EXPERIMENT SETTINGS

  • The experiments initialize from pre-trained Stable Diffusion 1.4 and use its 25-step DPMSolver output as teacher, with LPIPS as the distillation similarity loss.The SD U-Net is used for reflow and distillation, and FID is evaluated on 5,000 MS COCO 2017 captions.Source: §3.1 · p. 6, §3.2 · p. 6

3.2 DIRECT DISTILLATION FAILS, WHILE REFLOW + DISTILLATION SUCCEEDS

  • At 0.09s on MS COCO 2017-5k, (Pre) 2-Rectified Flow+Distill reaches FID 31.0, beating Progressive Distillation (FID=37.2) [58].The result is reported for the one-step model.Source: Table 1 · p. 7, §3.2 · p. 7
  • Direct distillation remains difficult despite hyperparameter tuning, whereas reflow narrows the student-teacher FID gap and produces student images resembling its teacher.The comparison identifies 2-Rectified Flow as a better teacher than the original SD for one-step distillation.Source: Figure 5 · p. 6, §3.2 · p. 7
  • 2-Rectified Flow+Distill costs ≈24.65 A100 GPU days, compared with a 108.8 A100 GPU-day lower-bound estimate for one-step Progressive Distillation [58].The model is fine-tuned from publicly available pre-trained SD.Source: §3.2 · p. 7
  • On MS COCO 2014-30k, (Pre) 2-Rectified Flow+Distill has FID=20.0 versus FID=34.6 for direct SD 1.4+Distill; (Pre) 2-Rectified Flow and SD 1.4 (+DPMSolver) yield FID 22.1 and 22.8 on COCO 2017-5k.The reflow model achieved the COCO 2014-30k result despite the (Pre) 2-Rectified Flow model being undertrained and performing worse than the original SD.Source: §3.2 · p. 7, Table 1 · p. 7
  • Reflow decreases estimated trajectory deviation S(Z), and 2-Rectified Flow trajectories are straighter; its one-step generations are recognizable, unlike the meaningless noises from SD.The straightening and image comparisons support the finding that reflow makes one-step distillation easier.Source: Figure 6 · p. 7, Figure 7 · p. 7, §3.2 · p. 8

4 INSTAFLOW: SCALING UP FOR BETTER ONE-STEP GENERATION

InstaFlow scales Rectified Flow reflow and distillation into one-step text-to-image models, reporting strong MS COCO results, an expanded 1.7B-parameter variant, and tests of few-step inference, guidance, and preview refinement.

InstaFlow-1.7B

  • The 1.7B-parameter Stacked U-Net, made by stacking two U-Nets and removing unnecessary modules, is distilled from InstaFlow-0.9B’s 2-Rectified Flow in 39.6 A100 GPU days.Its inference time is 0.12 second.Source: §4 · p. 8

Comparison with State-of-the-Arts on MS COCO

  • FID-5k 23.4 at 0.09s beats Progressive Distillation-SD (1 step, FID=37.2); FID-30k 13.10 at 0.09s beats StyleGAN-T [73] (13.90 in 0.1s), while InstaFlow-1.7B reaches FID-5k 22.4 at 0.12s.The paper attributes the improved coupling between noise and images to reflow, which also makes 2-Rectified Flow an easier teacher to distill. InstaFlow-0.9B uses Stable Diffusion 1.5 and 1,600,000 pairs each for reflow and distillation, costing 75.2 and 108 A100 GPU days, respectively.Source: §4 · p. 8

Few-step inference

  • 2-Rectified Flow shows an advantage over SD 1.5-DPM Solver when inference uses 4 or fewer steps.The comparison tests inference steps {1, 2, 4, 8}, using the standard Euler solver for 2-Rectified Flow.Source: §4 · p. 9, Figure 9 · p. 9

Guidance Scale α

  • As guidance scale α rises from 1.0 to 4.0, both FID-5k and CLIP score rise on MS COCO 2017, indicating worse image quality but stronger semantic alignment.The tested α values are 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, and 4.0.Source: §4 · p. 9, Figure 9 · p. 9

Fast Preview with One-Step InstaFlow

  • InstaFlow can serve as a fast previewer: it generates 512 × 512 images in about 0.1s, which are interpolated to 1024 and refined by SDXL-Refiner.The proposed workflow uses the refiner to produce high-resolution images after low-resolution filtering, enabling more generation possibilities under the same computational budget.Source: §4 · p. 9, Figure 10 · p. 9

5 LIMITATIONS AND CONCLUSIONS

InstaFlow is a one-step text-to-image generator built with a text-conditioned Rectified Flow pipeline and pure supervised learning. The paper notes challenges with complex prompt compositions but argues that longer training and larger datasets may mitigate them.

5 LIMITATIONS AND CONCLUSIONS

  • InstaFlow is presented as a state-of-the-art one-step text-to-image generator derived from a text-conditioned Rectified Flow pipeline with pure supervised learning.The authors say it significantly closes the gap between continuous-time diffusion models and one-step generative models.Source: §5 · p. 9
  • InstaFlow may struggle with complex compositions in text prompts, but longer training and larger datasets are expected to mitigate this limitation.The paper points to Figure 11 as an example of a failure case.Source: §5 · p. 9, Figure 11 · p. 9
  • The authors suggest InstaFlow may inspire algorithmic innovations and benefit downstream tasks such as 3D generation.Source: §5 · p. 9

SOCIETAL IMPACT … 4. Remove ‘Downsample Blocks 2 (the green blocks on the right)’

InstaFlow applies supervised Rectified Flow to large-scale text-to-image generation, while the authors note that faster generation may bring environmental benefits as well as misuse risks.

SOCIETAL IMPACT

  • Faster generation may conserve energy and benefit the environment, but it can also help bad actors create harmful information and fake news more quickly.The authors call for further research to align powerful ultra-fast models with human values and public interests.Source: SOCIETAL IMPACT · p. 10

A RELATED WORKS

  • Stable Diffusion is a latent diffusion model trained on LAION 5B, while GAN-based StyleGAN-T [73] and GigaGAN [32] generate images rapidly using adversarial loss; InstaFlow avoids delicate adversarial training.The paper places these systems in the shift toward large-scale text-to-image generation, following earlier work on flowers, birds, and MS COCO.Source: A RELATED WORKS · p. 17
  • InstaFlow uses Rectified Flow [45] [43] and reflow to straighten ODE trajectories, refine noise–image coupling through supervised least-squares training, and improve direct distillation.The paper presents this as a route to high-quality one-step generation in large-scale text-to-image models.Source: A RELATED WORKS · p. 17
  • 20–50 steps for fast samplers, fewer than 10 for distillation, and 2/4-step Stable Diffusion [58] with progressive distillation illustrate acceleration short of consistency models’ one-step operation.Concurrent approaches include BOOT [20], Latent Consistency Model [56], UFOGen [93], and Distribution Matching Distillation [95].Source: A RELATED WORKS · p. 17

B NEURAL NETWORK STRUCTURE

  • A concatenation of two U-Nets with shared parameters reduced distillation loss and improved generated-image quality, but doubled computational time.The tested structures and their inference times are shown in Figure 12.Source: Figure 12 · p. 18, B NEURAL NETWORK STRUCTURE · p. 19
  • 0.01s for text encoding and 0.04s for latent decoding per image (A100, batch 1); the pipeline freezes SD’s CLIP ViT-L/14 encoder and factor-8 autoencoder decoder.The latent-space generative model is a U-Net, fine-tuned for reflow without changing its structure.Source: B NEURAL NETWORK STRUCTURE · pp. 17, 19

2. Remove ‘Upsample Blocks 1 (the yellow blocks on the left)’

  • The block-removal ablations included deleting the middle In+Out Block (the blue and purple blocks); the supplied passage does not report its outcome.The stated purpose of deleting blocks was to identify unnecessary components and reduce inference time.Source: §2 · p. 19, B NEURAL NETWORK STRUCTURE · p. 19

5. Remove ‘Upsample blocks 2 (the yellow blocks on the right)’

Among the tested structures, only Structure 3 avoids hurting performance; this Stacked U-Net reduces inference time by 7.7%.

5. Remove ‘Upsample blocks 2 (the yellow blocks on the right)’

  • 7.7% lower inference time without hurting performance is achieved by Structure 3, the Stacked U-Net shown in Figure 12(c).The reported reduction is from 0.13 to 0.12 seconds.Source: §5 · p. 19

C ADDITIONAL DETAILS AND RESULTS ON THE PRELIMINARY EXPERIMENTS

The preliminary experiments used pretrained Stable Diffusion 1.4 for initialization and specified training and inference settings for reflow, distillation, and timing measurements.

General Experiment Settings

  • Pretrained Stable Diffusion 1.4 from the official repository initialized the experiments.The passage notes that this initialization was used because otherwise convergence is…; the provided text cuts off before completing that qualification.Source: C ADDITIONAL DETAILS AND RESULTS ON… · p. 19
  • Experiments used LAION2B-en prompts, SD’s U-Net, LPIPS loss [100], and 25-step DPMSolver SD at guidance scale 6.0.Training used batch size 32 on 8 A100 GPUs with AdamW, EMA factor 0.9999, gradient clipping at 1, 1,000-step warm-ups, BF16, and a reflow learning rate of 10^-6.Source: C ADDITIONAL DETAILS AND RESULTS ON… · p. 19
  • Inference timing used one sample per batch on an NVIDIA A100 and included the text encoder and latent decoder, but excluded the NSFW detector.The setup used PyTorch 2.0.1 and Hugging Face Diffusers 0.19.3; Progressive Distillation-SD timing used standard SD on the authors’ platform because that model was unavailable publicly.Source: C ADDITIONAL DETAILS AND RESULTS ON… · p. 19

C.1 ADDITIONAL DETAILS AND RESULTS OF DIRECT DISTILLATION · C.2 ADDITIONAL QUANTITATIVE COMPARISON

Additional results show that direct distillation was sensitive to learning rate, while a further reflow and distillation stage used reduced learning rates to stabilize training. The sections also report the search setup and data-generation procedures used for these experiments.

C.1 ADDITIONAL DETAILS AND RESULTS OF DIRECT DISTILLATION

  • The direct-distillation grid search tested all nine combinations of learning rates {10^-5, 10^-6, 10^-7} and weight decay coefficients {10^-1, 10^-2, 10^-3}.Each of the nine models was trained for 100,000 steps.Source: §C.1 · p. 20
  • The distillation training set comprised 3,200,000 pairs of (X0, ODE[vSD](X0)).The pairs were generated as 32 × 100,000 samples.Source: §C.1 · p. 20
  • Learning rates ≥10^-4 caused unstable training and NaN errors, while 10^-6 and 10^-7 converged slowly and produced blurry generations after 100,000 steps.These findings concern direct distillation of Stable Diffusion 1.4.Source: §C.1 · p. 20

C.2 ADDITIONAL QUANTITATIVE COMPARISON

  • For another reflow, 3-Rectified Flow (v3) was initialized from 2-Rectified Flow (v2) and trained to minimize equation 5 for 50,000 steps.The procedure repeats reflow once more.Source: §C.2 · p. 20
  • The v3 distilled model was trained for 50,000 steps using 1,600,000 newly generated pairs of (X0, ODE[v3](X0)).The new pairs were generated after training v3.Source: §C.2 · p. 20
  • Stabilizing 3-Rectified Flow training and its distillation required lowering the learning rate from 10^-6 to 10^-7.Source: §C.2 · p. 20

C.3 ESTIMATION OF TRAINING COST

The estimated training cost for (Pre) 2-Rectified Flow+Distill is 24.65 A100 GPU days, versus at least 108.8 A100 GPU days for one-step Progressive Distillation [58]. The estimates use platform-specific throughput measurements, and the Progressive Distillation estimate excludes costs that would make its actual total higher.

C.3 ESTIMATION OF TRAINING COST

  • With batch size 4 and U-Net, one A100 GPU day processes 100,000 L2-loss iterations or 86,000 LPIPS-loss iterations; batch-size-16 pair generation yields 200,000 pairs.These measured platform throughput rates are used to compute the training-cost estimates.Source: §C.3 · p. 20
  • At the same inference time, (Pre) 2-Rectified Flow+Distill is estimated at 24.65 A100 GPU days versus at least 108.8 for one-step Progressive Distillation [58], whose actual cost is higher.Table 4 describes 2-Rectified Flow+Distill as outperforming Progressive Distillation while using much less training cost; the estimate for Progressive Distillation omits stage 1 and teacher-sampling costs.Source: §C.3 · p. 20, Table 4 · p. 21

D ADDITIONAL TRAINING DETAILS ON INSTAFLOW

The appendix details the four-stage training pipeline for InstaFlow-0.9B and the distillation pipeline for the larger InstaFlow-1.7B. It also reports training observations and compares one-step Stacked U-Net inference with two-step progressive distillation.

Implementation Details and Training Pipeline for InstaFlow-0.9B

  • 199.2 A100 GPU days trained InstaFlow-0.9B through two reflow and two distillation stages.The setup uses Stable Diffusion 1.5, 25-step DPMSolver for ODE[vSD], guidance scale 5.0, and 1.6 million pairs for each of reflow and distillation. Reflow uses batch sizes 64 then 1024; distillation uses L2 then LPIPS similarity loss, with batch size 1024 in both stages.Source: D ADDITIONAL TRAINING DETAILS ON… · pp. 21–22

Implementation Details and Training Pipeline for InstaFlow-1.7B

  • 1.7B-parameter InstaFlow-1.7B uses a non-parameter-sharing Stacked U-Net distilled from 2-Rectified Flow.Distillation first uses L2 loss with batch size 64 for 110,000 iterations, then LPIPS loss with batch size 320 for 2,500 iterations.Source: D ADDITIONAL TRAINING DETAILS ON… · p. 22

Discussion 1 (Experiment Observations)

  • Training observations were that 2-Rectified Flow had not fully converged, distillation converged faster than reflow, and LPIPS immediately improved distilled one-step visual quality.The authors suggest longer training and additional computational resources could further improve the one-step models.Source: D ADDITIONAL TRAINING DETAILS ON… · p. 22

Discussion 2 (One-Step Stacked U-Net and Two-Step Progressive Distillation)

  • Approximately 8% less inference time (0.13s to 0.12s) resulted from removing redundant components in the one-step Stacked U-Net.The authors contrast it with two-step progressive distillation, which also minimizes distillation loss at t = 0.5, a step they suggest may be unnecessary for one-step generation from t = 0.Source: D ADDITIONAL TRAINING DETAILS ON… · p. 22

E ADDITIONAL QUALITATIVE RESULTS

The additional qualitative results show that InstaFlow’s one-step models align with the continuous 2-Rectified Flow latent space and illustrate their behavior across prompts, inference steps, guidance scales, and other applications.

Alignment between 2-Rectified Flow and the One-Step Models

  • The distilled one-step models align with continuous 2-Rectified Flow, making them useful surrogates for analyzing its higher-quality latent space.With the same random noise and text prompts, the one-step models generate images similar to the continuous flow.Source: E ADDITIONAL QUALITATIVE RESULTS · p. 22, Figure 17 · p. 24
  • InstaFlow-0.9B generates latent interpolations in 0.09s, saving ∼90% of inference time versus the 25-step SD-1.5 teacher.Source: Figure 13 · p. 23
  • With the same random noise, InstaFlow-1.7B preserves pose and lighting across different text prompts while generating images in 0.12s.Source: Figure 14 · p. 23
  • With the same random seed, 2-Rectified Flow generates clear images at N ≤4, whereas SD 1.5-DPM Solver cannot.Source: Figure 15 · p. 24
  • On 2-Rectified Flow, guidance scale α = 1.0 yields blurry edges and twisted details, while α ≥2.0 produces increasingly over-saturated images.Source: Figure 16 · p. 24
  • 2-Rectified Flow can encode and reconstruct an image successfully with as few as 4 steps, and its straighter trajectories enable encoding in 1 step.Source: Figure 26 · p. 29
  • Pre-trained InstaFlow is compatible with ControlNets [99] pre-trained with Stable Diffusion, enabling one-step generation with those ControlNets.Source: Figure 27 · p. 30
Loading 2309.06380v2…