SmartANN improves nearest neighbor search with causal modeling analysis
SmartANN: Object Causal Modeling Boosts Approximate Nearest Neighbor Diagnosis and Auto-Design
Databases
Summary
Approximate Nearest Neighbor (ANN) algorithms help find similar items quickly, but their multiple connected steps can cause hidden problems that affect overall performance. The researchers developed SmartANN, a tool that looks at each step in the process to find where issues first occur and then fixes them. By using a method called object causal modeling, SmartANN can automatically diagnose problems and suggest better designs for these algorithms. Tests show SmartANN helps improve accuracy and speed across different ANN methods and real-world datasets with little extra computing cost.
Approximate Nearest Neighbor (ANN)Index constructionQuery executionObject causal model (OCM)Bottleneck attributionRecallQPS (Queries per second)IVF-PQHNSWAuto-design
Authors
Yutong Zhou, Guoxin Kang, Lei Wang, Xueya Zhang, Qinwei Yang, Jianfeng Zhan
Abstract
Approximate Nearest Neighbor (ANN) algorithms achieve high efficiency through interdependent phases across index construction and query execution. This coupling allows upstream performance loss to propagate downstream, affecting execution behavior and measurable outputs. Existing component-level analyses mainly compare isolated design choices, while end-to-end benchmarks report aggregate metrics; neither traces loss propagation across dependent phases, hindering root-cause attribution and automated redesign. We present SmartANN, a framework based on the object causal model (OCM) for ANN bottleneck attribution and automated redesign. SmartANN represents an ANN workflow as eight ordered, replaceable objects and diagnoses them with a sequential diagnose-and-replace loop. At each iteration, it identifies the first object deviating from expected behavior or output as a bottleneck. Because an upstream bottleneck can obscure downstream ones, SmartANN replaces it with a test oracle when available, or with an implementation producing a better outcome, then continues downstream diagnosis. From the diagnosed bottlenecks and failure causes, SmartANN composes compatible actions from a pluggable action library to generate an optimized end-to-end ANN design. We instantiate SmartANN for IVF-PQ and HNSW, covering partition-and-quantization and graph-based ANN families. Experiments on eight real-world datasets show that SmartANN improves Recall by 0.24--74.20%, and increases QPS by 28.8--256.5% at comparable Recall, with low diagnosis and auto-design overhead. The code is available at https://github.com/zhouyutong20/SmartANN.