Bayesian methodsBayesianModel

Slice Sampling

Also known as: slice sampler, Neal slice sampler, uniform slice sampling, auxiliary variable slice sampler

OriginatorRadford M. NealYear2003Sources3Related methods5

Slice sampling is a Markov chain Monte Carlo (MCMC) algorithm introduced by Radford M. Neal in his 2003 Annals of Statistics paper. It generates samples from a target distribution by drawing uniformly from the region under the density curve — called the 'slice' — without requiring the user to specify a step-size or proposal distribution, making it self-tuning and broadly applicable for Bayesian posterior inference.

Key highlights

  • Self-tuning: requires no step-size or proposal distribution specification, removing the most common tuning burden of Metropolis–Hastings.
  • Guaranteed detailed balance: the shrinkage procedure maintains the correct invariant distribution without accept/reject overhead.
  • Efficient for low-to-moderate dimensions: the adaptive bracket expands to match the local scale of the posterior automatically.
  • Requires only unnormalised density evaluations, so it works directly with Bayesian posteriors defined up to a constant.

Intuition

This section is available to Pro members. Upgrade to Pro

How it works

This section is available to Pro members. Upgrade to Pro

When to use it

Slice sampling is well suited to unimodal or weakly multimodal continuous posteriors where Metropolis–Hastings performs poorly because of sensitivity to step-size tuning. It is particularly attractive when the posterior is defined up to a normalising constant (as in most Bayesian models), because only evaluations of the unnormalised density f(θ) are needed. It is available out-of-the-box in PyMC and Stan-adjacent samplers, making it accessible without custom implementation. It is less effective for high-dimensional problems (curse of dimensionality) or sharply multimodal posteriors where the slice may fragment into disconnected regions.

Strengths & limitations

Strengths
  • Self-tuning: requires no step-size or proposal distribution specification, removing the most common tuning burden of Metropolis–Hastings.
  • Guaranteed detailed balance: the shrinkage procedure maintains the correct invariant distribution without accept/reject overhead.
  • Efficient for low-to-moderate dimensions: the adaptive bracket expands to match the local scale of the posterior automatically.
  • Requires only unnormalised density evaluations, so it works directly with Bayesian posteriors defined up to a constant.
Limitations
  • Performance degrades in high dimensions because the univariate slice must be applied coordinate-by-coordinate or via hyperplane slices, making mixing slow.
  • Fragmented or sharply multimodal posteriors may trap the sampler in a single mode if the modes are separated by low-density regions below the current slice height.
  • Each iteration may require multiple density evaluations during the stepping-out and shrinkage phases, making it more expensive per sample than a simple Metropolis step when the density is costly to evaluate.
  • The univariate version does not exploit posterior geometry (gradients), so it is generally less efficient than Hamiltonian Monte Carlo for smooth, high-dimensional targets.

Common pitfalls

This section is available to Pro members. Upgrade to Pro

Applications

This section is available to Pro members. Upgrade to Pro

Frequently asked

How does slice sampling differ from Metropolis–Hastings?

Metropolis–Hastings proposes a candidate from a user-specified proposal distribution and accepts or rejects it. Its efficiency depends critically on choosing a good proposal scale. Slice sampling eliminates this choice: it constructs the proposal region (the slice and bracket) automatically from the density itself, and every candidate that lies inside the slice is accepted. This makes slice sampling easier to apply but does not make it universally faster — for smooth, high-dimensional posteriors, HMC typically outperforms both.

Does slice sampling always converge to the correct posterior?

Yes, under mild regularity conditions. Neal (2003) proved that the stepping-out and shrinkage procedures maintain detailed balance with respect to the target distribution, guaranteeing that the chain's stationary distribution is the target. Geometric ergodicity — meaning the chain converges at an exponential rate — holds for log-concave targets. As with all MCMC, convergence is asymptotic, so convergence diagnostics (R-hat, ESS) must be checked in practice.

Can slice sampling handle multimodal posteriors?

Only partially. If the posterior has well-separated modes and the density between them falls below the current slice height, the sampler may be unable to jump between modes — the slice becomes disconnected. Extensions such as parallel tempering or combining slice sampling with a global jump proposal are needed for reliable exploration of multimodal posteriors.

What is the 'stepping-out' width parameter and how do I set it?

The width w is an initial guess for the bracket size around the current point. Neal (2003) shows the algorithm is correct for any positive w: if w is too small the bracket is expanded (stepped out) until it covers the slice; if too large it is shrunk. A reasonable default is a fraction of the prior standard deviation. In PyMC the width is adapted automatically during tuning, so manual specification is rarely needed.

Sources

  1. 1.
    Neal, R. M. (2003). Slice sampling (with discussion). Annals of Statistics, 31(3), 705–767.
  2. 2.
    Gelman, A., Carlin, J. B., Stern, H. S., Dunson, D. B., Vehtari, A., & Rubin, D. B. (2013). Bayesian Data Analysis (3rd ed.). CRC Press.
    ISBN 978-1439840955
  3. 3.
    Robert, C. P., & Casella, G. (2004). Monte Carlo Statistical Methods (2nd ed.). Springer.
    ISBN 978-0387212395

You have read it. What now?

Cite this page

ScholarGate. (2026, June 3). Slice Sampling. ScholarGate. https://scholargate.app/bayesian/slice-sampling