betaFeedback

WorksMathematics

Improving score-based sampling via affine post-processing

Abstract

Sampling from a probability distribution with access only to its log-density is a foundational problem in statistics, machine learning, and the physical sciences. This problem is studied in the data-free score-based diffusion literature, which samples the target density via estimating scores of densities produced by convolution with Gaussian random variables and implementing a reverse SDE. In this framework, score estimators are constructed via Markov chain Monte Carlo, importance sampling, or rejection sampling. The estimators often operate far beyond the regime where mixing time and error control can be established and have large bias and variance when estimating the underlying score. In our method we propose post-processing: splitting a fixed computation budget across multiple evaluations, querying the estimator at different points, and fitting a single pooled estimate via linear combination to minimize bias and variance at a target location. The final value is an affine map of a vector of multiple score estimates. We show this reduces score estimation error when compared to the computation-matched base estimator queried at a single point. We demonstrate improved sample quality over other score estimation methods matched for computation cost on difficult target densities such as log-concave densities with large condition number, multimodal densities, and high-dimensional densities.

Introduction

Sampling from a probability density π(x)∝e−f(x)\pi(x) \propto e^{-f(x)} given only the negative log-density ff is a foundational problem across Bayesian inference, statistical physics, and computational biology, among many other fields. Traditionally, this problem has been approached with sampling algorithms such as time-invariant Markov chain Monte Carlo, annealing methods, and tempering algorithms. More recently, the field of data-free score-based diffusion has offered an alternative method: sampling from the target density by reversing a noising process of Gaussian convolution. Implementing such a sampling algorithm requires estimating the noised score function with only knowledge of ff.

Consider a random variable UU defined by a linear combination of a sample from π\pi and a Gaussian random variable,

U=aX+1−a2Z,a∈[0,1],X∼π,Z∼N(0,I).(1)U = aX + \sqrt{1-a^2}Z, \quad a \in[0,1], X \sim\pi, Z \sim N(0,I). \tag*{(1)}

Let pap_a denote the density of UU at signal level aa, and write s(u,a)=∇ulog⁡pa(u)s(u,a) = \nabla_u \log p_a(u) for its score. The ability to estimate s(u,a)s(u,a) for various inputs uu and aa is what facilitates sampling from π\pi via score-based diffusion [21].

The score is equal to an expectation over the reverse conditional density pa(x∣u)p_a(x\mid u) using Tweedie’s formula [18]. This has motivated a line of diffusion-based Monte Carlo methods in which the score of the noised target is estimated pointwise by a random estimator s^(u,a)\hat{s}(u,a) computed with knowledge of ff alone. This estimator should be considered a random variable with internal randomness: when queried at a fixed uu and aa value, it will return a value with some probability distribution. With knowledge of ff, this estimator can be a form of importance sampling (IS) [17], rejection sampling (RS) [9], or Markov chain Monte Carlo (MCMC) [10, 11, 8] approximating an empirical average of Tweedie’s formula to estimate the score.

The reverse conditional density pa(x∣u)p_a(x\mid u) which defines the expectation in Tweedie’s formula is often high-dimensional and multimodal, making it particularly difficult to estimate for sampling-based score estimators. Although such estimators may draw hundreds or thousands of proposal points, often only a handful contribute meaningfully to the empirical average. The effective sample size is therefore much smaller than the number of proposal points, and it grows little as more samples are drawn. As a result, these estimators suffer from high bias and variance at practical sample sizes, with significant error reduction only at sample sizes exponentially large in the state space dimension.

In this paper, we consider an alternative route to reducing bias and variance: querying the estimator at a fixed location uu across multiple signal levels {ai}i=0N\{a_i\}_{i=0}^{N}, and pooling the resulting estimates {s^(u,ai)}i=0N\{\hat{s}(u,a_i)\}_{i=0}^{N} together with the known terminal values s(u,0)=−us(u,0)=-u and s(u,1)=−∇f(u)s(u,1)=-\nabla f(u). For any vector h∈RN+1h\in\mathbb{R}^{N+1}, g∈R2g\in\mathbb{R}^{2}, ν∈R\nu\in\mathbb{R} we define an affine post-processor as any estimation rule

sˉ(u,a0)=∑i=0Nhis^(u,ai)+g0s(u,0)+g1s(u,1)−ν.(2)\bar{s}(u,a_0)=\sum_{i=0}^{N}h_i\hat{s}(u,a_i)+g_0s(u,0)+g_1s(u,1)-\nu. \tag*{(2)}

