---
title: Proximity Graph-based ANN Indices
url: https://www.emergentmind.com/topics/proximity-graph-based-ann-indices
type: topic
---

# Proximity Graph-based ANN Indices

A proximity graph–based Approximate Nearest Neighbor (ANN) index is a data structure for high-dimensional similarity search relying on a graph in which vertices correspond to data vectors and directed edges encode neighborhood relations that enable fast greedy, beam, or best-first search for nearest neighbor queries. Such indices underpin database, information retrieval, recommendation, and retrieval-augmented-generation (RAG) systems where efficient, robust, and updatable vector search is required. Proximity graph indices dominate ANN benchmarks, especially for billion-scale datasets. An important technical challenge arises in streaming scenarios: vectors are inserted and deleted at high rates, but proximity graphs are typically singly-linked (out-neighbors only), which complicates deletions. State-of-the-art algorithms—including FreshDiskANN's batched consolidation and the IP-DiskANN "in-place" update scheme—address this with distinct graph maintenance protocols that balance recall, update speed, and latency [2502.13826].

## 1. Fundamental Principles of Proximity Graph-Based ANN Indices

Proximity graph construction involves representing the data set \( P \) as directed graph \( G(P,E) \), where each vector is linked to a small set of neighbors chosen via prune procedures merging proximity and diversity. This ensures that a greedy or beam search from a fixed start node \( s \) reliably traverses the graph towards data points close to the query \( q \) using a limited number of distance computations. The key properties demanded are:

- **Connectivity:** The graph should minimize diameter while preserving reachability for all queries.
- **Neighbor selection:** Each node \( p \) selects up to \( R \) out-neighbors via "RobustPrune" or similar, balancing closeness and diversity.
- **Search complexity:** Proper pruning yields \( O(\log N) \) or \( O(N^\rho) \) query complexity, translating to a few hundred distance computations per query at scale.

Graph-based indices such as HNSW (Hierarchical Navigable Small World) and DiskANN instantiate these principles with single or multi-layer structures, supporting efficient in-place insertions. Deletions, however, are problematic due to the singly-linked nature—no easy access to in-neighbors—necessitating specialized update logic [2502.13826].

## 2. Dynamic Update Challenges: Insertions and Deletions

Formal metrics define the performance of an ANN index:

- **Recall@k:** At query time \( t \), given the true top-k neighbors \( G \) and algorithm output \( A \), recall@k is \( |G \cap A| / k \).
- **Query latency:** Measured in time per query or QPS.
- **Update throughput:** Number of insertions/deletions per second, or per-update cost.

Insertion is straightforward—running a GreedySearch plus RobustPrune attaches a new point in \( O(l_b + R^2) \) distance computations. By contrast, deletion requires not only removing a node \( p \), but repairing the graph so that each in-neighbor remains connected to the remaining subgraph via efficient rewiring, without visiting all \( O(R^2) \) possible edge pairs. Batched consolidation (as in FreshDiskANN) marks deleted vertices, periodically consolidating by replacing edges to deleted nodes and pruning, amortizing cost but introducing latency spikes and recall oscillation [2502.13826].

## 3. In-Place Graph Maintenance and Update Protocols

IP-DiskANN introduces a scheme to efficiently handle streaming insertions and deletions directly, eschewing batch consolidation for purely in-place updates:

- **Insertion:** The procedure runs GreedySearch to collect candidate neighbors, executes RobustPrune to select up to \( R \) out-neighbors, and rewires as required. Each updated node pruned if the maximum degree is exceeded.

```python
function Insert(G, x_p, l_b, R, α):
    V ← GreedySearch(G, x_p, 1, l_b).visited
    N_out(p) ← RobustPrune(p, V, R, α)
    for v in N_out(p):
        add edge v→p
        if |N_out(v)|>R:
            N_out(v) ← RobustPrune(v, N_out(v), R, α)
```

- **Deletion:** IP-DiskANN re-approximates in-neighbors of \( p \) by GreedySearch on \( x_p \), then rewires each with only a small constant \( c \) edges, not the full \( R^2 \), and prunes to cap out-degrees.

