Skip to content

[diskann-inmem] Add scalar quantization - #1484

Open
Mark Hildebrand (hildebrandmw) wants to merge 4 commits into
mhildebr/inmem-pq-2from
mhildebr/inmem-scalar
Open

Mark Hildebrand (hildebrandmw) wants to merge 4 commits into
mhildebr/inmem-pq-2from
mhildebr/inmem-scalar

Conversation

@hildebrandmw

Copy link
Copy Markdown
Contributor

This adds support for scalar quantization (bits 1 through 8) to diskann-inmem, follow the pattern mostly set up in #1469. This does require the Quantizer trait to differentiate between distances for insert and distances for general queries due to the need to rescale queries for wiki-cohere embedding.

I've found several areas in diskann-quantization that need help:

  1. Compression and distance methods should not panic on invalid vector lengths - they should return error types instead (that would remove some of the semi-redundant length checking in this PR).
  2. diskann-quantization needs better support for asymmetrical compression. It's really a shame that we need to handle the somewhat sketch query rescaling for inner-products manually.

@codecov-commenter

Codecov Comments Bot (codecov-commenter) commented Oct 15, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.80804% with 94 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.00%. Comparing base (1cac598) to head (e16d644).

Files with missing lines Patch % Lines
diskann-benchmark/src/index/inmem2.rs 70.65% 54 Missing ⚠️
diskann-inmem/integration/index/runner.rs 65.51% 30 Missing ⚠️
diskann-inmem/src/repr/quantized/scalar.rs 97.64% 9 Missing ⚠️
diskann-inmem/src/repr/quantized/mod.rs 98.95% 1 Missing ⚠️

❌ Your patch status has failed because the patch coverage (87.80%) is below the target coverage (90.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@                   Coverage Diff                   @@
##           mhildebr/inmem-pq-2    #1484      +/-   ##
=======================================================
- Coverage                92.03%   92.00%   -0.04%     
=======================================================
  Files                      590      591       +1     
  Lines                   119785   120486     +701     
=======================================================
+ Hits                    110243   110848     +605     
- Misses                    9542     9638      +96     
Flag Coverage Δ
miri 92.00% <87.80%> (-0.04%) ⬇️
unittests 91.94% <87.80%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
diskann-inmem/integration/main.rs 82.71% <100.00%> (+0.66%) ⬆️
diskann-inmem/src/neighbors.rs 100.00% <100.00%> (ø)
diskann-inmem/src/repr/full.rs 97.07% <100.00%> (-0.01%) ⬇️
...ann-inmem/src/repr/internal/quantization/rerank.rs 98.01% <100.00%> (-0.03%) ⬇️
diskann-inmem/src/repr/quantized/product.rs 98.75% <100.00%> (-0.04%) ⬇️
diskann-inmem/src/repr/spherical.rs 97.43% <100.00%> (ø)
diskann-vector/src/distance/distance_provider.rs 98.60% <100.00%> (+0.01%) ⬆️
diskann-inmem/src/repr/quantized/mod.rs 98.52% <98.95%> (-0.03%) ⬇️
diskann-inmem/src/repr/quantized/scalar.rs 97.64% <97.64%> (ø)
diskann-inmem/integration/index/runner.rs 88.56% <65.51%> (-3.75%) ⬇️
... and 1 more

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants