-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CompressionLevel Calculation for PQ #2200
Add CompressionLevel Calculation for PQ #2200
Conversation
f2d7c89
to
907f1ec
Compare
should we allow more compression level? |
@@ -29,6 +29,8 @@ public enum CompressionLevel { | |||
x16(16, "16x", new RescoreContext(3.0f, false), Set.of(Mode.ON_DISK)), | |||
x32(32, "32x", new RescoreContext(3.0f, false), Set.of(Mode.ON_DISK)); | |||
|
|||
public static final CompressionLevel MAX_COMPRESSION_LEVEL = CompressionLevel.x32; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we have 64 as a max compression level? I don't have a solid point to have 64 but I think have 1 more extra compression is always good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that makes sense. I guess for 64x, default for all dimensions should probably be 5x.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall looks good to me. Just 1 minor comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Do we want to add integ test for it? Recall should be higher with rescoring than baseline.
Currently, for product quantization, we set the calculated compression level to NOT_CONFIGURED. The main issue with this is that if a user sets up a disk-based index with PQ, no re-scoring will happen by default. This change adds the calculation so that the proper re-scoring will happen. The formula is fairly straightforward => actual compression = (d * 32) / (m * code_size). Then, we round to the neareste compression level (because we only support discrete compression levels). One small issue with this is that if PQ is configured to have compression > 32x, the value will be 32x. Functionally, the only issue will be that we may not be as aggressive on oversampling for on disk mode. Signed-off-by: John Mazanec <[email protected]>
Signed-off-by: John Mazanec <[email protected]>
907f1ec
to
78915d1
Compare
Currently, for product quantization, we set the calculated compression level to NOT_CONFIGURED. The main issue with this is that if a user sets up a disk-based index with PQ, no re-scoring will happen by default. This change adds the calculation so that the proper re-scoring will happen. The formula is fairly straightforward => actual compression = (d * 32) / (m * code_size). Then, we round to the neareste compression level (because we only support discrete compression levels). One small issue with this is that if PQ is configured to have compression > 64x, the value will be 64x. Functionally, the only issue will be that we may not be as aggressive on oversampling for on disk mode. Signed-off-by: John Mazanec <[email protected]> (cherry picked from commit 228aead)
@jmazanec15 did we do any benchmarks which suggest how much improvement we will get with PQ based rescoring? |
@navneet1v we did here: #1779 (comment) |
Thanks. I completely forgot about that. |
Description
Currently, for product quantization, we set the calculated compression level to NOT_CONFIGURED. The main issue with this is that if a user sets up a disk-based index with PQ, no re-scoring will happen by default.
This change adds the calculation so that the proper re-scoring will happen. The formula is fairly straightforward =>
actual compression = (d * 32) / (m * code_size). Then, we round to the neareste compression level (because we only support discrete compression levels).
One small issue with this is that if PQ is configured to have compression > 32x, the value will be 32x. Functionally, the only issue will be that we may not be as aggressive on oversampling for on disk mode.
Check List
--signoff
.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.