arXiv:2609.08172stat.COSep 2026

Manuscript Offprint

arXiv:2609.08172

Optimal Slice-Adaptive Tuning of Hybrid Slice Sampling

Trevor Campbell

BY TREVOR CAMPBELL¹,ª

¹Department of Statistics, UBC, a.trevor@stat.ubc.ca

Slice sampling is a Markov chain Monte Carlo algorithm that draws its next state uniformly from a “slice”—a super-level set of the target density function—at each iteration, thereby providing automatic local adaptivity to the scale of the target. In practice the exact slice is not known, so general-purpose implementations use an approximate slice that is grown from a starting interval of length w>0w > 0, with a computational cost that depends on ww. This work presents an analysis of the average per-iteration number of target density evaluations, as a function of ww, of hybrid slice sampling with various slice-finding schemes for targets with contiguous slices. The paper uses the results of the analysis to develop automated, slice-adaptive tuning schemes along with suboptimality bounds and asymptotic convergence guarantees. Simulations demonstrate that the tuning schemes reliably yield near-optimal slice-adaptive tuning with essentially no dependence on the initial setting of ww.

  1. Introduction. Markov chain Monte Carlo is a commonly-used tool for computational Bayesian inference. Standard methods typically involve a fixed scale parameter that determines the size of typical movements, e.g., the step size in random-walk Metropolis–Hastings [13, 28], Metropolis-adjusted Langevin algorithm [45], and Hamiltonian Monte Carlo [5, 40]. In general, it is nontrivial to set the scale for even just a single well-behaved target, let alone for distribution sequence targets (e.g., in annealed importance sampling [18, 19, 36, 38] and parallel tempering [9, 17, 52]), for multiscale targets where there may not be a single good choice throughout the whole state space (e.g., Bayesian posteriors with scale priors [43]), or in probabilistic programming libraries that cannot rely on expert user input. This challenge has motivated the development of locally-adaptive samplers, which select a scale value at each iteration based on the current state [see, e.g., 3, 10, 11, 21, 24–26, 32, 42, 57, 58]. Locally-adaptive samplers are typically more robust to the setting of their tuning parameters, but also often have a larger, random number of target evaluations at each step due to the need to establish rough local scale before a move. Slice sampling [7, 15, 16, 35, 37, 39, 53] is one such locally-adaptive method that has seen successful use in a wide variety of applications. The goal of this work is fully-automated tuning of slice sampling in the interest of reducing its computational cost to the maximum extent possible.

The slice samplers considered in this work are those that operate in one dimension. In particular, given a target density function π\pi (up to proportionality) with respect to the Lebesgue measure on Rd\mathbb{R}^d, and a current state x∈Rdx \in \mathbb{R}^d, the slice sampler first draws a slice variable u∈[0,π(x)]u \in [0, \pi(x)], then a direction ρ∈Rd\rho \in \mathbb{R}^d, ρ≠0\rho \neq 0 and then finally a new updated state x′∈Rdx' \in \mathbb{R}^d via

u∼Unif[0,π(x)],ρ∼m(dρ;u),x′∼Unif{y∈Rd:y=x+ρα,α∈R,π(y)≥u}.u \sim \text{Unif}[0, \pi(x)], \quad \rho \sim m(\mathrm{d}\rho; u), \quad x' \sim \text{Unif}\{y \in \mathbb{R}^d : y = x + \rho \alpha, \alpha \in \mathbb{R}, \pi(y) \geq u\}.

Because the new state x′x' is drawn from the uniform distribution on the slice, the scale of the move from xx to x′x' adapts locally to the size of the slice. With appropriate choice of the distribution m(dρ;u)m(\mathrm{d}\rho; u), this sampler recovers slice sampling within various multivariate schemes, e.g., the hit-and-run sampler [2, 51] when ρ∼Unif(Sd−1)\rho \sim \text{Unif}(\mathbb{S}^{d-1}), and the Gibbs sampler [8] when ρ\rho is a unit basis vector chosen randomly or in deterministic sweeping order.

Drawing the slice level variable uu and direction ρ\rho at each iteration is straightforward, but the slice itself is typically unknown, so the ideal slice sampler cannot be implemented. A computational method to draw from the slice is required. Two popular methods developed by

T. CAMPBELL

Neal [35, 37, 39] begin with an initial window of width w>0w > 0 around the current iterate and grow the window until the slice is (approximately) bounded. The first is stepping out, where the window is grown in increments of size ww, and the second is doubling, where the window length is progressively doubled. The choice of ww influences the long-run cost of the sampler. A precise characterization of this cost and tuning methods for ww are the focus of this work.

The paper begins with a set of pseudocode methods that establish the precise count of the number of target evaluations in each iteration. The pseudocode includes two novel variants of the doubling scheme, both of which improve upon the original method by Neal [39]: a simpler method that involves caching, and a more efficient but more complex method that involves both caching and lazy evaluation. Theorems 3.6 and 3.8 present an exact characterization of the cost of both stepping out and cached doubling for targets with contiguous slices, while Theorem 3.9 establishes coarse properties of the efficient lazy doubling scheme. These results are used to show that the optimal slice-adaptive choice of ww at each iteration is proportional to the slice width λ\lambda. In particular, the oracle optimal setting is w=1.358λw = 1.358\lambda for stepping out with cost 4.7154.715, w=3.211λw = 3.211\lambda for cached doubling with cost 5.9015.901, and w=2.277λw = 2.277\lambda for lazy cached doubling with cost 5.4105.410, where the reported cost is the average per-iteration number of target density evaluations.

These optima establish lower bounds on the cost of slice sampling, but are typically not achievable in practice because the slice width λ\lambda in general has a distribution given each slice value uu, as opposed to being a fixed value. The paper therefore leverages the earlier cost characterizations to develop one-shot and gradient-based tuning schemes for ww as a function of uu for each sampler in Section 4. The one-shot schemes, provided in Eq. (8), have closed-form formulae in terms of the mean/quantiles of the conditional distribution of the slice width λ\lambda given the slice variable uu. The gradient-based schemes, provided in Eq. (9), are designed have convex and smooth objectives and hence are tractable. Each method comes with theoretical bounds on suboptimality in Theorem 4.2. When tuned using draws from the Markov chain in practice, all algorithms have tuning cost that vanishes compared to the base cost of slice sampling. Under mild additional assumptions, Theorem 4.3 shows that all schemes converge in probability to the optimum for their respective surrogate cost functions. None of these schemes involve user input, enabling their use in an automated probabilistic programming libraries. Simulations demonstrate that these tuning schemes in practice yield near-optimal tuning reliably with no noticeable dependence on the initial setting of ww.

Proofs for all results in this work are presented in the appendices.

Related Work. Markov chain Monte Carlo with auxiliary slice augmentations was first developed by Swendsen and Wang [53], with a flurry of work soon afterward that generalized and applied the technique more broadly [4, 7, 15, 16], established its convergence properties [30, 31, 44], and developed the practical hybrid schemes [35, 37, 39] that are the focus of the present work. Over the past two decades since those original contributions, theoretical understanding of slice sampling has significantly improved (see, e.g., [34, 46–48]), and numerous generalizations of the original hybrid scheme have been developed, including novel hybrid slice approximations for multivariate targets [6, 12, 14, 20, 27, 33, 41, 49, 50, 54, 55]. Particularly germane to the present work are those that involve adaptation, e.g., adaptation to the mean and covariance of multivariate targets [27, 54, 55], adaptation of the initial window scale using heuristic Robbins-Monro stochastic approximation [20], and adaptation to density shape using a target approximation [14]. The present work is the first to develop an exact characterization of the optimal slice-adaptive cost of stepping out and doubling hybrid slice samplers, to develop tractable surrogate tuning objectives with suboptimality guarantees, and to leverage those results to develop a fully-automated slice-adaptive tuning scheme. This work is orthogonal to much of the preceding literature on adaptive slice sampling, and thus could likely be profitably combined with many of those earlier developments.

  1. Hybrid slice sampling with lazy cached doubling. This section reviews the stepping out and doubling slice sampling algorithms by Neal [39], including some efficiency improvements. For each method, detailed pseudocode in Section C establishes notation and the precise count of the number of calls to π(⋅)\pi(\cdot) for subsequent analysis. The implementation of stepping out (Algorithm 4) and shrinkage (Algorithm 6) are essentially identical to the implementation by Neal [39]. For doubling and the acceptance check, there are two novel variants: one with caching (Algorithms 5 and 7) and one with caching and lazy evaluation (Algorithms 9 and 10) that removes all unnecessary target density evaluations. All other algorithms in Section C are related to tuning and will be discussed in Section 4.

