-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Adding linear retriever to support weighted sums of sub-retrievers #120222
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 26 commits
825683f
6968760
6712fc6
466c026
a4259cd
a7da4f3
02db9d0
d64effa
b945acf
0c1b235
c97d27b
2d78404
c69b75b
06d727a
822ff1d
f2eb82c
020cd78
8d0583a
8ec4110
ceaf3b5
ed78bf2
a70b0d6
9304c7b
05aae70
4fde947
e71b25e
21a78d5
77fd4e1
a79b280
ff0c8c3
8d53d73
86db0bc
d7ab2ce
cc2c071
90ef7f3
30123ac
ecea688
7d6feed
83f9614
512952d
4f97a81
6294917
78fdcda
5b253aa
1eca5fe
1f36e18
43cd490
33bc324
4d82e28
cfcd84f
174e0d0
c0943cb
aeacd33
58e2887
c8a0e1e
29438ee
7d3f36c
8677263
d961f22
7a31b09
f973d73
3640ae1
da84e03
9259159
ea1787f
ce8f60f
2bda448
669e94d
8b07ea5
ccc2f8a
3ba0587
3237ef5
a7425c4
173f254
42c543a
9b40cf6
95842cc
21bbb92
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
pr: 120222 | ||
summary: Adding linear retriever to support weighted sums of sub-retrievers | ||
area: "Search" | ||
type: enhancement | ||
issues: [] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,9 @@ A <<standard-retriever, retriever>> that replaces the functionality of a traditi | |
`knn`:: | ||
A <<knn-retriever, retriever>> that replaces the functionality of a <<search-api-knn, knn search>>. | ||
|
||
`linear`:: | ||
A <<linear-retriever, retriever>> that linearly combines the scores of other retrievers for the top documents. | ||
|
||
`rescorer`:: | ||
A <<rescorer-retriever, retriever>> that replaces the functionality of the <<rescore, query rescorer>>. | ||
|
||
|
@@ -263,6 +266,19 @@ GET /restaurants/_search | |
This value must be fewer than or equal to `num_candidates`. | ||
<5> The size of the initial candidate set from which the final `k` nearest neighbors are selected. | ||
|
||
[[linear-retriever]] | ||
==== Linear Retriever | ||
A retriever that normalizes and linearly combines the scores of other retrievers. If the final scores produced after the | ||
weighted combination of all sub-retrievers are negative, they are set to increments of `1e-6` to avoid negative scores. | ||
|
||
===== Parameters | ||
|
||
include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=linear-retriever-components] | ||
|
||
include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=compound-retriever-rank-window-size] | ||
|
||
include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=compound-retriever-filter] | ||
|
||
[[rrf-retriever]] | ||
==== RRF Retriever | ||
|
||
|
@@ -275,9 +291,9 @@ include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=rrf-retrievers] | |
|
||
include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=rrf-rank-constant] | ||
|
||
include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=rrf-rank-window-size] | ||
include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=compound-retriever-rank-window-size] | ||
|
||
include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=rrf-filter] | ||
include::{es-ref-dir}/rest-api/common-parms.asciidoc[tag=compound-retriever-filter] | ||
|
||
[discrete] | ||
[[rrf-retriever-example-hybrid]] | ||
|
@@ -576,15 +592,15 @@ This example demonstrates how to deploy the {ml-docs}/ml-nlp-rerank.html[Elastic | |
|
||
Follow these steps: | ||
|
||
. Create an inference endpoint for the `rerank` task using the <<put-inference-api, Create {infer} API>>. | ||
. Create an inference endpoint for the `rerank` task using the <<put-inference-api, Create {infer} API>>. | ||
+ | ||
[source,console] | ||
---- | ||
PUT _inference/rerank/my-elastic-rerank | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this endpoint available by default yet? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm not sure, I had this as a custom endpoint for testing/documentation purposes :D . We can refactor though to use the default endpoint (once, if not already, available). |
||
{ | ||
"service": "elasticsearch", | ||
"service_settings": { | ||
"model_id": ".rerank-v1", | ||
"model_id": ".rerank-v1", | ||
"num_threads": 1, | ||
"adaptive_allocations": { <1> | ||
"enabled": true, | ||
|
@@ -595,7 +611,7 @@ PUT _inference/rerank/my-elastic-rerank | |
} | ||
---- | ||
// TEST[skip:uses ML] | ||
<1> {ml-docs}/ml-nlp-auto-scale.html#nlp-model-adaptive-allocations[Adaptive allocations] will be enabled with the minimum of 1 and the maximum of 10 allocations. | ||
<1> {ml-docs}/ml-nlp-auto-scale.html#nlp-model-adaptive-allocations[Adaptive allocations] will be enabled with the minimum of 1 and the maximum of 10 allocations. | ||
+ | ||
. Define a `text_similarity_rerank` retriever: | ||
+ | ||
|
Uh oh!
There was an error while loading. Please reload this page.