It is a form of linear smoother or ridge regression performing bias and variance reduction via a shrinkage procedure. We refer to the signal level a0a_0 as the on-policy level, and the queries s^(u,ai)\hat{s}(u,a_i), i≠0i\ne0 as off-policy evaluations.

The choice of parameters h=e0h=e_0, g=0g=0, ν=0\nu=0, where e0=(1,0,…,0)∈RN+1e_0=(1,0,\ldots,0)\in\mathbb{R}^{N+1}, we call “pure on-policy estimation” at s^(u,a0)\hat{s}(u,a_0), so simply relying on the score estimator’s on-policy estimate is already a form of affine post-processing. If there is an alternative choice of (h,g,ν)(h,g,\nu) which strictly reduces the average squared bias and variance at a signal level, then it reduces the path-averaged score error that controls the sampling error bound, which we observe as a reduction in terminal Wasserstein distance (W2W_2). We demonstrate that:

  1. The optimal choice of smoothing parameters relies on knowledge of the bias and variance of the base estimator. It can be written down in closed form, which we call the Wiener oracle post-processor. If it is not equal to (e0,0,0)(e_0,0,0), then optimally chosen affine post-processing strictly reduces score estimation error.

  1. We show pure on-policy estimation is optimal only under a specific zero-gradient condition most estimators will violate. In particular, for any unbiased estimator with non-zero variance, pure on-policy estimation is not optimal among affine post-processors.

  1. We construct practical, non-oracle post-processors via ridge regression in the Legendre polynomial basis, and in our experiments their score error captures most of the improvement available to the Wiener oracle.

  1. Post-processing is compared at matched computation cost: a fixed MCMC budget of Neval\mathcal{N}_{\mathrm{eval}} evaluations is split across the N+1N+1 query levels, and the pooled estimate is compared to a single on-policy estimate given the full Neval\mathcal{N}_{\mathrm{eval}} budget. The effective sample size grows slowly in Neval\mathcal{N}_{\mathrm{eval}}, thus the on-policy estimator gains little from the extra budget, while the split-and-pool estimator reduces score estimation error substantially.

Empirically, diffusion-based samplers built on pure on-policy score estimation degrade quickly as dimension grows. The Tweedie integral becomes hard to estimate directly in high dimensions, and base score estimates carry large bias and large variance. Post-processing is a general procedure that can be applied on top of any base score estimator. We run experiments with IS and Reverse Diffusion Monte Carlo (RDMC) [10] as base estimators in high-dimensional problems. Post-processing reduces score estimation error substantially, and improves sample quality with W2W_2 distance up to two orders of magnitude smaller at equal compute. This makes diffusion-based samplers practical in dimensions where their base estimators would otherwise fail.

Background

Diffusion Models

Fix a horizon T>0T > 0 and a decreasing signal level schedule α:[0,T]→(0,1]\alpha: [0,T] \to(0,1], with α(0)=1\alpha(0) = 1. The forward stochastic process

dXt=α˙(t)α(t)Xt dt+2α˙(t)α(t) dBt,X0∼π,(3)dX_t = \frac{\dot{\alpha}(t)}{\alpha(t)} X_t\,dt + \sqrt{\frac{2\dot{\alpha}(t)}{\alpha(t)}}\,dB_t,\qquad X_0 \sim\pi, \tag*{(3)}

has marginals Xt=dα(t)X0+1−α(t)2ZX_t \mathrel{\overset{d}{=}} \alpha(t)X_0 + \sqrt{1-\alpha(t)^2}Z with Z∼N(0,I)Z \sim N(0,I) independent of X0X_0, so Xt∼pα(t)X_t \sim p_{\alpha(t)}; it is the variance-preserving Ornstein–Uhlenbeck process run on the clock α\alpha. By the time-reversal of diffusions [21, 12], the reverse process

dYt=−α˙(T−t)α(T−t)(Yt+2s(Yt,α(T−t)))dt+−2α˙(T−t)α(T−t) dBt,Y0∼pα(T),(4)dY_t = -\frac{\dot{\alpha}(T-t)}{\alpha(T-t)}\left(Y_t + 2s(Y_t,\alpha(T-t))\right)dt + \sqrt{\frac{-2\dot{\alpha}(T-t)}{\alpha(T-t)}}\,dB_t,\qquad Y_0 \sim p_{\alpha(T)}, \tag*{(4)}