Slice sampling begins in Algorithm 1 by drawing u∼Unif[0,π(x)]u \sim \text{Unif}[0, \pi(x)] given the current state x∈Rdx \in \mathbb{R}^d, and ρ∼m(ρ;u)\rho \sim m(\rho; u). While this naively requires a call to π(x)\pi(x), it can be treated as an input to Algorithm 1 because it is obtained from the previous iteration's shrinkage step (Algorithm 6). Therefore this call does not appear in the long-run average cost.

Next, the algorithm finds the approximate slice using stepping out (Algorithm 4), cached doubling (Algorithm 5), or lazy cached doubling (Algorithm 9) along the line x+ρyx + \rho y, y∈Ry \in \mathbb{R}, starting with a window size ww computed as a function of uu. For both doubling methods, as the slice is grown the density values are stored in an array cache C\mathcal{C} (assumed to be 1-indexed). This cache is used to avoid recomputing known densities during the subsequent acceptance check. Algorithm 9 avoids further density computation by short-circuiting the decision to keep expanding the window.

Finally, the shrinkage algorithm (Algorithm 6) runs an adaptive rejection sampler that determines whether proposals are acceptable if necessary using a call to the accept (Algorithm 7) or lazy accept (Algorithm 10) function. The (lazy) accept function traces out what would have been the sequence of evaluations by the doubling scheme from the proposed point, and rejects the proposal if doubling could not have created the approximate slice. Algorithms 7 and 10 both use the cache, and Algorithm 10 uses short-circuit evaluation to avoid computing density values that are already known or unnecessary to compute. For the remainder of the paper, the term "cached doubling" refers to using only the cache (Algorithms 5 and 7), and "lazy cached doubling" refers to using both the cache and lazy evaluation (Algorithms 9 and 10). In practice one should always prefer lazy cached doubling, but simple cached doubling is retained for study because it is more amenable to analysis.

Fig. 1 displays the improvement in target density evaluations for the proposed two doubling schemes versus the original scheme proposed by Neal [39]. The lazy caching scheme in particular saves a substantial number of evaluations for small ww, and around 1-2 evaluations for well-tuned ww, which amounts to around a 15–25% overall cost reduction in that regime.

  1. Analysis. This section presents an analysis of the long-run cost of both stepping-out and doubling slice sampling. Assuming that the cost of each iteration is dominated by target density evaluation, the per-iteration cost can be characterized by the number of calls to π(⋅)\pi(\cdot).

The target π\pi is assumed to be unimodal and univariate for simplicity. There are two notes to make about this choice. First, the analysis suffices for broad class of scenarios: the main results in Theorems 3.6, 3.8 and 3.9 as stated apply, without modification, to any multivariate target such that the one-dimensional slice drawn in each iteration is guaranteed to be a contiguous interval. For example, slice sampling within hit-and-run [2, 51] and Gibbs [8] samplers on unimodal multivariate targets both adhere to the below theory, with the only difference being that the slice width at each level is random as opposed to fixed. In practice, the tuning recommendations in this work are also fruitful beyond unimodality (see Section 4.3). Second, unimodality technically enables further reduction of cost by skipping the acceptability check in Algorithm 6 [39, Section 4.4]. However, practical implementations of slice sampling cannot assume unimodality and cannot skip this check; the analysis below corresponds to such

T. CAMPBELL

Figure

(a) Accept

(b) Doubling

Fig 1: The average number of target evaluations in the accept and doubling phase of each slice sampling step, as a function of the ratio of the window width w and slice width λ\lambda, for the original scheme by Neal [39], the basic caching scheme, and the lazy caching scheme.

practical implementations to ensure useful tuning advice in general. The particular technical assumption that will be made for all theoretical results in this section is as follows.

ASSUMPTION 3.1. The target π\pi is a probability distribution on R\mathbb{R} with density π(x)\pi(x) with respect to the Lebesgue measure that satisfies the following: for all u>0u>0 such that {x:π(x)≥u}≠∅\{x:\pi(x)\geq u\}\neq\emptyset, there exist ℓ,r∈R\ell,r\in\mathbb{R}, ℓ≤r\ell\leq r such that

{x:π(x)≥u}=[ℓ,r],\{x:\pi(x)\geq u\}=[\ell,r],

and for all zz such that 0<π(z)<∞0 < \pi(z) < \infty,

P(∣{x:π(x)≥u}∣≤1)=0,u∼Unif[0,π(z)].\mathbb{P}(|\{x:\pi(x)\geq u\}|\leq1)=0,\qquad u\sim\mathrm{U n i f}[0,\pi(z)].

Furthermore, the Markov chain initial state x0x_0 satisfies 0<π(x0)<∞0 < \pi(x_0) < \infty.

Assumption 3.1 stipulates weak conditions under which the iterates of stepping or doubling can be computed in finite time and have the same distribution as those of ideal slice sampling. The first condition is that the slices are contiguous intervals, and the second is roughly that there are no removable discontinuities in the density function that can yield pathological initializations with slice width 0 where the shrinkage algorithm never terminates. Because the iterates are equal in distribution to ideal slice sampling, the optimality of doubling and stepping samplers in this regime is determined entirely by the cost per iteration, and does not depend on the mixing behaviour of the chain. Furthermore, to analyze the long-run cost of stepping and doubling, it suffices to consider the expected cost of one step starting at a state x∼πx \sim \pi, since the chain obeys the Markov chain law of large numbers. Both of these results are presented precisely in Lemma 3.2. The law of large numbers in particular is a straightforward combination of Meyn and Tweedie [29, Theorem 17.0.1] and Tierney [56, Corollary 1], and was originally obtained by Mira and Tierney [30, 31], although it was not stated explicitly as such in that work.

LEMMA 3.2. The iterates of hybrid slice sampling with either doubling or stepping are equal in distribution to those produced by ideal slice sampling, and require only finitely many evaluations of π(⋅)\pi(\cdot) almost surely. Furthermore, for any function h(x)h(x) such that π(∣h∣)<∞\pi(|h|) < \infty,

1T∑t=1Th(xt)→a.s.Eh(X)X∼π.\frac{1}{T}\sum_{t=1}^{T}h(x_{t})\xrightarrow{a.s.}\mathbb{E}h(X)\quad X\sim\pi.

The random cost CC of each iteration of slice sampling can be decomposed into 3 terms: one for finding the approximate slice, one for making proposals and shrinking the approximate slice, and one for checking acceptability of proposals: C=Cslice+Cshrink+CacceptC = C_{\text{slice}} + C_{\text{shrink}} + C_{\text{accept}}. The following sections characterize the distribution and/or expectation of each as needed. Throughout, let R+\mathbb{R}_+ denote the positive reals, xx denote the current state state, uu denote the slice variable, ww the initial window width, ℓ^,r^\widehat{\ell}, \widehat{r} denote the approximate slice boundaries, ℓ,r\ell, r denote the exact slice boundaries, and λ=r−ℓ\lambda = r - \ell denote the exact slice width. Note that in the setting of Assumption 3.1, w,ℓ,rw, \ell, r, and λ\lambda are all deterministic functions of uu, and ℓ^<ℓ<r<r^\widehat{\ell} < \ell < r < \widehat{r} almost surely.

