Kernel Stein Discrepancy thinning: a theoretical perspective of pathologies and a practical fix with regularization

Clement Benard, Brian Staber, Sébastien Da VeigaNeurIPS 2023

Introduction

Markov chain Monte Carlo (MCMC) is a cornerstone of Bayesian inference, allowing us to sample from complex posterior distributions. However, raw MCMC output is often "dirty"—it contains a "burn-in" period of low-quality initial points and highly correlated samples that consume excessive memory.

Stein thinning is a promising algorithm proposed to post-process these outputs. It greedily selects a small, high-quality subset of points by minimizing the Kernelized Stein Discrepancy (KSD). Because KSD only requires the gradient of the log-target distribution (the "score"), it bypasses the need to calculate intractable normalization constants. While Stein thinning automatically removes burn-in and corrects biases, it suffers from empirical pathologies that can lead to poor approximations. This paper provides a theoretical analysis of these failures and introduces Regularized Stein Thinning (RST) to correct them.

The Pathologies of Standard Stein Thinning

Researchers have identified two major failure modes when using standard Stein thinning:

  1. Mode Proportion Blindness: If a distribution has multiple distant peaks (modes), Stein thinning might select an equal number of points from each, ignoring the actual probability mass. Because the score function $\nabla \log p(x)$ is fundamentally local, it indicates the direction of the nearest peak but fails to convey the relative height (or mass) of distant peaks.
Standard Stein Thinning suffers from mode proportion blindness, often selecting an equal number of points from clusters of vastly different densities.
  1. Spurious Minima: The score is zero at any stationary point, including local minima and saddle points. Consequently, the algorithm can mistakenly cluster points in "dead zones" of very low probability simply because the gradient there is flat. In finite samples, KSD struggles to distinguish between a local maximum (a true mode) and a local minimum.

The Solution: Regularized Stein Thinning

To address these issues, the authors propose adding two specific regularization terms to the KSD objective function:

  • Entropic Regularization ($-\lambda \log(p(x))$): By incorporating the actual log-density value rather than just its gradient, the algorithm is forced to evaluate which modes are genuinely more probable. This ensures the thinned sample accurately reflects the true weights of different peaks, curing mode proportion blindness.
  • Laplacian Correction ($\Delta^+ \log(p(x))$): The Laplacian (the trace of the Hessian) reveals the curvature of the distribution. By penalizing positive Laplacian values, the algorithm can differentiate between a concave "peak" and a convex "valley" or "saddle point." This effectively prevents the algorithm from trapping points in low-probability spurious minima.

Importantly, the authors prove that these regularization terms preserve the algorithm's asymptotic properties; as more points are collected, the thinned sample still converges to the true target distribution.

Experimental Results

The researchers evaluated Regularized Stein Thinning using synthetic "stress tests" (like Gaussian mixtures and heavy-tailed "banana" distributions) and real-world benchmarks from the UCI Machine Learning Repository.

Qualitative Improvements: In visual tests, standard Stein thinning frequently placed points in the empty space between modes. Regularized Stein thinning successfully avoided these dead zones and correctly weighted the modes.

Regularized Stein Thinning successfully avoids placing points in low-probability "dead zones" between clusters, fixing the spurious minima pathology.

Quantitative Superiority: * RST consistently achieved a lower Maximum Mean Discrepancy (MMD) across various dimensions and thinning sizes, indicating the samples were much closer to the true distribution. * In Bayesian Logistic Regression tasks, RST significantly improved predictive performance. For example, on the Breast Cancer dataset, the Area Under the Curve (AUC) jumped from ~0.91 with standard thinning to 0.96 with the regularized version.

Limitations and Future Directions

While highly effective, Regularized Stein Thinning introduces a few new challenges:

  • Hyperparameter Tuning: The algorithm requires a regularization parameter $\lambda$. Although the authors suggest a heuristic ($\lambda = 1/m$), optimally tuning this parameter remains difficult because the true normalization constant is unknown.
  • Computational Overhead: Calculating the Laplacian requires second-order derivatives. While modern automatic differentiation tools (like the authors' JAX-based kernax library) make this efficient, it remains more computationally expensive than standard first-order Stein thinning.

Future work may explore applying these regularization strategies to other KSD-based methods, such as Stein Variational Gradient Descent, which likely suffer from similar local-gradient pathologies.

Summary updated

BibTeX
@inproceedings{benard2023kernel,
  author = {Clement Benard and Brian Staber and Sébastien Da Veiga},
  title = {{Kernel Stein Discrepancy thinning: a theoretical perspective of pathologies and a practical fix with regularization}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=TjgG4UT62W},
}
Figure