stsb-xlm-r-greek-transfer Matryoshka

This is a sentence-transformers model finetuned from lighteternal/stsb-xlm-r-greek-transfer on the json dataset. It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for retrieval.

Model Details

Model Description

  • Model Type: Sentence Transformer
  • Base model: lighteternal/stsb-xlm-r-greek-transfer
  • Maximum Sequence Length: 400 tokens
  • Output Dimensionality: 768 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': 768, 'pooling_mode': 'mean', 'include_prompt': True})
)

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/stsb-xlm-r-greek-transfer-matryoshka1")
# Run inference
queries = [
    'Ποιες είναι οι δύο τύποι τροφοδοσίας που αναφέρονται;',
]
documents = [
    '. Ελεγκτές μεταβλητών στροφών και σχεδίαση σειριακού ελεγκτή με εσωτερικό βρόχο ρεύματος: ΑΜ διπλής τροφοδοσίας, ΑΜ ή ΣΜ με διασύνδεση συνεχούς ρεύματος, Γεννήτρια ΑΜ με ηλεκτρονικά μεταβαλλόμενη αντίσταση ρότορα. Έλεγχος πραγματικής και άεργου ισχύος. Έλεγχος βήματος πτερυγίου. Περιβαλλοντικές επιπτώσεις από την εγκατάσταση αιολικών συστημάτων και λοιπών ΑΠΕ. Σύνδεση με το δίκτυο',
    '. Τα υποχρεωτικά είναι συγκεκριμένα βασικά μαθήματα της επιστήμης του Ηλεκτρολόγου Μηχανικού και Μηχανικού Υπολογιστών, τα οποία πρέπει να παρακολουθήσει και εξεταστεί επιτυχώς κάθε φοιτητής. Τα κατ’ επιλογήν υποχρεωτικά είναι μαθήματα εμβάθυνσης σε διάφορους ειδικούς τομείς',
    'Η σελίδα παρουσιάζει τους Τομείς του Τμήματος Ηλεκτρολόγων Μηχανικών και Τεχνολογίας Υπολογιστών: Τηλεπικοινωνιών και Τεχνολογίας Πληροφορίας (Τ&ΤΠ), Συστημάτων Ηλεκτρικής Ενέργειας (ΣΗΕ), Ηλεκτρονικής και Υπολογιστών (Η&Υ) και Συστήματα και Αυτόματου Ελέγχου (Σ&ΑΕ)',
]
query_embeddings = model.encode_query(queries)
document_embeddings = model.encode_document(documents)
print(query_embeddings.shape, document_embeddings.shape)
# [1, 768] [3, 768]

# Get the similarity scores for the embeddings
similarities = model.similarity(query_embeddings, document_embeddings)
print(similarities)
# tensor([[0.3252, 0.0351, 0.0844]])

Evaluation

Metrics

Information Retrieval

Metric Value
cosine_accuracy@1 0.4126
cosine_accuracy@3 0.4379
cosine_accuracy@5 0.5684
cosine_accuracy@10 0.6295
cosine_precision@1 0.4126
cosine_precision@3 0.4168
cosine_precision@5 0.3533
cosine_precision@10 0.2221
cosine_recall@1 0.1188
cosine_recall@3 0.3504
cosine_recall@5 0.4919
cosine_recall@10 0.6156
cosine_ndcg@10 0.522
cosine_mrr@10 0.4593
cosine_map@100 0.5133

Information Retrieval

Metric Value
cosine_accuracy@1 0.4189
cosine_accuracy@3 0.4379
cosine_accuracy@5 0.5642
cosine_accuracy@10 0.6253
cosine_precision@1 0.4189
cosine_precision@3 0.4204
cosine_precision@5 0.3512
cosine_precision@10 0.22
cosine_recall@1 0.1209
cosine_recall@3 0.3544
cosine_recall@5 0.49
cosine_recall@10 0.6114
cosine_ndcg@10 0.5216
cosine_mrr@10 0.4622
cosine_map@100 0.5152

Information Retrieval

Metric Value
cosine_accuracy@1 0.4274
cosine_accuracy@3 0.4463
cosine_accuracy@5 0.5389
cosine_accuracy@10 0.6253
cosine_precision@1 0.4274
cosine_precision@3 0.426
cosine_precision@5 0.3469
cosine_precision@10 0.2189
cosine_recall@1 0.1244
cosine_recall@3 0.3605
cosine_recall@5 0.4795
cosine_recall@10 0.6063
cosine_ndcg@10 0.521
cosine_mrr@10 0.4663
cosine_map@100 0.5138

Information Retrieval

Metric Value
cosine_accuracy@1 0.4
cosine_accuracy@3 0.4211
cosine_accuracy@5 0.5263
cosine_accuracy@10 0.5832
cosine_precision@1 0.4
cosine_precision@3 0.4021
cosine_precision@5 0.3314
cosine_precision@10 0.2067
cosine_recall@1 0.1165
cosine_recall@3 0.3432
cosine_recall@5 0.4609
cosine_recall@10 0.5726
cosine_ndcg@10 0.4934
cosine_mrr@10 0.4395
cosine_map@100 0.4895

Information Retrieval

Metric Value
cosine_accuracy@1 0.3558
cosine_accuracy@3 0.3726
cosine_accuracy@5 0.4716
cosine_accuracy@10 0.5137
cosine_precision@1 0.3558
cosine_precision@3 0.3558
cosine_precision@5 0.2943
cosine_precision@10 0.1838
cosine_recall@1 0.1033
cosine_recall@3 0.3009
cosine_recall@5 0.4058
cosine_recall@10 0.5056
cosine_ndcg@10 0.4372
cosine_mrr@10 0.3897
cosine_map@100 0.4371

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": [
            768,
            512,
            256,
            128,
            64
        ],
        "matryoshka_weights": [
            1,
            1,
            1,
            1,
            1
        ],
        "n_dims_per_step": -1
    }
    

Training Hyperparameters

Non-Default Hyperparameters

  • per_device_train_batch_size: 16
  • gradient_accumulation_steps: 8
  • learning_rate: 2e-05
  • num_train_epochs: 10
  • lr_scheduler_type: cosine
  • warmup_ratio: 0.1
  • bf16: True
  • tf32: True
  • load_best_model_at_end: True
  • batch_sampler: no_duplicates

All Hyperparameters

Click to expand
  • overwrite_output_dir: False
  • do_predict: False
  • prediction_loss_only: True
  • per_device_train_batch_size: 16
  • per_device_eval_batch_size: 8
  • per_gpu_train_batch_size: None
  • per_gpu_eval_batch_size: None
  • gradient_accumulation_steps: 8
  • eval_accumulation_steps: None
  • torch_empty_cache_steps: None
  • learning_rate: 2e-05
  • weight_decay: 0.0
  • adam_beta1: 0.9
  • adam_beta2: 0.999
  • adam_epsilon: 1e-08
  • max_grad_norm: 1.0
  • num_train_epochs: 10
  • max_steps: -1
  • lr_scheduler_type: cosine
  • lr_scheduler_kwargs: None
  • warmup_ratio: 0.1
  • warmup_steps: 0
  • log_level: passive
  • log_level_replica: warning
  • log_on_each_node: True
  • logging_nan_inf_filter: True
  • save_safetensors: True
  • save_on_each_node: False
  • save_only_model: False
  • restore_callback_states_from_checkpoint: False
  • no_cuda: False
  • use_cpu: False
  • use_mps_device: False
  • seed: 42
  • data_seed: None
  • jit_mode_eval: False
  • bf16: True
  • fp16: False
  • fp16_opt_level: O1
  • half_precision_backend: auto
  • bf16_full_eval: False
  • fp16_full_eval: False
  • tf32: True
  • local_rank: 0
  • ddp_backend: None
  • tpu_num_cores: None
  • tpu_metrics_debug: False
  • debug: []
  • dataloader_drop_last: False
  • dataloader_num_workers: 0
  • dataloader_prefetch_factor: None
  • past_index: -1
  • disable_tqdm: False
  • remove_unused_columns: True
  • label_names: None
  • load_best_model_at_end: True
  • ignore_data_skip: False
  • fsdp: []
  • fsdp_min_num_params: 0
  • fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
  • fsdp_transformer_layer_cls_to_wrap: None
  • 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
  • deepspeed: None
  • label_smoothing_factor: 0.0
  • optim: adamw_torch_fused
  • optim_args: None
  • adafactor: False
  • group_by_length: False
  • length_column_name: length
  • project: huggingface
  • trackio_space_id: trackio
  • ddp_find_unused_parameters: None
  • ddp_bucket_cap_mb: None
  • ddp_broadcast_buffers: False
  • dataloader_pin_memory: True
  • dataloader_persistent_workers: False
  • skip_memory_metrics: True
  • use_legacy_prediction_loop: False
  • push_to_hub: False
  • resume_from_checkpoint: None
  • hub_model_id: None
  • hub_strategy: every_save
  • hub_private_repo: None
  • hub_always_push: False
  • hub_revision: None
  • gradient_checkpointing: False
  • gradient_checkpointing_kwargs: None
  • include_inputs_for_metrics: False
  • include_for_metrics: []
  • eval_do_concat_batches: True
  • fp16_backend: auto
  • push_to_hub_model_id: None
  • push_to_hub_organization: None
  • mp_parameters:
  • auto_find_batch_size: False
  • full_determinism: False
  • torchdynamo: None
  • ray_scope: last
  • ddp_timeout: 1800
  • torch_compile: False
  • torch_compile_backend: None
  • torch_compile_mode: None
  • include_tokens_per_second: False
  • include_num_input_tokens_seen: no
  • neftune_noise_alpha: None
  • optim_target_modules: None
  • batch_eval_metrics: False
  • eval_on_start: False
  • use_liger_kernel: False
  • liger_kernel_config: None
  • eval_use_gather_object: False
  • average_tokens_across_devices: True
  • prompts: None
  • batch_sampler: no_duplicates
  • multi_dataset_batch_sampler: proportional
  • router_mapping: {}
  • learning_rate_mapping: {}

