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)c1cc(c(-c2ccc(F)cc2)n1\\C=C\\[C@@H](O)C[C@@H](O)CC([O-])=O)-c1ccccn1',
]
documents = [
    'CC(C)=CCC\\C(C)=C\\CCC1=C[C@@H](OC1=O)c1ccccc1O',
    'CCCCc1cc(OC)c(OC)cc1OC',
    'CO[C@@H]1C[C@H](OC(=O)C1)\\C=C\\c1c(C)cc(C)cc1-c1ccc(F)c(C)c1',
]
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.0571, -0.0621,  0.5212]])

Training Details

Training Dataset

Unnamed Dataset

  • Size: 42,498 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: 11 tokens
    • mean: 57.24 tokens
    • max: 110 tokens
    • min: 11 tokens
    • mean: 51.97 tokens
    • max: 110 tokens
    • 0: ~47.12%
    • 2: ~52.88%
  • Samples:
    premise hypothesis label
    CCC(C)(C)C(=O)O[C@H]1CC@(CSc2ccccc2)O[C@@H]2CCC@HC@HC12 Cc1nnnn1C(\C=C[C@@H](O)CC@@HCC([O-])=O)=C(c1ccc(F)cc1)c1ccc(F)cc1 2
    CCn1c(CCC@@HCC@@HCC([O-])=O)c(c(C)c1C(=O)Nc1ccccc1)-c1ccc(F)cc1 O[C@@H]1CC@H\C=C\c1c(Cl)cc(Cl)cc1OCc1cccnc1 2
    CC(C)c1c(c(c(-c2ccc(F)cc2)n1CCC@@HCC@@HCC([O-])=O)-c1ccc(F)cc1)S(=O)(=O)Nc1cccc(CC(N)=O)c1 COc1ccc(OC)c(c1)[C@@H]1OC(=O)C(CC\C=C(/C)CCC=C(C)C)=C1 2
  • 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: 7,500 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: 16 tokens
    • mean: 57.12 tokens
    • max: 93 tokens
    • min: 11 tokens
    • mean: 52.61 tokens
    • max: 90 tokens
    • 0: ~43.27%
    • 2: ~56.73%
  • Samples:
    premise hypothesis label
    O[C@@H]1CC(CCc2ccccc2-c2ccccc2)OC(=O)C1 O[C@@H]1CC@H\C=C\c1ccc(Cl)cc1Cl 0
    CC(C)n1c(CCC@@HCC@@HCC([O-])=O)c(c2CCCN(c3ccccc3)C(=O)c12)-c1ccc(F)cc1 CC(C)c1ccc(Sc2cc3c(Sc4ccc(cc4)C(C)C)c(\C=C[C@@H]4CC@@HCC(=O)O4)cnc3c(Sc3ccc(cc3)C(C)C)c2Sc2ccc(cc2)C(C)C)cc1 2
    CC(C)c1c(cc(-c2ccc(F)cc2)n1CC[C@@H]1CC@@HCC(=O)O1)-c1ccccc1 CC(CCc1ccc2c(c1)-c1ccccc1S2(=O)=O)CC(O)=O 2
  • 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

Epoch Step Training Loss Validation Loss
0.0150 20 0.9755 -
0.0301 40 0.9023 -
0.0376 50 - 0.8855
0.0451 60 0.8828 -
0.0602 80 0.8538 -
0.0752 100 0.8304 0.8613
0.0903 120 0.8119 -
0.1053 140 0.7917 -
0.1129 150 - 0.7640
0.1204 160 0.7857 -
0.1354 180 0.7664 -
0.1505 200 0.7574 0.7473
0.1655 220 0.7350 -
0.1806 240 0.7296 -
0.1881 250 - 0.7173
0.1956 260 0.7332 -
0.2107 280 0.7386 -
0.2257 300 0.7079 0.7244
0.2408 320 0.6684 -
0.2558 340 0.6670 -
0.2634 350 - 0.6760
0.2709 360 0.6600 -
0.2859 380 0.6630 -
0.3010 400 0.6050 0.6227
0.3160 420 0.6080 -
0.3311 440 0.6267 -
0.3386 450 - 0.6153
0.3461 460 0.6197 -
0.3612 480 0.6111 -
0.3762 500 0.5984 0.5897
0.3913 520 0.6073 -
0.4063 540 0.5479 -
0.4138 550 - 0.5703
0.4214 560 0.5916 -
0.4364 580 0.5567 -
0.4515 600 0.6482 0.7078
0.4665 620 0.5991 -
0.4816 640 0.5820 -
0.4891 650 - 0.5583
0.4966 660 0.5783 -
0.5117 680 0.5352 -
0.5267 700 0.5344 0.5442
0.5418 720 0.5527 -
0.5568 740 0.5349 -
0.5643 750 - 0.5376
0.5719 760 0.5310 -
0.5869 780 0.5384 -
0.6020 800 0.4973 0.5414
0.6170 820 0.5212 -
0.6321 840 0.4855 -
0.6396 850 - 0.5125
0.6471 860 0.5038 -
0.6622 880 0.5001 -
0.6772 900 0.4910 0.5051
0.6922 920 0.5000 -
0.7073 940 0.4682 -
0.7148 950 - 0.4980
0.7223 960 0.4830 -
0.7374 980 0.5125 -
0.7524 1000 0.5118 0.4886
0.7675 1020 0.4507 -
0.7825 1040 0.4715 -
0.7901 1050 - 0.4867
0.7976 1060 0.5020 -
0.8126 1080 0.4806 -
0.8277 1100 0.4737 0.4858
0.8427 1120 0.4677 -
0.8578 1140 0.4579 -
0.8653 1150 - 0.4536
0.8728 1160 0.4481 -
0.8879 1180 0.4897 -
0.9029 1200 0.4500 0.4570
0.9180 1220 0.4647 -
0.9330 1240 0.4498 -
0.9406 1250 - 0.4436
0.9481 1260 0.4429 -
0.9631 1280 0.4748 -
0.9782 1300 0.4139 0.4568
0.9932 1320 0.4340 -
1.0083 1340 0.4404 -
1.0158 1350 - 0.4689
1.0233 1360 0.4709 -
1.0384 1380 0.4103 -
1.0534 1400 0.3984 0.4238
1.0685 1420 0.4082 -
1.0835 1440 0.4505 -
1.091 1450 - 0.3957
1.0986 1460 0.4392 -
1.1136 1480 0.3966 -
1.1287 1500 0.3717 0.4049
1.1437 1520 0.3994 -
1.1588 1540 0.4006 -
1.1663 1550 - 0.4244
1.1738 1560 0.4005 -
1.1889 1580 0.3951 -
1.2039 1600 0.4065 0.4066
  • The bold row denotes the saved checkpoint.

Training Time

  • Training: 28.8 minutes

Framework Versions

  • Python: 3.12.13
  • Sentence Transformers: 5.7.0
  • Transformers: 5.13.1
  • PyTorch: 2.11.0+cu128
  • 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
-
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
(268)
this model

Paper for cafierom/smiles_embedding_gemma_FT_full