File size: 10,014 Bytes
3aab512 d96e8ca 3aab512 |
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 |
---
library_name: sentence-transformers
pipeline_tag: sentence-similarity
tags:
- sentence-transformers
- feature-extraction
- sentence-similarity
- transformers
- mteb
model-index:
- name: mxbai-embed-large-v1-sts-matryoshka
results:
- task:
type: STS
dataset:
type: mteb/biosses-sts
name: MTEB BIOSSES
config: default
split: test
revision: d3fb88f8f02e40887cd149695127462bbcf29b4a
metrics:
- type: cos_sim_pearson
value: 89.74819706519132
- type: cos_sim_spearman
value: 89.16227258672195
- type: euclidean_pearson
value: 87.4894915970516
- type: euclidean_spearman
value: 88.82371065549121
- type: manhattan_pearson
value: 87.4550672002364
- type: manhattan_spearman
value: 88.74479319465274
- task:
type: STS
dataset:
type: mteb/sickr-sts
name: MTEB SICK-R
config: default
split: test
revision: a6ea5a8cab320b040a23452cc28066d9beae2cee
metrics:
- type: cos_sim_pearson
value: 87.6165367318343
- type: cos_sim_spearman
value: 82.96648281765052
- type: euclidean_pearson
value: 85.15841275786363
- type: euclidean_spearman
value: 82.59932858741094
- type: manhattan_pearson
value: 85.13304536590803
- type: manhattan_spearman
value: 82.57423596486754
- task:
type: STS
dataset:
type: mteb/sts12-sts
name: MTEB STS12
config: default
split: test
revision: a0d554a64d88156834ff5ae9920b964011b16384
metrics:
- type: cos_sim_pearson
value: 90.28534830444329
- type: cos_sim_spearman
value: 82.55267827529079
- type: euclidean_pearson
value: 88.25378069753911
- type: euclidean_spearman
value: 83.11525616002255
- type: manhattan_pearson
value: 88.22692740852892
- type: manhattan_spearman
value: 83.09760476508313
- task:
type: STS
dataset:
type: mteb/sts13-sts
name: MTEB STS13
config: default
split: test
revision: 7e90230a92c190f1bf69ae9002b8cea547a64cca
metrics:
- type: cos_sim_pearson
value: 92.4873773117415
- type: cos_sim_spearman
value: 92.45311856572782
- type: euclidean_pearson
value: 91.3940762182452
- type: euclidean_spearman
value: 91.99304193285555
- type: manhattan_pearson
value: 91.36013458363827
- type: manhattan_spearman
value: 91.94059360016104
- task:
type: STS
dataset:
type: mteb/sts14-sts
name: MTEB STS14
config: default
split: test
revision: 6031580fec1f6af667f0bd2da0a551cf4f0b2375
metrics:
- type: cos_sim_pearson
value: 92.86047241342555
- type: cos_sim_spearman
value: 91.7373997118018
- type: euclidean_pearson
value: 91.85151887796326
- type: euclidean_spearman
value: 91.84470114529888
- type: manhattan_pearson
value: 91.84546446666218
- type: manhattan_spearman
value: 91.83943192650281
- task:
type: STS
dataset:
type: mteb/sts15-sts
name: MTEB STS15
config: default
split: test
revision: ae752c7c21bf194d8b67fd573edf7ae58183cbe3
metrics:
- type: cos_sim_pearson
value: 91.54334603049196
- type: cos_sim_spearman
value: 92.53856973601617
- type: euclidean_pearson
value: 91.78019629944465
- type: euclidean_spearman
value: 92.34058447365024
- type: manhattan_pearson
value: 91.77889261840363
- type: manhattan_spearman
value: 92.34415590718599
- task:
type: STS
dataset:
type: mteb/sts16-sts
name: MTEB STS16
config: default
split: test
revision: 4d8694f8f0e0100860b497b999b3dbed754a0513
metrics:
- type: cos_sim_pearson
value: 86.44182676813374
- type: cos_sim_spearman
value: 88.13762635519763
- type: euclidean_pearson
value: 87.368150115143
- type: euclidean_spearman
value: 87.80086022782062
- type: manhattan_pearson
value: 87.36033717796437
- type: manhattan_spearman
value: 87.79278886160228
- task:
type: STS
dataset:
type: mteb/sts17-crosslingual-sts
name: MTEB STS17 (en-en)
config: en-en
split: test
revision: af5e6fb845001ecf41f4c1e033ce921939a2a68d
metrics:
- type: cos_sim_pearson
value: 90.45736504439745
- type: cos_sim_spearman
value: 90.36467157990322
- type: euclidean_pearson
value: 90.19668998748772
- type: euclidean_spearman
value: 89.89620750310942
- type: manhattan_pearson
value: 90.28020856755623
- type: manhattan_spearman
value: 90.06372752006743
- task:
type: STS
dataset:
type: mteb/sts22-crosslingual-sts
name: MTEB STS22 (en)
config: en
split: test
revision: eea2b4fe26a775864c896887d910b76a8098ad3f
metrics:
- type: cos_sim_pearson
value: 68.08713149697203
- type: cos_sim_spearman
value: 68.46457718572601
- type: euclidean_pearson
value: 69.25165385150007
- type: euclidean_spearman
value: 68.1342295049583
- type: manhattan_pearson
value: 69.30447292480429
- type: manhattan_spearman
value: 68.25582089078411
- task:
type: STS
dataset:
type: mteb/stsbenchmark-sts
name: MTEB STSBenchmark
config: default
split: test
revision: b0fddb56ed78048fa8b90373c8a3cfc37b684831
metrics:
- type: cos_sim_pearson
value: 88.34259569356074
- type: cos_sim_spearman
value: 89.78243695761168
- type: euclidean_pearson
value: 89.12060338382234
- type: euclidean_spearman
value: 89.67729976099504
- type: manhattan_pearson
value: 89.12528974491349
- type: manhattan_spearman
value: 89.66532321334671
---
# MichaelKarpe/mxbai-embed-large-v1-sts-matryoshka
This is a [sentence-transformers](https://www.SBERT.net) model: It maps sentences & paragraphs to a 1024 dimensional dense vector space and can be used for tasks like clustering or semantic search.
<!--- Describe your model here -->
## Usage (Sentence-Transformers)
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('MichaelKarpe/mxbai-embed-large-v1-sts-matryoshka')
embeddings = model.encode(sentences)
print(embeddings)
```
## Usage (HuggingFace Transformers)
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('MichaelKarpe/mxbai-embed-large-v1-sts-matryoshka')
model = AutoModel.from_pretrained('MichaelKarpe/mxbai-embed-large-v1-sts-matryoshka')
# 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)
```
## Evaluation Results
<!--- Describe how your model was evaluated -->
For an automated evaluation of this model, see the *Sentence Embeddings Benchmark*: [https://seb.sbert.net](https://seb.sbert.net?model_name=MichaelKarpe/mxbai-embed-large-v1-sts-matryoshka)
## Training
The model was trained with the parameters:
**DataLoader**:
`torch.utils.data.dataloader.DataLoader` of length 360 with parameters:
```
{'batch_size': 16, 'sampler': 'torch.utils.data.sampler.RandomSampler', 'batch_sampler': 'torch.utils.data.sampler.BatchSampler'}
```
**Loss**:
`sentence_transformers.losses.MatryoshkaLoss.MatryoshkaLoss` with parameters:
```
{'loss': 'CoSENTLoss', 'matryoshka_dims': [1024, 768, 512, 256, 128, 64], 'matryoshka_weights': [1, 1, 1, 1, 1, 1], 'n_dims_per_step': -1}
```
Parameters of the fit()-Method:
```
{
"epochs": 4,
"evaluation_steps": 1000,
"evaluator": "sentence_transformers.evaluation.EmbeddingSimilarityEvaluator.EmbeddingSimilarityEvaluator",
"max_grad_norm": 1,
"optimizer_class": "<class 'torch.optim.adamw.AdamW'>",
"optimizer_params": {
"lr": 2e-05
},
"scheduler": "WarmupLinear",
"steps_per_epoch": null,
"warmup_steps": 144,
"weight_decay": 0.01
}
```
## Full Model Architecture
```
SentenceTransformer(
(0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: BertModel
(1): Pooling({'word_embedding_dimension': 1024, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
)
```
## Citing & Authors
<!--- Describe where people can find more information --> |