Update README.md (#2)
Browse files- Update README.md (12b65cf64059b6c27eaa91dac926c062d6d024f6)
README.md
CHANGED
|
@@ -15,8 +15,23 @@ tags:
|
|
| 15 |
# opensearch-neural-sparse-encoding-v1
|
| 16 |
This is a learned sparse retrieval model. It encodes the queries and documents to 30522 dimensional **sparse vectors**. The non-zero dimension index means the corresponding token in the vocabulary, and the weight means the importance of the token.
|
| 17 |
|
|
|
|
|
|
|
| 18 |
OpenSearch neural sparse feature supports learned sparse retrieval with lucene inverted index. Link: https://opensearch.org/docs/latest/query-dsl/specialized/neural-sparse/. The indexing and search can be performed with OpenSearch high-level API.
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
## Usage (HuggingFace)
|
| 21 |
This model is supposed to run inside OpenSearch cluster. But you can also use it outside the cluster, with HuggingFace models API.
|
| 22 |
|
|
@@ -109,5 +124,21 @@ for token in sorted(query_token_weight, key=lambda x:query_token_weight[x], reve
|
|
| 109 |
|
| 110 |
The above code sample shows an example of neural sparse search. Although there is no overlap token in original query and document, but this model performs a good match.
|
| 111 |
|
| 112 |
-
##
|
| 113 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
# opensearch-neural-sparse-encoding-v1
|
| 16 |
This is a learned sparse retrieval model. It encodes the queries and documents to 30522 dimensional **sparse vectors**. The non-zero dimension index means the corresponding token in the vocabulary, and the weight means the importance of the token.
|
| 17 |
|
| 18 |
+
This model is trained on MS MARCO dataset.
|
| 19 |
+
|
| 20 |
OpenSearch neural sparse feature supports learned sparse retrieval with lucene inverted index. Link: https://opensearch.org/docs/latest/query-dsl/specialized/neural-sparse/. The indexing and search can be performed with OpenSearch high-level API.
|
| 21 |
|
| 22 |
+
## Select the model
|
| 23 |
+
The model should be selected considering search relevance, model inference and retrieval efficiency(FLOPS). We benchmark models' **zero-shot performance** on a subset of BEIR benchmark: TrecCovid,NFCorpus,NQ,HotpotQA,FiQA,ArguAna,Touche,DBPedia,SCIDOCS,FEVER,Climate FEVER,SciFact,Quora.
|
| 24 |
+
|
| 25 |
+
Overall, the v2 series of models have better search relevance, efficiency and inference speed than the v1 series. The specific advantages and disadvantages may vary across different datasets.
|
| 26 |
+
|
| 27 |
+
| Model | Inference-free for Retrieval | Model Parameters | AVG NDCG@10 | AVG FLOPS |
|
| 28 |
+
|-------|------------------------------|------------------|-------------|-----------|
|
| 29 |
+
| [opensearch-neural-sparse-encoding-v1](https://huggingface.co/opensearch-project/opensearch-neural-sparse-encoding-v1) | | 133M | 0.524 | 11.4 |
|
| 30 |
+
| [opensearch-neural-sparse-encoding-v2-distill](https://huggingface.co/opensearch-project/opensearch-neural-sparse-encoding-v2-distill) | | 67M | 0.528 | 8.3 |
|
| 31 |
+
| [opensearch-neural-sparse-encoding-doc-v1](https://huggingface.co/opensearch-project/opensearch-neural-sparse-encoding-doc-v1) | ✔️ | 133M | 0.490 | 2.3 |
|
| 32 |
+
| [opensearch-neural-sparse-encoding-doc-v2-distill](https://huggingface.co/opensearch-project/opensearch-neural-sparse-encoding-doc-v2-distill) | ✔️ | 67M | 0.504 | 1.8 |
|
| 33 |
+
|
| 34 |
+
|
| 35 |
## Usage (HuggingFace)
|
| 36 |
This model is supposed to run inside OpenSearch cluster. But you can also use it outside the cluster, with HuggingFace models API.
|
| 37 |
|
|
|
|
| 124 |
|
| 125 |
The above code sample shows an example of neural sparse search. Although there is no overlap token in original query and document, but this model performs a good match.
|
| 126 |
|
| 127 |
+
## Detailed Search Relevance
|
| 128 |
+
|
| 129 |
+
| Dataset | [opensearch-neural-sparse-encoding-v1](https://huggingface.co/opensearch-project/opensearch-neural-sparse-encoding-v1) | [opensearch-neural-sparse-encoding-v2-distill](https://huggingface.co/opensearch-project/opensearch-neural-sparse-encoding-v2-distill) | [opensearch-neural-sparse-encoding-doc-v1](https://huggingface.co/opensearch-project/opensearch-neural-sparse-encoding-doc-v1) | [opensearch-neural-sparse-encoding-doc-v2-distill](https://huggingface.co/opensearch-project/opensearch-neural-sparse-encoding-doc-v2-distill) |
|
| 130 |
+
|---------|-------------------------------------------------------------------------|-------------------------------------------------------------------------------------|------------------------------------------------------------------------------|------------------------------------------------------------------------------------------|
|
| 131 |
+
| Trec Covid | 0.771 | 0.775 | 0.707 | 0.690 |
|
| 132 |
+
| NFCorpus | 0.360 | 0.347 | 0.352 | 0.343 |
|
| 133 |
+
| NQ | 0.553 | 0.561 | 0.521 | 0.528 |
|
| 134 |
+
| HotpotQA | 0.697 | 0.685 | 0.677 | 0.675 |
|
| 135 |
+
| FiQA | 0.376 | 0.374 | 0.344 | 0.357 |
|
| 136 |
+
| ArguAna | 0.508 | 0.551 | 0.461 | 0.496 |
|
| 137 |
+
| Touche | 0.278 | 0.278 | 0.294 | 0.287 |
|
| 138 |
+
| DBPedia | 0.447 | 0.435 | 0.412 | 0.418 |
|
| 139 |
+
| SCIDOCS | 0.164 | 0.173 | 0.154 | 0.166 |
|
| 140 |
+
| FEVER | 0.821 | 0.849 | 0.743 | 0.818 |
|
| 141 |
+
| Climate FEVER | 0.263 | 0.249 | 0.202 | 0.224 |
|
| 142 |
+
| SciFact | 0.723 | 0.722 | 0.716 | 0.715 |
|
| 143 |
+
| Quora | 0.856 | 0.863 | 0.788 | 0.841 |
|
| 144 |
+
| **Average** | **0.524** | **0.528** | **0.490** | **0.504** |
|