SentenceTransformer based on google/embeddinggemma-300m

This is a sentence-transformers model finetuned from google/embeddinggemma-300m. It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, classification, clustering, and more.

Model Details

Model Description

  • Model Type: Sentence Transformer
  • Base model: google/embeddinggemma-300m
  • Maximum Sequence Length: 128 tokens
  • Output Dimensionality: 768 dimensions
  • Similarity Function: Cosine Similarity
  • Supported Modality: Text

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': 'Gemma3TextModel'})
  (1): Pooling({'embedding_dimension': 768, 'pooling_mode': 'mean', 'include_prompt': True})
  (2): Dense({'in_features': 768, 'out_features': 3072, 'bias': False, 'activation_function': 'torch.nn.modules.linear.Identity', 'module_input_name': 'sentence_embedding', 'module_output_name': 'sentence_embedding'})
  (3): Dense({'in_features': 3072, 'out_features': 768, 'bias': False, 'activation_function': 'torch.nn.modules.linear.Identity', 'module_input_name': 'sentence_embedding', 'module_output_name': 'sentence_embedding'})
  (4): 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("sentence_transformers_model_id")
# Run inference
queries = [
    'CC(C)c1c(C)c(C)c(-c2ccc(F)cc2)n1CC[C@@H]1C[C@@H](O)CC(=O)O1',
]
documents = [
    'O[C@@H]1C[C@H](OC(=O)C1)\\C=C\\c1c(Cl)cc(Cl)cc1OC\\C=C\\c1ccccc1',
    'COc1cccc(Sc2cc3nc(C4CC4)c(\\C=C\\[C@@H]4C[C@@H](O)CC(=O)O4)c(Sc4cccc(OC)c4)c3cc2F)c1',
    'C[C@H](CC\\C=C(/C)C(O)=O)[C@H]1CC[C@@]2(C)C3=CC[C@H]4C(C)(C)[C@@H](O)CC[C@]4(C)C3=CC[C@]12C',
]
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.3374, 0.3095, 0.3194]])

Training Details

Training Dataset

Unnamed Dataset

  • Size: 84,996 training samples
  • Columns: premise, hypothesis, and label
  • Approximate statistics based on the first 100 samples:
    premise hypothesis label
    type string string int
    modality text text
    details
    • min: 16 tokens
    • mean: 58.66 tokens
    • max: 119 tokens
    • min: 16 tokens
    • mean: 55.37 tokens
    • max: 108 tokens
    • 0: ~54.81%
    • 2: ~45.19%
  • Samples:
    premise hypothesis label
    Cc1cc(nc(-c2ccc(F)cc2)c1\C=C[C@@H](O)CC@@HCC([O-])=O)-c1ccccc1 Cc1cc(C)c(CCC2CC@@HCC(=O)O2)c(c1)-c1ccc(F)c(C)c1 0
    COC(=O)CC@HCC@H\C=C\n1c(cc(c1-c1ccc(F)cc1)-c1cccc(Br)c1)C(C)C COc1cccc(Sc2c(\C=C[C@@H]3CC@@HCC(=O)O3)c(nc3ccc(F)cc23)C2CC2)c1 2
    CC(C)c1c(Br)c(Br)c(-c2ccc(F)cc2)n1CCC@@HCC@@HCC([O-])=O CC(c1ccc(F)cc1)c1cc(C)cc(C)c1OCC(O)CC@@HCC([O-])=O 0
  • Loss: SoftmaxLoss with these parameters:
    {
        "num_labels": 3,
        "concatenation_sent_rep": true,
        "concatenation_sent_difference": true,
        "concatenation_sent_multiplication": false
    }
    

Evaluation Dataset

Unnamed Dataset

  • Size: 15,000 evaluation samples
  • Columns: premise, hypothesis, and label
  • Approximate statistics based on the first 100 samples:
    premise hypothesis label
    type string string int
    modality text text
    details
    • min: 14 tokens
    • mean: 57.03 tokens
    • max: 82 tokens
    • min: 12 tokens
    • mean: 54.39 tokens
    • max: 113 tokens
    • 0: ~50.00%
    • 2: ~50.00%
  • Samples:
    premise hypothesis label
    CC(C)c1nc(nc(-c2ccc(F)cc2)c1\C=C[C@@H]1CC@HOCc1ccccc1)N(C)S(C)(=O)=O O[C@@H]1CC@@HOC(=O)C1 2
    CC(C)(C)c1ccc(CC2CCCc3c2nn(c3\C=C[C@@H](O)CC@@HCC([O-])=O)-c2ccc(F)cc2)cc1 CC(C)=CCC\C(C)=C\CCC1=CC@@Hc1cc(F)ccc1F 2
    CC(C)n1c(CCC@@HCC@@HCC([O-])=O)c(c(c1C(N)=O)-c1ccccn1)-c1ccc(F)cc1 CC(C)c1nc(nc(-c2ccc(F)cc2)c1\C=C[C@@H]1CC@@HCC(=O)O1)-c1ccc(F)cc1 0
  • Loss: SoftmaxLoss with these parameters:
    {
        "num_labels": 3,
        "concatenation_sent_rep": true,
        "concatenation_sent_difference": true,
        "concatenation_sent_multiplication": false
    }
    

Training Hyperparameters

Non-Default Hyperparameters

  • per_device_train_batch_size: 32
  • warmup_steps: 10
  • optim: adafactor
  • weight_decay: 0.01
  • bf16: True
  • per_device_eval_batch_size: 32
  • load_best_model_at_end: True
  • dataloader_pin_memory: False

All Hyperparameters

