LeDiFlow: Learned Distribution-guided Flow Matching to Accelerate Image Generation

Pascal Zwick, Nils Friederich, Maximilian Beichter, Lennart Hilbert, Ralf Mikut, Oliver BringmannarXiv 2025

TL;DR

LeDiFlow accelerates flow matching-based image generation by replacing the standard, unstructured Gaussian noise prior with a learned prior distribution from a regression-based auxiliary model. By starting closer to the target data distribution, it simplifies the ordinary differential equation (ODE) trajectory, enabling up to a 3.75x inference speedup and a 1.32x improvement in image quality with significantly fewer solver steps.

What Problem Does This Paper Address?

While Diffusion Models (DMs) and Flow Matching (FM) models generate stunning images, their iterative nature makes inference computationally expensive. Standard Flow Matching defines a smooth vector field to transform a simple prior distribution (typically standard Gaussian noise, $x \sim N(0,1)$) into a complex target data distribution (images).

However, a standard Gaussian prior contains zero structural information about the target images. This forces the model to learn highly curved, complex probability paths to map random noise to intricate image features. For numerical ODE solvers at inference time, these curved paths are difficult to navigate, requiring a large number of function evaluations (steps) to generate high-fidelity samples.

Methods

The authors introduce LeDiFlow (Learned Distribution-guided Flow Matching), which simplifies the transport problem a priori by initializing the ODE solver from a more advantageous, learned starting point.

Figure 1: LeDiFlow produces an easier to solve transformation for flow matching-based generative modeling via a learned prior, enabling faster inference with higher image quality. Z resembles the latent space.

The architecture consists of three main components trained individually:

  1. Regression-based Auxiliary Model: A VAE-like encoder-decoder network. The encoder maps a target image $y$ to a continuous latent space $Z$. The decoder is trained to predict a per-pixel distribution—specifically a mean $\mu$ and a log-variance $\sigma^2$—rather than a single deterministic image. To avoid vanishing gradients during training, the authors introduce a Variance Guided Loss (VGL) based on log-likelihood optimization.
  2. Flow Matching Model (FMM): Instead of mapping from standard Gaussian noise, this model learns the vector field transforming samples from the auxiliary model's predicted prior ($x \sim N(\mu, \sigma)$) to the target image ($y$). The authors apply a novel importance-weighted loss that scales inversely with the predicted variance $\sigma$. This up-weights the loss for pixels where the prior is confident (refining details) and down-weights it where the prior is uncertain (stabilizing training against noise).
  3. Latent Sampler: A standard FM model that maps a standard Gaussian distribution to the continuous latent space $Z$, allowing for unconditional generation at inference time.
Figure 2: LeDiFlow Pipeline. An auxiliary model (middle) maps images y ∼Q into latent vectors z ∼Z, from which the decoder defines a learned prior PL = N(µ(z; θD), σ2(z; θD)). In latent space (left), we train a flow model θL to match trajectories from Gaussian noise w ∼N(0, 1) to semantic codes z, using supervised vectors z −w. In image space (right), another flow model θFM transforms samples x ∼PL into the data distribution via flow matching towards y ∼Q. Dashed lines denote forward inference, solid lines are training-time supervision.

Datasets

The model was trained and evaluated on several standard image synthesis benchmarks at $256 \times 256$ resolution:

  • FFHQ (Flickr-Faces-HQ): Human faces.
  • AFHQ (Animal Faces-HQ): Animal faces.
  • LHQ (Landscapes High-Quality): Nature and scenic landscapes.
  • ImageNet: A large-scale, highly diverse dataset used to test the model's scaling limits.

Key Insights and Ideas

  • Straightening Paths via Initialization: Instead of trying to "straighten" flow paths iteratively during training (like Rectified Flow/Reflow techniques), LeDiFlow changes the boundary condition. Starting closer to the destination naturally yields shorter, less curved, and more computationally tractable trajectories.
  • Uncertainty as a Training Guide: Predicting both mean and variance allows the main Flow Matching network to prioritize its learning. It doesn't waste capacity trying to resolve highly uncertain noisy regions early on, leading to a more stable vector field.
  • Workstation-Friendly Training: By utilizing an Hourglass Diffusion Transformer (HDiT) backbone with neighborhood attention, the entire pipeline can be trained on a consumer workstation (~30 hours on two RTX 3090s), making it highly accessible.

Key Results

  • Inference Speedup: When operating directly in pixel space, LeDiFlow accelerates inference by up to 3.75x compared to standard pixel-space FM baselines, requiring fewer ODE solver steps (often just 1 or 2 steps of a higher-order solver like Midpoint or Heun3) to achieve high quality.
  • Higher Image Quality: When paired with a pretrained Stable Diffusion VAE (SDV) latent space, LeDiFlow improves image quality by an average of 1.32x over the baseline FM model, evaluated using the CLIP Maximum Mean Discrepancy (CMMD) metric.
CMMD quality metric vs. number of solver steps across different datasets

Limitations and Future Work

  • Prior Dependency: The performance of the generation phase is strictly bounded by the quality of the auxiliary model's learned prior. A poorly trained or overly simplistic prior could introduce complex artifacts or harder-to-solve trajectories than a standard Gaussian.
  • Scaling to Diverse Datasets: While LeDiFlow excels on domain-specific datasets (faces, landscapes), preliminary experiments on ImageNet showed that both LeDiFlow and the baseline FM struggled with its extreme diversity. The authors note that significant architectural scaling will be required for large-scale, open-domain generation.
  • Architectural Optimization: Currently, the same transformer backbone (HDiT) is used for all three stages. Tailoring and optimizing distinct architectures for the sampler, auxiliary model, and FMM independently could yield even better performance.

Summary updated

BibTeX
@misc{zwick2025lediflow,
  author = {Pascal Zwick and Nils Friederich and Maximilian Beichter and Lennart Hilbert and Ralf Mikut and Oliver Bringmann},
  title = {{LeDiFlow: Learned Distribution-guided Flow Matching to Accelerate Image Generation}},
  year = {2025},
  eprint = {2505.20723},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2505.20723},
}
Figure