Distribution Compression in Near-linear Time

Abhishek Shetty, Raaz Dwivedi, Lester Mackey

Introduction

In fields such as Bayesian inference and Monte Carlo integration, researchers often generate massive sets of sample points ($n$) to represent complex probability distributions. However, downstream applications—such as high-fidelity heart simulations or complex ecological models—often impose strict limits on the number of points that can be processed. This creates a need for "distribution compression" or "thinning": the process of selecting a small, high-quality subset (a "coreset") of size $\sqrt{n}$ that accurately represents the original distribution.

The Challenge: Speed vs. Accuracy

Traditional thinning methods, like simple subsampling, are fast but often result in high approximation errors. Conversely, state-of-the-art methods like Kernel Thinning (KT) provide near-optimal accuracy but suffer from a major computational bottleneck: their runtime scales quadratically ($O(n^2)$) with the number of input points. For a dataset with a million points, $O(n^2)$ scaling becomes prohibitively slow, requiring days of computation on high-performance clusters.

Methods: The Compress++ Meta-Procedure

This paper introduces Compress++, a meta-algorithm that accelerates slow, high-accuracy thinning procedures to near-linear $O(n \text{ polylog } n)$ time. The approach relies on two key innovations:

  1. COMPRESS (Divide-and-Conquer): This algorithm recursively splits the input points into smaller groups, compresses them, and recombines them using a "halving" primitive. The theoretical foundation of this method is that randomized decisions made during recursion allow errors to cancel out rather than accumulate, maintaining high fidelity to the original distribution.
  2. COMPRESS++ (Two-Stage Refinement): This is the full pipeline. It first uses the fast COMPRESS routine to reduce the initial $n$ points to a slightly larger intermediate coreset. Then, it applies a high-accuracy but slower thinning algorithm (like KT) only to this much smaller intermediate set.
The COMPRESS++ meta-procedure combines a fast recursive compression stage with a high-accuracy refinement stage to achieve near-linear runtime.

By offloading the bulk of the computation to the near-linear stage, Compress++ makes high-quality compression practical for million-point datasets on standard hardware.

Evaluation and Results

The authors evaluated Compress++ on a variety of targets, including synthetic Gaussian mixtures and real-world Markov Chain Monte Carlo (MCMC) samples from differential equation posteriors in ecology and cardiology.

Performance Gains

The empirical results demonstrate massive speedups. For a 100-dimensional dataset with 250,000 points, the standard Kernel Thinning algorithm takes over 24 hours to complete. In contrast, KT-Compress++ finishes in less than an hour—a 32x speedup. Similar improvements were observed for Kernel Herding, which saw a 45x speedup.

Maintaining Accuracy

Crucially, these speedups come with minimal loss in accuracy. Across all benchmarks, the error (measured by Maximum Mean Discrepancy, or MMD) of the Compress++ variants closely tracked the performance of the original $O(n^2)$ algorithms. In some low-dimensional cases, the meta-procedure even improved the accuracy of the underlying herding algorithm.

Comparison of Mean MMD (accuracy) and single-core runtime for KT and Kernel Herding variants across different dimensions and input sizes. Compress++ variants (blue/orange) maintain near-optimal accuracy while scaling significantly better than the original $O(n^2)$ algorithms (green).

Conclusion

Compress++ represents a significant step forward in making high-quality distribution summaries accessible. By reducing the computational complexity of thinning from quadratic to near-linear, it enables researchers to process larger datasets and more complex models without sacrificing statistical accuracy. This "near-linear" transformation changes distribution compression from an overnight cluster job into a routine task that can be performed in minutes on a laptop.

Summary updated

BibTeX
@inproceedings{shetty2022distribution,
  author = {Abhishek Shetty and Raaz Dwivedi and Lester Mackey},
  title = {{Distribution Compression in Near-linear Time}},
  booktitle = {International Conference on Learning Representations},
  year = {2022},
  url = {https://openreview.net/forum?id=lzupY5zjaU9},
}
Figure