Abstract
Traditional nearest neighbor search often assumes static datasets, which is impractical for dynamic environments like malware triage. This paper evaluates and optimizes three metric index structures—Cover-trees, Vantage-Point (VP) trees, and Random Ball Covers (RBC)—for incremental insertion and querying. We introduce the Minimum-Variance Vantage-Point tree ($VP_{MV}$), which utilizes a variance-minimizing split strategy to enhance pruning efficiency. Experimental results across diverse datasets demonstrate that $VP_{MV}$ consistently outperforms existing methods in dynamic scenarios, providing a robust solution for live indexing.
Introduction
Nearest neighbor search is a fundamental task in fields ranging from image retrieval to malware analysis. To avoid the computational cost of brute-force search, metric indexes leverage the triangle inequality to prune the search space. However, most research focuses on static datasets where the index is built once and queried many times. In production environments, such as malware analysis labs, millions of new files arrive continuously, requiring indexes that support interleaved insertions and queries without frequent, expensive rebuilds.
Methods for Incremental Indexing
The authors adapted three established metric index structures for incremental use:
Cover-trees
Cover-trees are naturally hierarchical and incremental. However, they typically rely on a maxdist parameter that is expensive to update. The authors implemented $Cover_B$, which employs a looser, computationally cheaper upper bound to facilitate immediate querying post-insertion.
Vantage-Point (VP) Trees
VP trees partition space using distances from a selected "vantage point." While traditionally built top-down, the authors developed an incremental strategy using a bucket system.
The primary innovation is the $VP_{MV}$ (Minimum-Variance) tree. Standard VP trees split data at the median distance. In contrast, $VP_{MV}$ selects a split point that minimizes the weighted variance of distances, similar to split selection in decision trees. This approach creates a larger "gap" between branches, significantly improving pruning efficiency during search.
Random Ball Cover (RBC)
Originally optimized for GPUs, RBC was modified with an incremental construction procedure. The improved version, $RBC_{Imp}$, enhances search speed by building neighbor lists incrementally and utilizing cached distances to tighten search bounds.
Experimental Evaluation
The study evaluated these structures across diverse datasets, including MNIST (images), Forest Cover Type (tabular), and VirusShare5m (malware). The malware dataset utilized the Lempel-Ziv Jaccard Distance (LZJD) to measure binary similarity.
Key Results
- Performance Leader: The $VP_{MV}$ tree emerged as the most efficient structure, requiring the fewest distance computations during construction and maintaining top-tier query speeds.
- Robustness: $VP_{MV}$ demonstrated superior performance in write-heavy scenarios (e.g., 100 insertions per query). On the VirusShare5m dataset, it avoided up to 57% of distance computations compared to brute-force search.
- Cover-tree Limitations: Despite their theoretical elegance, Cover-trees performed poorly on certain metrics like LZJD, sometimes falling behind brute-force search.
Conclusion
The $VP_{MV}$ tree provides a significant advancement for incremental nearest neighbor search. By optimizing the split strategy to minimize variance, it achieves superior pruning and stability in dynamic environments. Future work will explore better parallelization for tree-based structures and methods to maintain split quality as the index grows.
Summary updated