Table of Contents
Fetching ...

Filtered Approximate Nearest Neighbor Search Cost Estimation

Wenxuan Xia, Mingyu Yang, Wentao Li, Wei Wang

TL;DR

Filtered AKNN combines vector similarity with attribute filters, creating highly variable query costs. E2E introduces an Early Probe phase to extract filter-aware runtime signals and trains a LightGBM-based estimator to predict the total cost, enabling per-query adaptive termination. The approach explicitly models the correlation between query vectors and attribute selectivity, addressing the feature-filter misalignment that hurts prior cost estimators. On real-world datasets, E2E achieves speedups by a factor of two to three with recall preserved, demonstrating practical impact for large-scale filtered retrieval systems.

Abstract

Hybrid queries combining high-dimensional vector similarity with structured attribute filtering have garnered significant attention across both academia and industry. A critical instance of this paradigm is filtered Approximate k Nearest Neighbor (AKNN) search, where embeddings (e.g., image or text) are queried alongside constraints such as labels or numerical range. While essential for rich retrieval, optimizing these queries remains challenging due to the highly variable search cost induced by combined filters. In this paper, we propose a novel cost estimation framework, E2E, for filtered AKNN search and demonstrate its utility in downstream optimization tasks, specifically early termination. Unlike existing approaches, our model explicitly captures the correlation between the query vector distribution and attribute-value selectivity, yielding significantly higher estimation accuracy. By leveraging these estimates to refine search termination conditions, we achieve substantial performance gains. Experimental results on real-world datasets demonstrate that our approach improves retrieval efficiency by 2x-3x over state-of-the-art baselines while maintaining high search accuracy.

Filtered Approximate Nearest Neighbor Search Cost Estimation

TL;DR

Filtered AKNN combines vector similarity with attribute filters, creating highly variable query costs. E2E introduces an Early Probe phase to extract filter-aware runtime signals and trains a LightGBM-based estimator to predict the total cost, enabling per-query adaptive termination. The approach explicitly models the correlation between query vectors and attribute selectivity, addressing the feature-filter misalignment that hurts prior cost estimators. On real-world datasets, E2E achieves speedups by a factor of two to three with recall preserved, demonstrating practical impact for large-scale filtered retrieval systems.

Abstract

Hybrid queries combining high-dimensional vector similarity with structured attribute filtering have garnered significant attention across both academia and industry. A critical instance of this paradigm is filtered Approximate k Nearest Neighbor (AKNN) search, where embeddings (e.g., image or text) are queried alongside constraints such as labels or numerical range. While essential for rich retrieval, optimizing these queries remains challenging due to the highly variable search cost induced by combined filters. In this paper, we propose a novel cost estimation framework, E2E, for filtered AKNN search and demonstrate its utility in downstream optimization tasks, specifically early termination. Unlike existing approaches, our model explicitly captures the correlation between the query vector distribution and attribute-value selectivity, yielding significantly higher estimation accuracy. By leveraging these estimates to refine search termination conditions, we achieve substantial performance gains. Experimental results on real-world datasets demonstrate that our approach improves retrieval efficiency by 2x-3x over state-of-the-art baselines while maintaining high search accuracy.
Paper Structure (18 sections, 5 equations, 10 figures, 5 tables, 1 algorithm)

This paper contains 18 sections, 5 equations, 10 figures, 5 tables, 1 algorithm.

Figures (10)

  • Figure 1: An example of filtered AKNN search in an e-commerce scenario. A user submits a reference photo with a filter "Brand=A". The search process (bottom) illustrates that geometrically close neighbors (e.g., $x_2, x_5$) may be filtered out due to label mismatch. While traditional methods might exhaustively search the vector index to ensure recall, our proposed framework $$E2E utilizes runtime features (from $x_1, x_4, x_5$) and filter features to predict convergence and stop the search early at $x_3$, avoiding unnecessary computations.
  • Figure 2: Motivational Example in an E-commerce Scenario. While the Easy Range Filter aligns with vector proximity, the Hard Range Filter excludes the immediate vector neighbors of the Query. This necessitates expanding the search radius significantly to locate the nearest valid neighbor, highlighting the significant difference in search cost.
  • Figure 3: The Misalignment Between Local and Global Selectivity in Real-World Datasets. Scatter plots of observed local correlation ($\rho_{local}$) versus global selectivity ($\sigma_{global}$) in log-scale. The chaotic distribution in Tripclick-label (left) and the high variance in Arxiv-range (right) highlight the inability of static estimators to capture runtime search difficulty.
  • Figure 4: The overall architecture of our proposed ${ {\mathsf{E2E}}}\xspace$ framework.
  • Figure 5: Recall-Query Latency Tradeoff for $$E2E-HNSW and Naive-HNSW.
  • ...and 5 more figures

Theorems & Definitions (6)

  • definition 1: Attributed Vector Dataset
  • definition 2: Filtered Query
  • definition 3: Filter Predicate
  • definition 4: Filtered Subset
  • definition 5: Filtered $k$ Nearest Neighbor Search
  • definition 6: Selectivity