3.1. Shrinkage. The shrinkage algorithm takes as input a state xx, slice variable uu, approximate slice from ℓ^\widehat{\ell} to r^\widehat{r}, and a stream of i.i.d. uniform random variables Vn∼iidUnif[0,1]V_n \overset{\mathrm{iid}}{\sim} \mathrm{Unif}[0,1]. Define the left exceedance λℓ=ℓ−ℓ^\lambda_{\ell} = \ell - \widehat{\ell} and right exceedance λr=r^−r\lambda_r = \widehat{r} - r, and recall the exact slice width is λ=r−ℓ\lambda = r - \ell. The number NN of evaluations of π(⋅)\pi(\cdot) invoked by shrinkage (not including the accept call) is a function that depends only on (λℓ,λ,λr)(\lambda_{\ell}, \lambda, \lambda_r) and the stream of uniform variables (Vn)n=1∞(V_n)_{n=1}^{\infty}. NN is most naturally formulated recursively: the algorithm proposes a point y=(1−V1)ℓ+V1r^y = (1 - V_1)\ell + V_1\widehat{r} and invokes one evaluation of π(⋅)\pi(\cdot). If the proposed point is to the left of ℓ\ell (respectively, to the right of rr) the shrinkage algorithm is called again with ℓ^\widehat{\ell} (respectively, r^\widehat{r}) replaced by yy. Therefore for W∼Unif[0,1]W \sim \mathrm{Unif}[0,1] independent of (Vn)n=1∞(V_n)_{n=1}^{\infty},

(1)

N(λ,λℓ,λr,(Vn)n=1∞)=d1+{N(λ,Wλℓ,λr,(Vn)n=2∞)V1≤λℓλℓ+λr+λN(λ,λℓ,Wλr,(Vn)n=2∞)1−V1<λrλℓ+λr+λ.N(\lambda,\lambda_{\ell},\lambda_{r},(V_{n})_{n=1}^{\infty})\stackrel{d}{=}1+\begin{cases}N(\lambda,W\lambda_{\ell},\lambda_{r},(V_{n})_{n=2}^{\infty})&V_{1}\leq\frac{\lambda_{\ell}}{\lambda_{\ell}+\lambda_{r}+\lambda}\\ N(\lambda,\lambda_{\ell},W\lambda_{r},(V_{n})_{n=2}^{\infty})&1-V_{1}<\frac{\lambda_{r}}{\lambda_{\ell}+\lambda_{r}+\lambda}\end{cases}.

Using the above formula and the fact that (Vn)n=1∞=d(Vn)n=2∞(V_n)_{n=1}^{\infty} \stackrel{d}{=} (V_n)_{n=2}^{\infty}, one can obtain a characterization of the complementary CDF of NN in terms of the solution of a partial differential equation. The true slice width λ\lambda is suppressed in the function arguments below as it is held constant throughout the shrinkage procedure.

LEMMA 3.3. Let Fn(λℓ,λr)F_n(\lambda_\ell, \lambda_r) denote the probability that N>nN > n given λℓ,λr,λ\lambda_\ell, \lambda_r, \lambda. Then

∀n∈N∪{0},Fn(λℓ,λr)=1n!∂nG∂zn(λℓ,λr,z)∣z=0andE[N∣λℓ,λr,λ]=G(λℓ,λr,1),\forall n\in\mathbb{N}\cup\{0\},F_{n}(\lambda_{\ell},\lambda_{r})=\frac{1}{n!}\frac{\partial^{n}G}{\partial z^{n}}(\lambda_{\ell},\lambda_{r},z)\bigg|_{z=0}\quad{a n d}\quad\mathbb{E}[N|\lambda_{\ell},\lambda_{r},\lambda]=G(\lambda_{\ell},\lambda_{r},1),

where G(x,y,z)G(x,y,z) is the unique solution to the following system on x,y≥0x,y\geq 0, z∈[−1,1]:z\in[-1,1]:

(2)

0=(1−z)(∂G∂x+∂G∂y)+(x+y+λ)∂2G∂x∂y0=(1-z)\left(\frac{\partial G}{\partial x}+\frac{\partial G}{\partial y}\right)+(x+y+\lambda)\frac{\partial^{2}G}{\partial x\partial y} G(x,y,z)=G(y,x,z),G(x,0,z)={(1−z(xλ+1)z−1)/(1−z)z≠11+log⁡(xλ+1)z=1.G(x,y,z)=G(y,x,z),\quad G(x,0,z)=\begin{cases}\left(1-z\big(\frac{x}{\lambda}+1\big)^{z-1}\right)/(1-z)&z\neq1\\ 1+\log\big(\frac{x}{\lambda}+1\big)&z=1\end{cases}.

The variable-coefficient partial differential equation Eq. (2) can be solved, and yields a remarkably simple closed-form expression for the expected shrinkage cost in Proposition 3.4.

PROPOSITION 3.4. ECshrink=1+2E[log⁡(r^−rλ+1)]\mathbb{E}C_{shrink}=1+2\mathbb{E}\left[\log\left(\frac{\widehat{r}-r}{\lambda}+1\right)\right].

The expectation in Proposition 3.4 is over x∼πx \sim \pi and u∼Unif[0,π(x)]u \sim \mathrm{Unif}[0, \pi(x)]—which then determine the slice width λ\lambda and right edge rr—and all randomness in the approximate slice bounding algorithm, which determines the distribution of r^−r\widehat{r} - r conditioned on uu. To use this result, then, one requires a characterization of the distribution of the right exceedance r^−r\widehat{r} - r given the slice variable uu. The below two sections on stepping out and doubling provide characterizations of the required conditional distribution of r^−r\widehat{r} - r.

T. CAMPBELL

3.2. Stepping Out. Given the current state x,ux, u, stepping out begins by drawing V∼Unif[0,1]V \sim \mathrm{Unif}[0,1] and evaluating π(⋅)\pi(\cdot) at the initial window boundaries x−Vwx - Vw and x+(1−V)wx + (1 - V)w, and then proceeds by expanding rightwards and leftwards by units of ww until both ℓ>ℓ^\ell > \widehat{\ell} and r^>r\widehat{r} > r. Lemma 3.5 characterizes the conditional distributions of the number of stepping out iterations and the right exceedance given the slice variable uu.

LEMMA 3.5. Conditioned on uu, the number NN of stepping out iterations has distribution

N=d⌊λw⌋+B,B∼Bern(λw−⌊λw⌋),N\stackrel{d}{=}\left\lfloor\frac{\lambda}{w}\right\rfloor+B,\qquad B\sim\mathrm{Bern}\bigg(\frac{\lambda}{w}-\left\lfloor\frac{\lambda}{w}\right\rfloor\bigg),

and conditioned on uu, the right exceedance has distribution

r^−r=dwZ,Z∼Unif[0,1].\widehat{r}-r\stackrel{d}{=}w Z,\quad Z\sim\mathrm{Unif}[0,1].

The slice-finding cost is Cslice=2+NC_{\mathrm{slice}}=2+N, the cost to accept a proposal is identically Caccept=0C_{\mathrm{accept}}=0, and the expected shrinkage cost ECshrink\mathbb{E}C_{\mathrm{shrink}} can be obtained by combining the right exceedance distribution from Lemma 3.5 with the result of Proposition 3.4. Theorem 3.6 uses these three facts to obtain the overall expected per-iteration cost of slice sampling with stepping out. Define the function

fstep:R+→R+,fstep(x)=1+x+2(x+1)log⁡(1+1/x).f_{\mathrm{s t e p}}:\mathbb{R}_{+}\to\mathbb{R}_{+},\qquad f_{\mathrm{s t e p}}(x)=1+x+2(x+1)\log(1+1/x).

THEOREM 3.6. Slice sampling with stepping out has expected cost per iteration

(3)

EC=E[fstep(λw)].\mathbb{E}C=\mathbb{E}\left[f_{\mathrm{s t e p}}\left(\frac{\lambda}{w}\right)\right].

The cost is finite if and only if both E[λw]<∞\mathbb{E}\left[\frac{\lambda}{w}\right]<\infty and E[−log⁡λw]<∞\mathbb{E}\left[-\log\frac{\lambda}{w}\right]<\infty. The optimal slice-adaptive window size and corresponding cost is

w⋆=αλ,α=−1−W−1(−exp⁡(−3/2))≈1.358,EC≈4.715,w^{\star}=\alpha\lambda,\quad \alpha=-1-W_{-1}(-\exp(-3/2))\approx1.358,\quad \mathbb{E}C\approx4.715,

where W−1W_{-1} is the lower branch of the Lambert W function.

3.3. Doubling. Given the current state x,ux, u, doubling begins by drawing V∼Unif[0,1]V \sim \mathrm{Unif}[0,1] and setting the initial window boundaries x−Vwx - Vw and x+(1−V)wx + (1 - V)w, and then proceeds by expanding rightwards or leftwards, each with probability 1/21/2, in doubling rounds until both ℓ>ℓ^\ell > \widehat{\ell} and r^>r\widehat{r} > r. Lemma 3.7 characterizes the joint distribution of the number of doubling steps NN and right exceedance r^−r\widehat{r} - r of the approximate slice conditioned on uu. These distributions apply to both the cached and lazy cached doubling schemes. Define the functions n,c:R+→Rn, c: \mathbb{R}_+ \to \mathbb{R} and random values n0,c0∈Rn_0, c_0 \in \mathbb{R}

n(x)=⌈log⁡2(x)⌉∨0,c(x)=x2n(x),n0=n(λ/w),c0=c(λ/w),n(x)=\lceil\log_{2}(x)\rceil\vee0,\quad c(x)=\frac{x}{2^{n(x)}},\quad n_{0}=n(\lambda/w),\quad c_{0}=c(\lambda/w),

and let Geom denote the geometric distribution with support k∈{1,2,…}k\in\{1,2,\ldots\}.

LEMMA 3.7. Conditioned on uu, the number NN of doubling iterations has distribution

N=dn0+BG,B∼Bern(c0),G∼Geom(1/2),N\stackrel{d}{=}n_{0}+BG,\qquad B\sim\mathrm{Bern}(c_{0}),\quad G\sim\mathrm{Geom}(1/2),

and conditioned on N,uN, u, the right exceedance has distribution

r^−r∼{Unif[0,2Nw−λ]N=n0Unif[2N−1w−λ,2N−1w]N>n0.\widehat{r}-r\sim\begin{cases}\mathrm{Unif}[0,2^{N}w-\lambda]&N=n_{0}\\ \mathrm{Unif}[2^{N-1}w-\lambda,2^{N-1}w]&N>n_{0}\end{cases}.

Figure

(a) Stepping

(b) Doubling

Fig 2: Cost in terms of the average number of target evaluations for one iteration of each slice sampling algorithm as a function of w/λw/\lambda, broken down by algorithmic step (slice finding, shrinkage, and accept). Fig. 2a shows the costs for stepping, and Fig. 2b shows the costs for doubling, where black depicts cached doubling and grey depicts lazy cached doubling. For shrinkage, only black is shown because the cost is the same for both schemes.

For the simple cached doubling scheme, the slice cost is Cslice=2+NC_{slice} = 2 + N, the shrinkage cost ECshrink\mathbb{E}C_{shrink} is derived by combining the right exceedance distribution in Lemma 3.7 and the result from Proposition 3.4, and Lemma B.1 characterizes the expected number ECaccept\mathbb{E}C_{accept} of evaluations in the cached acceptance check. The sum of these results provides the total expected cost per iteration of slice sampling with cached doubling. Define the function

fcache:R+→R+,fcache(x)=f(n(x),c(x)),f_{\mathrm{c a c h e}}:\mathbb{R}_{+}\to\mathbb{R}_{+},\qquad f_{\mathrm{c a c h e}}(x)=f(n(x),c(x)),

where f:N∪{0}×(0,1]→Rf: \mathbb{N} \cup \{0\} \times (0,1] \to \mathbb{R} is given by

(4)

f(n,c)=1+n+((7/3)+2log⁡2)c−2(1+c)log⁡c+∑n=0∞(1+c2−n)log⁡(1+c2−n)+0∨(c3+n−1−1−21−nc+1−41−n9c2).\begin{align*}f(n,c)=&1+n+((7/3)+2\log2)c-2(1+c)\log c+\sum_{n=0}^{\infty}\bigl(1+c2^{-n}\bigr)\log\bigl(1+c2^{-n}\bigr)\\&+0\vee\left(\frac{c}{3}+n-1-\frac{1-2^{1-n}}{c}+\frac{1-4^{1-n}}{9c^{2}}\right).\end{align*}

THEOREM 3.8. Slice sampling with cached doubling has expected cost per iteration

(5)

EC=E[fcache(λw)].\mathbb{E}C=\mathbb{E}\bigg[f_{\mathrm{c a c h e}}\bigg(\frac{\lambda}{w}\bigg)\bigg].

The cost is finite if and only if E∣log⁡λw∣<∞\mathbb{E}|\log\frac{\lambda}{w}| < \infty. The optimal slice-adaptive window size and corresponding cost is

w⋆=αλ,α=(arg⁡min⁡x∈(0,1)f0(0,x)+f1(0,x))−1≈3.211,EC≈5.901.w^{\star}=\alpha\lambda,\quad\alpha=\left(\underset{x\in(0,1)}{\arg\min}f_{0}(0,x)+f_{1}(0,x)\right)^{-1}\approx3.211,\quad\mathbb{E}C\approx5.901.

The analysis of the cost of lazy cached doubling is significantly more challenging. While the cost of shrinkage is the same as for simple cached doubling and is available in closed form, the cost of doubling and acceptance depend on what is known at each iteration as each endpoint of the approximate slice grows/shrinks. Rather than developing an exact cost formula, it will suffice to understand coarser continuity and asymptotic properties, given by

T. CAMPBELL

Lemmas B.2, B.3 and B.8. Lemma B.2 shows that the costs of slice-finding and acceptance are locally Lipschitz continuous as a function of λ/w\lambda/w, and Lemmas B.3 and B.8 reveal their asymptotic behaviour for large and small λ/w\lambda/w. Theorem 3.9 combines these results with the exact cost of shrinkage to provide continuity and asymptotic results pertaining to the overall cost of lazy cached doubling, as well as a computational guarantee about the optimum.

THEOREM 3.9. There exists a function flazy:R+→R+f_{\mathrm{lazy}}: \mathbb{R}_+ \to \mathbb{R}_+ such that slice sampling with lazy cached doubling has expected cost per iteration

(6)

EC=E[flazy(λw)],\mathbb{E}C=\mathbb{E}\left[f_{\mathrm{lazy}}\left(\frac{\lambda}{w}\right)\right],

where the cost is finite if and only if E∣log⁡λw∣<∞\mathbb{E}|\log \frac{\lambda}{w}| < \infty. The function flazyf_{\mathrm{lazy}} is locally Lipschitz,

∀∣x−x′∣≤1, ∣flazy(x)−flazy(x′)∣≤4∣x−x′∣(5+max⁡y∈{x,x′}n(y)+21−n(y)(2+1/c(y))),\forall|x-x'| \leq 1,\ |f_{\mathrm{lazy}}(x)-f_{\mathrm{lazy}}(x')| \leq 4|x-x'| \left(5 + \max_{y \in \{x,x'\}} n(y)+2^{1-n(y)}(2+1/c(y))\right),

