Abstract
Real-world vector embeddings are usually associated with extra labels, such as attributes and keywords. Many applications require the nearest neighbor search that contains specific labels, such as searching for product image embeddings restricted to a particular brand. A straightforward approach is to materialize all possible indices according to the complete query label workload. However, this leads to an exponential increase in both index space and processing time, which significantly limits scalability and efficiency. In this paper, we leverage the inclusion relationships among query label sets to construct partial indexes, enabling index sharing across queries for improved construction efficiency. We introduce elastic factor bounds to guarantee search performance and use the greedy algorithm to select indices that meet the bounds, achieving a tradeoff between efficiency and space. Meanwhile, we also designed the algorithm to achieve the best elastic factor under a given space limitation. Experimental results on multiple real datasets demonstrate that our algorithm can achieve near-optimal search performance, achieving up to 10x-500x search efficiency speed up over state-of-the-art approaches. Our algorithm is highly versatile, since it is not constrained by index type and can seamlessly integrate with existing optimized libraries.
Introduction: The Challenge of Label-Hybrid Search
Modern search applications increasingly require "label-hybrid" Approximate K-Nearest Neighbor (AKNN) search. This involves finding items that are not only visually or semantically similar but also satisfy specific categorical constraints, such as brand, color, or release year.
The core challenge lies in the "exponential explosion" of label combinations. For a dataset with $L$ labels, there are $2^L$ possible filter sets. Building a dedicated index for every combination is storage-prohibitive, while post-filtering a single global index is often too slow when the filter is highly selective.
Methodology: Elastic Index Selection (EIS)
The authors propose Elastic Index Selection (EIS), a framework that selectively materializes a subset of label-combination indices. EIS is built on two key pillars:
- Label Containment & The Elastic Factor: An index built for a broad label set (e.g.,
{Brand: A}) can also answer queries for a more specific set (e.g.,{Brand: A, Year: 2025}). The Elastic Factor ($e$) is the ratio of vectors matching the specific query to the total vectors in the broader index. This factor serves as a formal predictor of search performance: a higher factor means less irrelevant data to filter out. - Greedy Index Selection: Since selecting the optimal set of indices is NP-complete, EIS employs greedy algorithms to either minimize storage space given a performance guarantee or maximize performance given a storage budget.
EIS is index-agnostic, allowing it to integrate seamlessly with existing libraries like HNSW or Faiss.
Experimental Evaluation
The framework was evaluated on eight diverse datasets, including real-world metadata (PAPER, Arxiv) and large-scale benchmarks (DEEP 100M).
Key Results
- Performance Gains: EIS achieved 10x to 800x speedups in query throughput (QPS) compared to state-of-the-art methods like UNG and ACORN.
- Storage Efficiency: The method achieves near-optimal performance with only ~100% space overhead (doubling the dataset size), whereas naive exhaustive indexing would require 64x to 1024x more space.
- Scalability: On the 100M-vector DEEP dataset, EIS maintained high performance where other methods struggled to scale or lost significant accuracy.
Insights and Future Work
A critical insight of this work is that search indices do not need to be perfect for every query; "good enough" shared indices provide a graceful, sublinear degradation in performance. By utilizing historical query workloads, EIS prioritizes indexing the most frequent label combinations. The system also supports dynamic updates through a batch-update strategy, avoiding the need for full index rebuilds.
While highly effective, the method's efficiency depends on label overlap. If a workload consists of thousands of completely disjoint label sets, the sharing mechanism is less effective. Future research will explore hardware acceleration (GPUs/FPGAs) and optimization for extremely large, sparse label alphabets.
Summary updated