SmartANN boosts speed and accuracy in approximate nearest neighbor search

SmartANN: Object Causal Modeling Boosts Approximate Nearest Neighbor Diagnosis and Auto-Design

Databases

Summary

Finding items similar to a query quickly is important in many computing tasks, but existing methods have parts that rely on each other, making it hard to find and fix slowdowns or errors. The authors created SmartANN, a tool that models the process as linked parts and checks each part in order to find exactly where problems happen. By fixing these problems step-by-step, SmartANN improves both the speed and accuracy of the whole search process. They tested SmartANN on several datasets and showed big improvements in results and query speed with little extra work.

What this means in practice

  • For search engine engineers: Automatically diagnose and improve bottlenecks in ANN components to boost search accuracy and speed in large-scale recommendation and retrieval systems.
  • For database system administrators: Use SmartANN to optimize existing approximate nearest neighbor indexes for faster query responses while maintaining quality.

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.