Efficient Nearest Neighbor Search for Cross-Encoder Models using Matrix Factorization

Nishant Yadav, Nicholas Monath, Rico Angell, Manzil Zaheer, Andrew McCallum
10/23/2022
cs.CLcs.IRcs.LG

Official code: iesl/anncur (13 stars, Python, Apache-2.0, last commit 2022-11-24).

Abstract

Efficient k-nearest neighbor search is a fundamental task, foundational for many problems in NLP. When the similarity is measured by dot-product between dual-encoder vectors or $\ell_2$-distance, there already exist many scalable and efficient search methods.

Show full abstract

But not so when similarity is measured by more accurate and expensive black-box neural similarity models, such as cross-encoders, which jointly encode the query and candidate neighbor. The cross-encoders' high computational cost typically limits their use to reranking candidates retrieved by a cheaper model, such as dual encoder or TF-IDF. However, the accuracy of such a two-stage approach is upper-bounded by the recall of the initial candidate set, and potentially requires additional training to align the auxiliary retrieval model with the cross-encoder model. In this paper, we present an approach that avoids the use of a dual-encoder for retrieval, relying solely on the cross-encoder. Retrieval is made efficient with CUR decomposition, a matrix decomposition approach that approximates all pairwise cross-encoder distances from a small subset of rows and columns of the distance matrix. Indexing items using our approach is computationally cheaper than training an auxiliary dual-encoder model through distillation. Empirically, for k > 10, our approach provides test-time recall-vs-computational cost trade-offs superior to the current widely-used methods that re-rank items retrieved using a dual-encoder or TF-IDF.

View on arXivView PDF

Code Implementations(1)

iesl/anncurOfficial100%
Apache-2.0

Approximate Nearest Neighbor search using CUR Decomposition

131Python, ShellOct 21, 20224 years agoApache-2.0

Similar Papers

Cite this paper

@article{yadav2022efficient,
  title  = {Efficient Nearest Neighbor Search for Cross-Encoder Models using Matrix Factorization},
  author = {Nishant Yadav and Nicholas Monath and Rico Angell and Manzil Zaheer and Andrew McCallum},
  year   = {2022},
  eprint = {2210.12579},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2210.12579}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2210.12579.svg)](https://codeofpaper.com/paper/2210.12579)

Discussion