Repository navigation
[diskann-quantization] Optimize spherical encoding scale search - #1478
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The optimized paths preserve existing behavior and are covered by focused equivalence and edge-case tests.
0 open findings
What changed in this PR
Optimizes spherical quantization encoding while preserving encoded output.
Changes:
- Uses integer bit ordering for non-NaN scale-search heap values.
- Reuses the destination buffer for non-subsampled Double Hadamard transforms.
- Adds equivalence and allocation-path tests.
| File | Description |
|---|---|
diskann-quantization/src/spherical/quantizer.rs |
Optimizes critical-value ordering and tests behavioral equivalence. |
diskann-quantization/src/algorithms/transforms/double_hadamard.rs |
Avoids temporary allocation when subsampling is unnecessary. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1478 +/- ##
==========================================
+ Coverage 91.97% 91.98% +0.01%
==========================================
Files 586 586
Lines 118173 118391 +218
==========================================
+ Hits 108688 108903 +215
- Misses 9485 9488 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Mark Hildebrand (hildebrandmw)
left a comment
There was a problem hiding this comment.
Thanks - I think both of these are useful. Please see the inline comments. For the ordering, I'd rather we just embrace integer based ordering. Is there a noticeable improvement there? When done in isolation?
Mark Hildebrand (hildebrandmw)
left a comment
There was a problem hiding this comment.
Thanks!!
Reference Issues/PRs
What does this implement/fix? Briefly explain your changes.
Optimizes SphericalQ encoding without changing the quantization algorithm or encoded output:
Any other comments?
Windows x86-64, Rust 1.97.1,
opt-level=3,codegen-units=1,target-cpu=x86-64-v3. Each configuration uses 512 deterministic synthetic vectors with components sampled in (-1, 1), one warmup pass and three timed passes. Three process pairs alternate float/integer execution order. The table is the median of the three per-process medians; times are nanoseconds per vector. All nine scale-result fingerprints match across comparators and runs.Wikipedia-Cohere: 1M × 768 float32 vectors, inner product, the same 50K training sample, 16 encoding threads, release build.
All times are in seconds; medians of three runs.