multilingual-e5-large base Matryoshka

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.

Model Details

Model Description

  • Model Type: Sentence Transformer
  • Base model: intfloat/multilingual-e5-large
  • Maximum Sequence Length: 512 tokens
  • Output Dimensionality: 1024 dimensions
  • Similarity Function: Cosine Similarity
  • Supported Modality: Text
  • Training Dataset:
    • json
  • Language: en
  • License: apache-2.0

Model Sources

Full Model Architecture

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({})
)

Usage

Direct Usage (Sentence Transformers)

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]])

Evaluation

Metrics

Information Retrieval

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

Information Retrieval

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

Information Retrieval

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

Information Retrieval

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

Information Retrieval

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

Information Retrieval

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

Training Details

Training Dataset

json

  • Dataset: json
  • Size: 4,268 training samples
  • Columns: anchor and positive
  • Approximate statistics based on the first 100 samples:
    anchor positive
    type string string
    modality text text
    details
    • min: 9 tokens
    • mean: 17.49 tokens
    • max: 34 tokens
    • min: 21 tokens
    • mean: 102.99 tokens
    • max: 184 tokens
  • Samples:
    anchor positive
    Πόσο διαρκεί το προπτυχιακό πρόγραμμα σπουδών; . Το προπτυχιακό πρόγραμμα σπουδών έχει διάρκεια δέκα διδακτικών εξαμήνων και οδηγεί στην απονομή Διπλώματος Μηχανικού, το οποίο αναγνωρίζεται ως Integrated Master με πλήρη επαγγελματικά δικαιώματα
    Ποιες είναι οι αλγόριθμοι τοπικής αναζήτησης Ι; . Επίλυση προβλημάτων με αναζήτηση: Χώροι καταστάσεων, δέντρα αναζήτησης, μέθοδοι αναζήτησης χωρίς πληροφόρηση (depth-first, breadth-first), αναζήτηση με μερική πληροφόρηση. 3. Πληροφορημένη αναζήτηση και εξερεύνηση: Αλγόριθμοι Best First και Α*. 4. Αλγόριθμοι τοπικής αναζήτησης Ι: Hill climbing, simulated annealing. 5. Αλγόριθμοι τοπικής αναζήτησης ΙΙ: Γενετικοί αλγόριθμοι. 6
    Ποιες είναι οι δύο βασικές ικανότητες που σχετίζονται με την εφαρμογή στο εργαστήριο; . • Η ανάπτυξη της κριτικής σκέψης, της ικανότητας λήψης αποφάσεων, της επιδίωξης της καινοτομίας, του εξωστρεφούς τρόπου σκέψης, του πνεύματος συνεργασίας και της ομαδικής προσπάθειας, και της ικανότητας προσαρμογής σε μεταβαλλόμενες συνθήκες. • Η πλήρης κατανόηση και η ικανότητα εφαρμογής του θεωρητικού υπόβαθρου στο εργαστήριο
  • Loss: MatryoshkaLoss with these parameters:
    {
        "loss": "MultipleNegativesRankingLoss",
        "matryoshka_dims": [
            1024,
            768,
            512,
            256,
            128,
            64
        ],
        "matryoshka_weights": [
            1,
            1,
            1,
            1,
            1,
            1
        ],
        "n_dims_per_step": -1
    }
    

Training Hyperparameters

Non-Default Hyperparameters

  • per_device_train_batch_size: 32
  • num_train_epochs: 10
  • learning_rate: 2e-05
  • lr_scheduler_type: cosine
  • warmup_steps: 0.1
  • gradient_accumulation_steps: 16
  • bf16: True
  • tf32: False
  • per_device_eval_batch_size: 16
  • load_best_model_at_end: True
  • batch_sampler: no_duplicates

All Hyperparameters

