spacemanidol commited on
Commit
19f9227
1 Parent(s): fc488b1

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +211 -1
README.md CHANGED
@@ -2800,4 +2800,214 @@ model-index:
2800
  - type: v_measure
2801
  value: 85.30624598674467
2802
  license: apache-2.0
2803
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2800
  - type: v_measure
2801
  value: 85.30624598674467
2802
  license: apache-2.0
2803
+ ---
2804
+ <h1 align="center">Snowflake's artic-embed-m</h1>
2805
+ <h4 align="center">
2806
+ <p>
2807
+ <a href=#news>News</a> |
2808
+ <a href=#models>Models</a> |
2809
+ <a href=#usage>Usage</a> |
2810
+ <a href="#evaluation">Evaluation</a> |
2811
+ <a href="#contact">Contact</a> |
2812
+ <a href="#faq">FAQ</a>
2813
+ <a href="#license">License</a> |
2814
+ <a href="#acknowledgement">Acknowledgement</a>
2815
+ <p>
2816
+ </h4>
2817
+
2818
+
2819
+ ## News
2820
+
2821
+
2822
+ 04/16/2024: Release the ** Arctic-text-embed ** family of text empedding models. The releases are state-of-the-art for Retrieval quality at each of their representative size profiles. [Technical Report]() is coming shortly. For more details, please refer to our Github: [Arctic-Text-Embed](https://github.com/Snowflake/Arctic-Text-Embed).
2823
+
2824
+
2825
+ ## Models
2826
+
2827
+
2828
+ Arctic-Embed is a suite of text embedding models that focuses on creating high-quality embedding models for retrieval that are optimized for performance.
2829
+
2830
+
2831
+ The `arctic-text-embedding` models achieve **state-of-the-art performance on the MTEB/BEIR leaderboard** for each of their size variants. Evaluation is performed using these [scripts](https://github.com/Snowflake-Labs/arctic-embed/tree/main/src). As shown below, each class of model size achieves SOTA retrieval accuracy when compared to other top models.
2832
+
2833
+
2834
+ The models are trained by leveraging existing open-source text representation models, such as bert-base-uncased, and are trained in a multi-stage pipeline to optimize their retrieval performance. First, the models are trained with large batches of query-document pairs where negatives are derived in-batch—pretraining leverages about 400m samples of a mix of public datasets and proprietary web search data. Following pretraining models are further optimized with long training on a smaller dataset (about 1m samples) of triplets of query, positive document, and negative document derived from hard harmful mining. Mining of the negatives and data curation is crucial to retrieval accuracy. A detailed technical report will be available shortly.
2835
+
2836
+
2837
+ | Name | MTEB Retrieval Score (NDCG @ 10) | Parameters (Millions) | Embedding Dimension |
2838
+ | ----------------------------------------------------------------------- | -------------------------------- | --------------------- | ------------------- |
2839
+ | [arctic-embed-s](https://huggingface.co/Snowflake/arctic-embed-xs/) | 50.15 | 22 | 384 |
2840
+ | [arctic-embed-s](https://huggingface.co/Snowflake/arctic-embed-s/) | 51.98 | 33 | 384 |
2841
+ | [arctic-embed-s](https://huggingface.co/Snowflake/arctic-embed-m/) | 54.90 | 110 | 768 |
2842
+ | [arctic-embed-s](https://huggingface.co/Snowflake/arctic-embed-m-long/) | 54.83 | 137 | 768 |
2843
+ | [arctic-embed-s](https://huggingface.co/Snowflake/arctic-embed-l/) | 55.98 | 335 | 1024 |
2844
+
2845
+
2846
+ Aside from being great open-source models, the largest model, [arctic-embed-l](https://huggingface.co/Snowflake/arctic-embed-l/), can serve as a natural replacement for closed-source embedding, as shown below.
2847
+
2848
+
2849
+ | Model Name | MTEB Retrieval Score (NDCG @ 10) |
2850
+ | ------------------------------------------------------------------ | -------------------------------- |
2851
+ | [arctic-embed-s](https://huggingface.co/Snowflake/arctic-embed-l/) | 55.98 |
2852
+ | Google-gecko-text-embedding | 55.7 |
2853
+ | text-embedding-3-large | 55.44 |
2854
+ | Cohere-embed-english-v3.0 | 55.00 |
2855
+ | bge-large-en-v1.5 | 54.29 |
2856
+
2857
+
2858
+ ### [arctic-embed-s](https://huggingface.co/Snowflake/arctic-embed-xs/)
2859
+
2860
+
2861
+ This tiny model packs quite the punch based on the [all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2) model. With only 22m parameters and 384 dimensions, this model should meet even the strictest latency/TCO budgets. Despite its size, its retrieval accuracy is closer to that of models with 100m paramers.
2862
+
2863
+
2864
+ | Model Name | MTEB Retrieval Score (NDCG @ 10) |
2865
+ | ------------------------------------------------------------------- | -------------------------------- |
2866
+ | [arctic-embed-s](https://huggingface.co/Snowflake/arctic-embed-xs/) | 50.15 |
2867
+ | GIST-all-MiniLM-L6-v2 | 45.12 |
2868
+ | gte-tiny | 44.92 |
2869
+ | all-MiniLM-L6-v2 | 41.95 |
2870
+ | bge-micro-v2 | 42.56 |
2871
+
2872
+
2873
+ ### Arctic-embed-m
2874
+
2875
+
2876
+ Based on the [all-MiniLM-L12-v2](https://huggingface.co/intfloat/e5-base-unsupervised) model, this small model does not trade off retrieval accuracy for its small size. With only 33m parameters and 384 dimensions, this model should easily allow scaling to large datasets.
2877
+
2878
+
2879
+ | Model Name | MTEB Retrieval Score (NDCG @ 10) |
2880
+ | ------------------------------------------------------------------ | -------------------------------- |
2881
+ | [arctic-embed-s](https://huggingface.co/Snowflake/arctic-embed-s/) | 51.98 |
2882
+ | bge-small-en-v1.5 | 51.68 |
2883
+ | Cohere-embed-english-light-v3.0 | 51.34 |
2884
+ | text-embedding-3-small | 51.08 |
2885
+ | e5-small-v2 | 49.04 |
2886
+
2887
+
2888
+ ### [arctic-embed-s](https://huggingface.co/Snowflake/arctic-embed-m-long/)
2889
+
2890
+
2891
+ Based on the [nomic-embed-text-v1](https://huggingface.co/nomic-ai/nomic-embed-text-v1) model, this long-context variant of our medium-sized model is perfect for workloads that can be constrained by the regular 512 token context of our other models. Without the use of RPE, this model supports up to 2048 tokens. With RPE, it can scale to 8192!
2892
+
2893
+
2894
+ | Model Name | MTEB Retrieval Score (NDCG @ 10) |
2895
+ | ------------------------------------------------------------------ | -------------------------------- |
2896
+ | [arctic-embed-s](https://huggingface.co/Snowflake/arctic-embed-m/) | 54.90 |
2897
+ | bge-base-en-v1.5 | 53.25 |
2898
+ | nomic-embed-text-v1.5 | 53.01 |
2899
+ | GIST-Embedding-v0 | 52.31 |
2900
+ | gte-base | 52.31 |
2901
+
2902
+
2903
+ ### Arctic-embed-m
2904
+
2905
+
2906
+ Based on the [intfloat/e5-base-unsupervised](https://huggingface.co/intfloat/e5-base-unsupervised) model, this medium model is the workhorse that provides the best retrieval performance without slowing down inference.
2907
+
2908
+
2909
+ | Model Name | MTEB Retrieval Score (NDCG @ 10) |
2910
+ | ------------------------------------------------------------------ | -------------------------------- |
2911
+ | [arctic-embed-s](https://huggingface.co/Snowflake/arctic-embed-m/) | 54.90 |
2912
+ | bge-base-en-v1.5 | 53.25 |
2913
+ | nomic-embed-text-v1.5 | 53.25 |
2914
+ | GIST-Embedding-v0 | 52.31 |
2915
+ | gte-base | 52.31 |
2916
+
2917
+
2918
+ ### [arctic-embed-s](https://huggingface.co/Snowflake/arctic-embed-l/)
2919
+
2920
+
2921
+ Based on the [intfloat/e5-large-unsupervised](https://huggingface.co/intfloat/e5-large-unsupervised) model, this small model does not sacrifice retrieval accuracy for its small size.
2922
+
2923
+
2924
+ | Model Name | MTEB Retrieval Score (NDCG @ 10) |
2925
+ | ------------------------------------------------------------------ | -------------------------------- |
2926
+ | [arctic-embed-s](https://huggingface.co/Snowflake/arctic-embed-l/) | 55.98 |
2927
+ | UAE-Large-V1 | 54.66 |
2928
+ | bge-large-en-v1.5 | 54.29 |
2929
+ | mxbai-embed-large-v1 | 54.39 |
2930
+ | e5-Large-v2 | 50.56 |
2931
+
2932
+
2933
+ ## Usage
2934
+
2935
+
2936
+ ### Using Huggingface transformers
2937
+
2938
+
2939
+ To use an arctic-embed model, you can use the transformers package, as shown below. For optimal retrieval quality, ensure that you use the CLS token as the embedding for each portion of text and use the query prefix below (just on the query).
2940
+
2941
+
2942
+
2943
+ ```python
2944
+ import torch
2945
+ from transformers import AutoModel, AutoTokenizer
2946
+
2947
+ tokenizer = AutoTokenizer.from_pretrained('Snowflake/snow-text-embed-base')
2948
+ model = AutoModel.from_pretrained('Snowflake/snow-text-embed-base', add_pooling_layer=False)
2949
+ model.eval()
2950
+
2951
+ query_prefix = 'Represent this sentence for searching relevant passages: '
2952
+ queries = ['what is snowflake?', 'Where can I get the best tacos?']
2953
+ queries_with_prefix = ["{}{}".format(query_prefix, i) for i in queries]
2954
+ query_tokens = tokenizer(queries_with_prefix, padding=True, truncation=True, return_tensors='pt', max_length=512)
2955
+
2956
+ documents = ['The Data Cloud!', 'Mexico City of Course!']
2957
+ document_tokens = tokenizer(documents, padding=True, truncation=True, return_tensors='pt', max_length=512)
2958
+
2959
+ # Compute token embeddings
2960
+ with torch.no_grad():
2961
+ query_embeddings = model(**query_tokens)[0][:, 0]
2962
+ doument_embeddings = model(**document_tokens)[0][:, 0]
2963
+
2964
+
2965
+ # normalize embeddings
2966
+ query_embeddings = torch.nn.functional.normalize(query_embeddings, p=2, dim=1)
2967
+ doument_embeddings = torch.nn.functional.normalize(doument_embeddings, p=2, dim=1)
2968
+
2969
+ scores = torch.mm(query_embeddings, doument_embeddings.transpose(0, 1))
2970
+ for query, query_scores in zip(queries, scores):
2971
+ doc_score_pairs = list(zip(documents, query_scores))
2972
+ doc_score_pairs = sorted(doc_score_pairs, key=lambda x: x[1], reverse=True)
2973
+ #Output passages & scores
2974
+ print("Query:", query)
2975
+ for document, score in doc_score_pairs:
2976
+ print(score, document)
2977
+ ```
2978
+
2979
+
2980
+ If you use the long context model and have more than 2048 tokens, ensure that you initialize the model like below instead. This will use [RPE](https://arxiv.org/abs/2104.09864) to allow up to 8192 tokens.
2981
+
2982
+
2983
+ ``` py
2984
+ model = AutoModel.from_pretrained('Snowflake/[arctic-embed-s](https://huggingface.co/Snowflake/arctic-embed-m-long/)', trust_remote_code=True, rotary_scaling_factor=2)
2985
+ ```
2986
+
2987
+
2988
+ ## FAQ
2989
+
2990
+
2991
+ TBD
2992
+
2993
+
2994
+ ## Contact
2995
+
2996
+
2997
+ If you have any questions or suggestions about this project, feel free to open an issue or pull request.
2998
+ You also can email Daniel Campos([email protected]).
2999
+
3000
+
3001
+ ## License
3002
+
3003
+
3004
+ Arctic is licensed under the [Apache-2](https://www.apache.org/licenses/LICENSE-2.0). The released models can be used for commercial purposes free of charge.
3005
+
3006
+
3007
+ ## Acknowledgement
3008
+
3009
+
3010
+ We would like to thank the open-source community, which has provided the great building blocks upon which we could make our models.
3011
+
3012
+
3013
+