[Blog Post] asymmetric model support in neural search#4058
Conversation
|
Thank you for submitting a blog post! The blog post review process is: Submit a PR -> (Optional) Peer review -> Doc review -> Editorial review -> Marketing review -> Published. |
|
Hi @fen-qin, It looks like you're adding a new blog post but don't have an issue mentioned. Please link this PR to an open issue using one of these keywords in the PR description:
If an issue hasn't been created yet, please create one and then link it to this PR. |
|
|
||
|
|
||
| ```json | ||
| PUT /_ingest/pipeline/asymmetric_embedding_pipeline |
There was a problem hiding this comment.
Can we use either semantic text field or text embedding processor instead of ml_inference processor?
050d85b to
f640500
Compare
Signed-off-by: Fen Qin <mfenqin@amazon.com>
f640500 to
5da7c0b
Compare
| ``` | ||
| cd opensearch-py-ml/docs/source/example/common | ||
|
|
||
| ## deploy |
There was a problem hiding this comment.
I think we need to pip install requirement first?
There was a problem hiding this comment.
yes. that's true. this is the setup process for host asymmetric model in sagemaker endpoint. I'm thinking if we should only focus on local model for opensearch. so, it had less dependencies with the aws resources
There was a problem hiding this comment.
In blog, we don't need to focus on local model. We can use sage maker.
| Follow these steps to implement asymmetric neural search in your OpenSearch cluster. This example uses a remote SageMaker endpoint, but you can also deploy models locally. | ||
|
|
||
| 1. Prerequisites: Deploy a sagemaker endpoint | ||
| check out the deployment scripts: https://github.com/opensearch-project/opensearch-py-ml/pull/587 |
There was a problem hiding this comment.
What blocks this PR from being merged? It's a little bit weird that we point people to a PR. Should we get it merged and point people to the README?
There was a problem hiding this comment.
no, these PRs will be merged before blog. blog review usually takes longer time. let me connect with ml-commons team to get it merge before the blog
| "region": "<YOUR_AWS_REGION>", | ||
| "service_name": "sagemaker" | ||
| }, | ||
| "credential": { |
There was a problem hiding this comment.
Should we call out in the AOS we need to follow this doc https://docs.aws.amazon.com/opensearch-service/latest/developerguide/ml-amazon-connector.html to create the connector?
There was a problem hiding this comment.
The blog should be about using opensource OpenSearch not AWS OpenSearch.
There was a problem hiding this comment.
here is the current how local asymmetric model is setup - https://docs.opensearch.org/latest/tutorials/vector-search/semantic-search/semantic-search-asymmetric/
it requires hosting model to local running endpoint.
There was a problem hiding this comment.
I think most of users won't setup local model. Maybe, you can share how you set it up in sage maker so that users can reference it.
| }, | ||
| "passage_text": { | ||
| "type": "semantic", | ||
| "model_id": "<YOUR_MODEL_ID>", |
There was a problem hiding this comment.
Can we add actual model id you used during testing?
There was a problem hiding this comment.
And tell how to get the model id as well?
There was a problem hiding this comment.
you mean getModel api to get the model id ?, the model_id will change everytime we create a new model
There was a problem hiding this comment.
It does not matter if model_id change or not; they will not use the same model id anyway. It is more about showing readers how to get the model id.
| OpenSearch returns response: | ||
|
|
||
| ```json | ||
| {"took":317,"timed_out":false,"_shards":{"total":1,"successful":1,"skipped":0,"failed":0},"hits":{"total":{"value":1,"relation":"eq"},"max_score":0.25255635,"hits":[{"_index":"my-nlp-index","_id":"1","_score":0.25255635,"_source":{"passage_text":"Hello world","id":"s1"}}]}}% |
There was a problem hiding this comment.
% is added at the end. Is this intentional?
|
|
||
| ## Next steps | ||
|
|
||
| - Review the [asymmetric model documentation](https://opensearch.org/docs/latest/tutorials/vector-search/semantic-search/semantic-search-asymmetric/) for detailed configuration options |
There was a problem hiding this comment.
We might need to update the document before publishing this blog.
There was a problem hiding this comment.
Maybe, let's just remove this line. There is no detailed configuration options in the linked page.
|
|
||
| This distinction allows the model to learn specialized representations. For example, the E5 model internally processes "What are some parks in NYC?" as `query: What are some parks in NYC?` during search, while indexing "Central Park is a large public park..." as `passage: Central Park is a large public park...`. This asymmetry helps the model better match short queries to longer documents. | ||
|
|
||
| ## Why asymmetric models outperform symmetric models |
There was a problem hiding this comment.
| ## Why asymmetric models outperform symmetric models | |
| ## When asymmetric models outperform symmetric models |
|
|
||
| Neural search in OpenSearch has traditionally used symmetric embedding models, where queries and documents are encoded identically. While effective, this approach doesn't reflect how search actually works: queries are typically short and question-like, while documents are longer and information-rich. Asymmetric embedding models address this mismatch by optimizing embeddings differently for queries versus documents, leading to significant improvements in search relevance. | ||
|
|
||
| OpenSearch now supports asymmetric embedding models, including state-of-the-art models like E5 that dominate the [MTEB leaderboard](https://huggingface.co/spaces/mteb/leaderboard). In this post, you'll learn how asymmetric models work, see comprehensive benchmark results, and follow a step-by-step guide to implement asymmetric neural search in your OpenSearch cluster. |
There was a problem hiding this comment.
| OpenSearch now supports asymmetric embedding models, including state-of-the-art models like E5 that dominate the [MTEB leaderboard](https://huggingface.co/spaces/mteb/leaderboard). In this post, you'll learn how asymmetric models work, see comprehensive benchmark results, and follow a step-by-step guide to implement asymmetric neural search in your OpenSearch cluster. | |
| Semantic text field now supports asymmetric embedding models, including state-of-the-art models like E5 that dominate the [MTEB leaderboard](https://huggingface.co/spaces/mteb/leaderboard). In this post, you'll learn how asymmetric models work, see comprehensive benchmark results, and follow a step-by-step guide to implement asymmetric neural search in your OpenSearch cluster. |
|
@fen-qin - Please reach out to me when you are ready to move this forward. |
Description
This PR is for asymmetric model support in neural search blog post.
Issues Resolved
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the BSD-3-Clause License.