has minimum on the interval [2−4,26][2^{-4}, 2^{6}], and has asymptotic limiting behaviour

lim⁡x→0flazy(x)−2log⁡x=lim⁡x→∞flazy(x)(5/6)log⁡2x=1.\lim_{x \to 0} \frac{f_{\mathrm{lazy}}(x)}{-2 \log x} = \lim_{x \to \infty} \frac{f_{\mathrm{lazy}}(x)}{(5/6) \log_2 x} = 1.

Theorem 3.9 states that the cost can be minimized by setting w∝λw \propto \lambda with a proportionality constant that can be found to any desired precision by evaluating flazyf_{\mathrm{lazy}} on a sufficiently fine grid on the interval [0.0625,64][0.0625, 64] determined by the local Lipschitz constant from Theorem 3.9. Numerical simulation yields the optimal slice-adaptive window size and corresponding cost for slice sampling with lazy cached doubling,

w⋆=αλ,α≈2.277,EC≈5.410.w^{\star}=\alpha\lambda,\quad \alpha\approx 2.277,\quad \mathbb{E}C\approx 5.410.

3.4. Summary and comparison of hybrid methods. Fig. 2 displays a breakdown of the expected per-iteration cost of slice sampling with stepping out, cached doubling, and lazy cached doubling conditioned on uu. Due to the results of Theorems 3.6, 3.8 and 3.9, these costs can be compared in a problem-independent manner as a function of w/λw/\lambda. Fig. 3 displays a comparison of the total expected per-iteration cost of slice sampling with stepping out, cached doubling, and lazy cached doubling. It demonstrates that stepping out has a ≈15%\approx 15\% advantage when all samplers are individually optimally tuned, that all samplers have nearly the same cost when w/λw/\lambda is too large, and that the doubling methods are significantly less expensive when w/λw/\lambda is too small. In the small-w/λw/\lambda asymptotic regime, the cost of each method is dominated by slice-finding and acceptance, where stepping has cost ≈λ/w\approx \lambda/w, cached doubling has cost ≈2log⁡2(λ/w)\approx 2\log_2(\lambda/w), and lazy cached doubling has cost ≈(5/6)log⁡2(λ/w)\approx (5/6)\log_2(\lambda/w). In the large-w/λw/\lambda asymptotic regime, all methods have asymptotic cost ≈2log⁡(w/λ)\approx 2\log(w/\lambda), dominated by the cost of shrinkage. Fig. 3b shows that lazy cached doubling is at most ≈25%\approx 25\% more expensive than stepping out in the worst case, while stepping out can be arbitrarily worse than either doubling method in a relative sense. Lazy cached doubling is therefore recommended in general, and especially for scenarios involving automated tuning where its robustness prevents severe performance degradation due to mistuning.

  1. Slice-adaptive tuning. Theorems 3.6, 3.8 and 3.9 state that the lowest possible per-iteration cost for slice sampling is obtained by setting w∝λw \propto \lambda, with a constant that depends on whether one is using stepping out, cached doubling, or lazy cached doubling. While that serves as an idealized lower bound on the cost of slice sampling, those recommendations are not implementable in practice because λ\lambda will generally have a distribution conditioned on

