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812
9daeb12
a739812
 
 
 
 
 
 
 
 
 
 
 
 
9daeb12
a739812
 
 
 
 
 
9daeb12
a739812
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9daeb12
 
a739812
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9daeb12
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
---
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

<span style="color:blue">This model is designed for use in semantic-autocomplete ([click here for demo](https://mihaiii.github.io/semantic-autocomplete/)).</span>

## 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.