EmbeddingGemma-300m trained to measure coverage

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

Model Details

Model Description

  • Model Type: Sentence Transformer
  • Base model: google/embeddinggemma-300m
  • Maximum Sequence Length: 2048 tokens
  • Output Dimensionality: 768 dimensions
  • Similarity Function: Cosine Similarity
  • Training Dataset:
    • json
  • Language: en
  • License: apache-2.0

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 2048, 'do_lower_case': False, 'architecture': 'Gemma3TextModel'})
  (1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
  (2): Dense({'in_features': 768, 'out_features': 3072, 'bias': False, 'activation_function': 'torch.nn.modules.linear.Identity'})
  (3): Dense({'in_features': 3072, 'out_features': 768, 'bias': False, 'activation_function': 'torch.nn.modules.linear.Identity'})
  (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("mancer146/embeddinggemma-300m-haystack-contrastive-better-thin")
# Run inference
queries = [
    "FullAddress: 5852 NORTHRIDGE DR, NAPLES 34110\nLegal: CARLTON LAKES UNIT NO 2 BLK A LOT 5 NKA VILLAS I AT CARLTON LAKES (HO) UNIT A-5\nSection: 19\nTownship: 48\nRange: 26section: Address,\ncounty: Collier,\nparcel_id: 25540003380",
]
documents = [
    'city_name: NAPLES\nlot: 5\npostal_code: 34110\nrange: 26\nsection: 19\nstate_code: FL\nstreet_name: NORTHRIDGE\nstreet_number: 5852\nstreet_suffix_type: Dr\ntownship: 48',
    'monthly_tax_amount: 317.4\nperiod_end_date: 2022-12-31\nperiod_start_date: 2022-01-01\nproperty_assessed_value_amount: 381299\nproperty_building_amount: 441115\nproperty_land_amount: 134469\nproperty_market_value_amount: 575584\nproperty_taxable_value_amount: 331299\ntax_year: 2022\nyearly_tax_amount: 3808.76\n\nmonthly_tax_amount: 517.39\nperiod_end_date: 2025-12-31\nperiod_start_date: 2025-01-01\nproperty_assessed_value_amount: 692367\nproperty_building_amount: 324162\nproperty_land_amount: 368205\nproperty_market_value_amount: 692367\nproperty_taxable_value_amount: 641645\ntax_year: 2025\nyearly_tax_amount: 6208.64\n\nmonthly_tax_amount: 320.37\nperiod_end_date: 2021-12-31\nperiod_start_date: 2021-01-01\nproperty_assessed_value_amount: 370193\nproperty_building_amount: 334803\nproperty_land_amount: 35390\nproperty_market_value_amount: 370193\nproperty_taxable_value_amount: 320193\ntax_year: 2021\nyearly_tax_amount: 3844.46',
    'first_name: Christina\nlast_name: Zajac\nmiddle_name: R\n\nfirst_name: Thomas\nlast_name: Zajac\nmiddle_name: H',
]
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.9780, 0.8260, 0.6371]])

Evaluation

Metrics

Binary Classification

Metric Value
cosine_accuracy 0.96
cosine_accuracy_threshold 0.9616
cosine_f1 0.961
cosine_f1_threshold 0.9616
cosine_precision 0.9367
cosine_recall 0.9867
cosine_ap 0.9525
cosine_mcc 0.9213

Training Details

Training Dataset

json

  • Dataset: json
  • Size: 1,200 training samples
  • Columns: input_text, output_text, and label
  • Approximate statistics based on the first 1000 samples:
    input_text output_text label
    type string string int
    details
    • min: 36 tokens
    • mean: 188.79 tokens
    • max: 536 tokens
    • min: 5 tokens
    • mean: 164.22 tokens
    • max: 801 tokens
    • 0: ~50.10%
    • 1: ~49.90%
  • Samples:
    input_text output_text label
    OwnerLine 1: JERI HURCKES LIVING TRUSTsection: Owners,
    county: Collier,
    parcel_id: 82660021104
    name: JERI HURCKES LIVING TRUST 1
    OwnerLine 1: GUALARIO, ANTHONY=& DIANAsection: Owners,
    county: Collier,
    parcel_id: 16054320005
    first_name: Anthony
    last_name: Gualario
    0
    Date: 02/11/14
    Amount: $496,300
    BookPage: 5009-963section: Sales,
    county: Collier,
    parcel_id: 69770005923
    ownership_transfer_date: 2014-02-11
    purchase_price_amount: 0
    0
  • Loss: ContrastiveLoss with these parameters:
    {
        "distance_metric": "SiameseDistanceMetric.COSINE_DISTANCE",
        "margin": 0.1,
        "size_average": true
    }
    

Training Hyperparameters

Non-Default Hyperparameters

  • eval_strategy: steps
  • per_device_train_batch_size: 3
  • per_device_eval_batch_size: 3
  • gradient_accumulation_steps: 2
  • learning_rate: 2e-05
  • num_train_epochs: 5
  • warmup_ratio: 0.05
  • fp16: True
  • prompts: {'input_text': 'STS', 'output_text': 'STS'}

All Hyperparameters

Click to expand
  • overwrite_output_dir: False
  • do_predict: False
  • eval_strategy: steps
  • prediction_loss_only: True
  • per_device_train_batch_size: 3
  • per_device_eval_batch_size: 3
  • per_gpu_train_batch_size: None
  • per_gpu_eval_batch_size: None
  • gradient_accumulation_steps: 2
  • 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: 5
  • max_steps: -1
  • lr_scheduler_type: linear
  • lr_scheduler_kwargs: {}
  • warmup_ratio: 0.05
  • 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
  • use_ipex: False
  • bf16: False
  • fp16: True
  • fp16_opt_level: O1
  • half_precision_backend: auto
  • bf16_full_eval: False
  • fp16_full_eval: False
  • tf32: None
  • 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: False
  • 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
  • optim_args: None
  • adafactor: False
  • group_by_length: False
  • length_column_name: length
  • 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: False
  • 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: False
  • prompts: {'input_text': 'STS', 'output_text': 'STS'}
  • batch_sampler: batch_sampler
  • multi_dataset_batch_sampler: proportional
  • router_mapping: {}
  • learning_rate_mapping: {}

Training Logs

Epoch Step cosine_ap
0.4 40 0.8756
0.8 80 0.8939
1.2 120 0.8644
1.6 160 0.9116
2.0 200 0.9696
2.4 240 0.9559
2.8 280 0.9412
3.2 320 0.9567
3.6 360 0.9543
4.0 400 0.9525

Framework Versions

  • Python: 3.11.13
  • Sentence Transformers: 5.1.2
  • Transformers: 4.57.0.dev0
  • PyTorch: 2.6.0+cu124
  • Accelerate: 1.9.0
  • Datasets: 4.1.1
  • Tokenizers: 0.22.1

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

ContrastiveLoss

@inproceedings{hadsell2006dimensionality,
    author={Hadsell, R. and Chopra, S. and LeCun, Y.},
    booktitle={2006 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR'06)},
    title={Dimensionality Reduction by Learning an Invariant Mapping},
    year={2006},
    volume={2},
    number={},
    pages={1735-1742},
    doi={10.1109/CVPR.2006.100}
}
Downloads last month
2
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 mancer146/embeddinggemma-300m-haystack-contrastive-better-thin

Finetuned
(247)
this model

Paper for mancer146/embeddinggemma-300m-haystack-contrastive-better-thin

Evaluation results