SentenceTransformer based on Snowflake/snowflake-arctic-embed-s

This is a sentence-transformers model finetuned from Snowflake/snowflake-arctic-embed-s. It maps sentences & paragraphs to a 384-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: Snowflake/snowflake-arctic-embed-s
  • Maximum Sequence Length: 512 tokens
  • Output Dimensionality: 384 dimensions
  • Similarity Function: Cosine Similarity

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: BertModel 
  (1): Pooling({'word_embedding_dimension': 384, 'pooling_mode_cls_token': True, 'pooling_mode_mean_tokens': False, '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): 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("LucaZilli/arctic-s-phrases-only-v0")
# Run inference
sentences = [
    'CDMO',
    'C.M.L. SNC DI ZANETTI GIOVANNI & C. ||~~|| C.M.L. SNC specializes in precision mechanical machining, offering a range of mechanical processing and various types of machines and systems. mechanical processing',
    'Insight Consulting - Siti web e Digital Marketing ||~~|| Insight Consulting specializes in digital strategy, enhancing customer engagement, brand awareness, and lead acquisition through tailored omni-channel solutions and market analysis. lead acquisition',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 384]

# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]

Training Details

Training Dataset

Unnamed Dataset

  • Size: 48,157 training samples
  • Columns: sentence1, sentence2, and score
  • Approximate statistics based on the first 1000 samples:
    sentence1 sentence2 score
    type string string float
    details
    • min: 4 tokens
    • mean: 14.6 tokens
    • max: 46 tokens
    • min: 4 tokens
    • mean: 25.64 tokens
    • max: 133 tokens
    • min: 0.0
    • mean: 0.5
    • max: 1.0
  • Samples:
    sentence1 sentence2 score
    pavimentazione industriale antiscivolo certificata MOLTA SRL
    monitor arm for dual screens braccio per monitor 0.6
    investigatore privato dipendenti Investigatore Privato
  • Loss: CosineSimilarityLoss with these parameters:
    {
        "loss_fct": "torch.nn.modules.loss.MSELoss"
    }
    

Evaluation Dataset

Unnamed Dataset

  • Size: 2,352 evaluation samples
  • Columns: sentence1, sentence2, and score
  • Approximate statistics based on the first 1000 samples:
    sentence1 sentence2 score
    type string string float
    details
    • min: 4 tokens
    • mean: 17.31 tokens
    • max: 48 tokens
    • min: 13 tokens
    • mean: 71.79 tokens
    • max: 122 tokens
    • min: 0.0
    • mean: 0.62
    • max: 1.0
  • Samples:
    sentence1 sentence2 score
    CDMO C.M.L. SNC DI ZANETTI GIOVANNI & C.
    programmatori salesforce EFFEGIT SRL
    software con intelligenza artificiale per i contratti BORRONI VALERIA
  • Loss: CosineSimilarityLoss with these parameters:
    {
        "loss_fct": "torch.nn.modules.loss.MSELoss"
    }
    

Training Hyperparameters

Non-Default Hyperparameters

  • eval_strategy: steps
  • per_device_train_batch_size: 32
  • per_device_eval_batch_size: 32
  • learning_rate: 2.0000000000000003e-06
  • num_train_epochs: 1
  • warmup_ratio: 0.1
  • fp16: True
  • load_best_model_at_end: True

All Hyperparameters

Click to expand
  • overwrite_output_dir: False
  • do_predict: False
  • eval_strategy: steps
  • prediction_loss_only: True
  • per_device_train_batch_size: 32
  • per_device_eval_batch_size: 32
  • per_gpu_train_batch_size: None
  • per_gpu_eval_batch_size: None
  • gradient_accumulation_steps: 1
  • eval_accumulation_steps: None
  • torch_empty_cache_steps: None
  • learning_rate: 2.0000000000000003e-06
  • weight_decay: 0.0
  • adam_beta1: 0.9
  • adam_beta2: 0.999
  • adam_epsilon: 1e-08
  • max_grad_norm: 1.0
  • num_train_epochs: 1
  • max_steps: -1
  • lr_scheduler_type: linear
  • lr_scheduler_kwargs: {}
  • 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
  • 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: 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}
  • 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
  • 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
  • dispatch_batches: None
  • split_batches: 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
  • eval_use_gather_object: False
  • average_tokens_across_devices: False
  • prompts: None
  • batch_sampler: batch_sampler
  • multi_dataset_batch_sampler: proportional

Training Logs

Epoch Step Training Loss Validation Loss
0.0066 10 0.1549 -
0.0133 20 0.1566 -
0.0199 30 0.1482 -
0.0266 40 0.135 0.0904
0.0332 50 0.1406 -
0.0399 60 0.1186 -
0.0465 70 0.1077 -
0.0532 80 0.1068 0.0746
0.0598 90 0.0818 -
0.0664 100 0.0841 -
0.0731 110 0.0768 -
0.0797 120 0.0737 0.0721
0.0864 130 0.0717 -
0.0930 140 0.0632 -
0.0997 150 0.0585 -
0.1063 160 0.0633 0.0757
0.1130 170 0.0567 -
0.1196 180 0.0633 -
0.1262 190 0.0584 -
0.1329 200 0.0686 0.0744
0.1395 210 0.0618 -
0.1462 220 0.0585 -
0.1528 230 0.0545 -
0.1595 240 0.0588 0.0721
0.1661 250 0.0532 -
0.1728 260 0.0608 -
0.1794 270 0.054 -
0.1860 280 0.059 0.0697
0.1927 290 0.0513 -
0.1993 300 0.0603 -
0.2060 310 0.0538 -
0.2126 320 0.0565 0.0686
0.2193 330 0.0515 -
0.2259 340 0.0565 -
0.2326 350 0.0579 -
0.2392 360 0.0504 0.0672
0.2458 370 0.0529 -
0.2525 380 0.0541 -
0.2591 390 0.0552 -
0.2658 400 0.0556 0.0669
0.2724 410 0.0561 -
0.2791 420 0.0629 -
0.2857 430 0.05 -
0.2924 440 0.0609 0.0659
0.2990 450 0.0539 -
0.3056 460 0.0556 -
0.3123 470 0.0516 -
0.3189 480 0.0456 0.0651
0.3256 490 0.0485 -
0.3322 500 0.0504 -
0.3389 510 0.0577 -
0.3455 520 0.0538 0.0647
0.3522 530 0.0458 -
0.3588 540 0.0496 -
0.3654 550 0.0486 -
0.3721 560 0.0536 0.0645
0.3787 570 0.0501 -
0.3854 580 0.0519 -
0.3920 590 0.0523 -
0.3987 600 0.0456 0.0639
0.4053 610 0.0561 -
0.4120 620 0.0534 -
0.4186 630 0.0546 -
0.4252 640 0.0531 0.0637
0.4319 650 0.0443 -
0.4385 660 0.0522 -
0.4452 670 0.0456 -
0.4518 680 0.049 0.0635
0.4585 690 0.0488 -
0.4651 700 0.0523 -
0.4718 710 0.0487 -
0.4784 720 0.0515 0.0632
0.4850 730 0.0453 -
0.4917 740 0.0511 -
0.4983 750 0.0429 -
0.5050 760 0.0409 0.0631
0.5116 770 0.0534 -
0.5183 780 0.0485 -
0.5249 790 0.0527 -
0.5316 800 0.0475 0.0630
0.5382 810 0.0512 -
0.5449 820 0.0439 -
0.5515 830 0.042 -
0.5581 840 0.0499 0.0628
0.5648 850 0.0431 -
0.5714 860 0.0541 -
0.5781 870 0.045 -
0.5847 880 0.0495 0.0627
0.5914 890 0.0531 -
0.5980 900 0.0478 -
0.6047 910 0.0547 -
0.6113 920 0.0474 0.0626
  • The bold row denotes the saved checkpoint.

Framework Versions

  • Python: 3.10.14
  • Sentence Transformers: 3.4.1
  • Transformers: 4.49.0
  • PyTorch: 2.2.2
  • Accelerate: 1.4.0
  • Datasets: 3.3.2
  • Tokenizers: 0.21.0

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",
}
Downloads last month
21
Safetensors
Model size
33.4M params
Tensor type
F32
·
Inference Providers NEW
This model is not currently available via any of the supported Inference Providers.

Model tree for LucaZilli/arctic-s-phrases-only-v0

Finetuned
(10)
this model