Kernel Thinning

Raaz Dwivedi, Lester Mackey

Abstract

Kernel thinning (KT) is a novel algorithm that compresses a large set of $n$ points representing a distribution into a much smaller subset of $\sqrt{n}$ points. It significantly outperforms standard random sampling, achieving integration error rates that resemble high-quality Quasi-Monte Carlo methods but for general distributions and kernels.

Introduction

In modern statistics and machine learning, complex probability distributions are often represented using large collections of points, such as the output of a Markov chain Monte Carlo (MCMC) sampler. However, these point sets can be massive, leading to high storage costs and slow downstream computations. The standard solution, "thinning" (keeping every $k$-th point or random subsampling), is inefficient, typically yielding an integration error that decreases at a slow rate of $O(1/\sqrt{m})$.

Methodology

The authors introduce Kernel Thinning (KT), a procedure that uses the properties of Reproducing Kernel Hilbert Spaces (RKHS) to select points intelligently. The goal is to minimize the Maximum Mean Discrepancy (MMD) between the original distribution and the thinned version, which is equivalent to minimizing the worst-case integration error across all functions in the kernel's RKHS.

KT takes an initial $n$-point approximation and compresses it into a $\sqrt{n}$-point approximation in $O(n^2)$ time. Unlike classical Quasi-Monte Carlo (QMC) methods restricted to uniform distributions on a unit cube, KT works for general distributions on $\mathbb{R}^d$ and a wide variety of kernels, including Gaussian, Matérn, and B-spline.

Key Insights and Results

A primary advantage of KT is its ability to break the $1/\sqrt{m}$ barrier. While standard i.i.d. sampling of size $m = \sqrt{n}$ yields an error of $\Omega(n^{-1/4})$, KT achieves an error of roughly $O(n^{-1/2})$. This represents a significant improvement in accuracy for the same number of points.

Visual comparison of i.i.d. sampling (top row, red) versus Kernel Thinning (bottom row, blue) across various point counts. KT points exhibit superior spatial coverage and less clumping.

Visually, i.i.d. sampling suffers from "clumping" and "gaps," whereas KT points are more evenly distributed, filling the space of the target distribution more effectively. Theoretically, the paper provides non-asymptotic bounds:

  • For compactly supported distributions, the maximum discrepancy is $O_d(n^{-1/2} \sqrt{\log n})$.
  • For sub-exponential distributions, KT maintains a near $O(n^{-1/2})$ rate, specifically $O_d(n^{-1/2} (\log n)^{d+1} \log \log n)$.

Conclusion

Kernel thinning provides a powerful tool for compressing distribution representations without sacrificing accuracy. While the $O(n^2)$ complexity and specific $\sqrt{n}$ compression ratio present areas for future optimization, the current implementation (available via the kernel_thinning Python package) offers a practical and theoretically grounded alternative to standard thinning methods.

Summary updated

BibTeX
@inproceedings{dwivedi2021kernel,
  author = {Raaz Dwivedi and Lester Mackey},
  title = {{Kernel Thinning}},
  booktitle = {Conference on Learning Theory},
  year = {2021},
}
Figure