Recent advances in multimodal retrieval-augmented generation (RAG) have increased the demand for efficient out-of-distribution (OOD) vector search, in which query and base vectors follow different distributions. Mainstream graph-based indexes perform well for in-distribution (ID) queries but often require substantially more distance computations for OOD queries to achieve the same recall. Although existing OOD methods use sampled queries to improve graph construction, searches still need to examine many candidates. In this paper, we propose Matrix, a graph-based index that learns how to adjust distances during graph construction. Specifically, we derive a unique symmetric positive definite matrix that matches the second moments of distance differences for transformed base vectors and OOD queries. We also prove that paired transformations preserve the original query distances during graph repair. To further improve search efficiency, we learn a binary tree from sampled OOD queries and their nearest neighbors to quickly select suitable entry vertices. Extensive experiments on four real-world OOD datasets show that, at matched Recall@10, Matrix achieves up to 2.97x the throughput of the fastest state-of-the-art OOD index and up to 43% fewer distance computations than the baseline with the lowest count, while maintaining a modest index cost.
翻译:暂无翻译