Click to expand
  • per_device_train_batch_size: 32
  • num_train_epochs: 10
  • max_steps: -1
  • learning_rate: 2e-05
  • lr_scheduler_type: cosine
  • lr_scheduler_kwargs: None
  • warmup_steps: 0.1
  • optim: adamw_torch_fused
  • optim_args: None
  • weight_decay: 0.0
  • adam_beta1: 0.9
  • adam_beta2: 0.999
  • adam_epsilon: 1e-08
  • optim_target_modules: None
  • gradient_accumulation_steps: 16
  • average_tokens_across_devices: True
  • max_grad_norm: 1.0
  • label_smoothing_factor: 0.0
  • bf16: True
  • fp16: False
  • bf16_full_eval: False
  • fp16_full_eval: False
  • tf32: False
  • gradient_checkpointing: False
  • gradient_checkpointing_kwargs: None
  • torch_compile: False
  • torch_compile_backend: None
  • torch_compile_mode: None
  • use_liger_kernel: False
  • liger_kernel_config: None
  • use_cache: False
  • neftune_noise_alpha: None
  • torch_empty_cache_steps: None
  • auto_find_batch_size: False
  • log_on_each_node: True
  • logging_nan_inf_filter: True
  • include_num_input_tokens_seen: no
  • log_level: passive
  • log_level_replica: warning
  • disable_tqdm: False
  • project: huggingface
  • trackio_space_id: None
  • trackio_bucket_id: None
  • trackio_static_space_id: None
  • per_device_eval_batch_size: 16
  • prediction_loss_only: True
  • eval_on_start: False
  • eval_do_concat_batches: True
  • eval_use_gather_object: False
  • eval_accumulation_steps: None
  • include_for_metrics: []
  • batch_eval_metrics: False
  • save_only_model: False
  • save_on_each_node: False
  • enable_jit_checkpoint: False
  • push_to_hub: False
  • hub_private_repo: None
  • hub_model_id: None
  • hub_strategy: every_save
  • hub_always_push: False
  • hub_revision: None
  • load_best_model_at_end: True
  • ignore_data_skip: False
  • restore_callback_states_from_checkpoint: False
  • full_determinism: False
  • seed: 42
  • data_seed: None
  • use_cpu: False
  • accelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
  • parallelism_config: None
  • dataloader_drop_last: False
  • dataloader_num_workers: 0
  • dataloader_pin_memory: True
  • dataloader_persistent_workers: False
  • dataloader_prefetch_factor: None
  • remove_unused_columns: True
  • label_names: None
  • train_sampling_strategy: random
  • length_column_name: length
  • ddp_find_unused_parameters: None
  • ddp_bucket_cap_mb: None
  • ddp_broadcast_buffers: False
  • ddp_static_graph: None
  • ddp_backend: None
  • ddp_timeout: 1800
  • fsdp: None
  • fsdp_config: None
  • deepspeed: None
  • debug: []
  • skip_memory_metrics: True
  • do_predict: False
  • resume_from_checkpoint: None
  • warmup_ratio: None
  • local_rank: -1
  • prompts: None
  • batch_sampler: no_duplicates
  • multi_dataset_batch_sampler: proportional
  • router_mapping: {}
  • learning_rate_mapping: {}

Training Logs

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
  • The bold row denotes the saved checkpoint.

Training Time

  • Training: 6.9 minutes

Framework Versions

  • Python: 3.12.13
  • Sentence Transformers: 5.6.0
  • Transformers: 5.12.1
  • PyTorch: 2.11.0+cu128
  • Accelerate: 1.14.0
  • Datasets: 4.0.0
  • Tokenizers: 0.22.2

Citation

BibTeX

Sentence Transformers

@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",
}

MatryoshkaLoss

@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}
}

MultipleNegativesRankingLoss

@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},
}
Downloads last month
21
Safetensors
Model size
0.6B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for IoannisKat1/multilingual-e5-large-matryoshka

Finetuned
(186)
this model

Papers for IoannisKat1/multilingual-e5-large-matryoshka

Evaluation results