Adaptive Monte-Carlo Optimization

Vivek Kumar Bagaria, Govinda M. Kamath, David N. C. TsearXiv 2018

Abstract

Finding nearest neighbors in high-dimensional spaces is a fundamental challenge in machine learning, traditionally constrained by $O(nd)$ complexity. This paper introduces Bandit-Based Monte Carlo Optimization (BMO-NN), a framework that treats candidate neighbors as "arms" in a multi-armed bandit problem. By adaptively sampling coordinates to estimate distances, BMO-NN prunes distant candidates early, effectively reducing complexity toward $O(n+d)$. On real-world datasets like Tiny ImageNet, the algorithm achieves up to an 80x reduction in computations while maintaining high accuracy, outperforming established heuristics like LSH and graph-based methods.

Introduction

The $k$-nearest neighbors ($k$-NN) algorithm is ubiquitous in fields ranging from recommendation systems to manifold learning. However, the "exact" computation of distances becomes a bottleneck as both the number of points ($n$) and the number of dimensions ($d$) scale. Standard approaches require summing coordinate-wise distances across all dimensions for every candidate, leading to a multiplicative $O(nd)$ cost.

While approximate methods like Locality Sensitive Hashing (LSH) or graph-based heuristics (e.g., kGraph, NGT) offer speedups, they often require expensive index construction or trade off significant accuracy. BMO-NN addresses this by asking if we can find exact neighbors faster by inspecting only a fraction of dimensions for the majority of points.

Methodology: The Bandit Approach

The core innovation of BMO-NN is framing distance estimation as an adaptive sampling problem. Instead of computing the full distance $\theta_i$ for a point $i$, the algorithm generates an unbiased estimate $\hat{\theta}_i$ by sampling a subset of coordinates.

Evolution of the BMO framework: from simple Monte Carlo estimation (a) to a multi-armed bandit approach (c) for adaptive distance estimation.

Adaptive Sampling with UCB

BMO-NN employs a modified Upper Confidence Bound (UCB1) algorithm. It maintains confidence intervals for the estimated distance to each candidate. If a point’s lower confidence bound exceeds the upper bound of the current best candidates, the algorithm stops sampling that point. This "adaptive precision" ensures that computational resources are focused on candidates that are likely to be true nearest neighbors.

Optimizing Convergence

To ensure rapid convergence, the authors use Random Rotations (Hadamard transforms) to distribute distance information evenly across all coordinates. For sparse datasets, such as gene expression data, a specialized "Sparse Monte Carlo" box is used to sample only non-zero entries. To avoid infinite sampling of nearly identical points, a MAX_PULLS threshold triggers an exact distance computation once a certain confidence level is reached.

Key Results

The framework was evaluated on high-dimensional datasets, including Tiny ImageNet (12,288 dimensions) and 10x Genomics (28,000 dimensions).

Computational gain of BMO compared to exact search and other approximate methods (kGraph, NGT, LSH) as a function of data dimensionality.

As shown in the results, BMO-NN demonstrates a linear increase in computational gain relative to exact search as dimensionality grows. On Tiny ImageNet, it achieved an 80x reduction in coordinate-wise computations with a 99% success rate. Notably, it required 50x fewer computations than LSH and significantly outperformed top-tier heuristics like kGraph and NGT. In practical C++ implementations, BMO-NN was 5x faster than the Falconn LSH library and 1.5x faster than optimized scikit-learn baselines.

Discussion and Conclusion

BMO-NN can be conceptualized as an "Adaptive Johnson-Lindenstrauss" transform. While standard dimensionality reduction projects all data into a fixed lower-dimensional space, BMO-NN adaptively determines the "effective" dimension needed to distinguish each pair of points. This shift from multiplicative ($nd$) to additive ($n+d$) complexity represents a significant theoretical and practical advancement for high-dimensional data analysis.

Future work aims to address the $O(n^2)$ scaling for full graph construction by integrating BMO with triangle-inequality pruning. Additionally, optimizing the batch size of bandit pulls for GPU architectures could further enhance wall-clock performance.

Summary updated

BibTeX
@misc{bagaria2018adaptive,
  author = {Vivek Kumar Bagaria and Govinda M. Kamath and David N. C. Tse},
  title = {{Adaptive Monte-Carlo Optimization}},
  year = {2018},
  eprint = {1805.08321},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1805.08321},
}
Figure