JAG: Joint Attribute Graphs for Filtered Nearest Neighbor Search

Haike Xu, Guy Blelloch, Laxman Dhulipala, Lars Gottesbüren, Rajesh Jayaram, Jakub Łącki

Abstract

Despite filtered nearest neighbor search being a fundamental task in modern vector search systems, the performance of existing algorithms is highly sensitive to query selectivity and filter type. In particular, existing solutions excel either at specific filter categories (e.g., label equality) or within narrow selectivity bands (e.g., pre-filtering for low selectivity) and are therefore a poor fit for practical deployments that demand generalization to new filter types and unknown query selectivities. In this paper, we propose JAG (Joint Attribute Graphs), a graph-based algorithm designed to deliver robust performance across the entire selectivity spectrum and support diverse filter types. Our key innovation is the introduction of attribute and filter distances, which transform binary filter constraints into continuous navigational guidance. By constructing a proximity graph that jointly optimizes for both vector similarity and attribute proximity, JAG prevents navigational dead-ends and allows JAG to consistently outperform prior graph-based filtered nearest neighbor search methods. Our experimental results across five datasets and four filter types (Label, Range, Subset, Boolean) demonstrate that JAG significantly outperforms existing state-of-the-art baselines in both throughput and recall robustness.

Introduction

In modern AI applications, vector search serves as the backbone for systems ranging from image retrieval to Retrieval-Augmented Generation (RAG). However, real-world queries rarely rely solely on vector similarity. Users typically impose constraints, such as finding the most similar product within a specific price range or the most relevant document published in a certain year. This task, known as Filtered Nearest Neighbor (FNN) search, presents significant challenges for current indexing strategies.

Existing FNN algorithms often struggle with varying selectivity—the fraction of the dataset satisfying the filter. Post-filtering methods, which search the entire vector space before applying filters, become inefficient at low selectivity. Conversely, pre-filtering methods, which filter before searching, are slow when the remaining subset is large. Most existing solutions are also "one-trick ponies," optimized for specific filter types like categorical labels but failing on range or boolean constraints. JAG (Joint Attribute Graphs) addresses these limitations by providing a unified, robust framework for diverse filter types and selectivity levels.

Methodology: From Binary Walls to Navigational Gradients

The fundamental innovation of JAG is the transformation of binary filter constraints into continuous navigational signals. Traditional graph-based searches often hit "dead ends"—clusters of points that are vector-similar to the query but fail the metadata filter, offering no guidance on where to go next.

Attribute and Filter Distances

JAG introduces two key metrics:

  1. Attribute Distance ($dist_A$): Measures the difference between the metadata of two items.
  2. Filter Distance ($dist_F$): Quantifies how far an item is from satisfying a specific query's filter.

By using these distances, JAG turns a "pass/fail" check into a "warmer/colder" signal. During search, JAG employs lexicographic ordering: it prioritizes points with lower filter distances (closer to satisfying the constraint). If filter distances are equal, it breaks the tie using standard vector similarity. This ensures the algorithm first navigates toward the "valid island" of data before optimizing for similarity.

Navigating toward a filter constraint using filter and vector distances.

Index Construction

JAG constructs a proximity graph that jointly optimizes for both vector similarity and attribute proximity. It uses a "capped" attribute distance, where items with attributes within a threshold $t$ are treated as equivalent. By merging edges from multiple thresholds into a single graph (Threshold-JAG), the system creates a hierarchy of connections. Some edges connect strict attribute neighbors (crucial for low selectivity), while others provide broader connectivity (efficient for high selectivity).

Experimental Evaluation

The researchers evaluated JAG across five major datasets (SIFT1M, ARXIV, MSTuring-10M, LAION, and YFCC-10M) covering four filter types: Label, Range, Subset, and Boolean logic.

Results and Performance

JAG demonstrated significant improvements in both throughput and recall robustness. On datasets like LAION-25M and YFCC, JAG achieved up to 10x higher Queries Per Second (QPS) at 0.9 recall compared to state-of-the-art filter-agnostic baselines.

Performance comparison on the MSTuring-10M-range dataset showing JAG's superior throughput and recall.

A key strength of JAG is its performance in low-selectivity scenarios. While many existing methods plateau at lower recall levels, JAG consistently reaches perfect (1.0) recall while maintaining high throughput. Furthermore, JAG matches the performance of specialized tools like iRangeGraph while maintaining the versatility to handle complex boolean and subset filters.

Conclusion and Future Work

JAG solves the "selectivity gap" in filtered vector search by replacing binary constraints with continuous navigational guidance. While JAG offers superior robustness, it does involve trade-offs. Indexing time is higher than metadata-oblivious methods, and the increased edge density can lead to a larger memory footprint. Future research may focus on automated threshold selection and further optimizing the memory efficiency of the joint graph structure. Nonetheless, JAG represents a significant step toward a universal index for complex, filtered vector search.

Summary updated

Abstract

Despite filtered nearest neighbor search being a fundamental task in modern vector search systems, the performance of existing algorithms is highly sensitive to query selectivity and filter type. In particular, existing solutions excel either at specific filter categories (e.g., label equality) or within narrow selectivity bands (e.g., pre-filtering for low selectivity) and are therefore a poor fit for practical deployments that demand generalization to new filter types and unknown query selectivities. In this paper, we propose JAG (Joint Attribute Graphs), a graph-based algorithm designed to deliver robust performance across the entire selectivity spectrum and support diverse filter types. Our key innovation is the introduction of attribute and filter distances, which transform binary filter constraints into continuous navigational guidance. By constructing a proximity graph that jointly optimizes for both vector similarity and attribute proximity, JAG prevents navigational dead-ends and allows JAG to consistently outperform prior graph-based filtered nearest neighbor search methods. Our experimental results across five datasets and four filter types (Label, Range, Subset, Boolean) demonstrate that JAG significantly outperforms existing state-of-the-art baselines in both throughput and recall robustness.
BibTeX
@misc{xu2026jag,
  author = {Haike Xu and Guy Blelloch and Laxman Dhulipala and Lars Gottesbüren and Rajesh Jayaram and Jakub Łącki},
  title = {{JAG: Joint Attribute Graphs for Filtered Nearest Neighbor Search}},
  year = {2026},
  eprint = {2602.10258},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2602.10258},
}

Loading related content...

Figure