Figure

(a) Individual costs

(b) Cost ratio

Fig 3: Comparison of the average cost per iteration of stepping out, cached doubling, and lazy cached doubling as a function of w/λw/\lambda. Fig. 3a shows the costs plotted together, while Fig. 3b displays the ratios compared to stepping out.

u rather than being a fixed value, e.g., for multivariate targets with the hit-and-run or Gibbs samplers. That being said, the expected cost functions in Theorems 3.6, 3.8 and 3.9 are still valid for any situation in which the slice is guaranteed to be contiguous and the Markov chain law of large numbers holds. In these situations, the optimal slice-adaptive tuning scheme sets the initial width w to be a function w(u)w(u) of the slice variable u given by the minimizer of the expectations in Eqs. (3), (5) and (6) conditioned on u,

(7)

ws⋆(u)=arg⁡min⁡w>0E[fs(λw)∣u],s∈{step,cache,lazy}.w_{s}^{\star}(u)=\underset{w>0}{\arg\min}\mathbb{E}\bigg[f_{s}\bigg(\frac{\lambda}{w}\bigg)|u\bigg],\quad s\in\{\mathrm{step},\mathrm{cache},\mathrm{lazy}\}.

However, the minimization problem in Eq. (7) is not tractable as it is nonconvex and nonsmooth in general (and moreover flazyf_{lazy} is not known in closed form). Instead, this section uses tractable surrogate approximations of each of fstepf_{step}, fcachef_{cache}, and flazyf_{lazy} to develop two tuning schemes for each slice sampling algorithm. The first is a set of “one-shot” tuning schemes based only on the properties of the distribution of λ\lambda given u, and the second is a gradient-descent-based scheme, where the optimization is initialized at the former scheme’s output. Both methods come with bounds on suboptimality compared with the minimizer of expected cost conditioned on u.

The surrogate cost functions f^step,f^cache,f^lazy,f^step,f^cache,f^lazy\widehat{f}_{\text{step}}, \widehat{f}_{\text{cache}}, \widehat{f}_{\text{lazy}}, \widehat{f}_{\text{step}}, \widehat{f}_{\text{cache}}, \widehat{f}_{\text{lazy}} used to develop these tuning schemes are displayed in Fig. 4. The functions f^step,f^cache,f^lazy\widehat{f}_{\text{step}}, \widehat{f}_{\text{cache}}, \widehat{f}_{\text{lazy}} are designed such that the minimum of E[f^(⋅)(λ/w)∣u]\mathbb{E}[\widehat{f}_{(\cdot)}(\lambda/w)|u] is available in closed form in terms of properties of the distribution of λ\lambda given uu. The functions f^step,f^cache,f^lazy\widehat{f}_{\text{step}}, \widehat{f}_{\text{cache}}, \widehat{f}_{\text{lazy}} are designed to be convex and locally smooth (Definition B.9) to enable gradient optimization. The precise formulae for these surrogates and related approximation error guarantees are deferred to Section A.

4.1. Tuning with known slice width distribution. For each u>0u>0 with nonempty slice, let qp(u)q_{p}(u) be the pp-quantile of λ\lambda conditional on uu. Define the one-shot tuning schemes

(8)

w^step(u)=65E[λ∣u],w^cache(u)=103q11+log⁡2(u),w^lazy(u)=3q512log⁡2+5(u),\widehat{w}_{\mathrm{s t e p}}(u)=\frac{6}{5}\mathbb{E}[\lambda|u],\qquad\widehat{w}_{\mathrm{c a c h e}}(u)=\frac{10}{3}q_{\frac{1}{1+\log2}}(u),\qquad\widehat{w}_{\mathrm{l a z y}}(u)=3q_{\frac{5}{12\log2+5}}(u),

and the gradient-optimization tuning scheme

(9)

w~s(u)=exp⁡(argmin⁡x∈RE[f~s(λexp⁡(−x))∣u]),s∈{step,cache,lazy}.\widetilde{w}_{s}(u)=\exp\biggl(\operatorname*{a r g m i n}_{x\in\mathbb{R}}\mathbb{E}\biggl[\widetilde{f}_{s}(\lambda\exp(-x))|u\biggr]\biggr),\quad s\in\{\mathrm{s t e p},\mathrm{c a c h e},\mathrm{l a z y}\}.

T. CAMPBELL

Figure

(a) Stepping

(b) Cached Doubling

(c) Lazy Cached Doubling

Fig 4: Surrogate approximations of fstepf_{step}, fcachef_{cache}, and flazyf_{lazy} used to develop the tuning algorithms. See Section A for specific formulae and approximation error results (Lemma A.2). Note that f^step=fstep\widehat{f}_{step} = f_{step}, so it is not shown separately.

Theorem 4.2 provides suboptimality guarantees for these tuning schemes. For stepping out, w^step\widehat{w}_{step} is optimal up to a multiplicative factor of 3, while w~step\widetilde{w}_{step} finds the slice-adaptive optimal tuning. For both doubling methods, w^cache,w~lazy\widehat{w}_{cache}, \widetilde{w}_{lazy} incur at most 4 extra evaluations, while w~cache,w~lazy\widetilde{w}_{cache}, \widetilde{w}_{lazy} incur at most 0.7. Theorem 4.2 also asserts that the minimization problems in Eq. (9) are all tractable in the sense that they can be solved to any desired precision by gradient descent with backtracking line search.

DEFINITION 4.1. A point xx is (ϵ,δ)(\epsilon, \delta)-optimal for function h≥0h \geq 0 if h(x)≤ϵinf⁡xh(x)+δh(x) \leq \epsilon \inf_x h(x) + \delta.

THEOREM 4.2. The following results hold:

• w^step\widehat{w}_{step} is (3,0)(3,0)-optimal and w~step\widetilde{w}_{step} is (1,0)(1,0)-optimal for the cost of stepping out.

• w^cache\widehat{w}_{cache} is (1,4)(1,4)-optimal and w~cache\widetilde{w}_{cache} is (1,0.7)(1,0.7)-optimal for the cost of cached doubling.

• w~lazy\widetilde{w}_{lazy} is (1,4)(1,4)-optimal and w~lazy\widetilde{w}_{lazy} is (1,0.7)(1,0.7)-optimal for the cost of lazy cached doubling.

