Generative Modeling with Flow-Guided Density Ratio Learning

Alvin Heng, Abdul Fatir Ansari, Harold Soh

TL;DR

The paper introduces Flow-Guided Density Ratio Learning (FDRL), a simple and scalable gradient flow framework for deep generative modeling. By training a density ratio estimator on progressively improving samples generated during the flow process, FDRL successfully bridges the "density chasm" that typically causes standard gradient flow methods to fail when generating images from noise. This allows the method to scale to high-quality $128\times128$ image synthesis and seamlessly adapt to class-conditional generation and image-to-image translation without retraining.

What Problem Does This Paper Address?

Gradient flow methods, particularly Wasserstein Gradient Flows (WGFs), offer an elegant perspective on generative modeling: they treat data generation as finding the path of steepest descent to transport a simple source distribution (like noise) into a target data distribution. However, simulating these paths usually requires tracking a complex, time-dependent density ratio between the evolving flow and the target distribution.

A recent method called DGflow simplified this by using a "stale" (time-independent) density ratio estimator provided by a pretrained GAN discriminator. While this works beautifully for sample refinement (where the source and target distributions are already very close), it completely breaks down for sample synthesis from scratch. When the initial noise prior and the target data distribution are far apart, they are separated by a massive "density chasm"—regions of vanishing probability where the density ratio estimator cannot get enough sample support to learn accurately, causing the simulated particles to drift away catastrophically.

Toy experiment showing how a stale estimator fails to bridge a large density chasm (b) compared to a small one (a).

Methods

FDRL overcomes the density chasm problem through a novel flow-guided training scheme. Instead of statically training the density ratio estimator $r_\theta$ to bridge the prior $q'(x)$ and the target $p(x)$ directly, FDRL updates the estimator dynamically:

  1. Flowing Samples: At each training step $\tau$, samples from the prior are pushed through $K$ steps of the gradient flow using the current stale estimator parameters $\theta_\tau$.
  2. Dynamic Density Estimation: This yields an evolved intermediate distribution, $\tilde{q}_\tau(x)$. The estimator is then optimized using the Bregman Divergence to fit the ratio between this currently flowed distribution and the target distribution ($\tilde{q}_\tau(x) / p(x)$).
  3. Iterative Improvement: As training progresses, the intermediate distribution moves closer to the target, meaning the estimator is always learning from a distribution that is actively closing the chasm.
Overview of FDRL's training setup (left) and its various generative applications (right).

Additionally, the authors introduce a Data-Dependent Prior (DDP) by fitting a simple multivariate Gaussian to the dataset. This provides a "warm start" with low-frequency features (like rough silhouettes and colors). At test time, they employ a two-stage sampling approach: running $K$ "bridging" steps to reach the data manifold, followed by $\kappa$ extra "refinement" steps to maximize image quality.

Datasets

The authors evaluated FDRL across several standard image benchmarks:

  • CIFAR10 ($32\times32$): Used for unconditional and class-conditional generation.
  • CelebA ($64\times64$): Used for unconditional face generation.
  • LSUN Church ($128\times128$): Used to demonstrate scalability to higher resolutions.
  • Cat2dog ($64\times64$): Used for unpaired image-to-image translation.

Key Insights and Ideas

  • Moving Targets Make Learning Tractable: The core "aha" moment is that trying to learn a static density ratio across a vast empty space is impossible for neural networks. However, by letting the training distribution "follow" the flow, the network only ever has to solve a sequence of local, manageable density ratio estimation problems.
  • Two-Stage Sampling is Essential: The authors discovered that sampling with the exact number of steps used in training ($K$) doesn't yield the best results. Adding a few extra refinement steps ($\kappa$) acts as a local optimization phase on the data manifold, significantly boosting visual fidelity.
The intermediate distribution smoothly migrates across the chasm toward the target distribution as training steps increase.

Key Results

  • State-of-the-Art for Gradient Flows: FDRL outperforms existing gradient flow baselines like Euler Particle Transport (EPT) and JKO-Flow. On CIFAR10, FDRL achieved an FID score of 22.28, outperforming EPT (24.60) and JKO-Flow (23.70), and matching the performance of SNGAN (21.70).
  • High-Resolution Scaling: FDRL is the first particle-based gradient flow method to successfully scale to $128\times128$ resolution (LSUN Church).
  • Compositional Flexibility: Because the model outputs explicit density ratios, an unconditional FDRL model can be composed off-the-shelf with a pretrained classifier to perform class-conditional generation without any retraining.
Class-conditional samples generated by combining unconditional FDRL with a robust classifier.

Limitations and Future Work

  • The Diffusion Gap: While FDRL represents a major leap forward for gradient flow methods, it still lags behind modern diffusion models (like DDPM, which achieves an FID of 3.17 on CIFAR10).
  • Image-to-Image Translation Biases: When applied to unpaired image-to-image translation, FDRL is outperformed by CycleGAN (FID of 108.10 vs 51.79). CycleGAN benefits from specialized architectural constraints like dual generators and cycle-consistency losses, which FDRL currently lacks.
  • Theoretical Foundations: The exact mathematical distribution induced by the time-independent "stale" SDE approximation remains to be fully characterized.

Summary updated

BibTeX
@inproceedings{heng2024generative,
  author = {Alvin Heng and Abdul Fatir Ansari and Harold Soh},
  title = {{Generative Modeling with Flow-Guided Density Ratio Learning}},
  booktitle = {ECML/PKDD},
  year = {2024},
  doi = {10.1007/978-3-031-70344-7\_15},
}
Figure