File size: 16,442 Bytes
9493a91 c9a1656 9493a91 7fcf5d4 37dae2d 9493a91 7e25eb7 9493a91 4704415 7e25eb7 4704415 1a5536f 7fcf5d4 4704415 7fcf5d4 f712218 7fcf5d4 4704415 |
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 |
---
license: mit
language:
- en
- ru
metrics:
- accuracy
- f1
- recall
library_name: transformers
pipeline_tag: sentence-similarity
tags:
- mteb
- retrieval
- retriever
- pruned
- e5
- sentence-transformers
- feature-extraction
- sentence-similarity
model-index:
- name: e5-large-en-ru
results:
- task:
type: Classification
dataset:
type: mteb/amazon_counterfactual
name: MTEB AmazonCounterfactualClassification (en)
config: en
split: test
revision: e8379541af4e31359cca9fbcf4b00f2671dba205
metrics:
- type: accuracy
value: 79.5671641791045
- type: ap
value: 44.011060753169424
- type: f1
value: 73.76504135120175
- task:
type: Reranking
dataset:
type: mteb/askubuntudupquestions-reranking
name: MTEB AskUbuntuDupQuestions
config: default
split: test
revision: 2000358ca161889fa9c082cb41daa8dcfb161a54
metrics:
- type: map
value: 57.69669466706412
- type: mrr
value: 70.61370531592138
- task:
type: STS
dataset:
type: mteb/biosses-sts
name: MTEB BIOSSES
config: default
split: test
revision: d3fb88f8f02e40887cd149695127462bbcf29b4a
metrics:
- type: cos_sim_pearson
value: 86.36465960226795
- type: cos_sim_spearman
value: 84.57602350761223
- type: euclidean_pearson
value: 84.31391364490506
- type: euclidean_spearman
value: 84.57602350761223
- type: manhattan_pearson
value: 84.15796224236456
- type: manhattan_spearman
value: 84.3645729064343
- task:
type: Reranking
dataset:
type: mteb/mind_small
name: MTEB MindSmallReranking
config: default
split: test
revision: 3bdac13927fdc888b903db93b2ffdbd90b295a69
metrics:
- type: map
value: 31.105698873583098
- type: mrr
value: 32.163780846856206
- task:
type: STS
dataset:
type: mteb/sickr-sts
name: MTEB SICK-R
config: default
split: test
revision: a6ea5a8cab320b040a23452cc28066d9beae2cee
metrics:
- type: cos_sim_pearson
value: 83.75973907678062
- type: cos_sim_spearman
value: 80.54994608351296
- type: euclidean_pearson
value: 80.58496551316748
- type: euclidean_spearman
value: 80.54993996457814
- type: manhattan_pearson
value: 80.49280884070782
- type: manhattan_spearman
value: 80.41230093993471
- task:
type: STS
dataset:
type: mteb/sts12-sts
name: MTEB STS12
config: default
split: test
revision: a0d554a64d88156834ff5ae9920b964011b16384
metrics:
- type: cos_sim_pearson
value: 87.345503928209
- type: cos_sim_spearman
value: 80.4634619001261
- type: euclidean_pearson
value: 84.2666575030677
- type: euclidean_spearman
value: 80.46347579495351
- type: manhattan_pearson
value: 84.14370038922885
- type: manhattan_spearman
value: 80.36565043629274
- task:
type: STS
dataset:
type: mteb/sts13-sts
name: MTEB STS13
config: default
split: test
revision: 7e90230a92c190f1bf69ae9002b8cea547a64cca
metrics:
- type: cos_sim_pearson
value: 75.14644787456163
- type: cos_sim_spearman
value: 75.88443166051762
- type: euclidean_pearson
value: 76.19117255044588
- type: euclidean_spearman
value: 75.88443166051762
- type: manhattan_pearson
value: 76.00450128624708
- type: manhattan_spearman
value: 75.69943934692938
- task:
type: STS
dataset:
type: mteb/sts14-sts
name: MTEB STS14
config: default
split: test
revision: 6031580fec1f6af667f0bd2da0a551cf4f0b2375
metrics:
- type: cos_sim_pearson
value: 77.60763524019471
- type: cos_sim_spearman
value: 77.2591077818027
- type: euclidean_pearson
value: 77.14021401348042
- type: euclidean_spearman
value: 77.25911027186999
- type: manhattan_pearson
value: 76.87139081109731
- type: manhattan_spearman
value: 76.98379627773018
- task:
type: STS
dataset:
type: mteb/sts15-sts
name: MTEB STS15
config: default
split: test
revision: ae752c7c21bf194d8b67fd573edf7ae58183cbe3
metrics:
- type: cos_sim_pearson
value: 88.18321035966198
- type: cos_sim_spearman
value: 89.0469892725742
- type: euclidean_pearson
value: 88.05085809092137
- type: euclidean_spearman
value: 89.04698194601134
- type: manhattan_pearson
value: 88.03620967628684
- type: manhattan_spearman
value: 89.02859425307943
- task:
type: STS
dataset:
type: mteb/sts16-sts
name: MTEB STS16
config: default
split: test
revision: 4d8694f8f0e0100860b497b999b3dbed754a0513
metrics:
- type: cos_sim_pearson
value: 82.39166503459249
- type: cos_sim_spearman
value: 83.71826060604693
- type: euclidean_pearson
value: 82.70145770530107
- type: euclidean_spearman
value: 83.71826045549452
- type: manhattan_pearson
value: 82.56870669205291
- type: manhattan_spearman
value: 83.55353737670136
- 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: 89.58290721169323
- type: cos_sim_spearman
value: 89.25956993522081
- type: euclidean_pearson
value: 89.4716703635447
- type: euclidean_spearman
value: 89.25956993522081
- type: manhattan_pearson
value: 89.4475864648432
- type: manhattan_spearman
value: 89.14694174575615
- task:
type: Reranking
dataset:
type: mteb/scidocs-reranking
name: MTEB SciDocsRR
config: default
split: test
revision: d3c5e1fc0b855ab6097bf1cda04dd73947d7caab
metrics:
- type: map
value: 81.4879065181404
- type: mrr
value: 94.81295937178291
- task:
type: PairClassification
dataset:
type: mteb/sprintduplicatequestions-pairclassification
name: MTEB SprintDuplicateQuestions
config: default
split: test
revision: d66bd1f72af766a5cc4b0ca5e00c162f89e8cc46
metrics:
- type: cos_sim_accuracy
value: 99.73960396039604
- type: cos_sim_ap
value: 92.70840767967965
- type: cos_sim_f1
value: 86.90890990542557
- type: cos_sim_precision
value: 86.5213082259663
- type: cos_sim_recall
value: 87.3
- type: dot_accuracy
value: 99.73960396039604
- type: dot_ap
value: 92.70828452993575
- type: dot_f1
value: 86.90890990542557
- type: dot_precision
value: 86.5213082259663
- type: dot_recall
value: 87.3
- type: euclidean_accuracy
value: 99.73960396039604
- type: euclidean_ap
value: 92.7084093403562
- type: euclidean_f1
value: 86.90890990542557
- type: euclidean_precision
value: 86.5213082259663
- type: euclidean_recall
value: 87.3
- type: manhattan_accuracy
value: 99.74059405940594
- type: manhattan_ap
value: 92.7406819850299
- type: manhattan_f1
value: 87.01234567901234
- type: manhattan_precision
value: 85.95121951219512
- type: manhattan_recall
value: 88.1
- type: max_accuracy
value: 99.74059405940594
- type: max_ap
value: 92.7406819850299
- type: max_f1
value: 87.01234567901234
- task:
type: Reranking
dataset:
type: mteb/stackoverflowdupquestions-reranking
name: MTEB StackOverflowDupQuestions
config: default
split: test
revision: e185fbe320c72810689fc5848eb6114e1ef5ec69
metrics:
- type: map
value: 48.566931484512196
- type: mrr
value: 49.23111100500807
- task:
type: PairClassification
dataset:
type: mteb/twittersemeval2015-pairclassification
name: MTEB TwitterSemEval2015
config: default
split: test
revision: 70970daeab8776df92f5ea462b6173c0b46fd2d1
metrics:
- type: cos_sim_accuracy
value: 86.27287357692079
- type: cos_sim_ap
value: 74.20855854505362
- type: cos_sim_f1
value: 69.09903201787044
- type: cos_sim_precision
value: 65.22961574507966
- type: cos_sim_recall
value: 73.45646437994723
- type: dot_accuracy
value: 86.27287357692079
- type: dot_ap
value: 74.20853189774614
- type: dot_f1
value: 69.09903201787044
- type: dot_precision
value: 65.22961574507966
- type: dot_recall
value: 73.45646437994723
- type: euclidean_accuracy
value: 86.27287357692079
- type: euclidean_ap
value: 74.20857455896677
- type: euclidean_f1
value: 69.09903201787044
- type: euclidean_precision
value: 65.22961574507966
- type: euclidean_recall
value: 73.45646437994723
- type: manhattan_accuracy
value: 86.2192287059665
- type: manhattan_ap
value: 74.0513280969461
- type: manhattan_f1
value: 69.13344473621389
- type: manhattan_precision
value: 63.12118570183086
- type: manhattan_recall
value: 76.41160949868075
- type: max_accuracy
value: 86.27287357692079
- type: max_ap
value: 74.20857455896677
- type: max_f1
value: 69.13344473621389
- task:
type: PairClassification
dataset:
type: mteb/twitterurlcorpus-pairclassification
name: MTEB TwitterURLCorpus
config: default
split: test
revision: 8b6510b0b1fa4e4c4f879467980e9be563ec1cdf
metrics:
- type: cos_sim_accuracy
value: 89.16055419722902
- type: cos_sim_ap
value: 86.03614264194854
- type: cos_sim_f1
value: 78.89855695205357
- type: cos_sim_precision
value: 73.74656938215409
- type: cos_sim_recall
value: 84.82445334154605
- type: dot_accuracy
value: 89.16055419722902
- type: dot_ap
value: 86.03614225282097
- type: dot_f1
value: 78.89855695205357
- type: dot_precision
value: 73.74656938215409
- type: dot_recall
value: 84.82445334154605
- type: euclidean_accuracy
value: 89.16055419722902
- type: euclidean_ap
value: 86.0361548355667
- type: euclidean_f1
value: 78.89855695205357
- type: euclidean_precision
value: 73.74656938215409
- type: euclidean_recall
value: 84.82445334154605
- type: manhattan_accuracy
value: 89.11786393448985
- type: manhattan_ap
value: 86.00799361972808
- type: manhattan_f1
value: 78.84721152788472
- type: manhattan_precision
value: 75.26776338816941
- type: manhattan_recall
value: 82.78410840776101
- type: max_accuracy
value: 89.16055419722902
- type: max_ap
value: 86.0361548355667
- type: max_f1
value: 78.89855695205357
---
# E5-large-en-ru
## Model info
This is vocabulary pruned version of [intfloat/multilingual-e5-large](https://huggingface.co./intfloat/multilingual-e5-large).
Uses only russian and english tokens.
### Size
| | intfloat/multilingual-e5-large | d0rj/e5-large-en-ru |
| --- | --- | --- |
| Model size (MB) | 2135.82 | 1394.8 |
| Params (count) | 559,890,946 | 365,638,14 |
| Word embeddings dim | 256,002,048 | 61,749,248 |
### Performance
Equal performance on SberQuAD dev benchmark.
| Metric on SberQuAD (4122 questions) | intfloat/multilingual-e5-large | d0rj/e5-large-en-ru |
| --- | --- | --- |
| recall@3 | 0.787239204269772 | **0.7882096069868996** |
| map@3 | 0.7230713245997101 | **0.723192624939351** |
| mrr@3 | 0.7241630276564784 | **0.7243651948892132** |
| recall@5 | 0.8277535177098496 | **0.8284813197476953** |
| map@5 | 0.7301603186155587 | **0.7302573588872716** |
| mrr@5 | 0.7334667637069385 | **0.7335718906679607** |
| recall@10 | **0.8716642406598738** | 0.871421639980592 |
| map@10 | **0.7314774917730316** | 0.7313000338687417 |
| mrr@10 | **0.7392223685527911** | 0.7391814537556898 |
## Usage
- Use **dot product** distance for retrieval.
- Use "query: " and "passage: " correspondingly for asymmetric tasks such as passage retrieval in open QA, ad-hoc information retrieval.
- Use "query: " prefix for symmetric tasks such as semantic similarity, bitext mining, paraphrase retrieval.
- Use "query: " prefix if you want to use embeddings as features, such as linear probing classification, clustering.
### transformers
#### Direct usage
```python
import torch.nn.functional as F
from torch import Tensor
from transformers import XLMRobertaTokenizer, XLMRobertaModel
def average_pool(last_hidden_states: Tensor, attention_mask: Tensor) -> Tensor:
last_hidden = last_hidden_states.masked_fill(~attention_mask[..., None].bool(), 0.0)
return last_hidden.sum(dim=1) / attention_mask.sum(dim=1)[..., None]
input_texts = [
'query: How does a corporate website differ from a business card website?',
'query: Где был создан первый троллейбус?',
'passage: The first trolleybus was created in Germany by engineer Werner von Siemens, probably influenced by the idea of his brother, Dr. Wilhelm Siemens, who lived in England, expressed on May 18, 1881 at the twenty-second meeting of the Royal Scientific Society. The electrical circuit was carried out by an eight-wheeled cart (Kontaktwagen) rolling along two parallel contact wires. The wires were located quite close to each other, and in strong winds they often overlapped, which led to short circuits. An experimental trolleybus line with a length of 540 m (591 yards), opened by Siemens & Halske in the Berlin suburb of Halensee, operated from April 29 to June 13, 1882.',
'passage: Корпоративный сайт — содержит полную информацию о компании-владельце, услугах/продукции, событиях в жизни компании. Отличается от сайта-визитки и представительского сайта полнотой представленной информации, зачастую содержит различные функциональные инструменты для работы с контентом (поиск и фильтры, календари событий, фотогалереи, корпоративные блоги, форумы). Может быть интегрирован с внутренними информационными системами компании-владельца (КИС, CRM, бухгалтерскими системами). Может содержать закрытые разделы для тех или иных групп пользователей — сотрудников, дилеров, контрагентов и пр.',
]
tokenizer = XLMRobertaTokenizer.from_pretrained('d0rj/e5-large-en-ru', use_cache=False)
model = XLMRobertaModel.from_pretrained('d0rj/e5-large-en-ru', use_cache=False)
batch_dict = tokenizer(input_texts, max_length=512, padding=True, truncation=True, return_tensors='pt')
outputs = model(**batch_dict)
embeddings = average_pool(outputs.last_hidden_state, batch_dict['attention_mask'])
embeddings = F.normalize(embeddings, p=2, dim=1)
scores = (embeddings[:2] @ embeddings[2:].T) * 100
print(scores.tolist())
# [[68.59542846679688, 81.75910949707031], [80.36100769042969, 64.77748107910156]]
```
#### Pipeline
```python
from transformers import pipeline
pipe = pipeline('feature-extraction', model='d0rj/e5-large-en-ru')
embeddings = pipe(input_texts, return_tensors=True)
embeddings[0].size()
# torch.Size([1, 17, 1024])
```
### sentence-transformers
```python
from sentence_transformers import SentenceTransformer
sentences = [
'query: Что такое круглые тензоры?',
'passage: Abstract: we introduce a novel method for compressing round tensors based on their inherent radial symmetry. We start by generalising PCA and eigen decomposition on round tensors...',
]
model = SentenceTransformer('d0rj/e5-large-en-ru')
embeddings = model.encode(sentences, convert_to_tensor=True)
embeddings.size()
# torch.Size([2, 1024])
``` |