Organizations: Department of Statistical Science, University College London, UK. · Google DeepMind, UK. · Department of Statistical Science, University College London, UK, and Department of Statistics, Athens University of Economics and Business, Greece.
Markov chain Monte Carlo (MCMC) methods are the standard tool for computing expectations under complex probability distributions. Control variates reduce the variance of the resulting estimates, but a good control variate requires solving the Poisson equation of the sampler, which rarely admits a closed-form solution. Exact solutions are available when the sampler's kernel has a known spectral decomposition on a simple reference density. In our work, we extend these solutions to general targets through a learned change of variables. A bijection, such as a normalizing flow, is trained so that the target becomes close to the reference in a latent space, and we show that Markov kernels and their Poisson solutions are transformed by any bijection. Running such samplers in the latent space then yields explicit control variates, and the estimator is consistent under mild tail conditions on the map and target. Importance sampling (IS) from the flow is the limiting case of the same construction and the control variates apply to it as well. Experiments on synthetic targets and real posteriors compare the procedure against state-of-the-art samplers and control variates.
Figures & tables
Figure 1: When to sample instead of reweighting. Each point is one target of Table 1 . The ratio is the precision per second of the best chain-based estimator on the main test function divided by that of SNIS+CV, and the marker shows which chain is best; above the dotted line a chain is more efficient than SNIS+CV. The horizontal axis is the largest normalized importance weight of the flow times N , over the 100 replicates of N=106 draws.
Target
SNIS
TGI-RWM
TGI-MALA
TESS
NeuTra
GARCH
9.7e7 † (29)
8.4e7 † (37)
2.2e7 (64)
2.4e7 (10)
5.0e7 (109)
One-comp.
8.9e5 (1.6)
6.7e5 (1.7)
4.6e5 (12)
4.7e5 (1.6)
5.8e5 (5.9)
Lotka–Volterra
1.0e8 (28)
2.3e7 (14)
5.6e6 (57)
8.9e6 (6.4)
2.1e7 (176)
Banana
4.1e7 (26)
3.4e7 (35)
1.1e7 (117)
5.9e6 (13)
1.7e7 (104)
Dugongs
2.0e7 (5.1)
5.4e6 (3.5)
5.1e4 (0.6)
9.2e6 (4.9)
1.3e6 (3.3)
Mixture
3.9e6 (3.3)
1.5e6 (2.3)
–
1.6e6 (2.4)
1.6e4 (1.9)
Table 1: Precision per second on the main test function of each target (Tables S8 and S9 ), with the protocol of Appendix S4 . In parentheses, the variance reduction factor of the control variates, the mean squared error without them over that with them on the same run. Targets are ordered by the largest normalized importance weight of the flow times N . Entries within 10% of the best in a row are in bold. † : the Monte Carlo error of the reference value accounts for at least half of the mean squared error; –: RMSE above one posterior standard deviation.
Appendix figures & tables16 assets
Supplementary material from the paper’s appendix.
Appendix
Sampler
Mean
Covariance
Derivatives
Cost per step
TGI-RWM
βz
(1−β2)I
none
1
TGI-MALA
βz+γ∇logw(z)
(1−β2)I
gradient
2
TGI-pMALA
z+γAz∇logπz(z)
(1−β2)Az
diagonal Hessian
2+2d
Appendix
Table S1: The TGI samplers on the Gaussian reference. The proposal is N(mean,cov) in the latent space. Cost counts one evaluation of logπ as one unit and a joint evaluation with its gradient as two.
K
1
2
4
6
8
10
γ=0.3
Predicted
15.6
270
1.28×105
1.03×108
1.30×1011
2.39×1014
Empirical
15.1
268
1.29×105
1.17×108
1.77×1011
4.58×1014
γ=1
Predicted
8.35
102
3.35×104
2.27×107
2.63×1010
4.66×1013
Empirical
8.10
97.5
3.24×104
2.35×107
3.03×1010
8.13×1013
Appendix
Table S2: VRF of TGI-RWM on LogNormal(0,0.52) with the exact map, F(x)=x and θ=(1,−1) . Predicted: Proposition 5.1 . Empirical: ratio of mean squared errors over 1000 stationary chains of 5000 steps. At γ=1 the chain draws independently from ρ .
k
1
2
3
4
5
6
λk=E[coskϑ]
0
0.5
0
0.375
0
0.3125
Autocorrelation of Hk(Zt)
0.001
0.499
−0.002
0.368
−0.009
0.274
K
1
2
4
6
8
10
VRF, Proposition 5.1
3.58
117
3.94×104
2.71×107
3.17×1010
5.62×1013
VRF, simulation
3.62
109
3.81×104
2.91×107
4.69×1010
1.09×1014
Appendix
Table S3: Elliptical slice sampling on LogNormal(0,0.52) with the exact map, 1000 stationary chains of 5000 steps. Top: eigenvalues of the candidate kernel on Hk and the lag-one autocorrelation of Hk(Zt) . Bottom: VRF of F(x)=x with the dictionary {H1,…,HK} and θ=(1,−1) , from Proposition 5.1 and from the ratio of mean squared errors.
Reference
Map
β
Acceptance
ESS /n
VRF
ESS × VRF /n
Tail gap
Gaussian
moment-matched
0.5
0.78
0.11
1.9
0.20
14.4
Gamma
moment-matched
0.1
0.92
0.60
16
9.7
0.37
Gaussian
exact
0
1.00
0.97
9.3×103
9.0×103
0
Gamma
exact
0.2
1.00
0.60
1.1×104
6.9×103
0
Appendix
Table S4: Gaussian and Gamma references on 21Gamma(2,1)+21Gamma(5,1) , F(x)=x , K=6 , over 1000 chains of 5000 steps started from exact draws of πz . For each row, β∈[0,0.95] is chosen on a grid to maximize ESS × VRF. The last column is the largest value of logw minus its 99.9% quantile on 2×105 target draws; for the Gaussian moment-matched map logw is unbounded and this gap grows with the number of draws.
ESS /n
VRF
Target
Map
Step
Acceptance
observed
predicted
observed
predicted
Circle
exact
τ=0.5
1.00
0.15
0.15
1900
1810
Circle
exact
τ=2
1.00
0.52
0.53
502
518
Circle
concentrations ×0.5
τ=2
0.80
0.31
–
5.4
–
Circle
concentrations ×2
τ=2
0.77
0.39
–
2.8
–
Sphere
exact
φ=0.6
1.00
0.11
0.12
783
678
Appendix
Table S5: The MH sampler proposing from Q on the circle ( 0.7vM(0.5,4)+0.3vM(3.5,2) , F=cosθ , Fourier degree 6 ) and on the sphere ( vMF with κ=3 , F=x⋅μ , harmonics of degree at most 4 ), with 1000 chains of 5000 steps. Each map is the quantile map of a model π′ , so that T#ρ=π′ and w=(π/π′)∘T : on the circle, π′ is the target mixture with both concentrations scaled; on the sphere, π′=vMF(κ′) . Predicted values are from Proposition 5.1 for the exact maps.
Variant
train cost
ESS IS/N
F
tail logw
VRF
max ∣z∣
bias
B
5.1×106
0.997
0.0287
7.63
4.19 / 2.92
208
−1.0×10−4
B + tail
7.4×106
0.993
0.0361
1
33.2 / 29.4
4
+5.0×10−5
A
5.5×106
0.997
0.0171
5.46
8.95 / 14.5
96
−9.9×10−5
A + tail (default)
7.8×106
0.998
0.0147
0.699
51.5 / 48.2
5
−4.6×10−6
A + tail, SMALL
7.8×106
0.996
0.0245
0.648
40.5 / 39.8
9
−6.5×10−5
A + tail, 1/10 cost
7.8×105
0.950
0.329
1.88
5.66 / 5.76
8
+3.4×10−5
Appendix
Table S6: Training ablation, banana: every variant trained once for 104 steps, except the 1/10-cost one, a complete training of 103 steps with every schedule scaled to its length; flow diagnostics at the last checkpoint (tail logw : 99.9% quantile over the radial band relative to the median over N(0,I) ) and TGI-RWM chains at J ’s γ (two seeds of 2000 chains, 500 + 5000 steps; main test function). max ∣z∣ : the largest ∣μ^r−medianμ^∣/(1.4826MAD) over the chains’ control-variate estimates μ^r (about 4 for Gaussian spread; larger values mean that a few chains stuck). bias: (μˉ−μ)/σπ of the pooled estimate; ∗ : more than four standard errors sd(μ^r)/R .
Variant
train cost
ESS IS/N
F
tail logw
q(x1>0)
VRF
max ∣z∣
bias
A
7.8×106
0.986
101
1.07
0.96
23.5 / 23.6
7
+0.871 ∗
A a without anchor
8.2×106
0.920
388
1.7
0.56
3.59 / 3.1
18
+6.5×10−5
A a (default)
8.2×106
0.959
6.3×103
1.63
0.52
3.59 / 3.82
10
−5.1×10−4
A a without tail
5.9×106
0.932
5.6×103
8.37
0.51
3.2 / 1.42
97
+1.6×10−4
A a , 1/10 cost
8.6×105
0.489
196
4.62
0.64
1.37 / 1.26
38
+3.8×10−3 ∗
B
7.4×106
0.985
85.3
1.12
0.96
9.81 / 8.52
16
+0.871 ∗
Appendix
Table S7: Training ablation, Gaussian mixture: every variant trained once for 104 steps, except the 1/10-cost one, a complete training of 103 steps with every schedule scaled to its length (pilot 8×104 ); flow diagnostics at the last checkpoint (tail logw : 99.9% quantile over the radial band relative to the median over N(0,I) ) and TGI-RWM chains at J ’s γ (two seeds of 2000 chains, 500 + 5000 steps; main test function). max ∣z∣ : the largest ∣μ^r−medianμ^∣/(1.4826MAD) over the chains’ control-variate estimates μ^r (about 4 for Gaussian spread; larger values mean that a few chains stuck). bias: (μˉ−μ)/σπ of the pooled estimate; ∗ : more than four standard errors sd(μ^r)/R .
Target
d
Scheme
Train. cost
maxw⋅N
Main F
L
γ
Banana
8
A
7.8×106
65
x2
1
0.90 / 0.20
Funnel
10
A
7.8×106
1.6×103
v
2
1.00 / 0.10
Gaussian mixture
10
Aa
8.2×106
1.2×103
x1
2
0.95 / 0.20
t mixture
10
Aa
8.2×106
1.3×105
x1
2
1.00 / 0.10
Appendix
Table S8: Settings for the synthetic targets. All flows use the LARGE network, 104 training steps, batch size 256 and the tail penalty; the multi-start pilot of the mixtures costs 4×105 and is included in the training cost. maxw⋅N is the largest normalized importance weight of the flow times N=106 , the largest over 100 replicates. L is the number of leapfrog steps of NeuTra and γ the step size of TGI-RWM / TGI-MALA, both chosen by pilot runs.
Figure S1: Analytic transports of the banana, main test function x2 , from the chain experiments of Appendix S4 . From left to right: the best ESS per unit cost over the step size of TGI-RWM and TGI-MALA, and ESSIS/N , against the Fisher divergence of the shear map Tc ; the ESS, the VRF and their product against the step size γ , relative to their maxima, for TGI-RWM and TGI-MALA on the accurate member c=0.01 (dashed: the step chosen by J ; dotted: by the speed measure); and the VRF (solid) and the number of kept Hermite terms (dotted) against the maximal degree K for each pruning rule, with TGI-MALA on the same member.
Figure S2: The banana with the training of the flow charged. Left: RMSE of the main test function in posterior standard deviations against the total number of target evaluations, with bootstrap 95% bands; each flow-based method shows the lower envelope over training checkpoints and sampling budgets. Right: a grid of the latent space pushed forward by the flow after 100 , 1000 and 104 training steps, over the target density (grey; contours hold 50 , 90 and 99% of the mass).
Posterior
d
Scheme
Network
Tail
Train. cost
maxw⋅N
Main F
L
γ
GARCH(1,1)
4
A
SMALL
yes
7.8×106
3
β1
1
0.90
One-compartment PK
4
A
SMALL
yes
7.8×106
9
logKm
1
0.99
Dugongs
4
B
SMALL
yes
7.4×106
3.5×102
β
1
0.80
Lotka–Volterra
8
A
SMALL
yes
7.8×106
42
α
1
1.00
GP Poisson
13
A
LARGE
no
5.5×106
7.7×103
α
2
0.99
Eight schools
10
A
LARGE
no
1.6×107
6.8×103
θ1
1
0.90
Appendix
Table S9: Settings for the real posteriors: dimension, training scheme, network, tail penalty, training cost in target evaluations, importance sampling effective sample size of the flow, main test function, leapfrog steps L selected for NeuTra and step size γ of TGI-RWM, both chosen by pilot runs. All flows are trained for 104 steps with batch size 256 , except eight schools ( 3×104 steps) and the sparse logistic regression ( 3×105 steps, batch size 1024 , a LARGE network of width 256 , marked ∗ ); for the ϕ4 field the multi-start pilot uses 64 NUTS chains and 4×106 evaluations, included in the training cost.
Figure S3: The 100 estimates of the main test function of every target, in posterior standard deviations from the reference value (dashed line). Panels are ordered by maxw⋅N ; circles are estimates beyond 1.5 interquartile ranges from the box.
Posterior
F
NUTS+ZV
SNIS+CV
TGI-RWM+CV
TESS+CV
NeuTra+ZV
GARCH
β1
2.1e-3
1.9e-4
2.0e-4
3.5e-4
2.9e-4
One-compartment
logKm
1.3e-2
1.3e-3
1.3e-3
1.5e-3
1.3e-3
Lotka–Volterra
α
1.6e-3
1.9e-4
3.1e-4
4.7e-4
2.7e-4
Dugongs
β
5.0e-3
5.0e-4
8.5e-4
5.8e-4
2.0e-3
GP Poisson
α
1.5e-2
1.8e-3
1.1e-3
1.0e-3
7.5e-4
Eight schools
θ1
1.4e-2
1.6e-3
1.4e-3
1.2e-3
2.1e-3
Appendix
Table S10: RMSE in posterior standard deviations of the main test function at B=106 target evaluations, without the training of the flow, over 100 estimates for the flow-based estimators and 50 for NUTS. NUTS+ZV was more accurate than plain NUTS on every posterior where both were run. † : extrapolated from the reference run as its Monte Carlo standard error times Cref/B ; ‡ : NUTS stays in one mode. Entries within 10% of the best in a row are in bold.
SNIS
TGI-RWM
TGI-RWM δ
TGI-MALA
TESS
NeuTra
Target
F
plain
+CV
plain
+CV
plain
+CV
plain
+CV
plain
+CV
plain
+ZV
GARCH
β1⋆
3.3e6
9.7e7 †
2.3e6
8.4e7 †
1.6e6
6.3e7 †
3.4e5
2.2e7
2.3e6
2.4e7
4.6e5
5.0e7
μ
3.3e6
5.3e8
2.3e6
2.6e8
1.6e6
1.8e8
3.4e5
3.6e7
2.5e6
3.6e7
4.4e5
5.7e8
α0
3.1e6
3.2e7 †
2.2e6
3.2e7 †
1.5e6
2.6e7 †
3.5e5
1.4e7
2.1e6
1.7e7
4.7e5
3.3e7
α1
3.4e6
4.8e8 †
2.3e6
2.4e8 †
1.6e6
1.5e8 †
3.4e5
2.8e7
2.3e6
3.2e7
4.6e5
8.1e7
One-comp.
logKm⋆
5.7e5
8.9e5
4.0e5
6.7e5
3.9e5
6.4e5
4.0e4
4.6e5
2.9e5
4.7e5
9.9e4
5.8e5
Appendix
Table S11: Precision per second on every test function, extending Table 1 ; ⋆ marks the main test function. For the sparse logistic regression we give logτ , w1 and the median, maximum and minimum over the 25 coefficients wj . Entries within 10% of the best in a row are in bold. † : the Monte Carlo error of the reference value accounts for at least half of the mean squared error; ‡ : the errors of this target are limited by a bias of about 0.01 posterior standard deviations in logτ shared by the flow-based estimators; –: RMSE above one posterior standard deviation.
Method
mean gap
factor
sd
worst row
within 2×
best
failed
(A) main test function, 12 functions
SNIS
−0.36
2.3
0.65
−1.74 ( t mixture, x1 )
9/12
8/12
0
TGI-RWM
−0.28
1.9
0.20
−0.65 (Lotka–Volterra, α )
6/12
1/12
0
TGI-MALA
−1.98
96
2.49
−6.46 (Mixture, x1 )
3/12
2/12
3
TESS
−0.39
2.4
0.31
−1.06 (Lotka–Volterra, α )
5/12
1/12
0
NeuTra
−0.83
6.8
0.87
−2.40 (Mixture, x1 )
5/12
2/12
0
Appendix
Table S12: Stability of the estimators: the gap log10(precision/best of the row) of each method with its control variates to the most precise one, over all test functions of Table S11 ( 0 : the best; −1 : ten times less precise). Mean gap, the corresponding factor 10−mean , standard deviation and worst row; number of rows within a factor 2 of the best and within 10% of it (the bold rule); failures (RMSE above one posterior standard deviation) are counted at RMSE =1 . (A) The main test function of each target. (B) All 70 test functions; the mean and standard deviation are over the 12 per-target means, so that every target has the same weight, the worst row and the counts over all rows.
TGI-RWM
TGI-MALA
Target
Member
F
γJ
γ⋆
acc. γJ / 1
R(1,γJ)
R(γJ,γ⋆)
γJ
γ⋆
acc. γJ / 1
R(1,γJ)
R(γJ,γ⋆)
Banana
c=0.01
7×10−4
0.95
1.00
0.99/0.99
1.01
0.99
0.57
0.50
1.00/0.99
0.60
0.99
c=0.3
0.63
0.91
0.60
0.81/0.81
0.88
0.87
0.37
0.35
0.92/0.69
0.01
1.00
c=1
7.0
0.48
0.45
0.60/0.55
0.62
0.82
0.14
0.07
0.82/0.28
0.12
0.40
Funnel
ϱ=0.01
1.3×10−3
0.99
0.85
0.99/0.99
1.00
1.00
0.40
0.30
0.99/0.98
0.22
0.90
ϱ=0.3
1.2
0.99
0.10
0.70/0.70
1.00
0.44
0.22
0.30
0.94/0.45
0.08
0.99
Appendix
Table S13: The step γJ selected by J against γ=1 and against the best step γ⋆ on a grid of 25 values, on the analytic families: acceptance rate at γJ and at 1 , and the ratios R(γ,γ′) of ESS × VRF of the main test function at γ to that at γ′ , from 500 chains of 5000 steps with common random numbers.
We develop sampling methods, which consist of Gaussian invariant versions of random walk Metropolis (RWM), Metropolis adjusted Langevin algorithm (MALA) and second order Hessian or Manifold MALA. Unlike standard RWM and MALA, we show that Gaussian invariant sampling can lead to ergodic estimators with improved statistical efficiency. This is due to a remarkable property of Gaussian invariance that allows us to obtain exact analytical solutions to the Poisson equation for Gaussian targets. These solutions can be used to construct efficient and easy to use control variates for variance reduction of estimators under any intractable target. We demonstrate the new samplers and estimators in several examples, including high dimensional targets in latent Gaussian models where we compare against several advanced methods and obtain state-of-the-art results. We also provide theoretical results regarding geometric ergodicity, and an optimal scaling analysis that shows the dependence of the optimal acceptance rate on the Gaussianity of the target.
Michalis K. Titsias, Angelos Alexopoulos, Siran Liu +1
Google DeepMind, UK · Athens University of Economics and Business, Greece · UCL, UK
Assume that we would like to estimate the expected value of a function F with respect to an intractable density π, which is specified up to some unknown normalising constant. We prove that if π is close enough under KL divergence to another density q, an independent Metropolis sampler estimator that obtains samples from π with proposal density q, enriched with a variance reduction computational strategy based on control variates, achieves smaller asymptotic variance than i.i.d. sampling from π. The control variates construction requires no extra computational effort but assumes that the expected value of F under q is analytically available. We illustrate this result by calculating the marginal likelihood in a linear regression model with prior-likelihood conflict and a non-conjugate prior. Furthermore, we propose an adaptive independent Metropolis algorithm that adapts the proposal density such that its KL divergence with the target is being reduced. We demonstrate its applicability in a Bayesian logistic and Gaussian process regression problems and we rigorously justify our asymptotic arguments under easily verifiable and essentially minimal conditions.
Siran Liu, Petros Dellaportas, Michalis K. Titsias
Department of Statistical Science, University College London, UK. · Department of Statistics, Athens University of Economics and Business, Greece. · Google DeepMind, UK.
Sampling from unnormalized probability densities is a pervasive challenge across the computational and physical sciences. Diffusion models provide a powerful generative framework for this task, but their success relies on accurately estimating the score of the perturbed target distribution. Current approaches face a dichotomy between two standard estimation methods: the Denoising Score Identity (DSI) requires data samples and exhibits high variance at low noise levels, whereas the Target Score Identity (TSI) relies on the energy function and suffers from diverging variance at high noise levels. In this work, we reconcile both approaches by introducing the Control Variate Score Identity (CVSI), an unbiased estimator with an analytically optimal, state- and time-dependent control coefficient that theoretically minimizes variance over the entire diffusion process. CVSI serves as a robust plug-in estimator that significantly enhances performance and efficiency in data-free sampler learning and training-free diffusion sampling. These gains scale to complex, high-dimensional energy-based models.