Importance-Weighted Non-IID Sampling for Flow Matching Models
Xinshuang Liu, Runfa Blark Li, Shaoxiu Wei, Truong Nguyen · 2025
Read Importance-Weighted Non-IID Sampling for Flow Matching Models by Xinshuang Liu, Runfa Blark Li, Shaoxiu Wei, Truong Nguyen (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2511-17812.txt.
Introduction
Xinshuang Liu, Runfa Li, Shaoxiu Wei, and Truong Nguyen improve how samples are drawn from flow matching models, a family of generative models that turn noise into data. When only a few samples are affordable, independent draws can miss rare outcomes that strongly affect an average.
Their method draws samples jointly so they spread across important regions, using the model's score to keep them apart without drifting off the data. They also learn weights that correct the bias from joint drawing. Tests show diverse, high quality samples and accurate weighted averages, helping users judge what a flow model really produces.
Catalog record
| CREATOR | Xinshuang Liu, Runfa Blark Li, Shaoxiu Wei, Truong Nguyen |
|---|---|
| YEAR | 2025 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 57 KB |
| VERSION | 1.0 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2511-17812
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
Importance-Weighted Non-IID Sampling for Flow Matching Models Xinshuang Liu, Runfa Blark Li, Shaoxiu Wei, Truong Nguyen Abstract Flow-matching models effectively represent complex distributions, yet estimating expectations of functions of their outputs remains challenging under limited sampling budgets. Independent sampling often yields high-variance estimates, especially when rare but with high-impact outcomes dominate the expectation. We propose an importance-weighted non-IID sampling framework that jointly draws multiple samples to cover diverse, salient regions of a flow’s distribution while maintaining unbiased estimation via estimated importance weights. To balance diversity and quality, we introduce a score-based regularization for the diversity mechanism , which uses the score function, i.e. , the gradient of the log probability, to ensure samples are pushed apart within high-density regions of the data manifold, mitigating off-manifold drift. We further develop the first approach for importance weighting of non-IID flow samples by learning a residual velocity field that reproduces the marginal distribution of the non-IID samples. Empirically, our method produces diverse, high-quality samples and accurate estimates of both importance weights and expectations, advancing the reliable characterization of flow-matching model outputs. Our code will be publicly available on GitHub. 1 Introduction Flow matching models 15 have become powerful tools for representing complex distributions 5 ; 13 ; 30 ; 29 . Beyond drawing individual samples, many applications require expectations of functions of model outputs 4 . Formally, for a fixed, pre-trained flow matching model with distribution p(x) and a task-defined functional f:\mathcal{X}\!\to\!\mathbb{R}^{d} , we seek \mu=\mathbb{E}_{X\sim p}\big[f(X)\big]. (1) For example, in image inpainting, X denotes a completed image, f(X) may represent the probability of a target category produced by a classifier, and \mu is the expected probability (under the same classifier) with respect to the generative model’s output distribution. A common practice is Monte Carlo with IID samples X^{(1)},\dots,X^{(n)}\!\sim\!p , \hat{\mu}_{\text{IID}}=\frac{1}{n}\sum_{i=1}^{n}f\big(X^{(i)}\big). (2) However, sampling from modern flows is costly, so n is small and \hat{\mu}_{\text{IID}} often exhibits high variance. The issue is acute when f(x) varies sharply across regions of the support ( e.g . , rare but with high-impact outcomes). Figure 1 : Illustration of importance-weighted non-IID sampling. Under IID sampling, both samples are likely drawn from the same dominant mode. In contrast, diversity velocity encourages samples to diverge along their trajectories, leading to coverage of multiple modes. To correct the resulting sampling bias, importance weights are required; intuitively, w_{1}\!>\!1\!>\!w_{2} , since non-IID sampling draws the second sample from a minor mode. Motivation for non-IID joint sampling. To reduce variance under a fixed sampling budget, we draw the n samples jointly , promoting coverage of distinct, salient regions of p . Intuitively, a diverse set can approximate \mu more efficiently than independent draws. A two-outcome toy example illustrates the point: suppose x\in\{a,b\} with probabilities p_{a},p_{b} and \mu=p_{a}f(a)+p_{b}f(b) . With two IID samples, \hat{\mu}_{\text{IID}}=\tfrac{1}{2}\big(f(X^{(1)})+f(X^{(2)})\big) and \mathrm{Var}\big(\hat{\mu}_{\text{IID}}\big)=\tfrac{1}{2}\,p_{a}p_{b}\big(f(a)-f(b)\big)^{2} . If we instead enforce diversity by drawing a pair that always contains both outcomes, the induced marginals are p_{a}^{\prime}=p_{b}^{\prime}=\tfrac{1}{2} . Using importance weights w_{a}=p_{a}/p_{a}^{\prime}=2p_{a} and w_{b}=2p_{b} , the estimator \hat{\mu}_{\text{N-IID}}=\tfrac{1}{2}\big(w_{a}f(a)+w_{b}f(b)\big)=\mu is exact and has zero variance. In realistic settings, rare events ( p_{b}\!\ll\!1 ) with large |f(a)-f(b)| can occur with risk-sensitive objectives ( e.g . safety), so IID sampling can be unreliable even with many draws. This motivates joint, diversity-enhancing sampling paired with importance weighting . From joint sampling to unbiased estimation. Let X^{(1:n)}\!\sim\!p_{\text{joint}} denote n samples drawn once from a joint distribution that encourages diversity. Denote by p^{\prime}(x) the marginal density of any single element under p_{\text{joint}} . An unbiased estimator is then (see Appendix A for details) \hat{\mu}_{\text{N-IID}}=\frac{1}{n}\sum_{i=1}^{n}w\big(X^{(i)}\big)\,f\big(X^{(i)}\big),\hskip 10.00002ptw(x)=\frac{p(x)}{p^{\prime}(x)}. (3) Thus, a good non-IID strategy for estimating \mu must satisfy two goals: (G1) Diversity with quality —the jointly drawn set covers p ’s support while keeping each sample on-manifold; and (G2) Unbiasedness —we can accurately estimate the per-sample importance weights w(x) . Limitations of existing diverse samplers. Recent work explores non-IID sampling to improve diversity. Particle Guidance 2 couples multiple diffusion trajectories via a repulsive potential, while DiverseFlow 22 injects diversity into flow matching through a determinantal point process (DPP) objective 10 . Both can be viewed as augmenting the sampling dynamics with a diversity velocity that pushes concurrent trajectories apart. Specifically, when jointly sampling n trajectories X^{(1:n)}_{t} from a flow-matching ODE, these methods can be formulated as solving n coupled ODEs \dot{X}_{t}^{(i)}=v\big(X_{t}^{(i)},t\big)+u\big(X^{(i)}_{t},X^{(-i)}_{t},t\big),\!\hskip 10.00002ptX_{0}^{(i)}\overset{\text{IID}}{\sim}p_{0}, (4) where i indexes sample trajectories, X^{(-i)}_{t} denotes the set excluding X^{(i)}_{t} , t\in[0,1] , v is the pre-trained flow-matching velocity field (parameters omitted since they remain fixed), and u computes a diversity velocity that pushes samples apart. Although effective at increasing diversity, these methods face a trade-off: strong diversity velocities improve spread but risk pushing samples into low-density, off-manifold regions; weak velocities preserve quality but limit diversity gains. Moreover, these approaches do not provide the importance weights needed to form unbiased estimators of expectations like \mu , so equal-weighted averages generally introduce bias. Overview of our approach. We propose Importance-Weighted Non-IID Sampling for Flow Matching Models , a framework that achieves both (G1) and (G2). An illustration appears in Figure 1 . For a pre-trained flow-matching model v and n coupled trajectories \{X_{t}^{(i)}\}_{i=1}^{n} , we constrain the direction of g using the model’s score \nabla_{x}\log p(x\,|\,t) so that diversity pushes samples within high-density regions (along the data manifold) rather than ejecting them off-manifold. Since g will be normalized in practice, removing components that push samples off-manifold will amplify on-manifold components. This yields sets that are both diverse and high-quality, alleviating the core trade-off observed in prior work. To obtain unbiased estimates, we provide (to our knowledge) the first method to compute importance weights for non-IID, jointly sampled outputs from flow-matching models. Directly estimating the marginal p^{\prime}(x) of the joint sampler is challenging because X^{(1:n)} is drawn only once. We address this by learning a lightweight residual velocity r_{\phi}(x,t) such that the perturbed flow \dot{X}_{t}=v(X_{t},t)+r_{\phi}(X_{t},t),\hskip 10.00002ptX_{0}\sim p_{0}, (5) matches the marginal distribution induced by the diversity-coupled sampler at t\!=\!1 . Since rectified-flow models 16 are widely used in recent flow-matching work 3 ; 12 , we focus on rectified flows here and include discussions for general flow-matching models in Section 3.2 . For rectified flows, learning such a residual velocity field is sufficient for importance-weight estimation, and a smaller network for r_{\phi} than for v can be used to reduce training and inference cost. Empirical validation. We evaluate our method comprehensively. For accurate diagnosis, we first test on a Gaussian mixture model, where the true density (under IID sampling) is available in closed form. Our method improves sample diversity and quality and yields more accurate importance-weight estimates and semantic estimation. We then evaluate advanced conditional flow-matching models: Stable Diffusion 3.5 Medium 3 for text-to-image generation and FLUX.1-Fill-dev 12 for image inpainting. Although training residual velocity fields for these large models is infeasible due to computational cost, our method improves coverage of the output distribution as a plug-in. Across these tasks, our approach produces diverse, high-quality samples and accurate importance weight and expectation estimation, and demonstrates potential gains for large models. Our contribution can be summarized as follows: • A non-IID sampling for flow matching. We propose a framework for joint, non-IID sampling in flow matching models, enabling efficient expectation estimation under fixed sampling budgets. • Score-based diversity regularization. We constrain