arXiv:2610.12437stat.MLOct 2026

Manuscript Offprint

arXiv:2610.12437

Density Ratio Estimation with Stein Displacement Fields

Song Liu

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Density ratios quantify distribution shift from a probability-mass point of view, whereas displacement fields describe, from a dynamical point of view, how one distribution is transported onto another. Although both offer complementary insights, they are usually estimated separately, and converting one into the other requires post-processing. In this paper, we estimate the density ratio between a target and a base distribution by parametrizing it through a displacement field acting on the base: the log-ratio is modeled as minus the Stein operator of the base applied to the field, up to a normalizing constant. This gives both statistical and dynamical descriptions of the distribution shift through a single convex optimization problem. Iterating this estimate-and-move step gives two inference algorithms: push-forward moves the model and corrects a pretrained sampler without retraining it, whereas pull-back moves the data closer to the base and fits a transformation model one layer at a time. Applications to distribution shift in simulation-based inference and to nonlinear independent component analysis illustrate the benefits and limitations of the approach.

1 INTRODUCTION

Many machine learning problems come down to comparing two distributions. Broadly speaking, there are two different ways to do so. The first is information-theoretic: a divergence, such as the Kullback–Leibler (KL) divergence or another f-divergence, measures how two distributions spread their probability mass differently. These divergences serve as training objectives for generative adversarial networks [25, 58], and their gradient flows move one distribution towards the other [39, 47, 53, 55]. An f-divergence is an expectation of a function of the density ratio r=p/qr = p/q [57, 78, 50]. Density ratio estimation (DRE) has therefore become a building block of this approach, as well as a tool in its own right for importance weighting, two-sample testing and likelihood-free inference [72, 18, 30]. However, ratio estimation is often fragile. When p and q are far apart, samples from one say little about the other, a problem known as the “density chasm” [64], and adversarial training is notoriously unstable [5].

The second approach compares distributions through transport. Rather than comparing densities, it learns how to move one distribution onto the other with a displacement field or a flow map. This view underlies optimal-transport domain adaptation [17] and flow-based generative modeling, where flow matching, rectified flows and stochastic interpolants fit the velocity of a prescribed path by least-squares regression [46, 51, 1]. These methods fit the velocity by regression, avoiding adversarial ratio estimation. Their prescribed paths, however, need not follow the gradient flow of a specified divergence.

Can we learn a divergence and, at the same time, a displacement field along which moving one distribution decreases that divergence? We show that this is feasible when the score of the base distribution qq can be evaluated and the target distribution pp is observed through samples. Stein's method connects the two views [70, 4]. The Langevin–Stein operator Aq\mathcal{A}_q of the base maps a vector field v:Rd→Rd\boldsymbol{v} : \mathbb{R}^d \to \mathbb{R}^d to a scalar function Aqv\mathcal{A}_q \boldsymbol{v} that has zero mean under qq and depends on qq only through its score sq=∇log⁡q\boldsymbol{s}_q = \nabla \log q (Section 2.2). We model the log-ratio as −Aqv-\mathcal{A}_q \boldsymbol{v}, up to a constant. This modelling choice has two consequences. First, a convex optimization problem derived from the Donsker–Varadhan (DV) lower bound estimates both p/qp/q and a lower bound on KL(q∥p)\mathrm{KL}(q \parallel p) using only samples of pp and the score of qq. Similar Stein-parametrized ratio models have been used to fit intractable statistical models [49]. Second, moving qq along the same field, x↦x+ηv(x)\boldsymbol{x} \mapsto \boldsymbol{x} + \eta \boldsymbol{v}(\boldsymbol{x}) with a small step size η>0\eta > 0, changes its log-density by −ηAqv-\eta \mathcal{A}_q \boldsymbol{v} to first order. At a population optimum attaining the DV bound, this is equivalent, up to nor-malization and to first order, to multiplying qq by rηr^\eta. The field that exactly represents the log-ratio therefore also gives a displacement towards pp. Its infinitesimal density change agrees with the Fisher–Rao gradient flow of KL(q∥p)\mathrm{KL}(q \parallel p), realized through transport.

This infinitesimal interpretation motivates repeating the refinement step, and there are two natural approaches. If qq is a pretrained generative model with a tractable density (e.g., flow models), we can move the model by appending displacement layers to the model, which correct the model without retraining it. If instead qq belongs to a simple parametric family that we want to fit, we can move the data, pulling them back towards the family through each displacement. We call the two algorithms push-forward and pull-back and show that they are naturally suited to model updating and latent independent source recovery tasks respectively.

In this paper, we first propose Stein displacement ratio estimation (SDRE), a convex density ratio estimator that estimates not only the ratio p/q but also a displacement field. When the population DV bound is attained, this field induces, to first order, a density update along the Fisher–Rao gradient flow of KL(q ∥\parallel p) (Section 3). This result motivates the two inference algorithms of Section 4. Push-forward appends displacement layers to a pretrained sampler to fit the data while keeping its model frozen, and pull-back transforms the data through an invertible flow towards a prior from a simple parametric family. Finally, we apply both algorithms to two problems (Section 5). Push-forward adapts a pretrained diffusion posterior sampler to a new posterior target, performing on par with discriminator guidance while keeping an exact density. Pull-back refines pretrained ICA models and gives strong signal identification in synthetic and speech settings. We also discuss the limitations of the approach (Section 6).

References (74)