Space and Time Efficient Kernel Density Estimation in High Dimensions

Arturs Backurs, Piotr Indyk, Tal WagnerNeurIPS 2019

This NeurIPS 2019 paper by Backurs, Indyk, and Wagner presents a significant optimization for Kernel Density Estimation (KDE) in high-dimensional spaces. By refining a recent hashing-based framework, the authors achieve sublinear query times while reducing memory requirements from super-linear to linear. This effectively offers the speed of advanced hashing methods with the storage efficiency of simple random sampling.

The Challenge of High-Dimensional KDE

Kernel Density Estimation (KDE) is a cornerstone of statistics and machine learning, primarily used to estimate the probability density function of a dataset. Given a set of points $X$ and a query point $y$, KDE calculates the average "influence" (or kernel value) of all points in $X$ on $y$.

However, KDE suffers heavily from the "curse of dimensionality":

  1. The Naive Approach: Calculating the exact density takes $O(N)$ time per query. For large datasets, this is prohibitively slow.
  2. Low-Dimensional Solutions: Tree-based methods (like KD-trees) work well in 2D or 3D but become exponentially slow as dimensions increase.
  3. Random Sampling: Estimating density by looking at a small random subset of the data is space-efficient but requires many samples to be accurate, especially when the target density is low.
  4. Hashing-Based Estimators (HBE): A 2017 breakthrough by Charikar and Siminelakis used Locality Sensitive Hashing (LSH) to achieve sublinear query times. However, their method required storing every data point in many different hash tables, leading to "super-linear" space requirements that made it difficult to scale on massive, real-world data.

The Innovation: Independent Subsampling

The authors build upon the HBE framework but introduce a subtle yet crucial modification to how data is stored to solve the memory bottleneck.

In the original HBE, the algorithm creates $L$ hash tables and places every data point into every table. To keep the query time sublinear, $L$ has to be quite large, leading to a massive memory footprint.

Instead of putting every point into every table, the authors' algorithm includes a point $x$ in a specific hash table $j$ only with a small probability $\delta$.

Why this works: In expectation, each point is now only stored a constant number of times across all tables, rather than $L$ times. The authors mathematically prove that even though much less information is stored, the variance of the estimator only increases by a constant factor. The algorithm still successfully finds the "important" nearby points that contribute most to the density, but it avoids wasting space by redundantly indexing them in every single table.

The paper specifically instantiates this for Laplacian and Exponential kernels, which are widely used in practice and possess the necessary LSH properties.

Key Insights

  • Linearity is King: The primary insight is that super-linear space is not a strict requirement for sublinear query time. By decoupling the number of hash tables from the total number of stored entries, algorithms can optimize for both speed and memory.
  • Variance Control: It is non-obvious that subsampling inside the hash tables wouldn't ruin the accuracy. The mathematical proof showing that the variance remains bounded is the core theoretical contribution of the paper.
  • Practicality for Low Density: The method is particularly effective when the query point $y$ is in a relatively "thin" part of the data space (low $\tau$), where standard random sampling would require a massive number of samples to find any relevant neighbors.

Empirical Results and Performance

The authors evaluated their approach on four standard high-dimensional benchmark datasets: Covertype (55 dimensions), Census (68 dimensions), GloVe (100 dimensions), and MNIST (784 dimensions).

Performance comparison showing error vs. query time and stored hashes.
  • Space Efficiency: The new method achieves a space complexity of $O(1/\tau \cdot 1/\epsilon^2)$, matching the space efficiency of simple random sampling. This is a massive improvement over the previous HBE bound of $O(1/\tau^{1.5} \cdot 1/\epsilon^4)$.
  • Query Speed: The query time remains $O(1/\sqrt{\tau} \cdot 1/\epsilon^2)$, which is significantly faster than random sampling when the density $\tau$ is small.
  • Overall Trade-off: In experiments, the authors' method achieved the same accuracy-vs-query-time tradeoff as the original HBE but used orders of magnitude less memory. As the target error ($\epsilon$) decreased, the "space gap" between this work and the original HBE grew even larger, proving the scalability of the new approach.

Limitations and Future Directions

While highly effective, the current theoretical guarantees rely on the kernel being "LSHable." This covers Laplacian and Exponential kernels, but it doesn't directly apply to the Gaussian kernel without further transformations. Additionally, while the big-O complexity is improved, constant factors related to the LSH family can still impact real-world performance.

Looking forward, the authors suggest that this "space-efficient hashing" idea could likely be applied to other problems beyond KDE, such as other types of kernel-based learning or large-scale similarity search.

Summary updated

BibTeX
@inproceedings{backurs2019space,
  author = {Arturs Backurs and Piotr Indyk and Tal Wagner},
  title = {{Space and Time Efficient Kernel Density Estimation in High Dimensions}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2019},
}
Figure