Skip to content

[diskann-garnet] Add spherical 2-bit and 4-bit quantization - #1465

Open
Jack Moffitt (metajack) wants to merge 1 commit into
push-qtrvttpzkznvfrom
push-pyrpzuyvksvv
Open

Jack Moffitt (metajack) wants to merge 1 commit into
push-qtrvttpzkznvfrom
push-pyrpzuyvksvv

Conversation

@metajack

@metajack Jack Moffitt (metajack) commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

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.

@metajack
Jack Moffitt (metajack) marked this pull request as ready for review October 6, 2026 19:44
@metajack
Jack Moffitt (metajack) added this pull request to stack #1466 October 6, 2026 19:44
@metajack
Jack Moffitt (metajack) requested a review from a team October 7, 2026 21:27
Copilot AI balanced review requested due to automatic review settings October 8, 2026 14:36

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.

🟡 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-commenter

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

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.63014% with 1 line in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (push-qtrvttpzkznv@7fcb897). Learn more about missing BASE report.

Files with missing lines Patch % Lines
diskann-garnet/src/provider.rs 92.85% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@                 Coverage Diff                  @@
##             push-qtrvttpzkznv    #1465   +/-   ##
====================================================
  Coverage                     ?   92.05%           
====================================================
  Files                        ?      586           
  Lines                        ?   119435           
  Branches                     ?        0           
====================================================
  Hits                         ?   109944           
  Misses                       ?     9491           
  Partials                     ?        0           
Flag Coverage Δ
miri 92.05% <98.63%> (?)
unittests 91.99% <98.63%> (?)

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

Files with missing lines Coverage Δ
diskann-garnet/src/lib.rs 93.39% <100.00%> (ø)
diskann-garnet/src/quantization.rs 97.43% <100.00%> (ø)
diskann-garnet/src/provider.rs 90.01% <92.85%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@metajack
Jack Moffitt (metajack) force-pushed the push-pyrpzuyvksvv branch 2 times, most recently from 03c9f04 to e6803fa Compare October 9, 2026 16:25

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