Furthermore, the optimization problems in w~step\widetilde{w}_{step}, w~cache\widetilde{w}_{cache}, w~lazy\widetilde{w}_{lazy} are all tractable.

4.2. Tuning with MCMC draws. Eqs. (8) and (9) provide tractable near-optimal tuning of slice sampling, but require knowing the distribution of λ\lambda conditioned on u. This section develops an algorithm that tunes using estimated conditional distributions using draws produced by the Markov chain. Key goals are convergence of the method to the optimal tuning (for the respective surrogate cost), and to ensure that the additional computational cost of tuning and evaluating the initial width function w(u)w(u) is insignificant compared to the cost of sampling with a fixed initial width.

The algorithm proceeds as follows. Suppose at some iteration 2t, there is a record of the t previous draws (λj,uj)j=t+12t(\lambda_j, u_j)_{j=t+1}^{2t}. For η∈(0,1)\eta \in (0,1), β∈(0.5,1)\beta \in (0.5,1) (in practice, η=0.95\eta = 0.95, β=0.51\beta = 0.51) set

(10)

τ=⌈tη⌉,k=⌊τβ⌋,n=⌊τ/k⌋.\tau=\lceil t^{\eta}\rceil,\qquad k=\lfloor\tau^{\beta}\rfloor,\qquad n=\lfloor\tau/k\rfloor.

Then take an evenly-spaced subsequence of (λj,uj)(\lambda_j, u_j) of length τ\tau and sort them in order of increasing uu, resulting in (λ~j,u~j)j=1τ(\widetilde{\lambda}_j, \widetilde{u}_j)_{j=1}^{\tau}. This thinning ensures that the order statistics are asymptotically indistinguishable from those produced by i.i.d. draws under mild conditions (Lemma B.11). Then for each block of kk draws with slice values between u~jk\widetilde{u}_{jk} and u~(j+1)k\widetilde{u}_{(j+1)k}, j∈Nj \in \mathbb{N}, approximate the conditional distribution of λ\lambda given uu using the empirical distribution of draws within that block. More precisely, approximate

(11)

P(λ∈⋅∣u)≈μ^t(⋅,u)=∑j=0n1[u~jk<u≤u~(j+1)k]μ^tj(⋅)μ^tj∝∑i=jk+1((j+1)k)∧τδλ~j,\mathbb{P}(\lambda\in\cdot|u)\approx\widehat{\mu}_{t}(\cdot,u)=\sum_{j=0}^{n}\mathbb{1}[\widetilde{u}_{j k}<u\leq\widetilde{u}_{(j+1)k}]\widehat{\mu}_{t j}(\cdot)\qquad\widehat{\mu}_{t j}\propto\sum_{i=j k+1}^{((j+1)k)\wedge\tau}\delta_{\widetilde{\lambda}_{j}},

where u~0=0\widetilde{u}_0 = 0 and u~(n+1)k=∞\widetilde{u}_{(n+1)k} = \infty by convention, and each μ^tj\widehat{\mu}_{tj} is normalized appropriately. Then set the tuned initial window wt(u)w_t(u) using the results from Eqs. (8) and (9), except that the distribution of λ\lambda given uu is replaced with the piecewise-constant approximation in Eq. (11). This procedure results in a piecewise-constant window function wt(u)w_t(u) that refines as more draws are obtained.

Theorem 4.3 shows that under mild technical assumptions, the above procedure results in a per-iteration cost that converges to the slice-adaptive optimal cost for each of the surrogate cost functions. In particular, the result confirms that any η∈(0,1)\eta \in (0,1) and β∈(0.5,1)\beta \in (0.5,1) in Eq. (10) suffices to ensure that the number of draws used to tune each region in the piecewise wt(u)w_t(u) increases quickly enough to guarantee convergence. One simplification made for Theorem 4.3 is that within each bin, ww is selected from a finite set W\mathcal{W} in Eq. (12) rather than the entirety of R+\mathbb{R}_+. This simplification does not meaningfully change the result but avoids significant unnecessary additional technicality.

THEOREM 4.3. Let W\mathcal{W} be a finite subset of (0,∞)(0,\infty), and let h:R+→Rh:\mathbb{R}_+ \to \mathbb{R} be a function such that for all w∈Ww \in \mathcal{W}, E[h(λ/w)∣u]\mathbb{E}[h(\lambda/w)|u] is continuous in uu and h(λ/w)h(\lambda/w) is locally uniformly subexponential conditioned on uu (Definition B.14). Suppose ideal slice sampling is geometrically ergodic for target π\pi, μ^\widehat{\mu} is the kernel given by Eq. (11), and

(12)

wt(u)=arg⁡min⁡w∈W∫h(λw)μ^t(dλ,u).w_{t}(u)=\arg\min_{w\in\mathcal{W}}\int h\left(\frac{\lambda}{w}\right)\widehat{\mu}_{t}(\mathrm{d}\lambda,u).

Then

E[h(λwt(u))∣(uj,λj)j=t+12t]→pE[min⁡w∈WE[h(λw)∣u]]t→∞.\mathbb{E}\bigg[h\bigg(\frac{\lambda}{w_{t}(u)}\bigg)|(u_{j},\lambda_{j})_{j=t+1}^{2t}\bigg]\xrightarrow{p}\mathbb{E}\bigg[\min_{w\in\mathcal{W}}\mathbb{E}\bigg[h\bigg(\frac{\lambda}{w}\bigg)|u\bigg]\bigg]\qquad t\to\infty.

The computational complexity of tuning wtw_t vanishes compared to the cost of sampling. Sorting (λj,uj)(\lambda_j, u_j) has complexity O(τlog⁡τ)=O(tηlog⁡t)=o(t)O(\tau \log \tau) = O(t^\eta \log t) = o(t). Once sorted, both one-shot and gradient tuning within each block of draws requires O(k)O(k) computation, and so for nn blocks tuning requires O(kn)=O(τ)=o(t)O(kn) = O(\tau) = o(t) computation. However, due to the need to perform a O(log⁡n)=O(log⁡τ1−β)=O(log⁡t)O(\log n) = O(\log \tau^{1-\beta}) = O(\log t) binary search for the bin in which uu falls to evaluate wt(u)w_t(u), the complexity of sampling increases by a log factor. In practice, this issue can be ignored; for nontrivial target distributions the search will usually be orders of magnitude faster than evaluating the density once, even for very large tt (when t=109t = 10^9, for example, the binary search will require roughly 14 floating-point lookups and comparisons). The issue can also be resolved simply by putting an upper limit on the number of bins nn.

The final fully-automated, tuned slice sampling algorithm is provided in Algorithm 8. The tuning algorithm runs in doubling rounds, each time using the last half of the draws. In the tuning algorithm itself, the initial window size function w(⋅)w(\cdot) is initialized using the one-shot estimate w^\widehat{w}, and then further refined using backtracking gradient descent to find w~\widetilde{w}. Note that in practice, the values of λ\lambda are not directly observed, and moreover slices may not be contiguous, so tuning is based on an average of upper and lower bounds on λ\lambda that are tracked by Algorithm 2.

4.3. Simulations. This section presents simulation results for the proposed tuning schemes, including both the one-shot window w^\widehat{w} and gradient-based window w~\widetilde{w} initialized using the one-shot scheme. These simulations are designed to be a demonstration that the tuning schemes reliably work well without user input across a range of target tail behaviour, dimension, and uni/multimodality. Results are shown only for stepping out and lazy cached doubling; simple cached doubling is omitted as it is dominated by lazy cached doubling.

T. CAMPBELL

Figure

(a) Stepping

(b) Lazy Cached Doubling

Fig 5: The average per iteration cost resulting from the proposed tuning schemes over 100,000 simulated iterations, as a function of the initial window size w (top row), and as a function of the iteration number (bottom row). Line shade corresponds to the target (uniform, normal, Laplace, and Cauchy), while line style corresponds to the tuning scheme (constant, one-shot, and gradient). The bottom row figures display only the one-shot and gradient tuning schemes, and for each tuning scheme and target, 13 traces are displayed across evenly-spaced initial choices of w∈(10−3,103)w \in (10^{-3}, 10^{3}). The horizontal grey dashed line displays the lowest possible cost with w∝αλw \propto \alpha \lambda and optimal α\alpha given by Theorems 3.6 and 3.9. All of the proposed methods for both stepping out and lazy cached doubling provide near-optimal cost per iteration after about 100 iterations, regardless of the initial choice of w.

