spacemanidol commited on
Commit
455d6f5
1 Parent(s): ea753c2

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +204 -1
README.md CHANGED
@@ -2800,4 +2800,207 @@ model-index:
2800
  metrics:
2801
  - type: v_measure
2802
  value: 85.5314389263015
2803
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2800
  metrics:
2801
  - type: v_measure
2802
  value: 85.5314389263015
2803
+ ---
2804
+ <h1 align="center">Snowflake's Artic-embed-l</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-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 retrieval models optimized for performance.
2829
+
2830
+
2831
+ The `arctic-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 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-xs](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-m](https://huggingface.co/Snowflake/arctic-embed-m/) | 54.90 | 110 | 768 |
2842
+ | [arctic-embed-m-long](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-l](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-xs](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-xs](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-s](https://huggingface.co/Snowflake/arctic-embed-s)
2874
+
2875
+
2876
+ Based on the [all-MiniLM-L12-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L12-v2) 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-m](https://huggingface.co/Snowflake/arctic-embed-m/)
2889
+
2890
+
2891
+ 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.
2892
+
2893
+
2894
+ | Model Name | MTEB Retrieval Score (NDCG @ 10) |
2895
+ | ------------------------------------------------------------------ | -------------------------------- |
2896
+ | [arctic-embed-m](https://huggingface.co/Snowflake/arctic-embed-m/) | 54.90 |
2897
+ | bge-base-en-v1.5 | 53.25 |
2898
+ | nomic-embed-text-v1.5 | 53.25 |
2899
+ | GIST-Embedding-v0 | 52.31 |
2900
+ | gte-base | 52.31 |
2901
+
2902
+ ### [arctic-embed-m-long](https://huggingface.co/Snowflake/arctic-embed-m-long/)
2903
+
2904
+
2905
+ 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!
2906
+
2907
+
2908
+ | Model Name | MTEB Retrieval Score (NDCG @ 10) |
2909
+ | ------------------------------------------------------------------ | -------------------------------- |
2910
+ | [arctic-embed-m-long](https://huggingface.co/Snowflake/arctic-embed-m-long/) | 54.83 |
2911
+ | nomic-embed-text-v1.5 | 53.01 |
2912
+ | nomic-embed-text-v1 | 52.81 |
2913
+
2914
+
2915
+
2916
+
2917
+ ### [arctic-embed-l](https://huggingface.co/Snowflake/arctic-embed-l/)
2918
+
2919
+
2920
+ 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.
2921
+
2922
+
2923
+ | Model Name | MTEB Retrieval Score (NDCG @ 10) |
2924
+ | ------------------------------------------------------------------ | -------------------------------- |
2925
+ | [arctic-embed-l](https://huggingface.co/Snowflake/arctic-embed-l/) | 55.98 |
2926
+ | UAE-Large-V1 | 54.66 |
2927
+ | bge-large-en-v1.5 | 54.29 |
2928
+ | mxbai-embed-large-v1 | 54.39 |
2929
+ | e5-Large-v2 | 50.56 |
2930
+
2931
+
2932
+ ## Usage
2933
+
2934
+
2935
+ ### Using Huggingface transformers
2936
+
2937
+
2938
+ You can use the transformers package to use an arctic-embed model, as shown below. For optimal retrieval quality, use the CLS token to embed each text portion and use the query prefix below (just on the query).
2939
+
2940
+
2941
+
2942
+ ```python
2943
+ import torch
2944
+ from transformers import AutoModel, AutoTokenizer
2945
+
2946
+ tokenizer = AutoTokenizer.from_pretrained('Snowflake/arctic-embed-l')
2947
+ model = AutoModel.from_pretrained('Snowflake/arctic-embed-l', add_pooling_layer=False)
2948
+ model.eval()
2949
+
2950
+ query_prefix = 'Represent this sentence for searching relevant passages: '
2951
+ queries = ['what is snowflake?', 'Where can I get the best tacos?']
2952
+ queries_with_prefix = ["{}{}".format(query_prefix, i) for i in queries]
2953
+ query_tokens = tokenizer(queries_with_prefix, padding=True, truncation=True, return_tensors='pt', max_length=512)
2954
+
2955
+ documents = ['The Data Cloud!', 'Mexico City of Course!']
2956
+ document_tokens = tokenizer(documents, padding=True, truncation=True, return_tensors='pt', max_length=512)
2957
+
2958
+ # Compute token embeddings
2959
+ with torch.no_grad():
2960
+ query_embeddings = model(**query_tokens)[0][:, 0]
2961
+ doument_embeddings = model(**document_tokens)[0][:, 0]
2962
+
2963
+
2964
+ # normalize embeddings
2965
+ query_embeddings = torch.nn.functional.normalize(query_embeddings, p=2, dim=1)
2966
+ doument_embeddings = torch.nn.functional.normalize(doument_embeddings, p=2, dim=1)
2967
+
2968
+ scores = torch.mm(query_embeddings, doument_embeddings.transpose(0, 1))
2969
+ for query, query_scores in zip(queries, scores):
2970
+ doc_score_pairs = list(zip(documents, query_scores))
2971
+ doc_score_pairs = sorted(doc_score_pairs, key=lambda x: x[1], reverse=True)
2972
+ #Output passages & scores
2973
+ print("Query:", query)
2974
+ for document, score in doc_score_pairs:
2975
+ print(score, document)
2976
+ ```
2977
+
2978
+
2979
+ ## FAQ
2980
+
2981
+
2982
+ TBD
2983
+
2984
+
2985
+ ## Contact
2986
+
2987
+
2988
+ Feel free to open an issue or pull request if you have any questions or suggestions about this project.
2989
+ You also can email Daniel Campos(daniel.campos@snowflake.com).
2990
+
2991
+
2992
+ ## License
2993
+
2994
+
2995
+ 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.
2996
+
2997
+
2998
+ ## Acknowledgement
2999
+
3000
+
3001
+ We want to thank the open-source community, which has provided the great building blocks upon which we could make our models.
3002
+ We thank our modeling engineers, Danmei Xu, Luke Merrick, Gaurav Nuti, and Daniel Campos, for making these great models possible.
3003
+ We thank our leadership, Himabindu Pucha, Kelvin So, Vivek Raghunathan, and Sridhar Ramaswamy, for supporting this work.
3004
+ We also thank the open-source community for producing the great models we could build on top of and making these releases possible.
3005
+ Finally, we thank the researchers who created BEIR and MTEB benchmarks.
3006
+ It is largely thanks to their tireless work to define what better looks like that we could improve model performance.