satisfies Yt∼pα(T−t)Y_t \sim p_{\alpha(T-t)}, so that YT∼πY_T \sim\pi. Different α\alpha time schedules are reparametrizations of the same reverse dynamics; the schedule decides only which signal levels a discretization visits. We note there are additional small errors introduced by initializing at Y0∼N(0,I)≠pα(T)Y_0 \sim N(0,I) \ne p_{\alpha(T)} and terminating at time t′<Tt' < T which are considered fully in the discrete process error analysis theory [20, 14, 5, 4, 1, 6, 22].

In this work we use the linear schedule α(t)=1−t\alpha(t) = 1-t, for which −α˙/α=1/α-\dot{\alpha}/\alpha= 1/\alpha. Specializing to the natural parameter schedule of the reverse process, the reverse process runs over signal levels aa directly, with aa increasing and a→1a \to1 approaching a sample from the target density

dYa=1a(Ya+2s(Ya,a))da+2a dWa,(5)dY_a = \frac{1}{a}\left(Y_a + 2s(Y_a,a)\right)da + \sqrt{\frac{2}{a}}\,dW_a, \tag*{(5)}

Given a score estimator s^\hat{s} and a grid 0<a0<a1<⋯<aM<10 < a_0 < a_1 < \cdots< a_M < 1 with hk=ak+1−akh_k = a_{k+1}-a_k, we initialize y0∼N(0,I)≈pa0y_0 \sim N(0,I) \approx p_{a_0} and take Euler–Maruyama steps

yk+1=yk+hkak(yk+2s^(yk,ak))+2hkak ξk,ξk∼N(0,I).(6)y_{k+1} = y_k + \frac{h_k}{a_k}\left(y_k + 2\hat{s}(y_k,a_k)\right) + \sqrt{\frac{2h_k}{a_k}}\,\xi_k,\qquad\xi_k \sim N(0,I). \tag*{(6)}

We use a non-uniform grid which follows the exponential-decay design of Chen et al. [4], Benton et al. [1], He et al. [9], which was shown to be optimal and prevents numerical instability in (5), see Appendix § 12.§ 1 for a precise definition.

Monte Carlo Score Estimators

With knowledge of ff, the score can be written as a posterior expectation using Tweedie’s formula [18],

