Manuscript Offprint
arXiv:2611.05238Post-stratified importance sampling
Abstract
Importance sampling is a building block of modern statistical computing, but the weighted estimate is prone to high or infinite variance. Moreover, its empirical standard error is often unreliable, leaving importance sampling without practical uncertainty quantification. Motivated by multilevel regression and poststratification (MRP) in survey sampling, we propose post-stratified importance sampling (PIS) for estimating target expectations from proposal draws. PIS reformulates arbitrarily high-dimensional weighting into two one-dimensional probabilistic modeling problems: regression for the conditional mean given the importance ratio and marginal density estimation for the importance ratio. Different modeling choices yield a family of PIS estimators, encompassing ordinary importance sampling as a special case. We develop a model-based implementation that combines one-dimensional Gaussian process regression for the conditional mean and score-informed heavy-tailed density estimation for the marginal law, using both the observed weights and the available density evaluations. We study the oracle gains of PIS and establish consistency under general and model-specific conditions. Simulations and applications to cross-validation demonstrate improvements in estimation accuracy and uncertainty quantification.
Keywords: Bayesian computation, importance sampling, heavy-tailed density, poststratification, score-based Monte Carlo, uncertainty quantification
1. Introduction
The task of importance sampling. Consider the general task of computing expectations: we are given a target density on , and our goal is to compute the target expectation of an arbitrary scalar function ,
Instead of sampling from the target , we draw an independent and identically distributed (IID) sample from a given proposal density ,
In practice, target and proposal densities may be known only up to normalizing constants. We write and for the evaluable, possibly unnormalized density functions, and use for expectation under the normalized distribution proportional to . Define the importance ratio function
Here we denote as a deterministic function of , and as the induced scalar random variable. We also write , the -th realized importance weight sample.
*Department of Statistics and Data Science, University of Texas at Austin
Depending on whether and are normalized, the classical importance sampling (IS) or self-normalized importance sampling estimate of the target expectation is the weighted sample mean
Why importance sampling is still important, and why it is fragile. Beyond its use as a stand-alone estimator, importance sampling often serves as a reweighting step within larger downstream algorithms, many of which are widely used in modern statistical workflows. To name a few, In Bayesian model evaluation, the leave-one-out (LOO) predictive quantities are expectations under the leave-one-out posterior . Exact LOO requires refitting the model for deleting every data point. Instead, importance-sampling-based LOO (Gelfand et al., 1992; Peruggia, 1997; Vehtari et al., 2017; Magnusson et al., 2019; Bürkner et al., 2020) reuses the full posterior proposal weighted by the inverse likelihood . In recursive Bayesian computing (Doucet et al., 2001; Chopin, 2002; Hooten et al., 2021), importance sampling is used to approximate expectations under a sequence of on-line targets. Draws from a previous distribution are reweighted by an incremental likelihood factor to approximate the updated posterior expectations. In sensitivity analysis, given posterior draws under one fixed model, prior, temperature, or dataset, importance sampling can approximate expectations under a tilted posterior (Smith and Gelfand, 1992; Kallioinen et al., 2024). In approximate inference, importance sampling reweighs variational samples for better calibration and diagnostics (Yao et al., 2018b). Conversely, using importance sampling inside variational objective tightens the evidence lower bound and leads to importance weighted variational inference (Burda et al., 2016; Domke and Sheldon, 2018).
Despite its wide deployment and asymptotic consistency, the weighted estimate (2) remains fragile (Vehtari et al., 2024). The usual central limit theorem requires a finite second moment of the weighted integrand, which often fails in practice. For example, even for a pair of Gaussian target and proposal, and , then as soon as . That is, under a modest scale mismatch, the Monte Carlo convergence rate no longer applies to the IS estimate. In general, the required sample size grows exponentially in the target-proposal discrepancy (Chatterjee and Diaconis, 2018); when this discrepancy scales linearly with parameter dimension , the sample size is required at the order . This curse of dimensionality rapidly makes direct importance weighting prohibitive in a moderate dimensional space.
Uncertainty quantification is challenging. Beyond its instability and potentially high or infinite variance, the weighted estimator (2) often lacks reliable uncertainty quantification. The usual sample variance estimate (Geweke, 1989) relies on the weighted empirical second moments:
This variance estimate can be unreliable for three reasons: (i) The underlying population variance may not exist. When , the variance of the IS estimate can be infinite even for bounded , and the sample variance is meaningless. (ii) Even when the variance is finite, when the importance ratios are heavy-tailed, this empirical variance is dominated by a small number of extreme weights , even more severely than the mean as the variance involves the quadratic weight . (iii) The self-normalized IS estimator is a ratio of dependent random variables and is biased. The empirical variance does not fully assess the mean squared error.
The limitation of the sample variance has motivated several alternative IS diagnostics. Pareto smoothed importance sampling (PSIS, Vehtari et al., 2024) instead reports the estimated Pareto tail index of the marginal distribution of , while Chatterjee and Diaconis (2018) proposes to monitor . These diagnostics appear more stable than the classical effective sample size (ESS, Kong, 1992; Elvira et al., 2022), and are useful qualitative indicators of whether an IS estimate should be trusted at all, but they still do not provide a calibrated uncertainty statement or confidence interval for the IS estimate. For this difficulty, the Monte Carlo uncertainty is often ignored or reduced to a diagnostic warning in many current statistical workflows involving importance sampling, such as model comparison, selection, and averaging (e.g., Vehtari et al., 2017; Yao et al., 2018a), despite the necessity to propagate it to downstream decision analysis.
Proposed method: Outline of poststratified importance sampling (PIS). We aim at the general importance sampling task: we can evaluate the continuous but potentially unnormalized target and proposal densities and , and we have IID draws . Our new strategy is to continuously stratify the distribution by the scalar importance ratio . Then we rearrange the target expectation using the law of total expectation
Here denotes the conditional expectation given , and denotes the marginal density of the scalar random variable , both under ; see Section 1.1 for a formal notation.
We develop poststratified importance sampling (PIS), a framework for computing based on the identity (4). It follows the motivation of multilevel regression and poststratification (MRP, Gelman and Little, 1997) in survey sampling. While MRP partitions a population into demographic strata and averages fitted stratum-level outcomes, PIS uses the scalar importance ratio as a continuous stratification variable. This representation admits a Rao-Blackwellization interpretation: we replace the original integrand with the conditional expectation , and then average over the marginal law .
Both the (a) conditional expectation and (b) marginal law are unknown and must be estimated. Different modeling choices for these two objects yield a family of PIS estimators by plugging in (4),
This general PIS framework recovers the classical importance weighting (2) as a degenerate special case. That is, if we adopt a “model-free” implementation,
-
estimate the conditional expectation using an unsmoothed estimate ,
-
estimate the marginal law empirically .
For the equivalence that we will develop in Section (2), this empirical implies (when normalized) or (when unnormalized). Thus, plugging-in this and , the PIS estimate becomes the classical (self-normalized) importance weighting (2).
Unsurprisingly, both and can admit more efficient estimates:
-
The unsmoothed conditional mean estimate amounts to a degenerating, interpolating regression. It infers the conditional mean at input using a single observation , without pooling information across samples.
-
The empirical estimate puts mass only on the observed weights, applies no tail smoothing, and discards additional information available from the density evaluation. Its extrapolation can be especially poor when is heavy-tailed.
These limitations motivate regularization and information sharing. We implement PIS in three steps:
-
Conditional mean via one-dimensional regression. We fit a model-based regression to estimate the conditional expectation using samples from , typically a Gaussian process regression. This step uses the identity .
-
Marginal law via one-dimensional score-based heavy-tail estimation. We estimate the marginal density and using a flexible Dirichlet process mixture with a generalized Pareto tail for the distribution of . Our density estimation not only uses the sample , but also incorporates score evaluations of the densities and , and this score information improves the tail estimation.
-
Aggregation via one-dimensional quadrature. After obtaining functional estimates of and , we adopt one-dimensional numerical integration in (5) to obtain the PIS estimate.
The modeling formulation also supports uncertainty quantification and model checking. The modeling formulation also supports uncertainty quantification and model checking. Monte Carlo draws propagate uncertainty in the regression and marginal density estimates to the final PIS estimate, while posterior predictive checks can assess the adequacy of both models.
Throughout this paper, when , we write for the marginal density of , and for the conditional density of given . Likewise, and denote the corresponding marginal and conditional densities under . Since is a deterministic function of , the formal definition of such marginal and conditional laws requires geometric measure theory (e.g., Evans and Gariepy, 2015). Below, we briefly review this construction so that our notation is self-contained.
In this paper, we work with continuous distributions on equipped with the Borel -algebra and Lebesgue measure. Let and be two smooth, nonnegative, integrable functions on , with finite normalizing constants and full support on . Define the potentially unnormalized importance ratio function . Given any value , define the -level set
We assume that, for almost every , the level set is non-singular; that is, for all . This non-singularity makes a smooth -dimensional submanifold.
Compared with regular importance sampling (2), the additional assumptions are that (a) the importance ratio map is smooth, and (b) the level set is non-singular. The former assumption can fail, for example, when using a step-function proposal to approximate a normal density. The latter assumption can fail, for example, when the importance ratio is constant. Other than such edge cases, these mild conditions hold in nearly all importance sampling applications we consider.
Marginal law. Let denote the pushforward of the probability measure under the map . That is, for every Borel set ,
Conditional expectation. For any integrable function , a version of the conditional expectation of given under is a measurable function of , satisfying, for every Borel set ,
Taking in (6) gives the total-expectation formula
Its validity follows directly from the definition; no application of Fubini's theorem is required.
Further define , a version of the conditional probability measure of given under , supported on , such that for any integrable function ,
Surface measure. One key mathematical device for the score-based estimator in this paper is the coarea formula, which turns the abstract conditional measure on the level set into an explicit surface-measure representation. Let denote the -dimensional surface measure on . Then, for any Borel sets and , the coarea formula gives
As a consequence, when admits a density with respect to Lebesgue measure on , denoted by , we have
The conditional density of given with respect to the surface measure is
In this paper, we reserve to denote the importance weight. When there is no ambiguity, we write and as shorthand for and respectively. The analogous notation and is used under the proposal distribution .
2. Proposed method
We propose poststratified importance sampling (PIS). It implements the conditioning strategy in (5), and consists of three steps: (i) estimation of the conditional expectation, (ii) marginal density, and (iii) numerical integral. Below, we develop a general framework that reformulates importance sampling into learning tasks and provides a practical recipe for these three steps.
2.1. Conditional expectation via regression
The first step is to estimate , the conditional expectation under the target . To emphasize that it is a function of , we write
The observed pairs suggest estimating the conditional mean by regression. Although the draws come from the proposal, the following theorem shows that the conditional mean is the same under and , so the regression requires no importance weighting.
Theorem 1. Let and be probability densities on with full support, and let . Then:
(1) For every integrable measurable function ,
(2) For every integrable function , suppose that a map satisfies
Then determines : there exists a measurable function such that almost surely.
With the proposal sample , we obtain training pairs
on which we fit a Gaussian process (GP) regression, with, for example, a squared exponential kernel:
This basic GP model can be readily extended when suggested by the data. For example, we can accommodate heteroskedasticity by modeling residual scale, .
When the integrand is not continuous, it is straightforward to go beyond the Gaussian likelihood. For example, when is binary, we use a Bernoulli-likelihood GP to estimate .
More generally, the regression can be performed on any bijective transformation of the weight, , as conditioning on is equivalent to conditioning on . The transformation becomes a model choice and can, in principle, be informed by the data. In practice, for numerical stability, we often use the log-weight scale, , in this Gaussian process regression.
Given evaluation points , the fitted GP provides posterior means, covariances, and joint posterior draws of the conditional mean function . We use these draws to propagate regression uncertainty through the final PIS estimator.
2.2. Marginal density estimation with a Pareto-tailed Dirichlet process mixture
The second step is to estimate , the marginal density of under . Although is one-dimensional, this density estimation can be challenging for two reasons:
(a) Available draws of are under the proposal , not the target.
(b) This has support on , and typically contains a heavy right-tail.
To solve problem (a), we show that the only difference between and , the marginal density of under and , is a multiplicative factor :
Theorem 2. Let , and let and denote its marginal densities under the corresponding normalized target and proposal distributions, respectively
- If both and are normalized, the marginal densities of under and satisfy, for ,
- If either or is not normalized, the marginal densities of under their normalized versions satisfy, for ,
Therefore, estimating one proposal marginal density function immediately determines the target (or up to self-normalizing). This is a deterministic relation between two functions and , not an additional importance weighting.
To address the challenge (b), we develop a model-based density estimate of with two features: one on the parametric form and one on the inference:
-
Model-based regularization using a heavy-tailed density: we estimate using a Dirichlet process mixture of truncated-normal densities for the bulk and a generalized Pareto model for the tail.
-
Score-based tail learning: We estimate the Pareto tail index using not only the observed sample but also local score information.
Flexible bulk-tail density model. We construct a flexible one-dimensional model for by combining a Dirichlet process mixture (DPM) for the bulk with a generalized Pareto distribution (GPD) for the right tail. Following the bulk-tail separation in PSIS (Vehtari et al., 2024), we treat the largest observed weights as the tail. The threshold and tail fraction are
We model the bulk as a mixture of normal densities truncated to :
where denotes the truncated-normal density and is the concentration parameter. We specify the base distribution over component means and scales through the priors:
We model the tail using a generalized Pareto distribution (GPD) with a shape parameter and a scale ,
Combining the bulk and tail gives the marginal density
The unknown quantities in the marginal model are the bulk mixing distribution and the tail Pareto parameters . We infer from the bulk observations using standard Bayesian inference via Markov chain Monte Carlo (MCMC). To stabilize estimation of the tail index , we incorporate score information when fitting to the tail observations , as described below.

