Skip to content

[VectorSets] Update diskann-garnet and wire up metric types#1688

Merged
tiagonapoli merged 8 commits into
mainfrom
tiagonapoli/update-diskann-garnet
Apr 10, 2026
Merged

[VectorSets] Update diskann-garnet and wire up metric types#1688
tiagonapoli merged 8 commits into
mainfrom
tiagonapoli/update-diskann-garnet

Conversation

@tiagonapoli

@tiagonapoli tiagonapoli commented Apr 9, 2026

Copy link
Copy Markdown
Collaborator
  • Update diskann-garnet
  • Add more synthetic recall unit tests - Test grids (l2 distance) and circles (cosine distance)

Copilot AI review requested due to automatic review settings April 9, 2026 22:08
@tiagonapoli tiagonapoli changed the title Update diskann-garnet [VectorSets] Update diskann-garnet Apr 9, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates Garnet’s DiskANN integration to align with a newer diskann-garnet package and expands test coverage around vector-search recall.

Changes:

  • Bump diskann-garnet NuGet package version to 1.0.26.
  • Update DiskANN native interop to pass the distance metric into create_index and add an external-id validity check.
  • Refresh DiskANN tests: adjust create_index call sites, replace the old (ignored) grid test with synthetic recall tests, and add an explicit test-project package reference.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/Garnet.test/Garnet.test.csproj Adds a direct diskann-garnet package reference for the test project.
test/Garnet.test/DiskANN/DiskANNSyntheticRecallTests.cs Introduces new synthetic recall tests exercising VADD/VSIM for FP32/XB8 and quantization modes.
test/Garnet.test/DiskANN/DiskANNServiceTests.cs Updates native create_index invocations to include the distance metric argument.
test/Garnet.test/DiskANN/DiskANNGridTests.cs Removes the prior grid test that was effectively disabled via Ignore.
libs/server/Resp/Vector/DiskANNService.cs Updates P/Invoke signature and CreateIndex call to include distance metric; adds check_external_id_valid interop and wrapper.
Directory.Packages.props Updates central package version for diskann-garnet to 1.0.26.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/Garnet.test/DiskANN/DiskANNSyntheticRecallTests.cs Outdated
Comment thread test/Garnet.test/DiskANN/DiskANNSyntheticRecallTests.cs
@tiagonapoli tiagonapoli force-pushed the tiagonapoli/update-diskann-garnet branch 3 times, most recently from ca59d2b to d393c6e Compare April 9, 2026 22:46
@tiagonapoli tiagonapoli changed the title [VectorSets] Update diskann-garnet [VectorSets] Update diskann-garnet and wire up metric types Apr 9, 2026
@tiagonapoli tiagonapoli force-pushed the tiagonapoli/update-diskann-garnet branch 2 times, most recently from 6f65133 to 23d49e1 Compare April 9, 2026 23:00
Signed-off-by: Tiago Napoli <[email protected]>
@tiagonapoli tiagonapoli force-pushed the tiagonapoli/update-diskann-garnet branch from 23d49e1 to 029fca7 Compare April 9, 2026 23:22
Tiago Napoli and others added 7 commits April 9, 2026 16:35
…thods

Replace 4 type-specific methods (BruteForceNearestNeighbors_FP32,
BruteForceNearestNeighbors_XB8, CountPerDistance_FP32, CountPerDistance_XB8)
with 2 generic methods that accept Func delegates for ID extraction and
distance computation.

Co-authored-by: Copilot <[email protected]>
…lTest

- Replace FP32VectorEntry and XB8VectorEntry with generic VectorEntry<TVec>
- Extract common recall loop into RunRecallTest<TEntry> with lambdas for
  distance, distance-key conversion, and VSIM querying
- RunRecallTest_FP32 and RunRecallTest_XB8 become thin wrappers

Co-authored-by: Copilot <[email protected]>
Instead of filtering entries by ID set internally, CountPerDistance now
receives the target vector and an enumerable of neighbor vectors, plus
the distance and bucketing functions. Callers filter with LINQ.

Co-authored-by: Copilot <[email protected]>
BruteForceNearestNeighbors now takes targetVector + candidates and
returns List<TVec> directly. VsimQuery IDs are mapped to vectors via
idToVector dictionary. Both flow as vector lists into CountPerDistance.

Co-authored-by: Copilot <[email protected]>
@tiagonapoli tiagonapoli merged commit 6819af9 into main Apr 10, 2026
48 of 49 checks passed
@tiagonapoli tiagonapoli deleted the tiagonapoli/update-diskann-garnet branch April 10, 2026 20:44
tiagonapoli added a commit that referenced this pull request Apr 10, 2026
* update diskann garnet

Signed-off-by: Tiago Napoli <[email protected]>

* Unify BruteForceNearestNeighbors and CountPerDistance into generic methods

Replace 4 type-specific methods (BruteForceNearestNeighbors_FP32,
BruteForceNearestNeighbors_XB8, CountPerDistance_FP32, CountPerDistance_XB8)
with 2 generic methods that accept Func delegates for ID extraction and
distance computation.

Co-authored-by: Copilot <[email protected]>

* Refactor recall tests: unify entry types and extract generic RunRecallTest

- Replace FP32VectorEntry and XB8VectorEntry with generic VectorEntry<TVec>
- Extract common recall loop into RunRecallTest<TEntry> with lambdas for
  distance, distance-key conversion, and VSIM querying
- RunRecallTest_FP32 and RunRecallTest_XB8 become thin wrappers

Co-authored-by: Copilot <[email protected]>

* Fix formatting: remove trailing newline

Co-authored-by: Copilot <[email protected]>

* Merge RunRecallTest_FP32 and RunRecallTest_XB8 into single generic RunRecallTest<TVec>

Co-authored-by: Copilot <[email protected]>

* Simplify CountPerDistance to take targetVector + otherVectors directly

Instead of filtering entries by ID set internally, CountPerDistance now
receives the target vector and an enumerable of neighbor vectors, plus
the distance and bucketing functions. Callers filter with LINQ.

Co-authored-by: Copilot <[email protected]>

* Return vectors instead of IDs from BruteForce and VsimQuery mapping

BruteForceNearestNeighbors now takes targetVector + candidates and
returns List<TVec> directly. VsimQuery IDs are mapped to vectors via
idToVector dictionary. Both flow as vector lists into CountPerDistance.

Co-authored-by: Copilot <[email protected]>

* Remove toDistanceKey parameter; hardcode Round(d*100) bucketing

Co-authored-by: Copilot <[email protected]>

---------

Signed-off-by: Tiago Napoli <[email protected]>
Co-authored-by: Tiago Napoli <[email protected]>
Co-authored-by: Copilot <[email protected]>
tiagonapoli added a commit that referenced this pull request Apr 10, 2026
* update diskann garnet

Signed-off-by: Tiago Napoli <[email protected]>

* Unify BruteForceNearestNeighbors and CountPerDistance into generic methods

Replace 4 type-specific methods (BruteForceNearestNeighbors_FP32,
BruteForceNearestNeighbors_XB8, CountPerDistance_FP32, CountPerDistance_XB8)
with 2 generic methods that accept Func delegates for ID extraction and
distance computation.

Co-authored-by: Copilot <[email protected]>

* Refactor recall tests: unify entry types and extract generic RunRecallTest

- Replace FP32VectorEntry and XB8VectorEntry with generic VectorEntry<TVec>
- Extract common recall loop into RunRecallTest<TEntry> with lambdas for
  distance, distance-key conversion, and VSIM querying
- RunRecallTest_FP32 and RunRecallTest_XB8 become thin wrappers

Co-authored-by: Copilot <[email protected]>

* Fix formatting: remove trailing newline

Co-authored-by: Copilot <[email protected]>

* Merge RunRecallTest_FP32 and RunRecallTest_XB8 into single generic RunRecallTest<TVec>

Co-authored-by: Copilot <[email protected]>

* Simplify CountPerDistance to take targetVector + otherVectors directly

Instead of filtering entries by ID set internally, CountPerDistance now
receives the target vector and an enumerable of neighbor vectors, plus
the distance and bucketing functions. Callers filter with LINQ.

Co-authored-by: Copilot <[email protected]>

* Return vectors instead of IDs from BruteForce and VsimQuery mapping

BruteForceNearestNeighbors now takes targetVector + candidates and
returns List<TVec> directly. VsimQuery IDs are mapped to vectors via
idToVector dictionary. Both flow as vector lists into CountPerDistance.

