Repository navigation
[diskann-garnet] Add spherical 2-bit and 4-bit quantization - #1465
Open
Jack Moffitt (metajack) wants to merge 1 commit into
Open
Jack Moffitt (metajack) wants to merge 1 commit into
Jack Moffitt (metajack) wants to merge 1 commit into
Conversation
Jack Moffitt (metajack)
marked this pull request as ready for review
October 6, 2026 19:44
Jack Moffitt (metajack)
added this pull request to stack #1466
October 6, 2026 19:44
Jack Moffitt (metajack)
force-pushed
the
push-pyrpzuyvksvv
branch
from
October 8, 2026 14:36
e95167e to
03c9f04
Compare
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Missing dimension limits allow metadata overflow during compression and incomplete backfills to be marked complete.
1 open finding
What changed in this PR
Adds 2-bit and 4-bit spherical quantization to Garnet’s existing vector indexing pipeline for f32, i8, and u8 vectors.
Changes:
- Generalizes spherical quantizers and adds native type routing and validation.
- Expands serialization, search, backfill, and recovery tests.
- Documents the formats and updates package versions to 8.0.0.
| File | Description |
|---|---|
| diskann-garnet/src/quantization.rs | Generalizes spherical encoding across bit widths. |
| diskann-garnet/src/provider.rs | Selects and validates new quantizers. |
| diskann-garnet/src/lib.rs | Adds native enum values and vector routing. |
| diskann-garnet/src/ffi_tests.rs | Expands quantizer lifecycle coverage. |
| diskann-garnet/README.md | Documents new quantization options. |
| diskann-garnet/docs/ffi-design.rs | Updates native interface documentation. |
| diskann-garnet/diskann-garnet.nuspec | Bumps NuGet version. |
| diskann-garnet/Cargo.toml | Bumps crate version. |
| Cargo.lock | Synchronizes the package version. |
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
Comment on lines
+450
to
+462
| let quantizer: Box<dyn GarnetQuantizer> = match quant_type { | ||
| VectorQuantType::XSpherical2 | ||
| | VectorQuantType::XSpherical2I8 | ||
| | VectorQuantType::XSpherical2U8 => { | ||
| Box::new(quantization::Spherical2Bit::new(metric_type, dim)) | ||
| } | ||
| VectorQuantType::XSpherical4 | ||
| | VectorQuantType::XSpherical4I8 | ||
| | VectorQuantType::XSpherical4U8 => { | ||
| Box::new(quantization::Spherical4Bit::new(metric_type, dim)) | ||
| } | ||
| _ => Box::new(quantization::Spherical1Bit::new(metric_type, dim)), | ||
| }; |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## push-qtrvttpzkznv #1465 +/- ##
====================================================
Coverage ? 92.05%
====================================================
Files ? 586
Lines ? 119435
Branches ? 0
====================================================
Hits ? 109944
Misses ? 9491
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Jack Moffitt (metajack)
force-pushed
the
push-pyrpzuyvksvv
branch
2 times, most recently
from
October 9, 2026 16:25
03c9f04 to
e6803fa
Compare
Jack Moffitt (metajack)
force-pushed
the
push-pyrpzuyvksvv
branch
from
October 12, 2026 19:37
e6803fa to
c4b5cbe
Compare
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.

This PR extends the Garnet vector set quantizers to support spherical 2-bit and 4-bit quantization on f32, i8, and u8 vectors. This supersedes and generalizes the quantizer work done in #1443.