Fig. 5 displays the average cost per iteration of tuned slice sampling for unimodal, univariate Unif[0,1], N(0,1)\mathcal{N}(0,1), Laplace(0,1), and Cauchy(0,1) targets. The top row figures show the average cost over the last 50,000 draws produced by 100,000 total iterations as a function of the initial setting of window size w∈[10−3,103]w \in [10^{-3}, 10^{3}]. Every proposed tuning method nearly matches the oracle optimal costs from Theorems 3.6 and 3.9, regardless of the initial choice of w, while the untuned slice sampler has performance that varies significantly depending on the choice of w. The bottom row figures show the cost as a function of iteration number, averaged over the most recent half of the iterations. Tuning traces are shown for 13 log-evenly-spaced starting values of w∈[10−3,103]w \in [10^{-3}, 10^{3}] for each method, with the same legend convention as in the top row of plots. These figures demonstrate that the tuning converges after about 100 iterations for both stepping out and lazy cached doubling, with some infrequent jumps in cost for stepping out, likely caused by temporary mistuning of w due to stochasticity in μ^t\widehat{\mu}_t. Fig. 6 repeats these experiments for 256-dimensional i.i.d. products of the same four univariate targets, and for univariate multimodal mixtures

Uniform Mix:0.4Unif[−3/2,−1/2]+0.2Unif[−1/2,1/2]+0.4Unif[1/2,3/2]Uniform~Mix:0.4Unif[-3/2,-1/2]+0.2Unif[-1/2,1/2]+0.4Unif[1/2,3/2]

Figure

(a) Stepping

(b) Lazy Cached Doubling

Fig 6: The average per iteration cost resulting from the proposed tuning schemes over 100,000 simulated iterations, as a function of the initial window size w, for hit-and-run sampling on multidimensional targets (top row), and univariate multimodal targets (bottom row). Line shade corresponds to the target, while line style corresponds to the tuning scheme. The horizontal grey dashed line displays the lowest possible cost with w∝αλw \propto \alpha \lambda and optimal α\alpha given by Theorems 3.6 and 3.9. All of the proposed methods for both stepping out and lazy cached doubling provide near-optimal cost per iteration regardless of the initial choice of w.

Normal Mix:0.5N(−1,1)+0.5N(1,1)\mathrm{N o r m a l~M i x:0.5\mathcal{N}(-1,1)+0.5\mathcal{N}(1,1)} Laplace Mix:0.5Laplace(−1,1)+0.5Laplace(1,1)\mathrm{L a p l a c e~M i x:0.5L a p l a c e}(-1,1)+0.5L a p l a c e(1,1) Cauchy Mix:0.5Cauchy(−1,1)+0.5Cauchy(1,1).Cauchy~Mix:0.5Cauchy(-1,1)+0.5Cauchy(1,1).

The results have the same qualitative characteristics as in the previous results; the tuned methods reliably achieve an average cost near the oracle optimal for each method, regardless of the initialization of w. Taken together, these results suggest that the proposed tuning methods are very robust to the initial choice of w, and initializing w(u)=1w(u) = 1 as suggested in Algorithm 8 is likely reasonable for most problems.

Finally, Fig. 7 displays a comparison of slice sampling with the proposed slice-adaptive tuning schemes versus using a tuned but constant, non-slice-adaptive choice of w. The results show that when the slice lengths tend to vary more—e.g., for targets with heavy tails or unbounded density functions—slice-adaptivity becomes increasingly important to obtaining a near oracle-optimal per-iteration cost. Results are shown only for lazy cached doubling, which is much more robust to mistuning; stepping out often became too expensive to run during early rounds before the tuning methods had stabilized. In practice, lazy cached doubling should essentially always be preferred over the other two methods.

T. CAMPBELL

Figure

(a) Gamma( α\alpha, 1)

(b) T( α\alpha)

Fig 7: The average per iteration cost for slice-adaptive lazy cached doubling versus constant tuning over 1,000,000 simulated iterations. Fig. 7a displays the result for the gamma distribution with shape parameter α\alpha, and Fig. 7b displays the result for the T distribution with α\alpha degrees of freedom. Line style corresponds to the tuning scheme (tuned constant, one-shot, and gradient). The proposed slice-adaptive methods provide increasing benefit the more the slice width λ\lambda varies from iteration to iteration (smaller α\alpha in each case).

  1. Conclusion. This paper presented an analysis of the cost of slice sampling along unidimensional manifolds, and a fully-automated, near-optimal implementation. Key contributions include an improvement to the doubling slice finding scheme via lazy caching (Algorithms 9 and 10), characterizations of the per-iteration cost as a function of initial window size and slice width (Theorems 3.6, 3.8 and 3.9), simple one-shot and tractable gradient-based tuning schemes along with suboptimality guarantees (Theorem 4.2), and tuning methods using draws from Markov chain Monte Carlo (Algorithm 8) that provide asymptotic convergence in probability to the surrogate optimal cost (Theorem 4.3).

This work focused on initial widths as a function of only the slice variable w(u)w(u). In multivariate settings, a natural and useful extension to this work would be to extend w to be a function of both the slice variable u and the direction ρ\rho. All of the theory and tuning methods in this work extend without much effort to this setting by using the conditional distribution of slice width λ\lambda given u,ρu, \rho in place of the conditional distribution of λ\lambda given u. For slice sampling within Gibbs sampling, for example, one should use the proposed procedure in this paper to tune a separate function wi(u)w_i(u) for each coordinate direction i of motion, because different variables in a model will often exhibit different posterior scale.

One limitation of the present work is that tuning is based on bounds on the slice width at each iteration (Algorithm 2) rather than the value of λ\lambda itself. A possible avenue for future work is therefore to rigorously handle the lack of observability of the slice width at each iteration in a manner that does not significantly increase computational cost. As mentioned earlier, there are also many avenues for follow-up work in combining earlier developments in adaptive slice sampling with the initial window tuning from this work, e.g., covariance adaptation to improve condition number dependence.

REFERENCES

[1] BACHEM, O., LUCIC, M. and KRAUSE, A. (2017). Practical coreset constructions for machine learning. arXiv:1703.06476.

[2] BÉLISLE, C., ROMEIJN, E. and SMITH, R. (1993). Hit-and-run algorithms for generating multivariate distributions. Mathematics of Operations Research 18 255–266.

[3] BIRON-LATTES, M., SURJANOVIC, N., SYED, S., CAMPBELL, T. and BOUCHARD-CÔTÉ, A. (2024). autoMALA: Locally adaptive Metropolis-adjusted Langevin algorithm. In International Conference on Artificial Intelligence and Statistics.

[4] DAMIEN, P., WAKEFIELD, J. and WALKER, S. (1999). Gibbs sampling for Bayesian non-conjugate and hierarchical models by using auxiliary variables. Journal of the Royal Statistical Society B 61 331–344.

[5] DUANE, S., KENNEDY, A. D., PENDLETON, B. J. and ROWETH, D. (1987). Hybrid Monte Carlo. Physics Letters B 195 216–222.

[6] DURMUS, A., GRUFFAZ, S., HASENPFLAG, M. and RUDOLF, D. (2026). Geodesic slice sampling on Riemannian manifolds. Biometrika 113.

[7] EDWARDS, R. and SOKAL, A. (1988). Generalization of the Fortuin-Kasteleyn-Swendsen-Wang representation and Monte Carlo algorithm. Physical Review D 38 2009–2012.

[8] GELFAND, A. and SMITH, A. (1990). Sampling-based approaches to calculating marginal densities. Journal of the American Statistical Association 85 398–409.

[9] GEYER, C. (1991). Markov chain Monte Carlo maximum likelihood. In Computing Science and Statistics, Proceedings of the 23rd Symposium on the Interface 156–163.

[10] GIROLAMI, M. and CALDERHEAD, B. (2011). Riemann manifold Langevin and Hamiltonian Monte Carlo methods. Journal of the Royal Statistical Society: Series B (Statistical Methodology) 73 123–214.