s(u,a)=E[−u−aX1−a2∣U=u]=∫−(u−ax1−a2)e−f(x)−12(1−a2)∥u−ax∥2∫e−f(x′)−12(1−a2)∥u−ax′∥2 dx′ dx,(7)s(u,a)=\mathbb{E}\left[-\frac{u-aX}{1-a^2}\mid U=u\right]=\int-\left(\frac{u-ax}{1-a^2}\right)\frac{e^{-f(x)-\frac{1}{2(1-a^2)}\lVert u-ax\rVert^2}}{\int e^{-f(x')-\frac{1}{2(1-a^2)}\lVert u-ax'\rVert^2}\,dx'}\,dx, \tag*{(7)}

References

  1. [1]Joe Benton, Valentin De Bortoli, Arnaud Doucet, and George Deligiannidis. Nearly d-linear convergence bounds for diffusion models via stochastic localization. In International Conference on Learning Representations, 2024. URL https://openreview.net/forum?id=r5nJjV3BsuD.arxiv.org/abs/2308.03686
  2. [2]David Bruns-Smith, Oliver Dukes, Avi Feller, and Elizabeth L Ogburn. Augmented balancing weights as linear regression. Journal of the Royal Statistical Society Series B: Statistical Methodology, 88(3):699–723, 2026.
  3. [3]Andreas Buja, Trevor Hastie, and Robert Tibshirani. Linear smoothers and additive models. The Annals of Statistics, pages 453–510, 1989.DOI
  4. [4]Hongrui Chen, Holden Lee, and Jianfeng Lu. Improved analysis of score-based generative modeling: User-friendly bounds under minimal smoothness assumptions. In Proceedings of the 40th International Conference on Machine Learning, volume 202 of Proceedings of Machine Learning Research, pages 4735–4763. PMLR, 2023.arxiv.org/abs/2211.01916
  5. [5]Sitan Chen, Sinho Chewi, Jerry Li, Yuanzhi Li, Adil Salim, and Anru R. Zhang. Sampling is as easy as learning the score: theory for diffusion models with minimal data assumptions. In International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id=kmqSo4JYYfW.arxiv.org/abs/2209.11215
  6. [6]Giovanni Conforti, Alain Durmus, and Marta Gentiloni Silveri. KL convergence guarantees for score diffusion models under minimal data assumptions. SIAM Journal on Mathematics of Data Science, 7(1):86–109, 2025.arxiv.org/abs/2308.12240
  7. [7]David L Donoho. Statistical estimation and optimal recovery. The Annals of Statistics, 22(1):238–270, 1994.DOI
  8. [8]Louis Grenioux, Maxence Noble, Marylou Gabrié, and Alain Oliviero Durmus. Stochastic localization via iterative posterior sampling. In Proceedings of the 41st International Conference on Machine Learning, volume 235 of Proceedings of Machine Learning Research, pages 16337–16376. PMLR, 2024.
  9. [9]Ye He, Kevin Rojas, and Molei Tao. Zeroth-order sampling methods for non-log-concave distributions: Alleviating metastability by denoising diffusion. In Advances in Neural Information Processing Systems, volume 37, 2024. URL https://openreview.net/forum?id=X3A1julsw5.arxiv.org/abs/2402.17886
  10. [10]Xunpeng Huang, Hanze Dong, Yifan Hao, Yi-An Ma, and Tong Zhang. Reverse diffusion Monte Carlo. In International Conference on Learning Representations, 2024.arxiv.org/abs/2307.02037
  11. [11]Xunpeng Huang, Difan Zou, Hanze Dong, Yi-An Ma, and Tong Zhang. Faster sampling without isoperimetry via diffusion-based Monte Carlo. In Proceedings of the 37th International Conference on Learning Theory, volume 247 of Proceedings of Machine Learning Research, pages 2438–2493. PMLR, 2024.arxiv.org/abs/2401.06325
  12. [12]Diederik Kingma, Tim Salimans, Ben Poole, and Jonathan Ho. Variational diffusion models. Advances in neural information processing systems, 34:21696–21707, 2021.arxiv.org/abs/2107.00630
  13. [13]A. N. Kolmogorov. Interpolation und Extrapolation von stationären zufälligen Folgen. Izvestiya Akademii Nauk SSSR, Seriya Matematicheskaya, 5(1):3–14, 1941. English translation in Selected Works of A. N. Kolmogorov, Vol. II, Kluwer, 1992.
  14. [14]Holden Lee, Jianfeng Lu, and Yixin Tan. Convergence for score-based generative modeling with polynomial complexity. In Advances in Neural Information Processing Systems, volume 35, pages 22870–22882, 2022.arxiv.org/abs/2206.06227
  15. [15]Cheng Lu, Yuhao Zhou, Fan Bao, Jianfei Chen, Chongxuan Li, and Jun Zhu. Dpm-solver: A fast ode solver for diffusion probabilistic model sampling in around 10 steps. Advances in neural information processing systems, 35:5775–5787, 2022.arxiv.org/abs/2206.00927
  16. [16]Georges Matheron. Principles of geostatistics. Econ. Geol., 58:1246–1266, 1963.DOI
  17. [17]Curtis McDonald and Andrew R. Barron. Proposal of a score based approach to sampling using Monte Carlo estimation of score and oracle access to target density. In NeurIPS 2022 Workshop on Score-Based Methods, 2022. arXiv:2212.03325.arxiv.org/abs/2212.03325
  18. [18]Herbert E. Robbins. An empirical Bayes approach to statistics. In Samuel Kotz and Norman L. Johnson, editors, Breakthroughs in Statistics: Foundations and Basic Theory, pages 388–394. Springer, New York, 1992.
  19. [19]Bernard W Silverman. Spline smoothing: the equivalent variable kernel method. The annals of Statistics, pages 898–916, 1984.DOI
  20. [20]Yang Song, Conor Durkan, Iain Murray, and Stefano Ermon. Maximum likelihood training of score-based diffusion models. In Advances in Neural Information Processing Systems, volume 31, pages 1415–1428, 2021.arxiv.org/abs/2101.09258
  21. [21]Yang Song, Jascha Sohl-Dickstein, Diederik P. Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id=PxTIG12RRHS.
  22. [22]Yuqing Wang, Ye He, and Molei Tao. Evaluating the design space of diffusion-based generative models. Advances in Neural Information Processing Systems, 37:19307–19352, 2024.arxiv.org/abs/2406.12839
  23. [23]Norbert Wiener. Extrapolation, interpolation, and smoothing of stationary time series: with engineering applications. The MIT press, 1949.
  24. [24]Christopher KI Williams and Carl Edward Rasmussen. Gaussian processes for machine learning, volume 2. MIT press Cambridge, MA, 2006.DOI
  25. [25]José R Zubizarreta. Stable weights that balance covariates for estimation with incomplete outcome data. Journal of the American Statistical Association, 110(511):910–922, 2015.DOI

Paper details

vlnc:W_d6judmse
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 1

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Mathematics

Generative AI

View statement
Looking for related papers…
Contents