NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Marginal Flow: a flexible and efficient framework for density estimation

Marcello Massimo Negri, Jonathan Aellen, Manuel Jahn, AmirEhsan Khorashadizadeh, Volker Roth · DOI

Abstract

Density estimation often involves a trade-off between training efficiency, sampling speed, and exact likelihood evaluation. Marginal Flow is a novel framework that breaks this "trilemma" by marginalizing over latent parameters generated by an unconstrained neural network. Unlike Normalizing Flows, it requires no bijective architectures or expensive Jacobian calculations. Unlike Diffusion Models, it enables fast, single-step sampling. Marginal Flow naturally handles data on lower-dimensional manifolds and demonstrates orders-of-magnitude speedups in training and inference across various benchmarks.

Introduction

In generative modeling, practitioners typically choose between three paradigms, each with significant drawbacks. Normalizing Flows (NF) offer exact likelihoods but are restricted by bijective architectures. Diffusion Models and Flow Matching (FM) produce high-quality samples but suffer from slow, multi-step inference. VAEs and GANs provide fast sampling but lack exact likelihoods or are prone to mode collapse. Furthermore, many real-world datasets reside on lower-dimensional manifolds, a structure that standard models often struggle to capture efficiently.

Marginal Flow addresses these challenges by defining a flexible density model that is easy to train, fast to sample, and capable of providing exact likelihoods without architectural constraints.

The Marginal Flow Framework

The core mechanism of Marginal Flow is marginalization. The model density $q_\theta(x)$ is defined as an integral over a conditional distribution $q(x|w)$ with latent parameters $w$:

$$q_\theta(x) = \int q(x|w)q_\theta(w)dw \approx \frac{1}{N_c} \sum_{i=1}^{N_c} q(x|w_{\theta,i})$$

Architecture for evaluating the marginal density $q_\theta(x)$ through a summation of conditional components.

Key Innovations

  1. Unconstrained Latent Generation: The parameters $w$ are generated by passing samples from a simple base distribution $z \sim p_{base}(z)$ through an unconstrained neural network $f_\theta(z)$. This removes the need for invertibility or specific Jacobian structures, allowing the use of standard MLPs.
  2. Dynamic Resampling: Unlike Gaussian Mixture Models (GMMs) with fixed centers, Marginal Flow resamples $w$ at every iteration. This prevents mode collapse and allows the model to represent smooth, continuous densities rather than discrete clusters.
  3. Manifold Learning by Design: By setting the dimension of the base distribution $z$ to match the intrinsic dimensionality of the data, the model naturally learns to "wrap" the latent space into the higher-dimensional data space.

Experimental Evaluation

The authors evaluated Marginal Flow on 2D synthetic datasets, simulation-based inference (SBI) benchmarks, Wishart mixtures, and image latent spaces (MNIST and JAFFE).

Qualitative Comparison

A key advantage of Marginal Flow is its ability to recover continuous manifolds. While a standard GMM might approximate a manifold with a series of disconnected "blobs," Marginal Flow learns a smooth, continuous density that closely matches the ground truth.

Comparison of Ground Truth, GMM, and Marginal Flow. Marginal Flow successfully recovers the continuous manifold where GMM produces discrete clusters.

Performance and Efficiency

  • Computational Speed: Marginal Flow is orders of magnitude faster than Normalizing Flows and Flow Matching for both sampling and density evaluation. This efficiency stems from avoiding ODE solvers and Jacobian determinant calculations.
  • Sample Efficiency: In low-data regimes (e.g., 100 training points), Marginal Flow recovers ground-truth densities more accurately than competing models.
  • Latent Traversal: On the JAFFE dataset, the model successfully learned a 1D manifold that smoothly interpolated between different levels of facial expressions.

Discussion and Future Work

Marginal Flow offers a compelling alternative to existing generative models by combining the strengths of mixture models with the flexibility of deep learning. However, some challenges remain. Users must pre-specify the form of the conditional distribution $q(x|w)$ and the dimension of the base distribution $z$. Future research could focus on automatically learning these parameters and scaling the framework to high-resolution image data.

Despite these limitations, Marginal Flow represents a significant step toward efficient and flexible density estimation for complex, manifold-valued data.

Summary updated

BibTeX
@misc{negri2025marginal,
  author = {Marcello Massimo Negri and Jonathan Aellen and Manuel Jahn and AmirEhsan Khorashadizadeh and Volker Roth},
  title = {{Marginal Flow: a flexible and efficient framework for density estimation}},
  year = {2025},
  eprint = {2509.26221},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2509.26221},
}
Figure