Skip to content

Forward is_normalized from the HNSWParams NewIndex overload - #1098

Closed
dor-forer wants to merge 1 commit into
mainfrom
codex/hnsw-forward-is-normalized
Closed

dor-forer wants to merge 1 commit into
mainfrom
codex/hnsw-forward-is-normalized

Conversation

@dor-forer

Copy link
Copy Markdown
Collaborator

Summary

HNSWFactory::NewIndex(const HNSWParams *, bool is_normalized) dropped is_normalized when it
forwarded to the VecSimParams overload. A quantized index with metric Cosine declared as
pre-normalized was therefore rejected instead of resolving to IP. This forwards the flag.

The only in-tree caller of this overload that passes true is test code; the tiered factory uses
the VecSimParams overload directly, so production behavior through the C API is unchanged.

Testing

  • New HNSWSQ8ParamsTest.HNSWParamsOverloadForwardsIsNormalized: SQ8 + Cosine through this
    overload returns an index with is_normalized = true and NULL with false. It failed before the
    fix (NULL returned).
  • test_hnsw_sq8 210/210 on ARM (Neoverse-V2); full unit suite 3371/3371 on x86_64.

The SQ4 PR stacked on this branch depends on the fix for its pre-normalized Cosine test.

🤖 Generated with Claude Code

HNSWFactory::NewIndex(const HNSWParams *, bool is_normalized) dropped
is_normalized when forwarding to the VecSimParams overload, so a
quantized Cosine index declared as pre-normalized was rejected instead
of resolving to IP. Forward the flag and cover both outcomes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dor-forer

Copy link
Copy Markdown
Collaborator Author

Closing: the only caller that needs this forwarding is a test, and the SQ4 PR (#1099) now uses the VecSimParams overload, which already forwards is_normalized. No production path calls the HNSWParams overload with is_normalized=true.

@dor-forer dor-forer closed this Nov 4, 2026
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.

1 participant