Figure 1: : the marginal distribution of the scaler importance ratio under the proposal. We model the tail area (largest samples) by a generalized Pareto distribution, and the remaining bulk by a Dirichlet process mixture.
Score-based tail estimation. We can estimate the GPD parameters from the observed tail weights using standard likelihood-based inference, as in heavy-tailed density estimation (Hickling and Prangle, 2025) and PSIS (Vehtari et al., 2024). For example, a Bayesian fit gives posterior density
Optionally, when both densities and are differentiable, we can further improve the tail index fit by using derivative information. Since with , the marginal score of admits the following conditional expectation representation, which enables a score-based estimator.
Lemma 1. Assume that and are smooth density functions on . Let denote the marginal density of under . Fix an open interval . Assume that for all . Then, for every such that ,
where
Algorithm 1 Score based marginal density estimation of
1: Input: Proposal draws , importance ratio , unbiased score expression , tail size , and output Monte Carlo size .
2: Output: Estimated density and posterior density draws .
3: Set and for .
4: Sort the pairs so that .
5: Set and .
6: Estimate the generalized Pareto shape and scale by score matching:
7: Set
8: Fit a Dirichlet process mixture to on , obtain its posterior mean density , and retain posterior draws .
9: Set
10: For , set
11: return and .
Since is unbiased for the marginal score at , matching these estimates to the GPD score over the largest weights gives a score matching estimate
Incorporating derivatives of and provides additional information beyond the observed weights and can improve tail-index estimation relative to likelihood-based fitting. A companion paper develops the general theory of this score-based approach.
2.3. Numerical integration
So far we have constructed the functional estimate of and , and is a deterministic transformation of . The final step is to compute the one-dimensional integral
We construct a quadrature on a -grid .
PIS estimate when and are normalized. Theorem 2 translates the proposal marginal into the functional estimation of the target marginal:
Using the trapezoidal rule in (14), the target expectation becomes
(15)
Self-normalized PIS estimate density when p and q are unnormalized. When only unnormalized densities are available, w represents the unnormalized density ratio. The target marginal density requires self-normalization.
We compute both the integral (14) and the self-normalization factor in (16) with two one-dimensional quadratures
2.4. Uncertainty quantification using posterior draws
The fitted conditional mean and marginal density carry uncertainty from the finite proposal sample, analogous to Monte Carlo error in ordinary importance sampling. On a fixed quadrature grid , the formulas (15) and (17) are deterministic functions of the conditional means and marginal densities on the grid. The point estimate plugs in the posterior means and ; to propagate their uncertainty, we instead apply the same quadrature to posterior draws of these functions. For each , let
denote joint draws of the conditional mean and proposal marginal density on the grid. We draw jointly across the grid from the GP posterior for the latent mean function and construct from posterior draws of the DPM bulk and the fitted GPD tail.
For normalized p and q, each pair gives
The resulting draws approximate the model-based posterior distribution of the target expectation. For unnormalized densities, we apply the self-normalized quadrature formula (17) to each pair of function draws.
2.5. Computational complexity
At first glance, our model-based PIS appears to replace a Monte Carlo mean with a conceptually more elaborate formulation involving (a) Gaussian process regression, (b) density estimation, and (c) numerical quadrature. In fact, all three components are one-dimensional, yielding a scalable, nearly dimension-free computational cost. In particular, because both the outcome and input
Algorithm 2 Poststratified importance sampling
1: Input: Proposal draws , integrand , score , and tail size . 2: Output: PIS estimate and posterior uncertainty draws. 3: Initialize the quadrature grid . 4: Set and for . 5: Fit a Gaussian process to and evaluate for . 6: Apply Algorithm 1 to obtain and posterior density draws . 7: Evaluate and set for . 8: if and are normalized then 9: Set .
10: else 11: Set .
12: end if 13: Draw jointly from the Gaussian process posterior for . 14: Apply the same quadrature rule, with the same normalization when required, to each pair to obtain . 15: return and .
are scalars, the regression is independent of the parameter dimension . One-dimensional fast GP algorithms (e.g., Yadav et al., 2021; Greengard, 2025; Greengard et al., 2025) are highly scalable, achieving nearly linear computational cost in the sample size .
The computational cost of the one dimensional quadrature is linear in the grid size , and the trapezoidal quadrature error drops at the rate . We therefore do not further optimize the quadrature scheme in this paper, although we expect that more sophisticated quadrature methods will further improve accuracy.
Moreover, PIS is not tied to a particular modeling choice. Our general framework provides a spectrum of complexity-accuracy tradeoffs through different choices of regression and density estimators, ranging from a simple empirical estimate to deep Bayesian models. Consequently, PIS bridges the gap between two extremes: a one-shot importance-sampling correction and full resampling from the target distribution, trading a small one-dimensional computation for improved accuracy and uncertainty quantification. In many applications we consider, including cross-validation, sensitivity analysis, and approximate Bayesian inference, the dominant cost is obtaining the proposal sample, while the extra cost of fitting a one-dimensional regression and density model is only a fraction.
3. Theoretical analysis
3.1. Oracle properties
We first analyze the idealized setting in which the conditional mean and the marginal law are known exactly. We study two sources of improvement in PIS: conditioning removes the conditional variation in , while numerical quadrature removes the Monte Carlo variation associated with sampling over w.
Oracle gain from conditioning. Suppose first that and are normalized. Ordinary importance sampling extrapolates from to in a potentially high-dimensional parameter space: . Instead, when is known, PIS extrapolates from to in the one-dimensional weight space: .
To separate the gains from conditioning and quadrature, we introduce a quadrature-free Monte Carlo version of PIS for theoretical purposes:
This is equivalent to performing importance sampling in the one-dimensional w-space, with the proposal and target , and remains unbiased. When , direct application of the law of total variance yields a non-negative variance reduction from the ordinary -space IS to our oracle w-space IS:
Examples. To demonstrate the gain from conditioning, first, consider an importance sampling task with d-dimensional multivariate normal proposal and target,
where is a fixed mean mismatch and is a given projection of interest. The oracle mean function is linear in : . The gain from conditioning depends on the alignment between the projection direction and the mismatch . When , is determined by , and conditioning gives no variance reduction. If is orthogonal to , then , and the oracle PIS estimator has zero variance.
In general, suppose a is uniformly distributed on the unit sphere. Averaging over projection directions, the variance reduction is
Averaged over all directions, the ratio of the expected variance of IS and oracle PIS is
For a fixed , this variance reduction ratio grows linearly with the dimension d.
Next, to give an even sharper contrast, consider importance sampling under a shape-mismatch between a multivariate Student-t and normal distributions:
with , and . Elementary calculations show that the mean function is a constant . Hence, regardless of the direction or the dimension, conditioning removes the entire variance
For every finite , however, the ordinary IS summand has infinite variance:
Oracle gain from quadrature. Beyond conditioning, PIS can further reduce integration error by replacing the Monte Carlo average with one-dimensional quadrature. Standard trapezoidal error bounds apply to smooth integrands on compact intervals, whereas PIS integrates over with potentially heavy-tailed weights. The following lemma extends the standard error bound to our setting.
Lemma 2 (Oracle quadrature error). Suppose and are normalized, and and are known. Assume that has a generalized Pareto tail above a fixed threshold , with shape . Suppose and , with
for some and . Then using quadrature nodes and a tail-adapted composite trapezoidal rule (see Appendix A.1) yields a quadrature error rate
For comparison, our previously discussed oracle Monte Carlo PIS estimator based on independent draws has the standard Monte Carlo rate:
provided . When this variance is not bounded, the Monte Carlo convergence is slower than , whereas the oracle quadrature rate (19) still remains valid.
3.2. Consistency
The preceding oracle analysis treats and as known. We now account for their estimation error and establish the consistency of PIS. Theorem 3 provides general consistency conditions for arbitrary regression and marginal density estimators. Theorem 4 extends the result to unnormalized densities through self-normalization. Theorem 5 then verifies the conditions for our proposed implementation using Gaussian process regression and heavy-tailed density estimation.
General conditions for PIS consistency We first establish general conditions on these two components under which the resulting PIS estimator is consistent.
We first state our results for and normalized. The goal is to estimate the expectation . Given proposal draws , the general PIS framework estimates the conditional mean and marginal density by and . We allow these two estimators to use the same training sample, with no restriction on their dependence. To account for numerical integration errors and truncation, we use the trapezoidal rule on a uniform grid of points over :
where both the quadrature size and upper bound can depend on the sample size .
Theorem 3 (Consistency). Assume , the fitted and are Riemann integrable on compact sets, and is bounded in probability on compact sets. Assume that, for every fixed , as ,
(i) The conditional mean estimate is consistent
(ii) The marginal density estimate is consistent
There exist deterministic sequences and , with , such that the PIS estimator is consistent in probability:
We provide a concrete quadrature scheme that truncate the integration at the largest observed importance weight.
Lemma 3 (quadrature scheme). Assume the conditions of Theorem 3. Suppose for all sufficiently large , where is slowly varying and . For a fixed , set
Fit as in heavy tailed marginal model 12 with this threshold and tail fraction. Assume that, for some ,
and
For the composite trapezoidal rule, there exists a deterministic sequence such that
We further extend this consistency result to the self-normalized PIS estimate:
Theorem 4 (Consistency for unnormalized densities). Let and be unnormalized densities with unknown normalizing constants. Assume that, on every fixed interval , and satisfy the regression, density, boundedness, and Riemann-integrability conditions of Theorem 3. Then there exist deterministic sequences and integers , such that the self normalized PIS estimate is consistent,
PIS consistency under our proposed regression and density estimation model. We now verify the consistency conditions for our recommended model-based implementation of Section (2), using Gaussian process regression and a Pareto-tailed Dirichlet process mixture. We take and to be the corresponding posterior mean estimates.
Theorem 5. Assume and that the distribution of has support . For a fixed , set , , and . Assume the following:
(i) Conditional mean. The observations satisfy , where independently of , and is known. We fit the observations to a Gaussian process regression and let denote its posterior mean. Assume that is continuous, is a continuous, nondegenerate, locally Lipschitz covariance kernel on , and .
(ii) Marginal density. Assume that is continuous and positive on every compact interval. At the threshold , use the Pareto-tailed Dirichlet-process mixture model 12 with and , where
With hyperparameters and . Let denote the posterior mean based on .
(iii) Marginal tail. Assume that has an asymptotically Pareto tail: for some ,
Then there exists a deterministic sequence and deterministic integers such that
4. Experiments
We compare PIS with self-normalized importance sampling (SNIS) and Pareto-smoothed importance sampling (PSIS, Vehtari et al., 2024) in simulated and real-data experiments. We use the PSIS implementation in theloo package (Vehtari et al., 2025).
4.1. Benchmark tasks
We first test on the same benchmark tasks from Vehtari et al. (2024), spanning a range of importance weight regimes, including the mean shift, scale mismatch, and distributional mismatch, all in a dimensional space.
The upper row in Figure 2 presents the results for computing the expected linear functional . PIS generally achieves the lowest root mean squared error (RMSE), with substantial improvements over IS and PSIS in most configurations. The lower row presents the results for the second moment . The improvements from PIS are particularly pronounced in the first three configurations.
PSIS benchmark (d = 50)

Figure 2: Comparison of PIS with regular importance sampling and PSIS on the benchmarking tasks. We report the root mean squared error (RMSE) of the estimated (upper row), and (lower row).
4.2. Larger gains in more challenging tasks
To study how PIS can scale to increasing proposal-target-mismatch, and to higher dimensions, we consider a multivariate Gaussian target distribution and proposal
. The corresponding importance ratio has a closed form density.
We do not supply this oracle marginal density nor the oracle to any of the competing methods. Larger values of correspond to a greater mismatch between the proposal and target distributions, and the variance of the weights is infinite when .
We first estimate the target first moment . We vary sample sizes under two designs. First, we vary while fixing . Second, we vary separately for .

Figure 3: With both proposal and target being multivariate Gaussian, we compare PIS with self-normalized importance sampling and Pareto smoothed importance sampling, measuring performance by RMSE of the estimated . Larger k indicates a harder problem.
First, we vary the tail-heaviness. Figure 3 shows that in the easier, lighter-tailed cases with , all methods perform similarly. But in heavier-tailed settings, the PIS estimator achieves noticeably lower RMSE than the competing methods.
We also vary the dimension of the configuration space. Figure 4 shows that the advantage of PIS becomes more pronounced as the dimension increases. Although the estimation problem becomes more challenging for all methods in higher dimensions, PIS maintains a lower RMSE and appears more stable than SNIS and PSIS, especially in higher dimensions.
Next, we use this Gaussian example to study the task of estimating a target tail probability:
Since is binary, we use a Bernoulli-likelihood GP to estimate the conditional probability .
Figure 5 presents the RMSE of the tail probability estimate with varying . In the light-tail case, PIS is consistently at least as good as PSIS and typically improves over both SNIS and PSIS, specifically in the high dimensional setting. In the moderate-tail regime ( ), the importance weights have infinite variance, so the standard Monte Carlo rate is no longer guaranteed. In the heavier-tail regime ( ), the tail index exceeds the usual PSIS diagnostic threshold of 0.7, a regime traditionally regarded as a practical no-go zone for importance sampling. In both moderate- and heavy-tail regimes, all RMSE curves flatten, suggesting slower convergence for all methods. Nevertheless, PIS maintains substantially lower RMSE across the sample sizes and dimensions considered.

Figure 4: RMSE of the estimated under different tail heaviness and dimensions. PIS exhibits a larger gain in higher-dimensional tasks.
4.3. Leave-one-out log predictive density, interval score, and coverage
Leave-one-out (LOO) cross-validation is widely used to evaluate the predictive performance of Bayesian models (Vehtari et al., 2017). Exact LOO evaluation requires refitting the model after removing each observation, which can be computationally expensive. Importance sampling avoids these repeated fits by reweighting draws from the full-data posterior toward the LOO posterior , using weights
However, these weights can be heavy-tailed when is influential, making direct importance sampling unstable and potentially leading to infinite-variance estimators. We use full-posterior draws to estimate various LOO model evaluation metrics.
-
leave-one-out probability integral transformation (PIT, Tesso and Vehtari, 2026), .
-
leave-one-out log predictive density ;

Figure 5: RMSE of the estimated under different tail regimes.
-
leave-one-out predictive coverage probability of an interval ;
-
leave-one-out interval score (Gneiting and Raftery, 2007) for the quantile interval;
These evaluation metrics assess complementary aspects of predictive performance: local predictive accuracy, predictive coverage, and the joint calibration and sharpness of predictive intervals. We compare direct importance sampling, PSIS, and PIS, measuring their performance by squared error relative to the exact LOO. For the precise definitions, see Appendix B.
These metrics also represent interesting cases for the conditional mean model in PIS. For LOO log predictive density, is a known, deterministic function of the importance ratio , so is available exactly without regression. PIS therefore only needs to estimate the marginal weight density and perform one-dimensional quadrature. The other three metrics involve predictive event probabilities, which we estimate using binary indicators from posterior predictive draws and Bernoulli-likelihood GP regression. For the interval score, we first estimate the predictive CDF and invert it to obtain the required quantiles.
For an analytically tractable LOO benchmark, consider a Gaussian model with likelihood . We fix one held-out observation . Suppose that the true LOO posterior, conditional on the remaining observations, is . The available full-data posterior is . The importance weight is the inverse-likelihood , which has a Pareto tail index under the full-data posterior and hence infinite variance. Figure 6 shows that PIS achieves the lowest RMSE for all four predictive metrics. The improvement is particularly pronounced for log predictive densities and interval scores, where ordinary importance sampling is highly unstable.

Figure 6: We use importance weighting to approximate leave-one-out metrics, including the probability integral transformation, log predictive density, coverage for a fixed interval [-2.6, 2.6], and the interval score for (0.05, 0.95) quantiles. In this Gaussian likelihood example, PIS generally outperforms PSIS and IS.
4.4. Calibrating approximate inference
When approximate inference is used for Bayesian posterior computation, it is often desirable to correct the approximation error (e.g., Agrawal et al., 2020; Goplerud, 2022). Importance sampling provides a natural calibration by reweighting draws from an approximate posterior toward the target . However, this correction can be unstable, especially when is lighter-tailed, as is common for variational approximation.
This application provides a realistic but challenging benchmark for proposal and target distributions. To evaluate PIS in this setting, we run variational inference on a collection of Stan models from PosteriorDB (Magnusson et al., 2024). For each model, we fit a mean-field variational approximation, use its draws as proposal samples, and compare the estimates of the target posterior expectations obtained from direct importance sampling, PSIS, and PIS, where their performance is measured by the squared error relative to a long-run MCMC.
Figure 7 compares IS, PSIS, and PIS across PosteriorDB models with varying degrees of target-proposal mismatch. For the ARMA model, the importance weights are light-tailed, and PIS offers only modest gains. For eight_schools and GARCH, PIS substantially reduces estimation error, especially as the sample size increases. For Wells, the extremely heavy tails limit the rate of improvement. Finally, in the basketball HMM, mean-field VI fails to capture the typical set, leaving all three methods with persistent bias. This failure mode illustrates a limitation of PIS: severe target-proposal mismatch cannot necessarily be corrected by poststratification.
Posterior-mean error after calibrating mean-field VI

Figure 7: Posterior-mean estimation error after calibrating mean-field variational approximations for five PosteriorDB models.
4.5. Uncertainty quantification
Reliable importance sampling requires not only accurate point estimates but also uncertainty intervals with appropriate coverage. PIS directly reports the Bayesian posterior distribution of the mean estimate. We study the same Gaussian proposal and target in Sec 4.2. We use IS, PSIS, and PIS to estimate the expectation and its confidence interval. We repeat the simulations and evaluate the empirical coverage of the reported confidence intervals.
Coverage calibration at S = 10,000 (d = 32)

Figure 8: Empirical versus nominal coverage for intervals from three methods. Perfect calibration is the diagonal line.
As a caveat, PIS reports Bayesian credible intervals, which are not guaranteed to achieve nominal frequentist coverage. Nevertheless, Figure 8 evaluates this frequentist calibration at and . When , all three methods are approximately calibrated. When , the confidence intervals from SNIS and PSIS are severely overconfident, whereas PIS remains close to the ideal calibration.
Figure 9 reports the mean interval score for the reported 90% confidence interval, which penalizes both interval width and failure to cover the true expectation. Lower scores indicate a better
Interval score at nominal level 90% (d = 32)

Figure 9: Mean interval score for nominal 90% intervals as a function of sample size at d = 32.
overall trade-off between confidence interval sharpness and coverage. At , all methods improve with sample size and perform similarly, with a small advantage for PIS. At , PIS exhibits a significant advantage, while PSIS improves upon SNIS but remains considerably worse than PIS. Together, these results suggest that PIS improves not only point estimation but also uncertainty quantification, particularly in heavy-tailed settings where conventional importance sampling standard error becomes unreliable.
5. Discussion
5.1. Heuristics from survey sampling
Importance weighting (2) has a direct analog in survey sampling. In an observational study where the survey subjects differ from the population of interest, two orthogonal approaches exist to adjust for the population mismatch. The first approach, inverse-probability weighting, reweighs sampled outcomes using inverse inclusion probabilities, which is effectively importance sampling from the survey population to the target.
An alternative strategy in survey sampling is multilevel regression and poststratification (MRP, Little, 1993; Gelman and Little, 1997). MRP groups the survey observations into strata or cells defined by demographic features (such as age, gender, state, education), and then sums over estimated strata-level outcomes. Concretely, let denote an individual survey outcome such as voting preference, and denote demographic variables. MRP uses a similar law of total expectation identity:
As the name suggests, MRP performs two steps: (i) fit a model-based, typically multilevel regression to estimate to the survey observations, and (ii) average over , the population distribution of demographic , typically known from a census table. It is not surprising that MRP has become a workhorse in survey sampling, with applications such as in political science (Lax and Phillips, 2009), opinion polling (Ghitza and Gelman, 2013; Wang et al., 2015), and epidemiology (Gelman and Carpenter, 2020; Covello et al., 2021). It is perhaps more surprising that this conditional-modeling framework (20) was not fully developed for the general importance sampling problem—Our present paper takes this step.
Despite the shared heuristic, our paper is not a direct application of MRP to statistical computing. First, the MRP poststratification variables are externally chosen, often discrete, and their target population distribution is typically known from a census table. PIS instead conditions on the scalar importance ratio while its target distribution needs to be estimated. Second, the identity of MRP (20) relies on a non-testable ignorability assumption: conditional on the poststratification variables, sample inclusion is assumed to be independent of the outcome. In contrast, the analogous conditional invariance in PIS is by construction (Thm. 1). Third, in PIS the weight is a deterministic function of , so that mathematically the PIS identity (4) requires a geometric measure theoretic formulation. Though conceptually more involved than MRP, it enables score-based marginal density estimation. Lastly, other than the empirical evidence (e.g., Downes et al., 2018), formal theory comparing MRP with weighting remains limited. Our theoretical analysis quantifies the gains from conditional modeling over direct weighting in importance sampling, and may in turn motivate analogous theory in survey sampling.
5.2. Relation to other importance sampling methods
Regularized importance sampling. There is an existing line of research on stabilizing importance sampling by regularizing the realized weights, and many of the proposed methods can now correspond to particular model choices in the PIS framework. Examples include truncated importance sampling (Ionides, 2008) and Pareto-smoothed importance sampling (PSIS; Vehtari et al., 2024). PSIS stabilizes importance sampling by fitting a generalized Pareto distribution to the tail of the observed importance ratios and replacing the largest few raw weights with expected order statistics. This tail modeling in PSIS inspires the same generalized Pareto transformation in our density architecture. Rather than smoothing only the largest weights, PIS estimates a full generative model of , including both the bulk and tail. In light of the general PIS framework, PSIS corresponds to using an interpolating estimate of the conditional mean , while modeling the marginal of by an empirical distribution in the bulk and a generalized Pareto approximation in the tail. Given that PSIS is currently used as the state-of-the-art weighting tool in the current Bayesian workflow (Gelman et al., 2020), our empirical comparisons treat PSIS as the primary baseline, and we generally find that our model-based PIS improves upon PSIS in both accuracy and uncertainty assessment.
Adaptive proposal construction. The term post-stratified in our method emphasizes that the sampling distribution is taken as given, in the same sense that post-stratification in survey sampling makes inference after a survey has already been collected rather than drawing a new survey. Likewise, PIS aims to improve the reweighting task when the proposal is fixed. This setting often arises in Bayesian computation: the proposal may be an existing posterior sample reused for cross-validation, or a variational sample in an approximate inference correction. However, in other settings when one can instead design the proposal and generate additional samples therein, an orthogonal line of research seeks to construct or adapt so that the resulting weighting task can be easier. Examples to design a better include mixture proposals (Owen and Zhou, 2000; Silva and Zanella, 2024), adaptive and population Monte Carlo (Cappé et al., 2008; Cornuet et al., 2012; Bugallo et al., 2017; Elvira et al., 2019), target-aware split proposal (Rainforth et al., 2020), umbrella sampling (Dinner et al., 2020), variational inference with chi squared divergence (Dieng et al., 2017) or importance weighted divergence (Domke and Sheldon, 2018), and affine transformation to match moments (Paananen et al., 2021). Combining proposal adaptation with PIS is a natural direction for future work: adaptation improves the proposal sample, while PIS improves inference given that sample.
5.3. Why condition on the importance ratio?
PIS conditions on the importance ratio . In principle, we can extend this framework to allow any conditioning variables , in the tower identity
Choosing ensures conditional invariance,
for every integrable , so the conditional expectation under can be learned from proposal draws without additional weighting.
Theorem 1 indicates that any conditioning variable with this invariance property must determine : there exists a measurable function such that almost surely. Thus, is the coarsest conditioning variable with this property up to a transformation.
5.4. Limitations and future work
As an approximation method, PIS has limitations and failure modes. First, our current PIS formulation assumes that the target and proposal densities and are smooth and have full support on . While it covers many continuous Bayesian models that we are interested in, it excludes settings with discrete parameters, bounded or truncated supports, or piecewise-constant approximations. When the support is discrete or truncated, the same PIS identity still holds, but the marginal density of would need to be replaced by a discrete or mixed discrete-continuous estimate. We avoid this generality in the present paper for brevity.
Second, the present paper focuses on expectations. This task is distinct from importance resampling (Rubin, 1987), which aims to generate approximate target draws from the available proposal draws. Importance resampling carries the same instability as importance weighting: a few realized draws with large weights can dominate the resampled population. Moreover, the resulting sample has fixed support on the original proposal draws. It is a promising direction to extend PIS to the generative sampling task, which would require modeling the conditional law of , and is left for future work.
Third, as in much of the importance sampling literature, we have assumed IID proposal draws. If instead they were obtained by MCMC, autocorrelation can bias both the regression estimate and the marginal-density estimate . Before PIS is extended to dependent sampling in future work, thinning is recommended before using PIS when autocorrelation is severe.
Lastly, the one-dimensionality of PIS does not fully eliminate the curse of dimensionality. Although PIS reduces the task to estimating the one-dimensional functions and , the quality of these estimates still depends on the proposal sample generated in the original -dimensional space. When the dimension is high, or when the proposal severely mismatches the target, this dependence can appear in three ways: (a) The marginal distribution may become increasingly heavy-tailed, making the marginal density harder to estimate; (b) When the heavy tail is represented by only a few observed proposal draws, the regression estimate locally relies on model extrapolation and prior regularization, and may exhibit a large uncertainty; (c) When is heavy-tailed, the integrand can decay slowly, so the numerical integration may require a wider and denser quadrature grid in the tail to control the truncation error.
Looking forward, the development of PIS represents an instance of bringing the Bayesian modeling workflow (Gelman et al., 2020) into Monte Carlo computation. This echoes a longstanding critique of conventional Monte Carlo integration (O'Hagan, 1987): despite its universal applicability, its averaging rule does not adapt to the observed integrand or exploit its underlying structure. More broadly, this reflects a contrast between the two cultures in statistics (Gelman, 2021): simple-form-for-robustness versus model-as-much-as-you-can. Conventional IS is not entirely model-free: within the PIS framework, it implicitly uses an empirical weight distribution and an unsmoothed conditional mean. PIS makes these modeling choices explicit, allowing them to be regularized, checked, and iteratively improved through the modeling workflow. We believe this modeling perspective can also benefit other computational methods traditionally treated as fixed algorithms.
References
Agrawal, A., Sheldon, D. R., and Domke, J. (2020). Advances in black-box VI: Normalizing flows, importance weighting, and optimization. Advances in Neural Information Processing Systems, 33:17358–17369.
Atkinson, K. E. (1989). An Introduction to Numerical Analysis. John Wiley & Sons, 2 edition.
Bugallo, M. F., Elvira, V., Martino, L., Luengo, D., Miguez, J., and Djuric, P. M. (2017). Adaptive importance sampling: The past, the present, and the future. IEEE Signal Processing Magazine, 34(4):60–79.
Burda, Y., Grosse, R., and Salakhutdinov, R. (2016). Importance weighted autoencoders. In International Conference on Learning Representations.
Bürkner, P.-C., Gabry, J., and Vehtari, A. (2020). Approximate leave-future-out cross-validation for Bayesian time series models. Journal of Statistical Computation and Simulation, 90(14):2499–2523.
Cappé, O., Douc, R., Guillin, A., Marin, J.-M., and Robert, C. P. (2008). Adaptive importance sampling in general mixture classes. Statistics and Computing, 18:447–459.
Chatterjee, S. and Diaconis, P. (2018). The sample size required in importance sampling. Annals of Applied Probability, 28(2):1099–1135.
Chopin, N. (2002). A sequential particle filter method for static models. Biometrika, 89(3):539–552.
Cornuet, J.-M., Marin, J.-M., Mira, A., and Robert, C. P. (2012). Adaptive multiple importance sampling. Scandinavian Journal of Statistics, 39(4):798–812.
Covello, L., Gelman, A., Si, Y., and Wang, S. (2021). Routine hospital-based SARS-CoV-2 testing outperforms state-based data in predicting clinical burden. Epidemiology, 32(6):792–799.
Dieng, A. B., Tran, D., Ranganath, R., Paisley, J., and Blei, D. M. (2017). Chi-divergence variational inference. In Advances in Neural Information Processing Systems.
Dinner, A. R., Thiede, E. H., Van Koten, B., and Weare, J. (2020). Stratification as a general variance reduction method for Markov chain Monte Carlo. SIAM/ASA Journal on Uncertainty Quantification, 8(3):1139–1188.
Domke, J. and Sheldon, D. R. (2018). Importance weighting and variational inference. In Advances in Neural Information Processing Systems, volume 31.
Doucet, A., De Freitas, N., and Gordon, N. (2001). An introduction to sequential Monte Carlo methods. In Sequential Monte Carlo Methods in Practice, pages 3–14. Springer.
Downes, M., Gurrin, L. C., English, D. R., Pirkis, J., Currier, D., Spittal, M. J., and Carlin, J. B. (2018). Multilevel regression and poststratification: a modeling approach to estimating population quantities from highly selected survey samples. American Journal of Epidemiology, 187(8):1780–1790.
Elvira, V., Martino, L., Luengo, D., and Bugallo, M. F. (2019). Generalized multiple importance sampling. Statistical Science, 34(1):129–155.
Elvira, V., Martino, L., and Robert, C. P. (2022). Rethinking the effective sample size. International Statistical Review, 90(3):525–550.
Evans, L. C. and Gariepy, R. F. (2015). Measure Theory and Fine Properties of Functions. CRC Press.
Gelfand, A. E., Dey, D. K., and Chang, H. (1992). Model determination using predictive distributions with implementation via sampling-based methods. Bayesian Statistics, 4:147–167.
Gelman, A. (2021). Reflections on breiman's two cultures of statistical modeling. Observational Studies, 7(1):95–98.
Gelman, A. and Carpenter, B. (2020). Bayesian analysis of tests with unknown specificity and sensitivity. Journal of the Royal Statistical Society Series C, 69(5):1269–1283.
Gelman, A. and Little, T. (1997). Poststratification into many categories using hierarchical logistic regression. Survey Methodology, 23:127.
Gelman, A., Vehtari, A., Simpson, D., Margossian, C. C., Carpenter, B., Yao, Y., Kennedy, L., Gabry, J., Bürkner, P.-C., and Modrák, M. (2020). Bayesian workflow. arXiv preprint arXiv:2011.01808.
Geweke, J. (1989). Bayesian inference in econometric models using Monte Carlo integration. Econometrica, 57(6):1317–1339.
Ghitza, Y. and Gelman, A. (2013). Deep interactions with MRP: Election turnout and voting patterns among small electoral subgroups. American Journal of Political Science, 57(3):762–776.
Ghosal, S., Ghosh, J. K., and Ramamoorthi, R. V. (1999). Posterior consistency of dirichlet mixtures in density estimation. The Annals of Statistics, 27(1):143–158.
Gneiting, T. and Raftery, A. E. (2007). Strictly proper scoring rules, prediction, and estimation. Journal of the American Statistical Association, 102(477):359–378.
Goplerud, M. (2022). Fast and accurate estimation of non-nested Binomial hierarchical models using variational inference. Bayesian Analysis, 17(2):623–650.
Greengard, P. (2025). Efficient Fourier representations of families of Gaussian processes. SIAM Journal on Scientific Computing, 47(2):A971–A990.
Greengard, P., Rachh, M., and Barnett, A. H. (2025). Equispaced Fourier representations for efficient Gaussian process regression from a billion data points. SIAM/ASA Journal on Uncertainty Quantification, 13(1):63–89.
Hickling, T. and Prangle, D. (2025). Flexible tails for normalizing flows. In International Conference on Machine Learning.
Hooten, M. B., Johnson, D. S., and Brost, B. M. (2021). Making recursive Bayesian inference accessible. The American Statistician, 75(2):185–194.
Ionides, E. L. (2008). Truncated importance sampling. Journal of Computational and Graphical Statistics, 17(2):295–311.
Kallenberg, O. (2002). Foundations of Modern Probability. Springer, New York, 2 edition.
Kallioinen, N., Paananen, T., Bürkner, P.-C., and Vehtari, A. (2024). Detecting and diagnosing prior and likelihood sensitivity with power-scaling. Statistics and Computing, 34(57).
Koepernik, P. and Pfaff, F. (2021). Consistency of gaussian process regression in metric spaces. Journal of Machine Learning Research, 22(244):1–27.
Kong, A. (1992). A note on importance sampling using standardized weights. Technical Report, University of Chicago.
Lax, J. R. and Phillips, J. H. (2009). How should we estimate public opinion in the states? American Journal of Political Science, 53(1):107–121.
Little, R. J. A. (1993). Post-stratification: A modeler's perspective. Journal of the American Statistical Association, 88(423):1001–1012.
Magnusson, M., Andersen, M. R., Jonasson, J., and Vehtari, A. (2019). Bayesian leave-one-out cross-validation for large data. In International Conference on Machine Learning, volume 97, pages 4244–4253.
Magnusson, M., Torgander, J., Bürkner, P.-C., Zhang, L., Carpenter, B., and Vehtari, A. (2024). posteriordb: Testing, benchmarking and developing Bayesian inference algorithms. arXiv preprint arXiv:2407.04967.
O'Hagan, A. (1987). Monte Carlo is fundamentally unsound. Journal of the Royal Statistical Society D, 36(2-3):247–249.
Owen, A. B. and Zhou, Y. (2000). Safe and effective importance sampling. Journal of the American Statistical Association, 95(449):135–143.
Paananen, T., Piironen, J., Bürkner, P.-C., and Vehtari, A. (2021). Implicitly adaptive importance sampling. Statistics and Computing, 31(2):16.
Peruggia, M. (1997). On the variability of case-deletion importance sampling weights in the Bayesian linear model. Journal of the American Statistical Association, 92(437):199–207.
Rainforth, T., Cornish, R., Yang, H., Warrington, A., and Wood, F. (2020). Target-aware Bayesian inference: How to beat optimal conventional estimators. Journal of Machine Learning Research, 21(88):1–54.
Rubin, D. B. (1987). A noniterative sampling/importance resampling alternative to the data augmentation algorithm for creating a few imputations when fractions of missing information are modest: The SIR algorithm. Journal of the American Statistical Association, 82(398):543–546.
Silva, L. A. and Zanella, G. (2024). Robust leave-one-out cross-validation for high-dimensional Bayesian models. Journal of the American Statistical Association, 119(547):2369–2381.
Smith, A. F. M. and Gelfand, A. E. (1992). Bayesian statistics without tears: A sampling-resampling perspective. The American Statistician, 46(2):84–88.
Tesso, H. and Vehtari, A. (2026). LOO-PIT predictive model checking. arXiv 2603.02928.
Tokdar, S. T. (2006). Posterior consistency of dirichlet location-scale mixture of normals in density estimation and regression. Sankhyā: The Indian Journal of Statistics, 68(1):90–110.
Vehtari, A., Gabry, J., Magnusson, M., Yao, Y., Bürkner, P.-C., Paananen, T., and Gelman, A. (2025). loo: Efficient leave-one-out cross-validation and WAIC for Bayesian models. R package version 2.9.0.
Vehtari, A., Gelman, A., and Gabry, J. (2017). Practical Bayesian model evaluation using leave-one-out cross-validation and WAIC. Statistics and Computing, 27(5):1413–1432.
Vehtari, A., Simpson, D., Gelman, A., Yao, Y., and Gabry, J. (2024). Pareto smoothed importance sampling. Journal of Machine Learning Research, 25(72):1–58.
Wang, W., Rothschild, D., Goel, S., and Gelman, A. (2015). Forecasting elections with non-representative polls. International Journal of Forecasting, 31(3):980–991.
Yadav, M., Sheldon, D., and Musco, C. (2021). Faster kernel interpolation for Gaussian processes. In International Conference on Artificial Intelligence and Statistics, pages 2971–2979.
Yao, Y., Vehtari, A., Simpson, D., and Gelman, A. (2018a). Using stacking to average bayesian predictive distributions (with discussion). Bayesian Analysis.
Yao, Y., Vehtari, A., Simpson, D., and Gelman, A. (2018b). Yes, but did it work?: Evaluating variational inference. In International Conference on Machine Learning, pages 5581–5590. PMLR.
Appendix
A. Proofs
Overview of the consistency results and proofs: Theorem 3 gives a general result: it assumes consistent estimation of the regression function and the importance ratio density, together with the regularity conditions required for numerical integration, and establishes consistency of the PIS estimator. The proof has three steps. For a fixed truncation threshold , the first step decomposes the error of the truncated PIS estimator into regression, density estimation, and quadrature errors, and shows that each term vanishes as the sample size grows and the quadrature is refined. The second step shows that the truncation bias vanishes as tends to infinity. The third step combines these two limits through a diagonal argument, showing that deterministic sequences of thresholds and numbers of quadrature points can always be chosen so that the resulting estimator is consistent.
Lemma 4 verifies the conditions of Theorem 3 for the specific regression and density models used in our empirical study on a compact domain. We model by a Gaussian process and estimate using a Dirichlet process mixture of truncated-normal densities. For the Gaussian process, we assume Gaussian noise, a continuous prior mean, standard regularity conditions on the covariance kernel. Then Theorem 8 of Koepernik and Pfaff (2021) gives uniform consistency of the posterior mean on the compact domain. For the density model, we assume that is continuous and positive on the compact domain, with a truncated-normal prior on component locations and an upper-truncated inverse-gamma prior on component variances. Following Theorem 2 of Ghosal et al. (1999), we verify three sufficient conditions. First, the prior can approximate the true density arbitrarily well. Second, it assigns exponentially small probability to mixtures containing too much mass at extremely small scales. Third, after excluding these near-zero component scales, the remaining mixture class is not too large; this follows from the covering argument of Tokdar (2006). These conditions give consistency of the posterior-mean density and thereby verify all assumptions required by the first theorem.
Theorem 5 treats unbounded importance ratios with and the empirical threshold . The Gaussian process posterior mean is consistent on every fixed compact interval. A separate argument establishes consistency of the posterior mean bulk density at this empirical threshold. Since , the fitted tail does not affect this density consistency result. The diagonal argument of Theorem 3 then gives deterministic integration cutoffs and quadrature sizes for which the PIS estimator is consistent.
Finally, Theorem 4 extends the result to unnormalized densities through self-normalization. Theorem 3 gives convergence of the numerator and denominator to and , respectively, so Slutsky's theorem gives convergence of their ratio to .
A.1. Quadrature error analysis
To reflect the challenge of Monte Carlo in heavy-tailed distributions, we assume that the importance weight has a generalized Pareto tail above , with shape and scale . Suppose is twice continuously differentiable on the bulk and is twice continuously differentiable in the tail, with for and . With and known, a tail-adapted trapezoidal rule using nodes then gives
This deterministic integration rate is faster than the root mean squared error of oracle MC-PIS based on independent proposal draws, provided . The comparison concerns only integration; the error from estimating and is analyzed next.
Assume that has an exact generalized Pareto tail above a fixed threshold , with shape and scale . On , we assume that has a continuous and bounded second derivative, with its value at defined by the limit from the left. On , we assume that is twice continuously differentiable and, for some ,
where controls the growth or decay of m in the tail.
We split the integral at and apply the change of variables for . The idea is to turn the infinite tail into a finite interval and make the transformed integrand smooth at the boundary point . The parameter controls how strongly the tail is compressed. It suffices to choose
Then
Write the transformed tail integrand as
and define its endpoint values by
The limit at exists under the stated assumptions. We justify the extension at u = 0 below.
We approximate both integrals by the trapezoidal rule on uniform grids, with an even number L of nodes in total, divided equally between the two intervals:
At the splitting point , the bulk and tail rules use their respective one-sided endpoint values; the two density components need not agree there.
We need to show that the transformed integrand has limit zero as , so it extends continuously to . For all sufficiently small , the tail assumptions give, for constants independent of and ,
All three exponents are positive by our choice of . Thus, setting gives a continuous extension to , with .
Under the stated derivative assumptions, both integrands are continuous on their respective compact intervals, and , and have bounded second derivatives in the interiors. By the error bound for the composite trapezoidal rule, each quadrature error is , which results in
A.2. Theorem 1
Proof. For part (1), since , the conditional change-of-measure identity gives
Because is measurable,
Since , we obtain, almost surely,
For part (2), by the conditional change-of-measure identity,
Set . The assumed equality of the conditional expectations implies
Since is -measurable, this is equivalent to, for every bounded measurable function ,
Take . Then
The random variable inside the conditional expectation is nonnegative, so almost surely. Therefore, almost surely. Moreover,
Thus, almost surely, where is -measurable.
Fact 1 (Doob–Dynkin lemma (Kallenberg, 2002, Lemma 1.13)). Let and be measurable. Then has a -measurable version if and only if there exists a Borel-measurable function such that almost surely.
Apply the Doob–Dynkin lemma to the -measurable version of . There exists a Borel-measurable function such that almost surely.
A.3. Theorem 2
Proof. For any Borel set ,
Since it holds for any Borel set ,
For any Borel set ,
Since it holds for any Borel set ,
□
A.4. Theorem 3
Proof. The proof consists of three steps: consistency at every fixed truncation , vanishing truncation bias, and an explicit choice of .
Step 1: compact domain. Fix . For this fixed , define the truncated PIS estimator and its population counterpart by:
Adding and subtracting and using ,
(21)
For the regression term, using and plugging in condition (i),
For the density term, plugging in conditions (ii) and ,
For the quadrature term, for each fixed , since the product of Riemann integrable functions is Riemann integrable on , so the quadrature error converges to zero almost surely, hence in probability, as (Atkinson, 1989, Chapter 5):
(24)
Hence, we may choose a deterministic integer such that
Therefore, substituting Eq. (22), (23), and (24) into Eq. (21) results in
Step 2: truncation bias. Since and , Jensen's inequality and dominated convergence theorem, with ,
Step 3: growing domain. By Step 2, choose a deterministic sequence such that
For each , Step 1 allows us to choose a deterministic sequence and strictly increasing deterministic integers such that, for every ,
For , set , , and . Then and . Moreover, on the th block, by triangle inequality and Eq. (25),
According to Eq. (27), the event implies . Using monotonicity of probability measure, along with Eq. (26), gives
As , the corresponding block index also tends to infinity. Hence, for every , eventually . As a result,
Therefore, .
□
A.5. Lemma 3
Proof. The tail assumption and the intermediate order statistic give
Fix . On , with probability tending to one, and the first assumption gives convergence of the fitted integral to .
For the fitted bulk above R,
The fitted generalized Pareto tail has mean excess . Hence its contribution, including the factor , is bounded in probability by a constant times
Finally, almost surely, and implies
Letting proves convergence of the fitted integral over to .
For each fixed , Riemann integrability makes its trapezoidal error converge to zero as . We can therefore choose deterministic so that this error is .
A.6. Lemma 4
Lemma 4 (Consistency for bounded importance ratio). Assume , the distribution of has support and is continuous on . Assume the following:
(i) Gaussian process regression. The observations satisfy , where independently of , and is known.
Put the prior , where is continuous and is a continuous, nondegenerate, locally Lipschitz covariance kernel on with .
(ii) Density estimation. Assume that the density of is continuous and positive on with . In Definition (12), let , where and for some .
Then there exists a deterministic sequence of integers such that the PIS estimator is consistent,
Proof. The proof proceeds in two parts, addressing regression and density estimation, respectively.
Regression consistency. Since is continuous on , are independent draws whose distribution has full support on . Therefore, condition (i) and Theorem (8) of Koepernik and Pfaff (2021) give convergence in the supremum norm,
Consequently, Eq. (28) implies convergence and uniform convergence in probability
Since is continuous, , and every RKHS function associated with a continuous kernel is continuous, we have that is continuous. By the extreme-value theorem, . Applying triangle inequality, along with Eq. (30), gives
Moreover, since the GP posterior mean is, conditional on the data, a finite linear combination of the continuous functions , it is continuous on .
Density consistency. We first consider estimation of the bulk density on . To establish consistency, we verify the three technical conditions of Theorem (2) of Ghosal et al. (1999): belongs to the Kullback–Leibler support of the DPM prior, the prior probability outside an appropriate sieve is exponentially small, and the sieve has metric entropy.
We first verify that belongs to the Kullback–Leibler support of the DPM prior. For each , define
As , the truncated-normal density concentrates at . Therefore, at every interior point ,
Since is continuous and strictly positive on , it is bounded above and away from zero. Moreover, for every fixed , the normalizing probability of the truncated-normal kernel is uniformly bounded away from zero over and . The same holds, by symmetry, when the normal kernel is integrated with respect to . Consequently, there exist constants such that, for every and ,
Hence, by the dominated convergence theorem,
Because assigns positive probability to every region of the location-scale parameter space, the Dirichlet-process prior assigns positive probability to mixing distributions arbitrarily close to the one that generates . Thus, belongs to the Kullback–Leibler support of the DPM prior.
Next, we verify that the prior probability outside the sieve is exponentially small. Let denote the number of bulk observations and choose for some . Fix a posteriori neighborhood radius and set . Consider the sieve
Since has an upper-truncated InvGamma distribution, a Chernoff bound applied to gives, for all sufficiently small , with and ,
Markov's inequality and Eq. (31) give
Thus, Eq. (32) shows that the prior probability outside the sieve decreases exponentially.
Finally, we verify the entropy condition. For each mixing distribution in the sieve, let be its restriction to , normalized to have mass one. Since the excluded mass is at most ,
Thus, a -cover of the mixtures with component scales at least gives a -cover of . The normalizing constants of the truncated-normal kernels are uniformly bounded away from zero, so the covering argument of Lemmas 4.1 and 4.2 of Tokdar (2006) gives
Since , this entropy bound, Eq. (32), and the Kullback–Leibler support condition satisfy the assumptions of Theorem 2 of Ghosal et al. (1999). Therefore, for every ,
Consequently, by the triangle inequality,
Since is arbitrary,
Since , there is no tail component. Therefore, and , and hence
Quadrature consistency. is continuous on . Since is continuous, is Riemann integrable on . Therefore, for every fixed ,
Thus, by the fixed-domain argument of Theorem (3), there exists a deterministic sequence of integers such that
Since is the support of , . Therefore,
□
A.7. Theorem 4
Proof. Since and , the fixed domain argument in the proof of Theorem 3 applies to both integrals. We choose each truncation threshold and grid size so that the errors of both integrals vanish; a union bound gives the required joint convergence. Thus, for these same and ,
Since , Slutsky's theorem gives
□
A.8. Theorem 5
Proof. We establish regression and density consistency on fixed compact intervals, then use the diagonal argument of Theorem 3 to choose the integration cutoff and quadrature grid.
Regression consistency. Since the are independent draws from a distribution with full support on , every open interval contains infinitely many observations almost surely. Moreover, is separable and -compact, and the local Lipschitz condition on gives the required kernel entropy condition on every compact interval. Therefore, Theorem (8) of Koepernik and Pfaff (2021) gives, for every fixed ,
It follows from Eq. (34) that
Furthermore, Eq. (34) gives , and is continuous on compact intervals.
Density consistency. Since and has unbounded support, almost surely.
We first control the variation of the fitted bulk density. Conditional on the component assignments and means, the precision posteriors are stochastically dominated by a Gamma distribution with shape and rate , restricted to . Indeed, the truncated normal normalizing constant increases with the precision, so its inverse powers can only decrease the precision relative to this Gamma law. The conditional Dirichlet process posterior mean formula therefore gives
Consequently,
On every fixed interval , the variation of is bounded by . Thus, outside a set of vanishing posterior probability, this variation is at most . The bounded contrasts
then satisfy a uniform law of large numbers on . To justify this, first approximate uniformly by a smooth function on this interval. The resulting contrasts have bounded range and variation . Brackets formed from intervalwise infima and suprema have arbitrarily small integrated width and logarithmic cardinality , so Hoeffding's inequality gives the uniform law. Since the contrasts are bounded, removal of the largest observations does not affect this conclusion.
For every bulk density,
Fix . Choose sufficiently large that the probability outside is small compared with . For sufficiently small , a normalized finite mixture of the same truncated normal kernels can have density at least throughout , uniformly for sufficiently large . The stick breaking representation allows these components to be added before an independent Dirichlet process remainder, with both the added mass and the remaining mass close to . The favorable component and weight neighborhoods have prior probability at least , uniformly for sufficiently large .
The inequality
and the uniform law above show that this augmentation increases the likelihood by at least whenever and , on an event whose probability tends to one. The loss outside is bounded because the original mixture remains with mass close to .
Before restriction to the favorable component and weight neighborhoods, the augmented mixing distribution has exactly the original Dirichlet process prior law. Restriction to these neighborhoods therefore gives a subprobability measure dominated by that prior. On the event where the likelihood bound holds, integration gives
Since the distance between two densities is at most two, the posterior mean satisfies
Finally, and
In particular, for every fixed ,
Together with Eq. (35) and compact boundedness in probability of , this gives
Moreover,
The diagonal argument of Theorem 3 therefore gives a deterministic sequence such that
Since almost surely, we can choose sufficiently slowly that .
The posterior inverse-scale moment bound and dominated convergence give continuity of on . Thus, on , the fitted integrand is continuous on , and its trapezoidal approximation converges as the grid size increases. We can therefore choose deterministic integers so that the quadrature error tends to zero in probability. Consequently,
□
B. Experiment details
In the LOO approximation, we consider the following LOO model evaluation metrics: For each observation , let denote the leave-one-out posterior predictive CDF. Given draws , the LOO predictive CDF can be estimated as
where is the conditional predictive CDF. Equivalently, can be replaced by using predictive draws.
LOO probability integral transform. The LOO-PIT value is
Using draws , its importance-sampling estimator is
LOO log predictive density. The pointwise LOO log predictive density is
Using draws , its importance-sampling estimator is
LOO predictive coverage. Using the estimated LOO predictive CDF , define the estimated central predictive interval by , and . Its theoretical coverage probability is
Using the estimated LOO predictive CDF , define , and . The LOO predictive coverage of the estimated interval is
We assess the estimated interval by comparing with its nominal coverage . In our Gaussian experiment, is known analytically and is used only for this evaluation.
LOO interval score. Using the central LOO predictive interval and , the pointwise LOO interval score is
Unlike the preceding quantities, the interval score requires estimating the predictive quantiles. Using the importance-sampling estimate , define and . The estimated LOO interval score is then