A Bi-metric Framework for Efficient Nearest Neighbor Search

Haike Xu, Sandeep Silwal, Piotr Indyk

Nearest Neighbor (NN) search serves as the backbone of modern information retrieval and Retrieval-Augmented Generation (RAG) pipelines. However, system designers constantly face a tradeoff between speed and accuracy. A recent paper introduces a novel "bi-metric" framework that elegantly bridges this gap, combining cheap, low-accuracy proxy metrics with expensive, high-accuracy ground-truth metrics to achieve state-of-the-art results at a fraction of the computational cost.

The "Goldilocks" Problem in Information Retrieval

When choosing distance metrics for search, practitioners are typically stuck between two extremes:

  1. Cheap metrics (like small embedding models) are incredibly fast but often miss the most semantically relevant results.
  2. Expensive metrics (like massive LLMs or cross-encoders) are highly accurate but computationally prohibitive to run across millions of data points.

The industry standard workaround is the "retrieve-then-rerank" pipeline: use a cheap model to retrieve the top 1,000 candidates, then apply an expensive model to re-sort them. However, this approach has two fatal flaws. First, if the cheap model fails to include the true best result in its initial top-K retrieval, the expensive model never even sees it. Second, linearly scanning and scoring 1,000 items with a heavy model remains a significant system bottleneck.

The Bi-Metric Solution: Navigate, Don't Just Rerank

To overcome the limitations of retrieve-then-rerank pipelines, the authors propose a "metric switch" strategy designed specifically for graph-based data structures (like DiskANN) and Cover Trees.

  • The Indexing Phase: The search index is constructed using only the proxy metric ($d$). This keeps the heavy lifting of index construction fast and computationally cheap.
  • The Query Phase: A search begins using the proxy metric to quickly navigate into the correct general "neighborhood" of the graph. Once there, the system switches to the ground-truth metric ($D$) to perform a greedy traversal toward the final nearest neighbors.

The core innovation here is using the expensive metric to navigate the graph rather than merely re-sorting a static list. Because the expensive metric actively guides the traversal, it can dynamically "correct" the path if the proxy metric initially led the search slightly astray.

Theoretical Underpinnings: Why Graphs Succeed

The paper provides strong theoretical backing for why this approach works, yielding several key insights:

  • Graphs are Inherently Robust: The most surprising finding is that a graph built for one metric is remarkably effective for searching with another, provided the two metrics are somewhat related. The authors prove that a "shortcut reachability graph" constructed for a proxy metric $d$ also functions as a valid shortcut graph for the expensive metric $D$.
  • The "Net" Principle: The theory relies on "nets"—subsets of data that represent the whole space at different scales. A net that adequately covers the space for a cheap metric will also cover it for the expensive metric, albeit with a slightly larger radius.
  • LSH is Brittle: The authors theoretically demonstrate that this bi-metric framework does not work for Locality Sensitive Hashing (LSH). LSH relies on a "one-shot" partitioning of space; if the proxy metric places a point in the wrong bucket, the search is permanently doomed. Graph-based methods succeed precisely because they are iterative and adaptive.

Key Results on the BEIR Benchmark

The researchers evaluated their framework using six large-scale datasets from the BEIR benchmark (Climate-FEVER, FEVER, HotpotQA, MSMARCO, NQ, and DBPedia), each containing over 1 million passages. They utilized models like bge-micro-v2 and gte-small as proxies, and SFR-Embedding-Mistral or Gemini-2.0-Flash as ground truths.

The empirical results demonstrate a massive leap in efficiency:

  • 4x Efficiency Gain: When using the Gemini-2.0-Flash API as a listwise reranker, the bi-metric approach achieved the same accuracy as traditional reranking while making 4x fewer API calls (approx. 200 vs. 800).
  • Massive Time Savings: On the HotpotQA dataset, the bi-metric search took roughly 260 seconds per query, compared to 1,040 seconds for the baseline to reach comparable accuracy.
  • Superior to "Single Metric" Searches: Surprisingly, the bi-metric search often converged faster than a search conducted entirely with the expensive metric from the start. This suggests that cheap metrics are actually better and more efficient at the early "routing" stages of a search.

Limitations and Future Work

While highly effective, the framework does have boundaries. The theoretical proofs rely on a Bounded Distortion Assumption, meaning the proxy metric must approximate the ground truth within a constant factor $C$. If the two models have wildly different "worldviews," the guarantees weaken.

Furthermore, search quality remains dependent on Graph Connectivity. If the proxy metric is so poor that it fails to create necessary "bridge" edges between relevant clusters, the expensive metric may still get stuck in a local optimum during traversal. Finally, while the authors successfully tested LLMs as listwise rerankers, these are not strictly mathematical metrics. Extending the formal theory to encompass non-metric, black-box ranking functions remains a promising area for future research.

Summary updated

BibTeX
@inproceedings{xu2026bi,
  author = {Haike Xu and Sandeep Silwal and Piotr Indyk},
  title = {{A Bi-metric Framework for Efficient Nearest Neighbor Search}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=kBzzertldC},
}
Figure