implement algorithm 5 for inplace repair and algorithm 6 to clean up … - #648
implement algorithm 5 for inplace repair and algorithm 6 to clean up …#648Kartikk1127 wants to merge 3 commits into
Conversation
…dangling edges. cleanup() method can be deprecated now
|
Hey, is there any update on this PR? Happy to talk if it needs to be better aligned with PR policies or anything else |
|
Thanks for the PR! The implementation overall looks good to me. My main concern is latency — specifically, how the per-call cost of The "1.49–1.55 ms, flat across batches" result is good news for Algorithm 5 in isolation, but I don't think it tells us about the impact of Algorithm 6. Two structural reasons it gets hidden:
I think there are two missing parts from benchmarking:
I'd suggest a benchmark that builds a million-scale index and deletes 30% with per-call timing. |
d6b1b22 to
a97b3b8
Compare
|
@dian-lun-lin
Let me know if this sounds good to you. |
|
@dian-lun-lin Hi, is there any update on this PR? |
Problem
The current
markNodeDeleted+cleanup()workflow has O(N) cost per deletion:markNodeDeletedonly flips a bit in the deleted setcleanup()scans every node in the graph vianodeStreamto find in-neighborsof the deleted node, then rebuilds their neighbor lists
This means deletion cost degrades linearly as the graph grows, and crucially it
grows over time as more deletions accumulate.
Solution
The IP-DiskANN paper (arXiv:2502.13826) describes two algorithms that solve this:
Algorithm 5 — In-place deletion repair:
Instead of scanning all N nodes to find in-neighbors, run a GreedySearch toward
the deleted node's vector. Nodes the search visits are the approximate in-neighbors.
This reduces in-neighbor discovery from O(N) to O(DELETION_LD) where DELETION_LD
is the beam width of the search.
The sequence per deletion:
list using the top-DELETION_LD search results as replacement candidates
Algorithm 6 — Dangling edge sweep:
Algorithm 5 repairs in-neighbors found via the search path, but greedy search
is approximate and may miss some. Algorithm 6 is a periodic O(N × M) sweep
(no distance calculations) that removes any remaining out-edges pointing to
absent nodes.
Benchmark Results (SIFT-1M, M=16, efConstruction=200, efSearch=200)
100K deletions (10% of index), 1000 query vectors, topK=10:
Baseline recall: 0.9534 → Post-deletion recall: 0.9279 (2.55% degradation)
Key observations:
API changes
markNodeDeletedbecomes self-contained — nocleanup()call needed after deletion.cleanup()is still required before writing to disk.consolidateDanglingEdges()is a new public method for Algorithm 6 execution.Implementation
The PR implements the algorithm.
References