iRangeGraph: Improvising Range-dedicated Graphs for Range-filtering Nearest Neighbor Search

Yuexuan Xu, Jianyang Gao, Yutong Gou, Cheng Long, Christian S. Jensen · DOI

Introduction

Range-filtering Approximate Nearest Neighbor (RFANN) search is a critical component in modern vector databases, where users seek the nearest neighbors within specific attribute constraints (e.g., finding images similar to a query but only for products priced between $50 and $100). Traditional approaches like pre-filtering, post-filtering, or in-filtering often suffer from performance bottlenecks or accuracy issues. Materializing dedicated graphs for every possible range is storage-prohibitive due to the $O(n^2)$ number of possible ranges. iRangeGraph addresses this by dynamically "improvising" a dedicated search graph for any query range on the fly.

The iRangeGraph Framework

The core of iRangeGraph is a segment-tree-based index that stores "elemental graphs" representing sub-ranges of the data.

Index Phase

Data is organized into a segment tree based on a numeric attribute. Each node in the tree contains an elemental graph (an approximate Relative Neighborhood Graph or RNG). Since the tree has $O(\log n)$ layers, each data point is included in only a logarithmic number of graphs, maintaining a manageable $O(nm \log n)$ space complexity.

Extracted figure from page 4 of iRangeGraph: Improvising Range-dedicated Graphs for Range-filtering Nearest Neighbor Search

Query Phase: Improvisation

When a query range $[L, R]$ is received, iRangeGraph does not search a single static graph. Instead, it improvises the neighbors of each visited node by selecting edges from the pre-built elemental graphs. A top-down edge selection algorithm prioritizes "robust" edges from higher levels of the segment tree that are contained within the query range. This on-the-fly construction adds minimal overhead ($O(m + \log n)$), making it nearly as fast as searching a pre-built graph.

Multi-Attribute Extension

For queries involving multiple numeric constraints, iRangeGraph employs a probabilistic strategy, allowing the search to traverse out-of-range nodes to find optimal paths to valid results.

Experimental Evaluation

The authors evaluated iRangeGraph against state-of-the-art baselines using five diverse real-world datasets covering various modalities.

Overview of the five real-world datasets used for evaluation, including vector dimensions and filtering attributes.

As shown in the table above, the datasets include images, text, video, and audio features, with filtering attributes ranging from image size and publication dates to view counts and timestamps.

Key Results and Insights

  • Superior Throughput: iRangeGraph achieves 2x–5x better query throughput than competitive baselines like SuperPostfiltering at 0.9 recall. Compared to industry standards like Milvus, speedups can reach up to 300x in specific workloads.
  • Memory Efficiency: By avoiding full graph materialization for every range, iRangeGraph maintains a significantly smaller memory footprint. For instance, on the WIT dataset, it required ~13GB compared to the baseline's ~29GB.
  • Structural Robustness: Edges that survive pruning in larger-range elemental graphs are prioritized, as they are likely to be effective for sub-ranges. This allows for efficient "layer skipping" during the improvisation process.
  • Oracle Performance: iRangeGraph performs within 2x the speed of an "Oracle-HNSW" (an impractical baseline with pre-built graphs for every specific query), demonstrating the efficiency of its on-the-fly construction.

Conclusion

iRangeGraph provides a scalable and efficient solution for RFANN search by leveraging segment trees and on-the-fly graph construction. While it currently relies on RNG approximations and faces challenges in reaching perfect recall for complex multi-attribute queries, it represents a significant step forward in constrained vector search. Future work includes exploring multi-branch trees to further reduce memory footprint and supporting dynamic updates for inserting or deleting points.

Summary updated

BibTeX
@article{xu2024irangegraph,
  author = {Yuexuan Xu and Jianyang Gao and Yutong Gou and Cheng Long and Christian S. Jensen},
  title = {{iRangeGraph: Improvising Range-dedicated Graphs for Range-filtering Nearest Neighbor Search}},
  journal = {Proc. ACM Manag. Data},
  year = {2024},
  doi = {10.1145/3698814},
}
Figure