Skip to content

fix: avoid 4-bit IVF-PQ accumulator overflow - #111

Merged
JingsongLi merged 2 commits into
apache:mainfrom
adrian-wang:fix-ivfpq-4bit-overflow
Oct 9, 2026
Merged

JingsongLi merged 2 commits into
apache:mainfrom
adrian-wang:fix-ivfpq-4bit-overflow

Conversation

@adrian-wang

Copy link
Copy Markdown
Contributor

Use exact f32 scanning when the number of subquantizers can overflow a u16 accumulator. Apply the bound to row-major, transposed, and FastScan layouts before integer accumulation begins.

Cover m=256, 258, and 512 with exactly representable vectors and a prefix whose distance range matches the LUT, independently of range calibration. Exercise in-memory, budgeted, persisted, and batch searches.

Validation: Rust 1.95 core tests (497 passed, 2 ignored), rustfmt, and Clippy.

Use exact f32 scanning when the number of subquantizers can overflow a
u16 accumulator. Apply the bound to row-major, transposed, and FastScan
layouts before integer accumulation begins.

Cover m=256, 258, and 512 with exactly representable vectors and a prefix
whose distance range matches the LUT, independently of range calibration.
Exercise in-memory, budgeted, persisted, and batch searches.

Validation: Rust 1.95 core tests (497 passed, 2 ignored), rustfmt, and Clippy.
@adrian-wang
adrian-wang force-pushed the fix-ivfpq-4bit-overflow branch from 66fe7f1 to f1c2a78 Compare October 9, 2026 07:26
@JingsongLi

Copy link
Copy Markdown
Contributor

+1

@JingsongLi
JingsongLi merged commit bdaee49 into apache:main Oct 9, 2026
9 checks passed
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.

2 participants