Click to expand
  • per_device_train_batch_size: 32
  • num_train_epochs: 3
  • max_steps: -1
  • learning_rate: 5e-05
  • lr_scheduler_type: linear
  • lr_scheduler_kwargs: None
  • warmup_steps: 10
  • optim: adafactor
  • optim_args: None
  • weight_decay: 0.01
  • adam_beta1: 0.9
  • adam_beta2: 0.999
  • adam_epsilon: 1e-08
  • optim_target_modules: None
  • gradient_accumulation_steps: 1
  • 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: None
  • 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: 32
  • 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: False
  • 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: batch_sampler
  • multi_dataset_batch_sampler: proportional
  • router_mapping: {}
  • learning_rate_mapping: {}

Training Logs

Click to expand
Epoch Step Training Loss Validation Loss
0.0075 20 0.9718 -
0.0151 40 0.9007 -
0.0188 50 - 0.8585
0.0226 60 0.8638 -
0.0301 80 0.8383 -
0.0376 100 0.8177 0.8061
0.0452 120 0.7900 -
0.0527 140 0.7714 -
0.0565 150 - 0.7483
0.0602 160 0.7685 -
0.0677 180 0.7646 -
0.0753 200 0.7267 0.7716
0.0828 220 0.7011 -
0.0903 240 0.7125 -
0.0941 250 - 0.6630
0.0979 260 0.6717 -
0.1054 280 0.6909 -
0.1129 300 0.6571 0.6595
0.1204 320 0.6452 -
0.1280 340 0.6249 -
0.1317 350 - 0.6331
0.1355 360 0.6354 -
0.1430 380 0.6096 -
0.1505 400 0.6140 0.5933
0.1581 420 0.5773 -
0.1656 440 0.5829 -
0.1694 450 - 0.5645
0.1731 460 0.5626 -
0.1807 480 0.5426 -
0.1882 500 0.5622 0.5493
0.1957 520 0.5388 -
0.2032 540 0.5175 -
0.2070 550 - 0.5402
0.2108 560 0.5439 -
0.2183 580 0.5280 -
0.2258 600 0.4912 0.5181
0.2333 620 0.5223 -
0.2409 640 0.5352 -
0.2446 650 - 0.4903
0.2484 660 0.4860 -
0.2559 680 0.4960 -
0.2635 700 0.4727 0.5087
0.2710 720 0.4897 -
0.2785 740 0.4987 -
0.2823 750 - 0.4752
0.2860 760 0.5292 -
0.2936 780 0.5049 -
0.3011 800 0.4351 0.4706
0.3086 820 0.4715 -
0.3161 840 0.4900 -
0.3199 850 - 0.4554
0.3237 860 0.4658 -
0.3312 880 0.4579 -
0.3387 900 0.4525 0.4458
0.3463 920 0.4361 -
0.3538 940 0.4663 -
0.3575 950 - 0.4305
0.3613 960 0.4590 -
0.3688 980 0.4451 -
0.3764 1000 0.4457 0.4188
0.3839 1020 0.4250 -
0.3914 1040 0.4195 -
0.3952 1050 - 0.3994
0.3989 1060 0.4180 -
0.4065 1080 0.3685 -
0.4140 1100 0.4286 0.5046
0.4215 1120 0.4912 -
0.4291 1140 0.4331 -
0.4328 1150 - 0.4072
0.4366 1160 0.3891 -
0.4441 1180 0.3991 -
0.4516 1200 0.3882 0.3993
0.4592 1220 0.3859 -
0.4667 1240 0.3829 -
0.4705 1250 - 0.3743
0.4742 1260 0.3745 -
0.4817 1280 0.3900 -
0.4893 1300 0.3509 0.3541
0.4968 1320 0.3596 -
0.5043 1340 0.3689 -
0.5081 1350 - 0.3400
0.5119 1360 0.3522 -
0.5194 1380 0.3200 -
0.5269 1400 0.3314 0.3305
0.5344 1420 0.3104 -
0.5420 1440 0.3830 -
0.5457 1450 - 0.3313
0.5495 1460 0.3156 -
0.5570 1480 0.3209 -
0.5645 1500 0.3023 0.3167
0.5721 1520 0.3266 -
0.5796 1540 0.3051 -
0.5834 1550 - 0.3093
0.5871 1560 0.2805 -
0.5947 1580 0.3092 -
0.6022 1600 0.2911 0.2979
0.6097 1620 0.3340 -
0.6172 1640 0.2923 -
0.6210 1650 - 0.3117
0.6248 1660 0.3332 -
0.6323 1680 0.2779 -
0.6398 1700 0.2879 0.2756
0.6473 1720 0.2857 -
0.6549 1740 0.2709 -
0.6586 1750 - 0.2355
0.6624 1760 0.2708 -
0.6699 1780 0.2623 -
0.6775 1800 0.2505 0.2744
0.6850 1820 0.2711 -
0.6925 1840 0.2410 -
0.6963 1850 - 0.2683
0.7000 1860 0.2745 -
0.7076 1880 0.2557 -
0.7151 1900 0.2798 0.2675
  • The bold row denotes the saved checkpoint.

Training Time

  • Training: 18.4 minutes
  • Evaluation: 41.6 minutes
  • Total: 1.0 hours

Framework Versions

  • Python: 3.12.6
  • Sentence Transformers: 5.7.0
  • Transformers: 5.14.1
  • PyTorch: 2.13.0+cu130
  • Accelerate: 1.14.0
  • Datasets: 5.0.1
  • Tokenizers: 0.22.2

Additional Resources

Citation

BibTeX

Sentence Transformers and SoftmaxLoss

@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",
}
Downloads last month
17
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 cafierom/smiles_embedding_gemma_FT_full

Finetuned
(267)
this model

Paper for cafierom/smiles_embedding_gemma_FT_full