Co-authored-by: Copilot <[email protected]>

* Remove toDistanceKey parameter; hardcode Round(d*100) bucketing

Co-authored-by: Copilot <[email protected]>

---------

Signed-off-by: Tiago Napoli <[email protected]>
Co-authored-by: Tiago Napoli <[email protected]>
Co-authored-by: Copilot <[email protected]>
tiagonapoli added a commit that referenced this pull request Apr 11, 2026
* update diskann garnet

Signed-off-by: Tiago Napoli <[email protected]>

* Unify BruteForceNearestNeighbors and CountPerDistance into generic methods

Replace 4 type-specific methods (BruteForceNearestNeighbors_FP32,
BruteForceNearestNeighbors_XB8, CountPerDistance_FP32, CountPerDistance_XB8)
with 2 generic methods that accept Func delegates for ID extraction and
distance computation.

Co-authored-by: Copilot <[email protected]>

* Refactor recall tests: unify entry types and extract generic RunRecallTest

- Replace FP32VectorEntry and XB8VectorEntry with generic VectorEntry<TVec>
- Extract common recall loop into RunRecallTest<TEntry> with lambdas for
  distance, distance-key conversion, and VSIM querying
- RunRecallTest_FP32 and RunRecallTest_XB8 become thin wrappers

Co-authored-by: Copilot <[email protected]>

* Fix formatting: remove trailing newline

Co-authored-by: Copilot <[email protected]>

* Merge RunRecallTest_FP32 and RunRecallTest_XB8 into single generic RunRecallTest<TVec>

Co-authored-by: Copilot <[email protected]>

* Simplify CountPerDistance to take targetVector + otherVectors directly

Instead of filtering entries by ID set internally, CountPerDistance now
receives the target vector and an enumerable of neighbor vectors, plus
the distance and bucketing functions. Callers filter with LINQ.

Co-authored-by: Copilot <[email protected]>

* Return vectors instead of IDs from BruteForce and VsimQuery mapping

BruteForceNearestNeighbors now takes targetVector + candidates and
returns List<TVec> directly. VsimQuery IDs are mapped to vectors via
idToVector dictionary. Both flow as vector lists into CountPerDistance.

Co-authored-by: Copilot <[email protected]>

* Remove toDistanceKey parameter; hardcode Round(d*100) bucketing

Co-authored-by: Copilot <[email protected]>

---------

Signed-off-by: Tiago Napoli <[email protected]>
Co-authored-by: Tiago Napoli <[email protected]>
Co-authored-by: Copilot <[email protected]>
vazois pushed a commit that referenced this pull request Apr 11, 2026
…1692)

* update diskann garnet



* Unify BruteForceNearestNeighbors and CountPerDistance into generic methods

Replace 4 type-specific methods (BruteForceNearestNeighbors_FP32,
BruteForceNearestNeighbors_XB8, CountPerDistance_FP32, CountPerDistance_XB8)
with 2 generic methods that accept Func delegates for ID extraction and
distance computation.



* Refactor recall tests: unify entry types and extract generic RunRecallTest

- Replace FP32VectorEntry and XB8VectorEntry with generic VectorEntry<TVec>
- Extract common recall loop into RunRecallTest<TEntry> with lambdas for
  distance, distance-key conversion, and VSIM querying
- RunRecallTest_FP32 and RunRecallTest_XB8 become thin wrappers



* Fix formatting: remove trailing newline



* Merge RunRecallTest_FP32 and RunRecallTest_XB8 into single generic RunRecallTest<TVec>



* Simplify CountPerDistance to take targetVector + otherVectors directly

Instead of filtering entries by ID set internally, CountPerDistance now
receives the target vector and an enumerable of neighbor vectors, plus
the distance and bucketing functions. Callers filter with LINQ.



* Return vectors instead of IDs from BruteForce and VsimQuery mapping

BruteForceNearestNeighbors now takes targetVector + candidates and
returns List<TVec> directly. VsimQuery IDs are mapped to vectors via
idToVector dictionary. Both flow as vector lists into CountPerDistance.



* Remove toDistanceKey parameter; hardcode Round(d*100) bucketing



---------

Signed-off-by: Tiago Napoli <[email protected]>
Co-authored-by: Tiago Napoli <[email protected]>
Co-authored-by: Copilot <[email protected]>
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants