CleANN: Efficient Full Dynamism in Graph-based Approximate Nearest Neighbor Search

Ziyu Zhang, Yuanhao Wei, Joshua Engels, Julian ShunarXiv 2025 · DOI

Introduction

Approximate Nearest Neighbor Search (ANNS) is a critical component in modern AI applications, ranging from recommendation systems to the retrieval-augmented generation (RAG) pipelines of Large Language Models (LLMs). While graph-based indexes like HNSW and Vamana have established themselves as the state-of-the-art for static datasets, they struggle in "fully dynamic" scenarios where data is continuously inserted, deleted, and queried.

Current dynamic solutions often rely on marking deleted nodes as "tombstones" and performing periodic, resource-intensive global consolidation to repair the graph structure. This approach introduces "stop-the-world" bottlenecks, causing throughput to plummet during maintenance phases. Furthermore, the structural quality of these graphs is often sensitive to the order of data insertion, which is problematic for streaming data. CleANN is proposed as a solution that replaces global maintenance with adaptive, on-the-fly updates.

Methodology

CleANN introduces three core techniques to maintain graph integrity and performance without global interruptions:

1. Guided Bridge Building

During standard insertion or search operations, CleANN analyzes the search tree to identify "cousin" nodes—nodes at similar depths that lack direct connections. By establishing "bridge" edges between these nodes, CleANN enhances graph navigability and ensures the index remains robust regardless of the data insertion order. This process, termed ROBUSTINSERT, mimics the benefits of expensive global optimizations.

Figure 3: Step-by-step illustration of the ROBUSTINSERT algorithm, showing how bridge edges are formed to maintain connectivity.

2. Dynamic Neighborhood Consolidation

Rather than waiting for a batch process, CleANN repairs the graph incrementally. When an operation encounters a tombstone (a deleted node), the system proactively assists the tombstone's neighbors in finding new, active connections. This approach amortizes the cost of deletions across all system operations, preventing performance cliffs.

3. Semi-lazy Memory Cleaning

To manage memory efficiently, CleANN employs an "eagerness threshold." Once a deleted node has been bypassed by a sufficient number of operations, it is marked for replacement. CleANN avoids the high cost of tracking every incoming edge to a deleted node; instead, it allows new data to overwrite old nodes. The inherent robustness of greedy search algorithms allows the system to naturally ignore any residual "random" edges pointing to the overwritten node.

Experimental Evaluation

The authors evaluated CleANN against state-of-the-art baselines like FreshVamana across seven diverse datasets, including standard benchmarks (Sift, GloVe) and billion-scale real-world datasets (MS-SpaceV, Yandex-tti).

Key Results

CleANN demonstrated significant performance gains across all tested scenarios:

  • Throughput: In concurrent workloads involving simultaneous updates and searches, CleANN achieved throughput improvements ranging from 7x to 1200x compared to FreshVamana.
  • Accuracy: The system maintains search recall levels comparable to, and occasionally exceeding, those of indexes built statically from scratch.
  • Robustness: On adversarial datasets designed to trigger structural degradation, CleANN maintained over 90% recall, whereas competing dynamic methods experienced significant failures.
Figure 1: Comparison of throughput and average recall across various datasets, highlighting CleANN's superior performance in dynamic environments.

Discussion and Conclusion

CleANN's primary insight is that structural maintenance can be effectively integrated into the search and insertion paths. By connecting "cousin" nodes and embracing the robustness of greedy search against "random" edges, CleANN eliminates the need for disruptive global consolidation.

While CleANN offers a major leap in dynamic ANNS, some limitations remain. The semi-lazy cleaning approach may lead to slightly higher temporary memory overhead compared to aggressive cleanup methods. Future work will focus on providing a formal theoretical analysis of the bridge-building mechanism and exploring the integration of CleANN with data compression techniques like product quantization to support even larger datasets.

Summary updated

BibTeX
@misc{zhang2025cleann,
  author = {Ziyu Zhang and Yuanhao Wei and Joshua Engels and Julian Shun},
  title = {{CleANN: Efficient Full Dynamism in Graph-based Approximate Nearest Neighbor Search}},
  year = {2025},
  eprint = {2507.19802},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2507.19802},
}
Figure