fix(diskann): tombstone deletes with vector preservation, local graph repair, and delete_deferred escape hatch#684
Open
ohdearquant wants to merge 2 commits into
Conversation
…aph repair Fixes ruvnet#679 Co-Authored-By: Leo <noreply@khive.ai>
Contributor
Author
|
CI note — the red checks on this PR are not caused by this diff:
The DiskANN build jobs and remaining test shards for this change all pass. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
delete_deferred()for callers that prefer tombstone-only deletion and later batch cleanup.Fixes #679
Design
Deletion now marks the internal vector position in a packed tombstone set and removes the external ID from the live reverse map. The original vector values remain unchanged. This removes the prior NaN distance hazard and lets tombstoned nodes remain valid routing waypoints when deletion is deferred. Search filters tombstones before exact re-ranking and uses a total floating-point ordering.
The default
delete()path performs local graph repair. Because this crate does not maintain reverse adjacency, it finds the deleted node's in-neighbors by scanning the bounded-degree adjacency in O(n * degree) time per deletion. For each live in-neighbor, it combines the node's existing candidates with the deleted node's live out-neighbors, removes deleted candidates, and applies the existing alpha robust-prune selection with the configured maximum degree. The deleted node is then removed from all adjacency. Tombstoned sources and candidates are short-circuited during the scan.delete_deferred()is the low-latency escape hatch. It records the tombstone without modifying graph edges, allowing callers to defer repair or rebuild work. Unknown IDs and repeated deletes returnDiskAnnError::NotFound.Measurements
Recall is recall@10 against brute-force ground truth over surviving vectors after seeded random deletion of 20% of the index. Main is unmeasurable because deleted IDs can be returned, invalidating survivor-only recall.
Measured on an Apple M2 Max, single-threaded, with the release profile. The raw machine-readable output is produced by
bench_delete_recall.Validation
cargo fmt -p ruvector-diskanncargo clippy -p ruvector-diskann --all-targets -- -D warningscargo test -p ruvector-diskannWASM
The implementation uses only the Rust standard library, adds no dependencies, and remains compatible with the crate's WASM builds.