- Notifications
You must be signed in to change notification settings - Fork 25.6k
Implement support for weighted rrf #130658
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
Implement support for weighted rrf #130658
Conversation
x-pack/plugin/rank-rrf/src/main/java/org/elasticsearch/xpack/rank/rrf/RRFRetrieverBuilder.java Outdated Show resolved Hide resolved
x-pack/plugin/rank-rrf/src/main/java/org/elasticsearch/xpack/rank/rrf/RRFRetrieverBuilder.java Outdated Show resolved Hide resolved
7614936
to e7f0a90
Compare f1eede5
to f5e1572
Compare f1eede5
to 0640099
Compare x-pack/plugin/rank-rrf/src/main/java/org/elasticsearch/xpack/rank/rrf/RRFRetrieverBuilder.java Outdated Show resolved Hide resolved
x-pack/plugin/rank-rrf/src/main/java/org/elasticsearch/xpack/rank/rrf/RRFRetrieverBuilder.java Outdated Show resolved Hide resolved
...ck/plugin/rank-rrf/src/main/java/org/elasticsearch/xpack/rank/rrf/RRFRetrieverComponent.java Outdated Show resolved Hide resolved
...ck/plugin/rank-rrf/src/main/java/org/elasticsearch/xpack/rank/rrf/RRFRetrieverComponent.java Outdated Show resolved Hide resolved
@ioanatia have addressed all the comments. please let me know if there are any more concerns. |
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.
this is getting super close! thank you for your patience 🙇♀️
...ck/plugin/rank-rrf/src/main/java/org/elasticsearch/xpack/rank/rrf/RRFRetrieverComponent.java Outdated Show resolved Hide resolved
...in/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/rrf/320_rrf_weighted_retriever.yml Outdated Show resolved Hide resolved
...in/rank-rrf/src/yamlRestTest/resources/rest-api-spec/test/rrf/320_rrf_weighted_retriever.yml Show resolved Hide resolved
...ck/plugin/rank-rrf/src/main/java/org/elasticsearch/xpack/rank/rrf/RRFRetrieverComponent.java Show resolved Hide resolved
Co-authored-by: Liam Thompson <leemthompo@gmail.com>
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.
nice work!
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, nice work!
...plugin/rank-rrf/src/test/java/org/elasticsearch/xpack/rank/rrf/RRFRetrieverBuilderTests.java Show resolved Hide resolved
* RRFRetrieverComponent added: * Modified parser, toXcontent and included component in the RetrieverBuilder * [CI] Auto commit changes from spotless * Resolved merge conflicts * Fixed compile issues in tests * [CI] Auto commit changes from spotless * trying to resolve parse errros * wip * Modified builder * [CI] Auto commit changes from spotless * Removed unnecessary code * Fixed import * Enhanced tests * Fixed the failing tests * Yaml tests were added * Added cluster features to it * Fixed spotless * Update docs/changelog/130658.yaml * Fixed the relaxed constraints * Resolving issues * Resolved PR comments * removed simplified rrf * changed the test file back to its original state * Resolved comments to have ahelper method and the test case to use it * made parsing robust * IT test reverted * Replaced the declareString array parser * Enforced weights as nonnull * Fixed the weights null * Empty weight shouldnt be serialised * [CI] Auto commit changes from spotless * removed the hard coding * Cleanup and optimised the code flow * Fixed the comments * [CI] Auto commit changes from spotless * optimised test * Added additional test * addressed the commentS * Update docs/changelog/130658.yaml Co-authored-by: Liam Thompson <leemthompo@gmail.com> * Explicit check for retriever object * Resolved PR comments * Fixed the error message --------- Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co> Co-authored-by: Ioana Tagirta <ioana.tagirta@elastic.co> Co-authored-by: Liam Thompson <leemthompo@gmail.com>
Edit: nvm, the old syntax seems to be still valid. @mridula-s109 @leemthompo Hey folks. Just double checking here. Judging from the provided JSON example, this seems to be a breaking change since the structure now includes a new nesting: { "retriever": { "rrf": { "retrievers": [ { // <- Retriever container "standard": { "query": { "match": { "description": "pizza" } } } }, to { "retriever": { "rrf": { "retrievers": [ { // <- New RRFRetrieverComponent class that wraps `retriever` and `weigth` "retriever": { "standard": { "query": { "match": { "description": "pizza" } } } }, "weight": 0.7 }, Is this expected to ship in a minor version? |
Implement support for weighted RRF
Summary
This PR implements support for weighted RRF (Reciprocal Rank Fusion) retrievers, allowing users to specify custom weights for each sub-retriever within an RRF retriever configuration. This addresses a common customer request to customize the influence of different retrievers in the RRF scoring process.
Core Implementation
Key Features
1. Weighted Retriever Support
Users can now specify weights for individual retrievers: