Distribution Compression in Near-Linear Time

Abhishek Shetty, Raaz Dwivedi, Lester Mackey

The Challenge: The Quadratic Bottleneck in Distribution Compression

In fields ranging from Bayesian inference to Monte Carlo integration, complex probability distributions are often represented using a massive set of $n$ sample points. However, many downstream applications—such as running 1,000-CPU-hour simulations of human heart tissue—are far too computationally expensive to evaluate on every single point. To solve this, researchers use "coresets": much smaller subsets of points that accurately summarize the original distribution.

Finding the right coreset involves a classic computational trade-off:

  1. Standard Thinning: Methods like picking every $t$-th point are incredibly fast but result in high integration error.
  2. High-Accuracy Thinning: Algorithms like Kernel Thinning (KT) and Kernel Herding provide near-optimal accuracy but suffer from quadratic $O(n^2)$ runtimes.

When $n$ is large (e.g., 250,000 points), high-accuracy methods become prohibitively slow, often taking days to compute. This paper introduces Compress++, a meta-procedure designed to break this "quadratic bottleneck" by accelerating high-accuracy thinning algorithms to near-linear time without sacrificing the quality of the summary.

The Solution: Compress and Compress++

The authors propose a two-stage meta-procedure to achieve these massive speedups:

1. Compress (The Recursive Engine)

Compress is a divide-and-conquer algorithm. It partitions the $n$ input points into four groups, recursively compresses each group, and then uses a "halving" algorithm to merge them back together. Because the heavy, quadratic-time computation is restricted to small subsets at the bottom of the recursion tree, the total runtime drops significantly.

2. Compress++ (The Final Polish)

To offset any slight error introduced by the recursive merging steps, Compress++ adds a second stage. It first uses the fast Compress routine to generate an intermediate coreset. Then, it applies a slower, high-quality THIN algorithm only on that small intermediate set to produce the final $\sqrt{n}$ points.

Key Innovation: Unlike previous "merge-reduce" attempts that still suffered from super-linear runtimes, Compress++ achieves a near-linear runtime of $O(n \log^3 n)$ and can be implemented in a streaming fashion to drastically reduce memory usage.

Key Insights and Theoretical Guarantees

  • Random Cancellation of Errors: A major theoretical breakthrough in the paper is proving that errors in the recursive steps do not simply compound. Because the underlying halving algorithms are "sub-Gaussian," the errors from different branches of the recursion tree tend to cancel each other out. This keeps the final error bounded within a factor of 4 of the original, slow algorithm.
  • Algorithm Agnostic: Compress++ acts as a universal "wrapper." It can speed up any thinning algorithm, including those with unknown theoretical properties like kernel herding or Stein thinning.

Experimental Results

The researchers evaluated Compress++ on several challenging benchmarks, including synthetic targets (Gaussians up to 100 dimensions) and real-world Markov Chain Monte Carlo (MCMC) posteriors targeting complex differential equation models (e.g., the 38-dimensional Hinch model for cardiac cells).

Massive Speedups

By reducing the size of the set passed to the $O(n^2)$ thinning algorithms, Compress++ effectively achieves a square-root reduction in runtime. For a dataset of 250,000 points in 100 dimensions, the original Kernel Thinning (KT) algorithm would take over 24 hours. KT-Compress++ finished the same task in less than one hour—a massive 32x speedup.

Runtime comparison of Kernel Thinning variants showing Compress++ achieving near-linear scaling.

Accuracy Preservation and Surprising Improvements

In almost all experiments, Compress++ matched or nearly matched the Maximum Mean Discrepancy (MMD) error of the original quadratic-time algorithms. Surprisingly, in lower-dimensional herding tasks, the "Herd-Compress++" variant actually outperformed the original kernel herding algorithm in terms of accuracy.

Mean MMD for Herding variants, demonstrating that Herd-Compress++ matches or even outperforms standard Herding in low dimensions.

Limitations and Future Work

While Compress++ offers a robust, practical solution for scaling distribution compression, several open questions remain:

  • The "Why" of Herding: The authors note the surprising accuracy improvements of Compress++ in low-dimensional herding but do not yet have a full theoretical explanation for the phenomenon.
  • Optimal Trade-offs: While the error is bounded by a factor of 4, it remains an open question whether one can thin distributions even faster than near-linear time without sacrificing more accuracy.
  • Lower Bounds: Future work should focus on establishing strict "computational-statistical trade-offs" to prove exactly how much computational speed can be gained before statistical accuracy must inevitably degrade.

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