Improving Approximate Nearest Neighbor Search through Learned Adaptive Early Termination
Conglong Li, Minjia Zhang, David G. Andersen, Yuxiong He
Abstract
In applications ranging from image search to recommendation systems, the problem of identifying a set of "similar" real-valued vectors to a query vector plays a critical role. However, retrieving these vectors and computing the corresponding similarity scores from a large database is computationally challenging. Approximate nearest neighbor (ANN) search relaxes the guarantee of exactness for efficiency by vector compression and/or by only searching a subset of database vectors for each query. Searching a larger subset increases both accuracy and latency. State-of-the-art ANN approaches use fixed configurations that apply the same termination condition (the size of subset to search) for all queries, which leads to undesirably high latency when trying to achieve the last few percents of accuracy. We find that due to the index structures and the vector distributions, the number of database vectors that must be searched to find the ground-truth nearest neighbor varies widely among queries. Critically, we further identify that the intermediate search result after a certain amount of search is an important runtime feature that indicates how much more search should be performed. To achieve a better tradeoff between latency and accuracy, we propose a novel approach that adaptively determines search termination conditions for individual queries. To do so, we build and train gradient boosting decision tree models to learn and predict when to stop searching for a certain query. These models enable us to achieve the same accuracy with less total amount of search compared to the fixed configurations. We apply the learned adaptive early termination to state-of-the-art ANN approaches, and evaluate the end-to-end performance on three million to billion-scale datasets. Compared with fixed configurations, our approach consistently improves the average end-to-end latency by up to 7.1 times faster under the same high accuracy targets. Our approach is open source at github.com/efficient/faiss-learned-termination.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext cb1ce620-653f-4291-9c1b-e2cc8c213494Cited by top-tier papers54
- A Comprehensive Survey and Experimental Comparison of Graph-Based Approximate Nearest Neighbor SearchMengzhao Wang, Xiaoliang Xu, Qiang Yue, Yuxiang WangVLDB 2021 · 354 citations
- RaBitQ: Quantizing High-Dimensional Vectors with a Theoretical Error Bound for Approximate Nearest Neighbor SearchJianyang Gao, Cheng LongSIGMOD 2024 · 83 citations
- Efficient Approximate Nearest Neighbor Search in Multi-dimensional DatabasesYun Peng, Byron Choi, Tsz Nam Chan, Jianye Yang et al.SIGMOD 2023 · 74 citations
- High-Dimensional Approximate Nearest Neighbor Search: with Reliable and Efficient Distance Comparison OperationsJianyang Gao, Cheng LongSIGMOD 2023 · 73 citations
- HVS: Hierarchical Graph Structure Based on Voronoi Diagrams for Solving Approximate Nearest Neighbor SearchKejing Lu, Mineichi Kudo, Chuan Xiao, Yoshiharu IshikawaVLDB 2022 · 70 citations
Related papers
- Recall-Aware Early Termination in Approximate Nearest Neighbor SearchShuang Hao, Xinxin Li, Wei ZhangKDD 2026
- E2E: Efficient Filtered AKNN Search via Adaptive TerminationWenxuan Xia, Mingyu Yang, Wentao Li, Wei WangKDD 2026 · 1 citation
- ANNA: Specialized Architecture for Approximate Nearest Neighbor SearchYejin Lee, Hyunji Choi, Sunhong Min, Hyunseung Lee et al.HPCA 2022 · 37 citations
- ANSMET: Approximate Nearest Neighbor Search with Near-Memory Processing and Hybrid Early TerminationYiwei Li, Yuxin Jin, Boyu Tian, Huanchen Zhang et al.ISCA 2025 · 10 citations
- JUNO: Optimizing High-Dimensional Approximate Nearest Neighbour Search with Sparsity-Aware Algorithm and Ray-Tracing Core MappingZihan Liu, Wentao Ni, Jingwen Leng, Yu Feng et al.ASPLOS 2024 · 21 citations
