-
Notifications
You must be signed in to change notification settings - Fork 138
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
[RFC] Support pass query string to add in model input in ml inference search response processor #2897
Comments
So as a customer do I need to remember this |
May be we should also provide a detailed example output before and after providing this |
the exact json path This is more for rerank use case, that we need the query_text to compare with the search documents to get text similarity score. for example. cross encoder model
|
@ylwu-amzn you proposed an idea to use search extension, so the search pipeline will carry the configuration and read from search extension,
the pipeline config would be:
the search request needs to always carry search extensions, or it won't find the model input for this is the sample query that would work for this proposal:
the pros of this approach:
the cons of this approach:
|
Here is an example from: https://opensearch.org/docs/latest/search-plugins/hybrid-search/
Queries can be very complex. This is the reason I abandoned this approach for the RAG search processor and instead have a separate I also think a lot of this work seems redundant and is already built into the RAG response processor... |
Summary
Currently, the ML inference search response processor allows passing document fields as input to the machine learning model. However, in certain use cases, such as re-ranking, it is necessary to include the query text as part of the model input along with the document fields. This RFC proposes adding support for passing the query string as input to the ML inference search response processor.
Motivation
In re-ranking use cases, the machine learning model often needs to consider the query text in addition to the document fields to produce an accurate ranking score. By including the query text as input, the model can better understand the context and relevance of the documents to the query, leading to improved ranking results.
Proposed Solution
We propose adding a new configuration option to the
model_config
section of the ML inference search response processor. This option would allow specifying the query string as an input to the machine learning model.Example configuration:
In the example above, the model_config section includes a new query_text field, which is set to the value of the path of query.term.dairy.value This template will be resolved to the actual query string during the search request.
Implementation Details
The implementation would involve the following steps:
Extend the model_config section in the ML inference search response processor to accept a query_text field.
During the search request processing, resolve the query_text json pat (if provided) to the actual query string.
Include the resolved query string as part of the input to the machine learning model, along with the other input fields specified in the input_map.
Backward Compatibility
This change should not break backward compatibility, as it introduces a new optional configuration option. Existing configurations without the query_text field will continue to work as before.
Security Considerations
There are no significant security considerations for this change, as it only involves passing the query string as input to the machine learning model, which is already part of the search request.
Adding support for passing the query string as input to the ML inference search response processor will enable better re-ranking capabilities by allowing machine learning models to consider the query context along with the document fields. This enhancement will improve the relevance of search results in re-ranking use cases.
Out of Scope
Currently ml inference search response processor doesn't support rescore and sorting functionality, a separate RFC is raised to address these functionality
opensearch-project/OpenSearch#15631
Related Issue
[META]#2878
The text was updated successfully, but these errors were encountered: