-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Adds new unexposed and experimental IVF format #127528
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
Conversation
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.
Pull Request Overview
This pull request adds an experimental IVF vectors format along with its supporting reader/writer implementations, tests, modifications to the neighbor queue, and updates to the SIMD vectorization utilities.
- Adds experimental IVF format implementations and tests.
- Extends SIMD vectorization support with OSQ scoring and associated tests.
- Updates module exports to include IVFVectorsFormat.
Reviewed Changes
Copilot reviewed 20 out of 21 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| server/src/test/java/org/elasticsearch/index/codec/vectors/IVFVectorsFormatTests.java | New tests for the experimental IVF vectors format. |
| server/src/main/java/org/elasticsearch/index/codec/vectors/NeighborQueue.java | Introduction of a custom neighbor queue implementation. |
| server/src/main/java/org/elasticsearch/index/codec/vectors/IVFVectorsReader.java | New reader implementation for IVF vectors indexing. |
| server/src/main/java/org/elasticsearch/index/codec/vectors/IVFVectorsFormat.java | Implementation of the IVF vectors format with feature-flag checks. |
| server/src/main/java/module-info.java | Updated module export to include IVFVectorsFormat. |
| libs/simdvec/... | Enhancements to OSQ-based vector scoring and utility support across SIMD vectorization providers. |
Files not reviewed (1)
- server/src/main/resources/META-INF/services/org.apache.lucene.codecs.KnnVectorsFormat: Language not supported
Comments suppressed due to low confidence (2)
server/src/main/java/org/elasticsearch/index/codec/vectors/IVFVectorsFormat.java:103
- The toString() method returns "IVFVectorFormat", which is inconsistent with the class name IVFVectorsFormat. Consider changing it to "IVFVectorsFormat" for consistency.
return "IVFVectorFormat";
libs/simdvec/src/main/java/org/elasticsearch/simdvec/internal/vectorization/DefaultESVectorUtilSupport.java:148
- The fma() method is used without being defined. To improve clarity and correctness, consider using Math.fma(djk, originalResidual[i], proj) or ensure that a proper helper method is provided.
proj = fma(djk, originalResidual[i], proj);
|
Pinging @elastic/es-search-relevance (Team:Search Relevance) |
server/src/main/java/org/elasticsearch/index/codec/vectors/IVFVectorsReader.java
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/index/codec/vectors/DefaultIVFVectorsWriter.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/index/codec/vectors/DefaultIVFVectorsWriter.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/index/codec/vectors/DefaultIVFVectorsWriter.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/index/codec/vectors/DefaultIVFVectorsWriter.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/index/codec/vectors/DefaultIVFVectorsWriter.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/index/codec/vectors/IVFVectorsWriter.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/index/codec/vectors/IVFVectorsWriter.java
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/index/codec/vectors/DefaultIVFVectorsWriter.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/index/codec/vectors/DefaultIVFVectorsWriter.java
Outdated
Show resolved
Hide resolved
| /** | ||
| * Copied from and modified from Apache Lucene. | ||
| */ | ||
| class NeighborQueue { |
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.
since you are pulling over NeighborQueue consider pulling over TestNeighborQueue as well?
john-wagster
left a 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.
i've taken a few passes over the code here at this point. I feel like it's in a good enough state to merge and to start getting CI running on it. lgtm.
carlosdelest
left a 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.
From a code structure and testing perspective, this LGTM.
I can only rubber stamp the codec level / algorithmic side of it as I'm not familiar with that. But I trust the testing infrastructure and how it's been extended.
| return centroid; | ||
| } | ||
|
|
||
| private void readQuantizedCentroid(int centroidOrdinal) throws IOException { |
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.
the function name is readQuantizedCentroid but it also reads full centroid. It looks like the second read of full centroid is not necessary in scoring. Should we break this function be only about reading quantized centroid?
| @Override | ||
| NeighborQueue scorePostingLists(FieldInfo fieldInfo, KnnCollector knnCollector, CentroidQueryScorer centroidQueryScorer, int nProbe) | ||
| throws IOException { | ||
| NeighborQueue neighborQueue = new NeighborQueue(centroidQueryScorer.size(), true); |
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.
Are you supposed to have MIN heap of only nprobe size?
What's the role of nprobe here?
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.
For this, we need to be able to explore past nProbe in the case of filtered search. nProbe has no current role.
I think we will end up with a double queue system eventually, but given its all flat, we just score everything. This needs to be improved, for sure.
| ++centroidsVisited; | ||
| // todo do we actually need to know the score??? | ||
| int centroidOrdinal = centroidQueue.pop(); | ||
| // todo do we need direct access to the raw centroid??? |
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.
+1 for this TODO: it looks like we always do 2 reads of quantized and full centroid, why we need only a single
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.
We need the raw to quantize the query vector for the posting list. So, we score with the quantized and then quantize the query vector according to the raw value.
I think we might want to separate out the scoring vs. the iterating for the centroids.
mayya-sharipova
left a 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.
@benwtrent Amazing work, Ben and the team! I've left some minor comments, but overall LGTM!
This reverts commit ebe8ea6.
…" (elastic#128005) This reverts commit ebe8ea6.
…)" (elastic#128005) This reverts commit 8a17a5e.
…)" (elastic#128005) (elastic#128051) This reverts commit 8a17a5e. reapplying ivf format, but with a fix.
…)" (elastic#128005) (elastic#128051) This reverts commit 8a17a5e. reapplying ivf format, but with a fix.
No description provided.