Skip to content

Fix default encoder to SQ 1 bit for faiss 32x compression#3210

Open
kotwanikunal wants to merge 4 commits intoopensearch-project:mainfrom
kotwanikunal:default-encoder-faiss-32x
Open

Fix default encoder to SQ 1 bit for faiss 32x compression#3210
kotwanikunal wants to merge 4 commits intoopensearch-project:mainfrom
kotwanikunal:default-encoder-faiss-32x

Conversation

@kotwanikunal
Copy link
Copy Markdown
Member

Description

  • Fixes the faiss 32x compression to use the SQ 1 bit encoder

Related Issues

Related - #3169

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@kotwanikunal kotwanikunal force-pushed the default-encoder-faiss-32x branch 3 times, most recently from 467b1c3 to beadab6 Compare March 26, 2026 23:45
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 27, 2026

Codecov Report

❌ Patch coverage is 25.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.24%. Comparing base (dcac8ae) to head (3973a86).

Files with missing lines Patch % Lines
...ch/knn/index/engine/faiss/FaissMethodResolver.java 25.00% 0 Missing and 3 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #3210      +/-   ##
============================================
+ Coverage     83.11%   83.24%   +0.12%     
- Complexity     4210     4221      +11     
============================================
  Files           453      453              
  Lines         15455    15458       +3     
  Branches       1972     1974       +2     
============================================
+ Hits          12846    12868      +22     
+ Misses         1814     1794      -20     
- Partials        795      796       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Kunal Kotwani <kkotwani@amazon.com>
Signed-off-by: Kunal Kotwani <kkotwani@amazon.com>
Signed-off-by: Kunal Kotwani <kkotwani@amazon.com>
@kotwanikunal kotwanikunal force-pushed the default-encoder-faiss-32x branch from beadab6 to 5bac4a2 Compare March 27, 2026 16:11
@kotwanikunal kotwanikunal changed the title [DRAFT] Fix default encoder to SQ 1 bit for faiss 32x compression Fix default encoder to SQ 1 bit for faiss 32x compression Mar 27, 2026
@kotwanikunal kotwanikunal marked this pull request as ready for review March 27, 2026 16:57
Copy link
Copy Markdown
Collaborator

@navneet1v navneet1v left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small comment. Will wait for all CIs to complete before approving

Comment on lines +157 to +158
// When auto-resolved to bits=1, remove the type and clip defaults that were injected —
// the 1-bit quantization path doesn't use them, and validateEncoderConfig would reject them.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why there is injection of Clip when 1-bit is there?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default for SQ faiss injects clip as a parameter by default - https://github.com/opensearch-project/k-NN/blame/44df2eb082b2ca68c6b2d5d2519aa23f2008931b/src/main/java/org/opensearch/knn/index/engine/faiss/FaissSQEncoder.java#L88-L93

For 1-bit we want to prevent clip or type from being resolved within the mappings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants