Repository navigation
[diskann-inmem] Spherical Quantization Round 2 - #1485
Open
Mark Hildebrand (hildebrandmw) wants to merge 5 commits into
Open
Mark Hildebrand (hildebrandmw) wants to merge 5 commits into
Mark Hildebrand (hildebrandmw) wants to merge 5 commits into
Conversation
Mark Hildebrand (hildebrandmw)
added this pull request to stack #1468
October 15, 2026 00:55
Mark Hildebrand (hildebrandmw)
force-pushed
the
mhildebr/inmem-spherical
branch
from
October 15, 2026 01:34
f3048ea to
2092ea8
Compare
Harsha Simhadri (harsha-simhadri)
approved these changes
Oct 15, 2026
Mark Hildebrand (hildebrandmw)
force-pushed
the
mhildebr/inmem-spherical
branch
2 times, most recently
from
October 21, 2026 00:42
df9d3d6 to
891e94f
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1485 +/- ##
==========================================
- Coverage 92.08% 91.07% -1.02%
==========================================
Files 591 591
Lines 122196 121845 -351
==========================================
- Hits 112523 110969 -1554
- Misses 9673 10876 +1203
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Mark Hildebrand (hildebrandmw)
force-pushed
the
mhildebr/inmem-spherical
branch
from
October 21, 2026 17:42
50a6104 to
28bff60
Compare
Mark Hildebrand (hildebrandmw)
force-pushed
the
mhildebr/inmem-spherical
branch
from
October 21, 2026 19:15
28bff60 to
025ffc3
Compare
Mark Hildebrand (hildebrandmw)
marked this pull request as ready for review
October 21, 2026 19:43
Mark Hildebrand (hildebrandmw)
requested review from
a team
and
a balanced review from Copilot
October 21, 2026 19:43
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
Static review identified no blocking issues in the migration or backend conversions; project tests were not run.
No open issues 🎉
What changed in this PR
Unifies spherical quantization with the shared Quantized representation, following the product and scalar quantization work.
Changes:
- Adds a spherical adapter and type-erased
Backendconfiguration. - Migrates integration and benchmark callers, removing the standalone representation.
- Handles zero-norm rescaling and adds adapter tests.
| File | Description |
|---|---|
| diskann-quantization/src/spherical/quantizer.rs | Guards zero-norm rescaling; exposes concrete quantizers. |
| diskann-inmem/src/store/intrusive.rs | Removes guard access while retaining ownership. |
| diskann-inmem/src/repr/spherical.rs | Deletes the standalone spherical representation. |
| diskann-inmem/src/repr/quantized/spherical.rs | Adds the spherical adapter and tests. |
| diskann-inmem/src/repr/quantized/mod.rs | Adds Backend, conversions, and spherical exports. |
| diskann-inmem/src/repr/mod.rs | Removes standalone spherical exports. |
| diskann-inmem/src/repr/internal/quantization/rerank.rs | Removes the unused disabled configuration variant. |
| diskann-inmem/src/repr/internal/intrusive.rs | Removes the unused guard accessor. |
| diskann-inmem/integration/index/runner.rs | Migrates spherical and scalar setup to backends. |
| diskann-inmem/integration/index/object.rs | Removes standalone spherical index registration. |
| diskann-benchmark/src/index/inmem2.rs | Migrates benchmark setup to shared configuration. |
Review effort: Balanced
This branch has not been deployed
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.
Turns out with the work done in #1469 and #1484, we can simplify the implementation of spherical quantization in
diskann-inmemto also be behindQuantized. This does that and gets rid of the customSphericalrepresentation.Since we now have a lot
Quantizermonomorphizations, this also introducesquantized::Backedas kind of an intermediate type-erased quantizer to store inquantized::Config. The relationship goes like this:Quantizedtrait has aninto_backendmethod for making aBackend. This can make use of private constructors and so is largely unimplementable by user code (they could do something weird by swapping out the quantizer, but that wouldn't cause us any issues since we callinto_backendbefore calling any methods.IntoBackendtrait is used to construct a backend. There is a blanket implementation for anyQuantizer, delegating toQuantizer::into_backend. There is also an implementation forBackendwhich simply returns itself. SinceBackenddoes not implementQuantizer, there is no coherence issue.Configcan then be constructed from a concreteQuantizeror from aBackend. The latter allows quantizers to be type-erased before constructing aConfig, which simplifies a lot of set up code.Now, the reason to go with an
into_backendmethod on theQuantizertrait is to give quantizers defined withindiskann-inmeman escape hatch for potentially specializinginner::Quantizer, keeping the door open for hybrid PQ pruning if absolutely necessary.