Downloads · 30 days
123
29% of all-time downloads
IoannisKat1/multilingual-e5-large-matryoshka
multilingual-e5-large-matryoshka is a sentence similarity model from IoannisKat1. Use it when you need a score for how close two texts are. It is set up for sentence-transformers. The card lists the license as apache-2.0.
This is a sentence-transformers model finetuned from intfloat/multilingual-e5-large on the json dataset. It maps sentences & paragraphs to a 1024-dimensional dense vector space and can be used for retrieval.
Downloads · 30 days
123
29% of all-time downloads
All-time downloads
430
Public
Parameters
560M
2.3 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors2.2 GB · 99%
From the Hugging Face model README
This is a sentence-transformers model finetuned from intfloat/multilingual-e5-large on the json dataset. It maps sentences & paragraphs to a 1024-dimensional dense vector space and can be used for retrieval.
SentenceTransformer(
(0): Transformer({'transformer_task': 'feature-extraction', 'modality_config': {'text': {'method': 'forward', 'method_output_name': 'last_hidden_state'}}, 'module_output_name': 'token_embeddings', 'architecture': 'XLMRobertaModel'})
(1): Pooling({'embedding_dimension': 1024, 'pooling_mode': 'mean', 'include_prompt': True})
(2): Normalize({})
)
First install the Sentence Transformers library:
pip install -U sentence-transformers
Then you can load this model and run inference.
from sentence_transformers import SentenceTransformer
# Download from the 🤗 Hub
model = SentenceTransformer("IoannisKat1/multilingual-e5-large-matryoshka")
# Run inference
queries = [
'Ποιες είναι οι δύο τύποι τροφοδοσίας που αναφέρονται;',
]
documents = [
'. Ελεγκτές μεταβλητών στροφών και σχεδίαση σειριακού ελεγκτή με εσωτερικό βρόχο ρεύματος: ΑΜ διπλής τροφοδοσίας, ΑΜ ή ΣΜ με διασύνδεση συνεχούς ρεύματος, Γεννήτρια ΑΜ με ηλεκτρονικά μεταβαλλόμενη αντίσταση ρότορα. Έλεγχος πραγματικής και άεργου ισχύος. Έλεγχος βήματος πτερυγίου. Περιβαλλοντικές επιπτώσεις από την εγκατάσταση αιολικών συστημάτων και λοιπών ΑΠΕ. Σύνδεση με το δίκτυο',
'. Τα υποχρεωτικά είναι συγκεκριμένα βασικά μαθήματα της επιστήμης του Ηλεκτρολόγου Μηχανικού και Μηχανικού Υπολογιστών, τα οποία πρέπει να παρακολουθήσει και εξεταστεί επιτυχώς κάθε φοιτητής. Τα κατ’ επιλογήν υποχρεωτικά είναι μαθήματα εμβάθυνσης σε διάφορους ειδικούς τομείς',
'Η σελίδα παρουσιάζει τους Τομείς του Τμήματος Ηλεκτρολόγων Μηχανικών και Τεχνολογίας Υπολογιστών: Τηλεπικοινωνιών και Τεχνολογίας Πληροφορίας (Τ&ΤΠ), Συστημάτων Ηλεκτρικής Ενέργειας (ΣΗΕ), Ηλεκτρονικής και Υπολογιστών (Η&Υ) και Συστήματα και Αυτόματου Ελέγχου (Σ&ΑΕ)',
]
query_embeddings = model.encode_query(queries)
document_embeddings = model.encode_document(documents)
print(query_embeddings.shape, document_embeddings.shape)
# [1, 1024] [3, 1024]
# Get the similarity scores for the embeddings
similarities = model.similarity(query_embeddings, document_embeddings)
print(similarities)
# tensor([[0.3994, 0.0838, 0.1636]])
<!--
### Direct Usage (Transformers)
<details><summary>Click to see the direct usage in Transformers</summary>
</details>
-->
<!--
### Downstream Usage (Sentence Transformers)
You can finetune this model on your own dataset.
<details><summary>Click to expand</summary>
</details>
-->
<!--
### Out-of-Scope Use
*List how the model may foreseeably be misused and address what users ought not to do with the model.*
-->
dim_1024{
"truncate_dim": 1024
}
| Metric | Value |
|---|---|
| cosine_accuracy@1 | 0.5137 |
| cosine_accuracy@3 | 0.5516 |
| cosine_accuracy@5 | 0.6716 |
| cosine_accuracy@10 | 0.7368 |
| cosine_precision@1 | 0.5137 |
| cosine_precision@3 | 0.5228 |
| cosine_precision@5 | 0.4291 |
| cosine_precision@10 | 0.2596 |
| cosine_recall@1 | 0.1486 |
| cosine_recall@3 | 0.4425 |
| cosine_recall@5 | 0.5951 |
| cosine_recall@10 | 0.717 |
| cosine_ndcg@10 | 0.6257 |
| cosine_mrr@10 | 0.5642 |
| cosine_map@100 | 0.6135 |
dim_768{
"truncate_dim": 768
}
| Metric | Value |
|---|---|
| cosine_accuracy@1 | 0.5179 |
| cosine_accuracy@3 | 0.5537 |
| cosine_accuracy@5 | 0.6632 |
| cosine_accuracy@10 | 0.7474 |
| cosine_precision@1 | 0.5179 |
| cosine_precision@3 | 0.527 |
| cosine_precision@5 | 0.4299 |
| cosine_precision@10 | 0.2636 |
| cosine_recall@1 | 0.1495 |
| cosine_recall@3 | 0.4454 |
| cosine_recall@5 | 0.5926 |
| cosine_recall@10 | 0.7281 |
| cosine_ndcg@10 | 0.6323 |
| cosine_mrr@10 | 0.5688 |
| cosine_map@100 | 0.6172 |
dim_512{
"truncate_dim": 512
}
| Metric | Value |
|---|---|
| cosine_accuracy@1 | 0.4905 |
| cosine_accuracy@3 | 0.5221 |
| cosine_accuracy@5 | 0.6526 |
| cosine_accuracy@10 | 0.7179 |
| cosine_precision@1 | 0.4905 |
| cosine_precision@3 | 0.4989 |
| cosine_precision@5 | 0.4139 |
| cosine_precision@10 | 0.2558 |
| cosine_recall@1 | 0.1409 |
| cosine_recall@3 | 0.4193 |
| cosine_recall@5 | 0.57 |
| cosine_recall@10 | 0.7042 |
| cosine_ndcg@10 | 0.6075 |
| cosine_mrr@10 | 0.542 |
| cosine_map@100 | 0.5927 |
dim_256{
"truncate_dim": 256
}
| Metric | Value |
|---|---|
| cosine_accuracy@1 | 0.4758 |
| cosine_accuracy@3 | 0.5095 |
| cosine_accuracy@5 | 0.6168 |
| cosine_accuracy@10 | 0.6968 |
| cosine_precision@1 | 0.4758 |
| cosine_precision@3 | 0.4856 |
| cosine_precision@5 | 0.3966 |
| cosine_precision@10 | 0.2455 |
| cosine_recall@1 | 0.1375 |
| cosine_recall@3 | 0.4098 |
| cosine_recall@5 | 0.5477 |
| cosine_recall@10 | 0.6763 |
| cosine_ndcg@10 | 0.5852 |
| cosine_mrr@10 | 0.5242 |
| cosine_map@100 | 0.5738 |
dim_128{
"truncate_dim": 128
}
| Metric | Value |
|---|---|
| cosine_accuracy@1 | 0.4505 |
| cosine_accuracy@3 | 0.4842 |
| cosine_accuracy@5 | 0.5726 |
| cosine_accuracy@10 | 0.6463 |
| cosine_precision@1 | 0.4505 |
| cosine_precision@3 | 0.4604 |
| cosine_precision@5 | 0.3735 |
| cosine_precision@10 | 0.2248 |
| cosine_recall@1 | 0.1286 |
| cosine_recall@3 | 0.3875 |
| cosine_recall@5 | 0.5175 |
| cosine_recall@10 | 0.623 |
| cosine_ndcg@10 | 0.544 |
| cosine_mrr@10 | 0.4933 |
| cosine_map@100 | 0.5404 |
dim_64{
"truncate_dim": 64
}
| Metric | Value |
|---|---|
| cosine_accuracy@1 | 0.3705 |
| cosine_accuracy@3 | 0.3937 |
| cosine_accuracy@5 | 0.4842 |
| cosine_accuracy@10 | 0.5747 |
| cosine_precision@1 | 0.3705 |
| cosine_precision@3 | 0.3754 |
| cosine_precision@5 | 0.3099 |
| cosine_precision@10 | 0.1989 |
| cosine_recall@1 | 0.107 |
| cosine_recall@3 | 0.3154 |
| cosine_recall@5 | 0.4288 |
| cosine_recall@10 | 0.5542 |
| cosine_ndcg@10 | 0.4668 |
| cosine_mrr@10 | 0.4122 |
| cosine_map@100 | 0.4584 |
| anchor | positive | |
|---|---|---|
| type | string | string |
| modality | text | text |
| details | <ul><li>min: 9 tokens</li><li>mean: 17.49 tokens</li><li>max: 34 tokens</li></ul> | <ul><li>min: 21 tokens</li><li>mean: 102.99 tokens</li><li>max: 184 tokens</li></ul> |
| anchor | positive |
|---|---|
| <code>Πόσο διαρκεί το προπτυχιακό πρόγραμμα σπουδών;</code> | <code>. Το προπτυχιακό πρόγραμμα σπουδών έχει διάρκεια δέκα διδακτικών εξαμήνων και οδηγεί στην απονομή Διπλώματος Μηχανικού, το οποίο αναγνωρίζεται ως Integrated Master με πλήρη επαγγελματικά δικαιώματα</code> |
| <code>Ποιες είναι οι αλγόριθμοι τοπικής αναζήτησης Ι;</code> | <code>. Επίλυση προβλημάτων με αναζήτηση: Χώροι καταστάσεων, δέντρα αναζήτησης, μέθοδοι αναζήτησης χωρίς πληροφόρηση (depth-first, breadth-first), αναζήτηση με μερική πληροφόρηση. 3. Πληροφορημένη αναζήτηση και εξερεύνηση: Αλγόριθμοι Best First και Α*. 4. Αλγόριθμοι τοπικής αναζήτησης Ι: Hill climbing, simulated annealing. 5. Αλγόριθμοι τοπικής αναζήτησης ΙΙ: Γενετικοί αλγόριθμοι. 6</code> |
| <code>Ποιες είναι οι δύο βασικές ικανότητες που σχετίζονται με την εφαρμογή στο εργαστήριο;</code> | <code>. • Η ανάπτυξη της κριτικής σκέψης, της ικανότητας λήψης αποφάσεων, της επιδίωξης της καινοτομίας, του εξωστρεφούς τρόπου σκέψης, του πνεύματος συνεργασίας και της ομαδικής προσπάθειας, και της ικανότητας προσαρμογής σε μεταβαλλόμενες συνθήκες. • Η πλήρης κατανόηση και η ικανότητα εφαρμογής του θεωρητικού υπόβαθρου στο εργαστήριο</code> |
{
"loss": "MultipleNegativesRankingLoss",
"matryoshka_dims": [
1024,
768,
512,
256,
128,
64
],
"matryoshka_weights": [
1,
1,
1,
1,
1,
1
],
"n_dims_per_step": -1
}
per_device_train_batch_size: 32num_train_epochs: 10learning_rate: 2e-05lr_scheduler_type: cosinewarmup_steps: 0.1gradient_accumulation_steps: 16bf16: Truetf32: Falseper_device_eval_batch_size: 16load_best_model_at_end: Truebatch_sampler: no_duplicatesper_device_train_batch_size: 32num_train_epochs: 10max_steps: -1learning_rate: 2e-05lr_scheduler_type: cosinelr_scheduler_kwargs: Nonewarmup_steps: 0.1optim: adamw_torch_fusedoptim_args: Noneweight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08optim_target_modules: Nonegradient_accumulation_steps: 16average_tokens_across_devices: Truemax_grad_norm: 1.0label_smoothing_factor: 0.0bf16: Truefp16: Falsebf16_full_eval: Falsefp16_full_eval: Falsetf32: Falsegradient_checkpointing: Falsegradient_checkpointing_kwargs: Nonetorch_compile: Falsetorch_compile_backend: Nonetorch_compile_mode: Noneuse_liger_kernel: Falseliger_kernel_config: Noneuse_cache: Falseneftune_noise_alpha: Nonetorch_empty_cache_steps: Noneauto_find_batch_size: Falselog_on_each_node: Truelogging_nan_inf_filter: Trueinclude_num_input_tokens_seen: nolog_level: passivelog_level_replica: warningdisable_tqdm: Falseproject: huggingfacetrackio_space_id: Nonetrackio_bucket_id: Nonetrackio_static_space_id: Noneper_device_eval_batch_size: 16prediction_loss_only: Trueeval_on_start: Falseeval_do_concat_batches: Trueeval_use_gather_object: Falseeval_accumulation_steps: Noneinclude_for_metrics: []batch_eval_metrics: Falsesave_only_model: Falsesave_on_each_node: Falseenable_jit_checkpoint: Falsepush_to_hub: Falsehub_private_repo: Nonehub_model_id: Nonehub_strategy: every_savehub_always_push: Falsehub_revision: Noneload_best_model_at_end: Trueignore_data_skip: Falserestore_callback_states_from_checkpoint: Falsefull_determinism: Falseseed: 42data_seed: Noneuse_cpu: Falseaccelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}parallelism_config: Nonedataloader_drop_last: Falsedataloader_num_workers: 0dataloader_pin_memory: Truedataloader_persistent_workers: Falsedataloader_prefetch_factor: Noneremove_unused_columns: Truelabel_names: Nonetrain_sampling_strategy: randomlength_column_name: lengthddp_find_unused_parameters: Noneddp_bucket_cap_mb: Noneddp_broadcast_buffers: Falseddp_static_graph: Noneddp_backend: Noneddp_timeout: 1800fsdp: Nonefsdp_config: Nonedeepspeed: Nonedebug: []skip_memory_metrics: Truedo_predict: Falseresume_from_checkpoint: Nonewarmup_ratio: Nonelocal_rank: -1prompts: Nonebatch_sampler: no_duplicatesmulti_dataset_batch_sampler: proportionalrouter_mapping: {}learning_rate_mapping: {}| Epoch | Step | Training Loss | dim_1024_cosine_ndcg@10 | dim_768_cosine_ndcg@10 | dim_512_cosine_ndcg@10 | dim_256_cosine_ndcg@10 | dim_128_cosine_ndcg@10 | dim_64_cosine_ndcg@10 |
|---|---|---|---|---|---|---|---|---|
| 1.0 | 9 | - | 0.5086 | 0.5057 | 0.4976 | 0.4640 | 0.4198 | 0.3376 |
| 1.1194 | 10 | 11.6335 | - | - | - | - | - | - |
| 2.0 | 18 | - | 0.5035 | 0.4978 | 0.4938 | 0.4781 | 0.4504 | 0.3969 |
| 2.2388 | 20 | 5.7000 | - | - | - | - | - | - |
| 3.0 | 27 | - | 0.5723 | 0.5727 | 0.5594 | 0.5503 | 0.4953 | 0.4321 |
| 3.3582 | 30 | 3.3180 | - | - | - | - | - | - |
| 4.0 | 36 | - | 0.6052 | 0.5961 | 0.5847 | 0.5603 | 0.5155 | 0.4487 |
| 4.4776 | 40 | 2.3573 | - | - | - | - | - | - |
| 5.0 | 45 | - | 0.6125 | 0.6096 | 0.5905 | 0.5752 | 0.5262 | 0.4570 |
| 5.5970 | 50 | 1.8056 | - | - | - | - | - | - |
| 6.0 | 54 | - | 0.6148 | 0.6138 | 0.5981 | 0.5714 | 0.5381 | 0.4558 |
| 6.7164 | 60 | 1.6216 | - | - | - | - | - | - |
| 7.0 | 63 | - | 0.6190 | 0.6239 | 0.6020 | 0.5789 | 0.5410 | 0.4596 |
| 7.8358 | 70 | 1.4629 | - | - | - | - | - | - |
| 8.0 | 72 | - | 0.6233 | 0.6292 | 0.6115 | 0.5827 | 0.5466 | 0.465 |
| 8.9552 | 80 | 1.2774 | - | - | - | - | - | - |
| 9.0 | 81 | - | 0.6224 | 0.6296 | 0.6031 | 0.5840 | 0.5423 | 0.4698 |
| 10.0 | 90 | 1.3563 | 0.6257 | 0.6323 | 0.6075 | 0.5852 | 0.5440 | 0.4668 |
@inproceedings{reimers-2019-sentence-bert,
title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
author = "Reimers, Nils and Gurevych, Iryna",
booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
month = "11",
year = "2019",
publisher = "Association for Computational Linguistics",
url = "https://arxiv.org/abs/1908.10084",
}
@misc{kusupati2024matryoshka,
title={Matryoshka Representation Learning},
author={Aditya Kusupati and Gantavya Bhatt and Aniket Rege and Matthew Wallingford and Aditya Sinha and Vivek Ramanujan and William Howard-Snyder and Kaifeng Chen and Sham Kakade and Prateek Jain and Ali Farhadi},
year={2024},
eprint={2205.13147},
archivePrefix={arXiv},
primaryClass={cs.LG}
}
@misc{oord2019representationlearningcontrastivepredictive,
title={Representation Learning with Contrastive Predictive Coding},
author={Aaron van den Oord and Yazhe Li and Oriol Vinyals},
year={2019},
eprint={1807.03748},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/1807.03748},
}
<!--
## Glossary
*Clearly define terms in order to be accessible across audiences.*
-->
<!--
## Model Card Authors
*Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
-->
<!--
## Model Card Contact
*Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
-->