SentenceTransformer based on BAAI/bge-small-en

This is a sentence-transformers model finetuned from BAAI/bge-small-en. 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: BAAI/bge-small-en
  • 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': True}) 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("sentence_transformers_model_id")
# Run inference
sentences = [
    'Can the 3051s transmitter be ordered with a G½ conduit entry size?',
    'Info for 8700m\n|2 (50)|ASME 600 DERAT. So / RF|8705 020C6|223|223|221|224|223| |165|132|122|126|92| |\n|2 (50)|Din Pn40 So / RF|8705 OzocH|200|200|198|201|200|200|165|132|122|126|102| |\n|2 (50)|AS2129 TABLE D, So / RF| |8705|200| |198|201|200| |50|32|122|126|90|\n|2 (50)|AS2129 TABLE E, So / RF|8705 020CL|200| |198|201|200| |50|132|122|126|90| |\n|2 (50)|JIS B220 10K, So / RF|8705 02CP|200| |198|201|200| |155|132|122|126|96| |\n|2 (50)|JIS B220 20K, So / RF|8705 O2OCR|200| |198|201|200| |55|132|122|126|96| |\n|2 (50)|JIS B220 40K, So / RF|8705 O20CI|223| |22|224|223| |165|32|122|126|105| |\n|2 (50)|AS4087 Pni6_ Sq / RF|8705 020CU|200| |198|201|200| |150|132|122|126|90| |\n|2 (50)|AS4087 Pn2| , So / RF|8705 020CW|200| |198|201|200| |165|132|122|126|103| |\n|2 (50)|AS4087 Pn35 , So / RF|8705 O20cy|200| |198|201|200| |65|132|122|126|103| |\n|2.5 (65)|ASME 150 So / RF|8705 025C1|199| |197| |78|160|136|140|105|12| | |\n|2.5 (65)|ASME 300 So / RF|8705 025c3|199| |197| |19|60|136|140|105|15| | |',
    'Info for 8700m\n# Process connections\n\n|ASME B16.5|Class 150 and Class 300: ½ inch to 24 inch (15 mm to 600 mm)|\n|---|---|\n| |Class 600: ½ inch to 24 inch (15 mm to 600 mm)(1)|\n| |Class 900: 1 inch to 12 inch (25 mm to 300 mm)(2)|\n| |Class 1500: 1½ inch to 12 inch (40 mm to 300 mm)(2)|\n| |1½ inch to 6 inch (40 mm to 150 mm)(2)|\n|ASME B16.47|Class 150: 30 inch to 36 inch (750 mm to 900 mm)|\n| |Class 300: 30 inch to 36 inch (750 mm to 900 mm)|\n|AWWA C207|Class D: 30 inch and 36 inch (750 mm and 900 mm)|\n|MSS SP44|Class 150: 30 inch to 36 inch (750 mm to 900 mm)|\n|EN 1092-1|PN10: 200 mm to 900 mm (8 inch to 36 inch)|\n| |PN16: 100 mm to 900 mm (4 inch to 36 inch)|\n| |PN25: 200 mm to 900 mm (8 inch to 36 inch)|\n| |PN40: 15 mm to 900 mm (½ inch to 36 inch)|\n|AS2129|Table D and Table E: 15 mm to 900 mm (½ inch to 36 inch)|\n|AS4087|PN16, PN21, PN35: 50 mm to 600 mm (2 inch to 24 inch)|\n|JIS B2220|10K, 20K, 40K: 15 mm to 200 mm (½ inch to 8 inch)|',
]
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]

Evaluation

Metrics

Semantic Similarity

Metric Value
pearson_cosine 0.8612
spearman_cosine 0.7357

Training Details

Training Dataset

Unnamed Dataset

  • Size: 41,760 training samples
  • Columns: sentence_0, sentence_1, and label
  • Approximate statistics based on the first 1000 samples:
    sentence_0 sentence_1 label
    type string string float
    details
    • min: 12 tokens
    • mean: 20.93 tokens
    • max: 46 tokens
    • min: 16 tokens
    • mean: 304.51 tokens
    • max: 512 tokens
    • min: 0.0
    • mean: 0.25
    • max: 1.0
  • Samples:
    sentence_0 sentence_1 label
    How much does the 8705 240CE model weigh in the DIN PNI6 So / RF setup? Info for 3051s
    # Process connection size

    Code
    What type of instrument flange is used for the Rosemount 3051S_T with F11 code? Info for 3051s
    # Electrical connections

    ½–14 NPT, G½, and M20 × 1½ conduit. HART® interface connections fixed to terminal block for Output code A and X.

    # Process connections

    Coplanar sensor module (Rosemount 3051S_C, 3051SMV, 3051SF, 3051SAM_ _G or A)

    Standard
    I need info on the 8700m sensor with ASME -1500 WN / RTJ, can you help? Info for 8700m
    (350) JIS B2200 20k, So / RF
  • Loss: MultipleNegativesRankingLoss with these parameters:
    {
        "scale": 20.0,
        "similarity_fct": "cos_sim"
    }
    

Training Hyperparameters

Non-Default Hyperparameters

  • eval_strategy: steps
  • per_device_train_batch_size: 64
  • per_device_eval_batch_size: 64
  • num_train_epochs: 6
  • multi_dataset_batch_sampler: round_robin

All Hyperparameters

Click to expand
  • overwrite_output_dir: False
  • do_predict: False
  • eval_strategy: steps
  • prediction_loss_only: True
  • per_device_train_batch_size: 64
  • per_device_eval_batch_size: 64
  • 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: 5e-05
  • weight_decay: 0.0
  • adam_beta1: 0.9
  • adam_beta2: 0.999
  • adam_epsilon: 1e-08
  • max_grad_norm: 1
  • num_train_epochs: 6
  • max_steps: -1
  • lr_scheduler_type: linear
  • lr_scheduler_kwargs: {}
  • warmup_ratio: 0.0
  • 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: False
  • 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}
  • 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: round_robin

Training Logs

Epoch Step Training Loss valid_spearman_cosine
0.2496 163 - 0.7010
0.4992 326 - 0.7209
0.7489 489 - 0.7259
0.7657 500 3.9185 -
0.9985 652 - 0.7252
1.0 653 - 0.7253
1.2481 815 - 0.7285
1.4977 978 - 0.7321
1.5314 1000 3.7874 -
1.7473 1141 - 0.7300
1.9969 1304 - 0.7333
2.0 1306 - 0.7332
2.2466 1467 - 0.7304
2.2971 1500 3.7241 -
2.4962 1630 - 0.7293
2.7458 1793 - 0.7357

Framework Versions

  • Python: 3.11.11
  • Sentence Transformers: 3.4.1
  • Transformers: 4.48.3
  • PyTorch: 2.5.1+cu124
  • Accelerate: 1.3.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",
}

MultipleNegativesRankingLoss

@misc{henderson2017efficient,
    title={Efficient Natural Language Response Suggestion for Smart Reply},
    author={Matthew Henderson and Rami Al-Rfou and Brian Strope and Yun-hsuan Sung and Laszlo Lukacs and Ruiqi Guo and Sanjiv Kumar and Balint Miklos and Ray Kurzweil},
    year={2017},
    eprint={1705.00652},
    archivePrefix={arXiv},
    primaryClass={cs.CL}
}
Downloads last month
13
Safetensors
Model size
33.4M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for LeiPricingManager/02262025_fine-tuned-bge-small-optimized

Base model

BAAI/bge-small-en
Finetuned
(8)
this model

Evaluation results