--- license: mit library_name: sentence-transformers pipeline_tag: sentence-similarity tags: - sentence-transformers - feature-extraction - sentence-similarity - gte - mteb model-index: - name: gte-micro-v4 results: - task: type: Classification dataset: type: mteb/amazon_counterfactual name: MTEB AmazonCounterfactualClassification (en) config: en split: test revision: e8379541af4e31359cca9fbcf4b00f2671dba205 metrics: - type: accuracy value: 71.83582089552239 - type: ap value: 34.436093320979126 - type: f1 value: 65.82844954638102 - task: type: Classification dataset: type: mteb/amazon_polarity name: MTEB AmazonPolarityClassification config: default split: test revision: e2d317d38cd51312af73b3d32a06d1a08b442046 metrics: - type: accuracy value: 80.03957500000001 - type: ap value: 74.4510899901909 - type: f1 value: 79.98034714963279 - task: type: Classification dataset: type: mteb/amazon_reviews_multi name: MTEB AmazonReviewsClassification (en) config: en split: test revision: 1399c76144fd37290681b995c656ef9b2e06e26d metrics: - type: accuracy value: 39.754 - type: f1 value: 39.423135672769796 - task: type: Clustering dataset: type: mteb/arxiv-clustering-p2p name: MTEB ArxivClusteringP2P config: default split: test revision: a122ad7f3f0291bf49cc6f4d32aa80929df69d5d metrics: - type: v_measure value: 42.85928858083004 - task: type: Clustering dataset: type: mteb/arxiv-clustering-s2s name: MTEB ArxivClusteringS2S config: default split: test revision: f910caf1a6075f7329cdf8c1a6135696f37dbd53 metrics: - type: v_measure value: 32.475201371814784 - task: type: Reranking dataset: type: mteb/askubuntudupquestions-reranking name: MTEB AskUbuntuDupQuestions config: default split: test revision: 2000358ca161889fa9c082cb41daa8dcfb161a54 metrics: - type: map value: 58.01141755339977 - type: mrr value: 71.70821791320407 - task: type: Classification dataset: type: mteb/banking77 name: MTEB Banking77Classification config: default split: test revision: 0fd18e25b25c072e09e0d92ab615fda904d66300 metrics: - type: accuracy value: 80.9220779220779 - type: f1 value: 80.86851039874094 - task: type: Clustering dataset: type: mteb/biorxiv-clustering-p2p name: MTEB BiorxivClusteringP2P config: default split: test revision: 65b79d1d13f80053f67aca9498d9402c2d9f1f40 metrics: - type: v_measure value: 36.82555236565894 - task: type: Clustering dataset: type: mteb/biorxiv-clustering-s2s name: MTEB BiorxivClusteringS2S config: default split: test revision: 258694dd0231531bc1fd9de6ceb52a0853c6d908 metrics: - type: v_measure value: 29.243444611175995 - task: type: Classification dataset: type: mteb/emotion name: MTEB EmotionClassification config: default split: test revision: 4f58c6b202a23cf9a4da393831edf4f9183cad37 metrics: - type: accuracy value: 44.87500000000001 - type: f1 value: 39.78455417008123 - task: type: Classification dataset: type: mteb/imdb name: MTEB ImdbClassification config: default split: test revision: 3d86128a09e091d6018b6d26cad27f2739fc2db7 metrics: - type: accuracy value: 71.9568 - type: ap value: 65.91179027501194 - type: f1 value: 71.85575290323182 - task: type: Classification dataset: type: mteb/mtop_domain name: MTEB MTOPDomainClassification (en) config: en split: test revision: d80d48c1eb48d3562165c59d59d0034df9fff0bf metrics: - type: accuracy value: 90.87323301413589 - type: f1 value: 90.45433994230181 - task: type: Classification dataset: type: mteb/mtop_intent name: MTEB MTOPIntentClassification (en) config: en split: test revision: ae001d0e6b1228650b7bd1c2c65fb50ad11a8aba metrics: - type: accuracy value: 68.53169174646602 - type: f1 value: 50.49367676485481 - task: type: Classification dataset: type: mteb/amazon_massive_intent name: MTEB MassiveIntentClassification (en) config: en split: test revision: 31efe3c427b0bae9c22cbb560b8f15491cc6bed7 metrics: - type: accuracy value: 69.11230665770007 - type: f1 value: 66.9035022957204 - task: type: Classification dataset: type: mteb/amazon_massive_scenario name: MTEB MassiveScenarioClassification (en) config: en split: test revision: 7d571f92784cd94a019292a1f45445077d0ef634 metrics: - type: accuracy value: 74.15601882985877 - type: f1 value: 74.059011768806 - task: type: Clustering dataset: type: mteb/medrxiv-clustering-p2p name: MTEB MedrxivClusteringP2P config: default split: test revision: e7a26af6f3ae46b30dde8737f02c07b1505bcc73 metrics: - type: v_measure value: 32.551619758274406 - task: type: Clustering dataset: type: mteb/medrxiv-clustering-s2s name: MTEB MedrxivClusteringS2S config: default split: test revision: 35191c8c0dca72d8ff3efcd72aa802307d469663 metrics: - type: v_measure value: 30.80210958999942 - task: type: Clustering dataset: type: mteb/reddit-clustering name: MTEB RedditClustering config: default split: test revision: 24640382cdbf8abc73003fb0fa6d111a705499eb metrics: - type: v_measure value: 48.27542501963987 - task: type: Clustering dataset: type: mteb/reddit-clustering-p2p name: MTEB RedditClusteringP2P config: default split: test revision: 385e3cb46b4cfa89021f56c4380204149d0efe33 metrics: - type: v_measure value: 53.55942763860501 - task: type: PairClassification dataset: type: mteb/sprintduplicatequestions-pairclassification name: MTEB SprintDuplicateQuestions config: default split: test revision: d66bd1f72af766a5cc4b0ca5e00c162f89e8cc46 metrics: - type: cos_sim_accuracy value: 99.82673267326733 - type: cos_sim_ap value: 95.53621808930455 - type: cos_sim_f1 value: 91.19275289380975 - type: cos_sim_precision value: 91.7933130699088 - type: cos_sim_recall value: 90.60000000000001 - type: dot_accuracy value: 99.75445544554455 - type: dot_ap value: 92.76410342229411 - type: dot_f1 value: 87.50612444879961 - type: dot_precision value: 85.78290105667628 - type: dot_recall value: 89.3 - type: euclidean_accuracy value: 99.82673267326733 - type: euclidean_ap value: 95.46124795179632 - type: euclidean_f1 value: 91.01181304571135 - type: euclidean_precision value: 93.55860612460401 - type: euclidean_recall value: 88.6 - type: manhattan_accuracy value: 99.82871287128712 - type: manhattan_ap value: 95.51436288466519 - type: manhattan_f1 value: 91.11891620672353 - type: manhattan_precision value: 91.44008056394763 - type: manhattan_recall value: 90.8 - type: max_accuracy value: 99.82871287128712 - type: max_ap value: 95.53621808930455 - type: max_f1 value: 91.19275289380975 - task: type: Clustering dataset: type: mteb/stackexchange-clustering name: MTEB StackExchangeClustering config: default split: test revision: 6cbc1f7b2bc0622f2e39d2c77fa502909748c259 metrics: - type: v_measure value: 55.0721745308552 - task: type: Clustering dataset: type: mteb/stackexchange-clustering-p2p name: MTEB StackExchangeClusteringP2P config: default split: test revision: 815ca46b2622cec33ccafc3735d572c266efdb44 metrics: - type: v_measure value: 31.91639764792279 - task: type: Classification dataset: type: mteb/toxic_conversations_50k name: MTEB ToxicConversationsClassification config: default split: test revision: edfaf9da55d3dd50d43143d90c1ac476895ae6de metrics: - type: accuracy value: 66.0402 - type: ap value: 12.106715125588833 - type: f1 value: 50.67443088623853 - task: type: Classification dataset: type: mteb/tweet_sentiment_extraction name: MTEB TweetSentimentExtractionClassification config: default split: test revision: d604517c81ca91fe16a244d1248fc021f9ecee7a metrics: - type: accuracy value: 59.42840973401245 - type: f1 value: 59.813350770208665 - task: type: Clustering dataset: type: mteb/twentynewsgroups-clustering name: MTEB TwentyNewsgroupsClustering config: default split: test revision: 6125ec4e24fa026cec8a478383ee943acfbd5449 metrics: - type: v_measure value: 41.37273187829312 - task: type: PairClassification dataset: type: mteb/twittersemeval2015-pairclassification name: MTEB TwitterSemEval2015 config: default split: test revision: 70970daeab8776df92f5ea462b6173c0b46fd2d1 metrics: - type: cos_sim_accuracy value: 84.10919711509806 - type: cos_sim_ap value: 67.55255054010537 - type: cos_sim_f1 value: 64.22774378823823 - type: cos_sim_precision value: 60.9623133443944 - type: cos_sim_recall value: 67.86279683377309 - type: dot_accuracy value: 80.62228050306967 - type: dot_ap value: 54.81480289413879 - type: dot_f1 value: 54.22550997534184 - type: dot_precision value: 47.13561964146532 - type: dot_recall value: 63.82585751978892 - type: euclidean_accuracy value: 84.04363116170948 - type: euclidean_ap value: 67.77652401372912 - type: euclidean_f1 value: 64.46694460988684 - type: euclidean_precision value: 58.762214983713356 - type: euclidean_recall value: 71.39841688654354 - type: manhattan_accuracy value: 83.94230196101806 - type: manhattan_ap value: 67.419155052755 - type: manhattan_f1 value: 64.15049692380501 - type: manhattan_precision value: 58.151008151008156 - type: manhattan_recall value: 71.53034300791556 - type: max_accuracy value: 84.10919711509806 - type: max_ap value: 67.77652401372912 - type: max_f1 value: 64.46694460988684 - task: type: PairClassification dataset: type: mteb/twitterurlcorpus-pairclassification name: MTEB TwitterURLCorpus config: default split: test revision: 8b6510b0b1fa4e4c4f879467980e9be563ec1cdf metrics: - type: cos_sim_accuracy value: 88.25823728024217 - type: cos_sim_ap value: 84.67785320317506 - type: cos_sim_f1 value: 76.67701296330108 - type: cos_sim_precision value: 72.92491491282907 - type: cos_sim_recall value: 80.83615645210965 - type: dot_accuracy value: 84.63344588038964 - type: dot_ap value: 75.25182203961072 - type: dot_f1 value: 70.35217601881962 - type: dot_precision value: 63.87737152908657 - type: dot_recall value: 78.28765013858947 - type: euclidean_accuracy value: 88.2504754142896 - type: euclidean_ap value: 84.68882859374924 - type: euclidean_f1 value: 76.69534508021188 - type: euclidean_precision value: 74.89177489177489 - type: euclidean_recall value: 78.58792731752386 - type: manhattan_accuracy value: 88.26211821321846 - type: manhattan_ap value: 84.60061548046698 - type: manhattan_f1 value: 76.63928519959647 - type: manhattan_precision value: 72.02058504875406 - type: manhattan_recall value: 81.89097628580228 - type: max_accuracy value: 88.26211821321846 - type: max_ap value: 84.68882859374924 - type: max_f1 value: 76.69534508021188 --- # gte-micro-v4 This is a distill of [gte-tiny](https://huggingface.co/TaylorAI/gte-tiny). ## Intended purpose This model is designed for use in semantic-autocomplete ([click here for demo](https://mihaiii.github.io/semantic-autocomplete/)). ## Usage (Sentence-Transformers) (same as [gte-tiny](https://huggingface.co/TaylorAI/gte-tiny)) Using this model becomes easy when you have [sentence-transformers](https://www.SBERT.net) installed: ``` pip install -U sentence-transformers ``` Then you can use the model like this: ```python from sentence_transformers import SentenceTransformer sentences = ["This is an example sentence", "Each sentence is converted"] model = SentenceTransformer('Mihaiii/gte-micro-v4') embeddings = model.encode(sentences) print(embeddings) ``` ## Usage (HuggingFace Transformers) (same as [gte-tiny](https://huggingface.co/TaylorAI/gte-tiny)) Without [sentence-transformers](https://www.SBERT.net), you can use the model like this: First, you pass your input through the transformer model, then you have to apply the right pooling-operation on-top of the contextualized word embeddings. ```python from transformers import AutoTokenizer, AutoModel import torch #Mean Pooling - Take attention mask into account for correct averaging def mean_pooling(model_output, attention_mask): token_embeddings = model_output[0] #First element of model_output contains all token embeddings input_mask_expanded = attention_mask.unsqueeze(-1).expand(token_embeddings.size()).float() return torch.sum(token_embeddings * input_mask_expanded, 1) / torch.clamp(input_mask_expanded.sum(1), min=1e-9) # Sentences we want sentence embeddings for sentences = ['This is an example sentence', 'Each sentence is converted'] # Load model from HuggingFace Hub tokenizer = AutoTokenizer.from_pretrained('Mihaiii/gte-micro-v4') model = AutoModel.from_pretrained('Mihaiii/gte-micro-v4') # Tokenize sentences encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt') # Compute token embeddings with torch.no_grad(): model_output = model(**encoded_input) # Perform pooling. In this case, mean pooling. sentence_embeddings = mean_pooling(model_output, encoded_input['attention_mask']) print("Sentence embeddings:") print(sentence_embeddings) ``` ### Limitation (same as [gte-small](https://huggingface.co/thenlper/gte-small)) This model exclusively caters to English texts, and any lengthy texts will be truncated to a maximum of 512 tokens.