Repository navigation
[diskann-inmem] Spherical Quantization Round 2 - #1485
Merged
Merged
Conversation
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
Jack Moffitt (metajack)
approved these changes
Oct 22, 2026
Mark Hildebrand (hildebrandmw)
added a commit
that referenced
this pull request
Oct 26, 2026
# DiskANN v0.61.0 ## Highlights - **Quantization:** Added 3-bit spherical quantization with AVX2 acceleration, faster spherical encoding, and NEON float32 MinMax kernels. - **In-memory indexing (experimental):** Added product quantization and 1-8-bit scalar quantization, unified quantized representations, and AArch64 prefetching. - **Multi-vector search:** Added `i8 x i8` and MinMax8 x MinMax4 MaxSim kernels. - **Fixes:** Preserve virtual start-point out-edges when writing disk indexes, correctly round-trip scalar quantization configurations without standard deviation, and support zero-column mutable matrix iterators. ## Breaking changes and upgrading Changes are concentrated in quantization APIs and experimental/tooling crates. * PQ training (#1467) - Training now returns `BasicTable`. `SimplePivots` was removed. Replace `flatten()` with `view_pivots().as_slice()` and use `pivots_for(chunk)` for per-chunk access. * PQ distance tables (#1458) - Change `ProcessInto` bounds to `ProcessInto<f32>` and calls from `process_into::<Metric>(...)` to `process_into::<Metric, f32>(...)`. * MaxSim kernels (#1429) - Generic kernel/erasure code now requires `T: MaxSimElement` and score buffers of `T::Score` (`f32` for floats, `i32` for `i8`). Update `build_max_sim` error handling from `NotSupported` to `BuildMaxSimError`. * `diskann-inmem` (#1485) - Replace `repr::Spherical` with `repr::Quantized`. Wrap the quantizer in `repr::quantized::spherical::Spherical::new(...)` when configuring it. Configuration and `Rerank` types now live under `repr::quantized`. * `diskann-benchmark-runner` (#1475) - `input::Registered` and public `Registry::input` were removed. Use the concrete `Input` implementation's `tag()` and `example()` methods instead. ## All Changes * Fix serialization round trip for QuantizationType::SQ without standard deviation by @arrayka in #1461 * i8 x i8 MaxSim Kernels by @suri-kumkaran in #1429 * Adding `subview_mut` to `MatrixMut` by @arkrishn94 in #1463 * Add InsertResult::SuccessUpdate by @metajack in #1449 * [diskann-quantization] PQ Infrastructure for `diskann-inmem` by @hildebrandmw in #1458 * [diskann-quantization] Teach PQ training to return a `BasicTable`. by @hildebrandmw in #1467 * [deps] Run `cargo-update` by @hildebrandmw in #1452 * Support zero-column mutable matrix iterators by @arrayka in #1462 * [diskann-quantization] Use `f32::NAN` instead of `core::f32::NAN`. by @hildebrandmw in #1471 * [diskann-wide] Add `V4::new_checked_miri_uncached`. by @hildebrandmw in #1480 * [diskann-wide] Add maddubs intrinsic wrappers to V3 and V4 by @partychen in #1479 * Bump the github-actions group across 1 directory with 5 updates by @dependabot[bot] in #1482 * [benchmark-runner] Simplify Input representation by @hildebrandmw in #1475 * [diskann-quantization] Optimize spherical encoding scale search by @xinyuwen2 in #1478 * [diskann-garnet] Implement XVCREATE, XVIMPORT by @metajack in #1455 * [diskann-garnet] Support configurable start points and allow importing start points by @metajack in #1464 * [diskann-garnet] Add spherical 2-bit and 4-bit quantization by @metajack in #1465 * [deps] Address depandabot issue 32 by @hildebrandmw in #1496 * [diskann-disk] Preserve virtual start point out-edges when writing the disk index by @doliawu in #1483 * [diskann-quantization] Add Neon F32 Minmax Kernels by @pfoxARM in #1431 * [diskann-garnet] Add macOS arm64 support to NuGet publishing by @metajack in #1495 * [diskann-disk] Require start points at index initialization. by @hildebrandmw in #1497 * Expose metric-aware quantizer centroid distance by @cherryrhea in #1395 * [diskann-inmem] Add support for Product Quantization by @hildebrandmw in #1469 * Adds aarch64 prefetching into diskann-vector and diskann-inmem by @pfoxARM in #1408 * [diskann-inmem] Add scalar quantization by @hildebrandmw in #1484 * Bump the github-actions group with 3 updates by @dependabot[bot] in #1505 * [diskann-inmem] Spherical Quantization Round 2 by @hildebrandmw in #1485 * [diskann-quantization] Add SphericalQ 3-bit support and AVX2 kernel by @xinyuwen2 in #1474 * [muilt-vetor] Add standalone MinMax8 x MinMax4 MaxSim kernel by @partychen in #1494 ## New Contributors * @cherryrhea made their first contribution in #1395 **Full Changelog**: v0.60.0...v0.61.0 Co-authored-by: Mark Hildebrand <mhildebrand@microsoft.com>
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.