-
Couldn't load subscription status.
- Fork 25.6k
1 Bit Centroids into 4 Bit Rescored #131895
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
Changes from 5 commits
e284036
9e03d0b
d5c9db6
8243ce5
2380533
1023e6d
030cdf5
d4bc0a5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,6 +39,7 @@ | |
|
|
||
| import static org.apache.lucene.codecs.lucene99.Lucene99HnswVectorsReader.SIMILARITY_FUNCTIONS; | ||
| import static org.elasticsearch.index.codec.vectors.IVFVectorsFormat.DYNAMIC_NPROBE; | ||
| import static org.elasticsearch.index.codec.vectors.IVFVectorsFormat.NPROBE_OVERSAMPLE; | ||
|
|
||
| /** | ||
| * Reader for IVF vectors. This reader is used to read the IVF vectors from the index. | ||
|
|
@@ -88,8 +89,13 @@ protected IVFVectorsReader(SegmentReadState state, FlatVectorsReader rawVectorsR | |
| } | ||
| } | ||
|
|
||
| abstract CentroidIterator getCentroidIterator(FieldInfo fieldInfo, int numCentroids, IndexInput centroids, float[] target) | ||
| throws IOException; | ||
| abstract CentroidIterator getCentroidIterator( | ||
| FieldInfo fieldInfo, | ||
| int numCentroids, | ||
| int numOversampled, | ||
| IndexInput centroids, | ||
| float[] target | ||
| ) throws IOException; | ||
|
|
||
| private static IndexInput openDataInput( | ||
| SegmentReadState state, | ||
|
|
@@ -244,7 +250,15 @@ public final void search(String field, float[] target, KnnCollector knnCollector | |
| // clip to be between 1 and the number of centroids | ||
| nProbe = Math.max(Math.min(nProbe, entry.numCentroids), 1); | ||
| } | ||
| CentroidIterator centroidIterator = getCentroidIterator(fieldInfo, entry.numCentroids, entry.centroidSlice(ivfCentroids), target); | ||
|
|
||
| final int numOversampled = Math.min((int) (nProbe * NPROBE_OVERSAMPLE), entry.numCentroids()); | ||
|
||
| CentroidIterator centroidIterator = getCentroidIterator( | ||
| fieldInfo, | ||
| entry.numCentroids, | ||
| numOversampled, | ||
| entry.centroidSlice(ivfCentroids), | ||
| target | ||
| ); | ||
| PostingVisitor scorer = getPostingVisitor(fieldInfo, ivfClusters, target, needsScoring); | ||
| int centroidsVisited = 0; | ||
| long expectedDocs = 0; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
Not sure why we weren't normalizing for COSINE here previously; bug maybe?