Training Logs

Epoch Step Training Loss 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
0.2996 10 5.3786 - - - - -
0.5993 20 4.5717 - - - - -
0.8989 30 3.2079 - - - - -
1.0 34 - 0.4624 0.4615 0.4493 0.4159 0.3622
1.1798 40 2.3917 - - - - -
1.4794 50 2.0746 - - - - -
1.7790 60 1.9635 - - - - -
2.0 68 - 0.5067 0.5023 0.4917 0.4668 0.4049
2.0599 70 1.6445 - - - - -
2.3596 80 1.2504 - - - - -
2.6592 90 1.2917 - - - - -
2.9588 100 1.19 - - - - -
3.0 102 - 0.5102 0.5033 0.4874 0.4678 0.4072
3.2397 110 0.9015 - - - - -
3.5393 120 0.8336 - - - - -
3.8390 130 0.8562 - - - - -
4.0 136 - 0.5111 0.4968 0.4924 0.4714 0.4081
4.1199 140 0.6733 - - - - -
4.4195 150 0.6683 - - - - -
4.7191 160 0.6656 - - - - -
5.0 170 0.6658 0.5112 0.5092 0.5150 0.4793 0.4231
5.2996 180 0.517 - - - - -
5.5993 190 0.5305 - - - - -
5.8989 200 0.6392 - - - - -
6.0 204 - 0.5098 0.5122 0.5036 0.4765 0.4275
6.1798 210 0.5473 - - - - -
6.4794 220 0.5504 - - - - -
6.7790 230 0.4659 - - - - -
7.0 238 - 0.5156 0.5183 0.5133 0.4892 0.4315
7.0599 240 0.4675 - - - - -
7.3596 250 0.4109 - - - - -
7.6592 260 0.4783 - - - - -
7.9588 270 0.4001 - - - - -
8.0 272 - 0.5232 0.5256 0.5184 0.4943 0.4345
8.2397 280 0.3837 - - - - -
8.5393 290 0.3422 - - - - -
8.8390 300 0.3952 - - - - -
9.0 306 - 0.5238 0.5231 0.5193 0.495 0.4371
9.1199 310 0.3641 - - - - -
9.4195 320 0.4011 - - - - -
9.7191 330 0.4063 - - - - -
10.0 340 0.4291 0.5220 0.5216 0.5210 0.4934 0.4372
  • The bold row denotes the saved checkpoint.

Training Time

  • Training: 5.5 minutes

Framework Versions

  • Python: 3.12.13
  • Sentence Transformers: 5.6.0
  • Transformers: 4.57.6
  • 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
88
Safetensors
Model size
0.3B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for IoannisKat1/stsb-xlm-r-greek-transfer-matryoshka1

Finetuned
(10)
this model

Papers for IoannisKat1/stsb-xlm-r-greek-transfer-matryoshka1

Evaluation results