[11] GREEN, P. and MIRA, A. (2001). Delayed rejection in reversible jump Metropolis–Hastings. Biometrika 88 1035–1053.

[12] HABECK, M., HASENPFLAG, M., KODGIRWAR, S. and RUDOLF, D. (2025). Geodesic Slice Sampling on the Sphere. Journal of Machine Learning Research 26 1–38.

[13] HASTINGS, W. K. (1970). Monte Carlo sampling methods using Markov chains and their applications. Biometrika 57 97–109.

[14] HEINER, M., JOHNSON, S., CHRISTENSEN, J. and DAHL, D. (2024). Quantile slice sampling. arXiv:2407.12608.

[15] HIGDON, D. (1996). Auxiliary variable methods for Markov chain Monte Carlo with applications. Technical Report, Institute of Statistics and Decision Sciences, Duke University.

[16] HIGDON, D. (1998). Auxiliary variable methods for Markov chain Monte Carlo with applications. Journal of the American Statistical Association 93 585–595.

[17] HUKUSHIMA, K. and NEMOTO, K. (1996). Exchange Monte Carlo method and application to spin glass simulations. Journal of the Physical Society of Japan 65 1604–1608.

[18] JARZYNSKI, C. (1997a). Nonequilibrium equality for free energy differences. Physical Review Letters 78 2690–2693.

[19] JARZYNSKI, C. (1997b). Equilibrium free energy differences from nonequilibrium measurements: A master equation approach. Physical Review E 56 5018–5035.

[20] KARAMANIS, M. and BEUTLER, F. (2021). Ensemble slice sampling: parallel, black-box and gradient-free inference for correlated & multimodal distributions. Statistics and Computing 31.

[21] KLEPPE, T. S. (2016). Adaptive Step Size Selection for Hessian-Based Manifold Langevin Samplers. Scandinavian Journal of Statistics 43 788–805.

[22] LANGBERG, M. and SCHULMAN, L. (2010). Universal ϵ\epsilon-approximators for integrals. In Proceedings of the Twenty-First Annual ACM-SIAM Symposium on Discrete Algorithms (SODA 2010) 598–607.

[23] LI, Y., LONG, P. and SRINIVASAN, A. (2001). Improved bounds on the sample complexity of learning. Journal of Computer and System Sciences 62 516–527.

[24] LIU, T., SURJANOVIC, N., BIRON-LATTES, M., BOUCHARD-CÔTÉ, A. and CAMPBELL, T. (2025). AutoStep: locally adaptive involutive MCMC. In International Conference on Machine Learning.

[25] LIVINGSTONE, S. (2021). Geometric Ergodicity of the Random Walk Metropolis with Position-Dependent Proposal Covariance. Mathematics 9.

[26] MAIRE, F. and VANDEKERKHOVE, P. (2022). Markov Kernels Local Aggregation for Noise Vanishing Distribution Sampling. SIAM Journal on Mathematics of Data Science 4 1293-1319.

[27] MARCO, N. and TOKDAR, S. (2026). Adaptive generalized elliptical slice sampling. arXiv:2605.21659.

[28] METROPOLIS, N., ROSENBLUTH, A. W., ROSENBLUTH, M. N., TELLER, A. H. and TELLER, E. (1953). Equation of State Calculations by Fast Computing Machines. The Journal of Chemical Physics 21 1087–1092.

[29] MEYN, S. and TWEEDIE, R. (1993). Markov chains and stochastic stability. Springer-Verlag.

[30] MIRA, A. and TIERNEY, L. (1997). On the use of auxiliary variables in Markov chain Monte Carlo sampling. Technical Report, School of Statistics, University of Minnesota.

[31] MIRA, A. and TIERNEY, L. (2002). Efficiency and convergence properties of slice samplers. Scandinavian Journal of Statistics 29 1–12.

[32] MODI, C., BARNETT, A. and CARPENTER, B. (2024). Delayed rejection Hamiltonian Monte Carlo for sampling multiscale distributions. Bayesian Analysis.

T. CAMPBELL

[33] MURRAY, I., ADAMS, R. and MACKAY, D. (2010). Elliptical slice sampling. In Artificial Intelligence and Statistics.

[34] NATAROVSKII, V., RUDOLF, D. and SPRUNGK, B. (2021). Quantitative spectral gap estimate and Wasserstein contraction of simple slice sampling. The Annals of Applied Probability 31 806–825.

[35] NEAL, R. (1997). Markov chain Monte Carlo methods based on ‘slicing’ the density function. Technical Report No. 9722, Department of Statistics, University of Toronto.

[36] NEAL, R. (1998). Annealed importance sampling. Technical Report No. 9805, Department of Statistics, University of Toronto.

[37] NEAL, R. (2000). Slice sampling. Technical Report No. 2005, Department of Statistics, University of Toronto.

[38] NEAL, R. (2001). Annealed importance sampling. Statistics and Computing 11 125–139.

[39] NEAL, R. (2003). Slice sampling. Annals of Statistics 31 705–767.

[40] NEAL, R. (2011). MCMC using Hamiltonian dynamics. In Handbook of Markov chain Monte Carlo (S. Brooks, A. Gelman, G. Jones and X.-L. Meng, eds.) 5 CRC Press.

[41] NISHIHARA, R., MURRAY, I. and ADAMS, R. (2014). Parallel MCMC with generalized elliptical slice sampling. Journal of Machine Learning Research 15 2087–2112.

[42] NISHIMURA, A. and DUNSON, D. (2016). Variable length trajectory compressible hybrid Monte Carlo. arXiv:1604.00889.

[43] POLSON, N. G. and SCOTT, J. G. (2012). On the half-Cauchy prior for a global scale parameter. Bayesian Analysis 7 887–902.

[44] ROBERTS, G. and ROSENTHAL, J. (1999). Convergence of slice sampler Markov chains. Journal of the Royal Statistical Society B 61 643–660.

[45] ROSSKY, P., DOLL, J. and FRIEDMAN, H. (1978). Brownian dynamics as smart Monte Carlo simulation. The Journal of Chemical Physics 69 4628–4633.

[46] RUDOLF, D. and ULLRICH, M. (2013). Positivity of hit-and-run and related algorithms. Electronic Communications in Probability 18 1–8.

[47] RUDOLF, D. and ULLRICH, M. (2018). Comparison of hit-and-run, slice sampler and random walk Metropolis. Journal of Applied Probability 55 1186–1202.

[48] SCHÄR, P. (2025). Slice sampling: theoretical and methodological advances, PhD thesis.

[49] SCHÄR, P., HABECK, M. and RUDOLF, D. (2023). Gibbsian polar slice sampling. In International Conference on Machine Learning.

[50] SCHÄR, P., HABECK, M. and RUDOLF, D. (2024). Parallel Affine Transformation Tuning of Markov Chain Monte Carlo. In International Conference on Machine Learning.

[51] SMITH, R. (1984). Efficient Monte Carlo procedures for generating points uniformly distributed over bounded regions. Operations Research 32 1296–1308.

[52] SWENDSEN, R. and WANG, J.-S. (1986). Replica Monte Carlo simulation of spin-glasses. Physical Review Letters 57.

[53] SWENDSEN, R. and WANG, J.-S. (1987). Nonuniversal critical dynamics in Monte Carlo simulations. Physical Review Letters 58 86–88.

[54] THOMPSON, M. (2011). Slice sampling with multivariate steps, PhD thesis.

[55] TIBBITS, M., GROENDYKE, C., HARAN, M. and LIECHTY, J. (2014). Automated factor slice sampling. Journal of Computational and Graphical Statistics 23 543–563.

[56] TIERNEY, L. (1994). Markov chains for exploring posterior distributions. The Annals of Statistics 22 1701–1762.

[57] TIERNEY, L. and MIRA, A. (1999). Some adaptive Monte Carlo methods for Bayesian inference. Statistics in Medicine 18 2507–2515.

[58] TUROK, G., MODI, C. and CARPENTER, B. (2024). Sampling From Multiscale Densities With Delayed Rejection Generalized Hamiltonian Monte Carlo. arXiv:2406.02741.