```python
function Delete(G, p, l_d, k, c, α, R):
    (Visited, Candidates) ← GreedySearch(G, x_p, k, l_d)
    N'_in(p) ← {z ∈ Visited : p ∈ N_out(z)}
    for z in N'_in(p):
        C_z ← top-c closest points to x_z among Candidates
        N_out(z) ← (N_out(z) ∪ C_z) \ {p}
    for w in N_out(p):
        C_w ← top-c closest points to x_w among Candidates
        for y in C_w:
            add edge y→w
    remove vertex p from G
    for any v whose out-degree > R:
        N_out(v) ← RobustPrune(v, N_out(v), R, α)
```
With parameters \( l_d=128, k=50, c=3, α=1.2 \), the per-deletion complexity is \( O(l_d + cR\log R) \), dramatically reducing update overhead compared to batch-based approaches.

Additionally, IP-DiskANN performs lightweight consolidation: after a threshold (e.g., 20% deletions), a scan strips out-edges to deleted nodes, with no pruning or distance computation. This ensures query stability by removing dangling pointers [2502.13826].

## 4. Theoretical and Empirical Evaluation

Theoretical analysis demonstrates that in-place deletion maintains expected connectivity: rewiring neighbors and out-neighbors through candidate selection preserves graph structure and high recall. Empirical benchmarks—using 100D MSTuring and 768D Wikipedia embeddings—show:

- **Recall stability:** IP-DiskANN maintains recall within ±0.2% of static indices over long update streams; FreshDiskANN's recall dips before consolidation batches and recovers.
- **Query/update efficiency:** IP-DiskANN matches or slightly exceeds FreshDiskANN in recall (up to +2.3%), with 10–30% faster deletions. HNSW update costs increase rapidly at large scale (\( O(R^3) \)).
- **Regimes:** In all runbooks, in the SlidingWindow setting for 10M points, IP-DiskANN achieves Recall@10 ≈ 94.8% (deletion 1.11s, insertion 1.46s) vs FreshDiskANN's 94.4% (deletion 1.7s, insertion 1.45s) and HNSW's 91.8% (per-step update+query ≈ 4s).
- **Trade-offs:** IP-DiskANN's per-delete cost slightly exceeds insertion, but the algorithm entirely avoids periodic \( O(N) \) consolidations.

## 5. Architectural and Algorithmic Guidelines

Use in-place IP-DiskANN when supporting workflows with high-rate mixed insert/delete patterns on dataset scales \( >10^7 \) where stable latency and consistent resource utilization are essential. Latency-sensitive deployments benefit from the elimination of periodic rebuild spikes. Batched consolidation (FreshDiskANN) or static rebuild remains preferable only under low deletion rates (\(<5\%\)) or if delete bursts are rare and idle consolidation windows are available.

Practical tuning recommendations include setting \( c \) (extra edge copies) in the range 2–5 and \( l_d \) (delete beam size) between 100–200 to balance recall and latency, performing lightweight consolidation at 10–20% delete thresholds, and monitoring recall drift, which remains within 0.5% of static recall using IP-DiskANN indefinitely.

## 6. Extensions, Related Results, and Broader Context

Other approaches have investigated incremental proximity graph maintenance via explicit reverse graphs to ease in-neighbor identification and facilitate efficient local/global graph repair (GlobalReconnect strategies) [2206.10839]. Theoretical works have established that only direct neighbors of a deleted node require edge updates, matching the locality exploited by IP-DiskANN [2206.10839]. Monotonic relative neighborhood graphs (MRNG) provide foundational understanding of searchability and minimality in graph-based indices and have inspired generalized pruning procedures for balancing degree and navigability [2107.13052]. Further refinements—such as fast index construction via iterative prune-and-search strategies employing angle-based pruning and adaptive refinement—offer scalability improvements and search guarantees [2410.01231].

## 7. Summary

Proximity graph-based ANN indices, as represented by the IP-DiskANN framework, offer high-recall, low-latency, scalable vector search with robust support for streaming insertions and deletions. By shifting from batch-based consolidation to efficient in-place updates, these indices maintain stable query performance and resource efficiency, making them the leading solution for high-throughput, dynamic ANN search and retrieval systems [2502.13826].

Source: https://www.emergentmind.com/topics/proximity-graph-based-ann-indices