gte-multilingual-base Matryoshka

This is a sentence-transformers model finetuned from Alibaba-NLP/gte-multilingual-base 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: Alibaba-NLP/gte-multilingual-base
  • Maximum Sequence Length: 8192 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': 'NewModel'})
  (1): Pooling({'embedding_dimension': 768, 'pooling_mode': 'cls', '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/gte-multilingual-base-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.3604, 0.1620, 0.0892]])

Evaluation

Metrics

Information Retrieval

Metric Value
cosine_accuracy@1 0.5095
cosine_accuracy@3 0.5411
cosine_accuracy@5 0.6253
cosine_accuracy@10 0.7032
cosine_precision@1 0.5095
cosine_precision@3 0.5158
cosine_precision@5 0.4143
cosine_precision@10 0.2463
cosine_recall@1 0.1453
cosine_recall@3 0.4319
cosine_recall@5 0.5709
cosine_recall@10 0.6804
cosine_ndcg@10 0.6009
cosine_mrr@10 0.5506
cosine_map@100 0.597

Information Retrieval

Metric Value
cosine_accuracy@1 0.4989
cosine_accuracy@3 0.52
cosine_accuracy@5 0.6126
cosine_accuracy@10 0.6926
cosine_precision@1 0.4989
cosine_precision@3 0.4982
cosine_precision@5 0.4013
cosine_precision@10 0.2444
cosine_recall@1 0.1446
cosine_recall@3 0.4189
cosine_recall@5 0.5504
cosine_recall@10 0.6714
cosine_ndcg@10 0.5908
cosine_mrr@10 0.5379
cosine_map@100 0.5857

Information Retrieval

Metric Value
cosine_accuracy@1 0.4926
cosine_accuracy@3 0.5116
cosine_accuracy@5 0.6021
cosine_accuracy@10 0.6779
cosine_precision@1 0.4926
cosine_precision@3 0.4912
cosine_precision@5 0.3933
cosine_precision@10 0.2383
cosine_recall@1 0.1433
cosine_recall@3 0.413
cosine_recall@5 0.5409
cosine_recall@10 0.6595
cosine_ndcg@10 0.5805
cosine_mrr@10 0.5301
cosine_map@100 0.5747

Information Retrieval

Metric Value
cosine_accuracy@1 0.4463
cosine_accuracy@3 0.4674
cosine_accuracy@5 0.5495
cosine_accuracy@10 0.6253
cosine_precision@1 0.4463
cosine_precision@3 0.4428
cosine_precision@5 0.3575
cosine_precision@10 0.2173
cosine_recall@1 0.1305
cosine_recall@3 0.3747
cosine_recall@5 0.496
cosine_recall@10 0.6026
cosine_ndcg@10 0.5285
cosine_mrr@10 0.4817
cosine_map@100 0.5267

Information Retrieval

Metric Value
cosine_accuracy@1 0.3958
cosine_accuracy@3 0.4126
cosine_accuracy@5 0.4884
cosine_accuracy@10 0.5474
cosine_precision@1 0.3958
cosine_precision@3 0.3916
cosine_precision@5 0.3166
cosine_precision@10 0.1905
cosine_recall@1 0.1149
cosine_recall@3 0.3326
cosine_recall@5 0.4402
cosine_recall@10 0.5326
cosine_ndcg@10 0.4668
cosine_mrr@10 0.4261
cosine_map@100 0.4693

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 4.9665 - - - - -
0.5993 20 4.4986 - - - - -
0.8989 30 3.3306 - - - - -
1.0 34 - 0.5533 0.5562 0.5324 0.4876 0.4216
1.1798 40 2.5665 - - - - -
1.4794 50 2.1953 - - - - -
1.7790 60 2.1143 - - - - -
2.0 68 - 0.5933 0.5833 0.5585 0.5128 0.4431
2.0599 70 1.7159 - - - - -
2.3596 80 1.3878 - - - - -
2.6592 90 1.4126 - - - - -
2.9588 100 1.3782 - - - - -
3.0 102 - 0.5855 0.5795 0.5601 0.5127 0.4474
3.2397 110 1.1938 - - - - -
3.5393 120 1.0914 - - - - -
3.8390 130 1.0606 - - - - -
4.0 136 - 0.5942 0.5803 0.5624 0.5239 0.4519
4.1199 140 0.9771 - - - - -
4.4195 150 0.8633 - - - - -
4.7191 160 0.9322 - - - - -
5.0 170 0.8111 0.6041 0.5964 0.5709 0.5339 0.4518
5.2996 180 0.7574 - - - - -
5.5993 190 0.7694 - - - - -
5.8989 200 0.8429 - - - - -
6.0 204 - 0.5974 0.5954 0.5750 0.5310 0.4632
6.1798 210 0.8397 - - - - -
6.4794 220 0.7183 - - - - -
6.7790 230 0.7234 - - - - -
7.0 238 - 0.6030 0.5891 0.5768 0.5290 0.4658
7.0599 240 0.6865 - - - - -
7.3596 250 0.6614 - - - - -
7.6592 260 0.6584 - - - - -
7.9588 270 0.6603 - - - - -
8.0 272 - 0.6033 0.5921 0.5760 0.5271 0.4697
8.2397 280 0.65 - - - - -
8.5393 290 0.581 - - - - -
8.8390 300 0.571 - - - - -
9.0 306 - 0.6027 0.5904 0.5786 0.5280 0.4653
9.1199 310 0.5424 - - - - -
9.4195 320 0.632 - - - - -
9.7191 330 0.5892 - - - - -
10.0 340 0.6056 0.6009 0.5908 0.5805 0.5285 0.4668
  • The bold row denotes the saved checkpoint.

Training Time

  • Training: 6.1 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
-
Safetensors
Model size
0.3B params
Tensor type
I64
·
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for IoannisKat1/gte-multilingual-base-matryoshka1

Finetuned
(105)
this model

Papers for IoannisKat1/gte-multilingual-base-matryoshka1

Evaluation results