FAVOR: Efficient Filter-Agnostic Vector ANNS Based on Selectivity-Aware Exclusion Distances

Junjie Song, Yu Liu, Guoyu Hu, Zhongle Xie, Ming Yang, Beng Chin Ooi, Ke ZhouarXiv 2026

TL;DR

FAVOR is a new filter-agnostic approximate nearest neighbor search (ANNS) framework that efficiently handles hybrid queries combining vector similarity with structured attribute filters. By introducing a dynamic "exclusion distance" mechanism and an on-the-fly selectivity router, FAVOR achieves a 1.3–5× throughput speedup over state-of-the-art methods while maintaining high recall across all selectivity levels without the need for expensive, attribute-tailored indexes.

What Problem Does This Paper Address?

Modern retrieval applications like Recommendation Systems and Retrieval-Augmented Generation (RAG) frequently require hybrid queries. For example, a user might want to find videos semantically similar to a text description but restricted to those uploaded in the past week.

To solve this, systems perform Filtered Approximate Nearest Neighbor Search (ANNS). Graph-based indexes like Hierarchical Navigable Small World (HNSW) are excellent for pure vector search but struggle when filters are introduced. Existing solutions fall into two flawed categories:

  1. Attribute-Tailored Indexes: These build specialized graph structures for specific attributes. While fast, they are inflexible, cannot easily handle arbitrary new filters, and incur massive index maintenance costs.
  2. Filter-Agnostic Inline Methods: These use a standard vector graph but filter out invalid nodes during traversal. However, when a filter is highly restrictive (low selectivity), the valid nodes become sparse, causing the search graph to lose connectivity or forcing the algorithm into expensive, dead-end paths.

FAVOR addresses this fundamental trade-off, aiming to support arbitrary filtering conditions with high efficiency and stable performance, even when only a tiny fraction of the dataset satisfies the filter.

Table 2. Summary table w.r.t filtered ANNS solutions.

Methods

FAVOR achieves its flexibility and speed through a unified workflow that operates on a standard, unmodified proximity graph. Its architecture consists of three core components:

  1. Selectivity-Driven Search Selector: When a query arrives, FAVOR quickly estimates its selectivity ($\hat{p}$) using a lightweight random sampling strategy. If the selectivity is extremely low ($\hat{p} \le 1\%$), graph-based routing becomes inefficient. The selector dynamically routes these queries to a fast, pre-filtering brute-force algorithm. For all other cases, it deploys the main FAVOR graph search.
  2. Exclusion Distance Mechanism: This is the core algorithmic innovation. During graph traversal, instead of completely ignoring nodes that fail the attribute filter (Non-Target Data, or NTD), FAVOR computes their standard vector distance and adds a mathematically derived penalty called the exclusion distance ($D$). This dynamically reshapes the distance distribution: invalid nodes are pushed further away, allowing valid target nodes to naturally rise to the top of the candidate pool, all while keeping the invalid nodes connected to prevent the search from getting stuck in dead ends.
  3. Termination Condition Optimization: Standard HNSW terminates when the closest node in the candidate pool is further away than the furthest node in the result set. In a filtered setting, consecutive invalid nodes can trick the algorithm into stopping early. FAVOR introduces a conservative constraint requiring that a reliable proportion of the result set must contain valid target data before triggering termination, significantly boosting recall.
The overall workflow of the FAVOR framework

Datasets

The authors evaluated FAVOR across seven widely recognized image, audio, and text benchmarks:

  • SIFT1M, GIST1M, DEEP1M (Images)
  • Msong (Audio)
  • Paper, Words, LAION25M (Text & Images)

To simulate real-world hybrid queries, each vector was augmented with synthetic structured attributes (boolean, integer, and float types) to evaluate four distinct filtering scenarios: Equality, Inclusion, Range, and Logic (composite queries using AND/OR operators).

Key Insights and Ideas

  • Dynamic Metric Reshaping: Instead of physically restructuring the index graph to suit a filter, FAVOR achieves the same effect virtually by altering the distance metric on the fly. Penalizing invalid nodes acts as a repulsive force that steers the search path toward valid regions.
  • The Low-Selectivity Trap: Proximity graphs inherently degrade when valid nodes are rare. Recognizing that brute-force linear scanning actually outperforms graph navigation at ultra-low selectivities ($\le 1\%$) allows FAVOR to maintain a flat, predictable latency curve where other graph methods spike.
  • The Connectivity Balance: Pushing invalid nodes too far away breaks graph connectivity (creating "unavailable connections"). The authors mathematically derived an optimal intermediate exclusion distance ($D$) using a spatial statistical model, balancing path exploration efficiency with graph connectivity.

Key Results

  • Throughput Gains: At a strict accuracy target of $Recall@10 = 95\%$, FAVOR achieved 1.3× to 5× higher Queries Per Second (QPS) compared to leading filter-agnostic baselines like ACORN and Result-Set Filtering.
  • Robustness Across Selectivity: Thanks to its selector, FAVOR avoids the severe performance drops that plague other inline-filtering methods under low-selectivity conditions.
  • Low Overhead: Because FAVOR builds on a standard HNSW graph, its index construction time is nearly identical to vanilla HNSW (only adding a negligible ~2 seconds to compute global dataset density statistics) and requires zero extra storage overhead for structural links.

Limitations and Future Work

A key theoretical assumption in FAVOR's mathematical derivation of the exclusion distance is that the attribute distribution is completely independent of the vector positions in the embedding space. In many real-world scenarios, attributes and semantic vectors are correlated (e.g., certain types of products might cluster within specific price ranges).

The authors note that future work will focus on optimizing the exclusion distance calculation to adapt to highly correlated attribute-vector distributions and exploring hardware-level acceleration (such as SIMD and GPU optimizations) to further scale throughput.

Summary updated

BibTeX
@misc{song2026favor,
  author = {Junjie Song and Yu Liu and Guoyu Hu and Zhongle Xie and Ming Yang and Beng Chin Ooi and Ke Zhou},
  title = {{FAVOR: Efficient Filter-Agnostic Vector ANNS Based on Selectivity-Aware Exclusion Distances}},
  year = {2026},
  eprint = {2605.07770},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2605.07770},
}
Figure