[Blog Post] asymmetric model support in neural search#4058
[Blog Post] asymmetric model support in neural search#4058fen-qin wants to merge 1 commit intoopensearch-project:mainfrom
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?
| 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?
| "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.
| "description": "Asymmetric E5 embedding model for semantic search", | ||
| "connector_id": "<YOUR_CONNECTOR_ID>", | ||
| "model_config": { | ||
| "model_type": "text_embedding", |
There was a problem hiding this comment.
Have you tested this can work? I recall we need to use TEXT_EMBEDDING as the model_type for the semantic field to recognize it. - https://github.com/opensearch-project/neural-search/blob/de482d7fcfbfbebddc341c7e6bc50c7504a808cc/src/main/java/org/opensearch/neuralsearch/util/SemanticMLModelUtils.java#L60
| }, | ||
| "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?
| 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.
|
|
||
| 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.