SentenceTransformer based on BAAI/bge-base-en-v1.5
This is a sentence-transformers model finetuned from BAAI/bge-base-en-v1.5. 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: BAAI/bge-base-en-v1.5
- Maximum Sequence Length: 256 tokens
- Output Dimensionality: 768 dimensions
- Similarity Function: Cosine Similarity
Model Sources
- Documentation: Sentence Transformers Documentation
- Repository: Sentence Transformers on GitHub
- Hugging Face: Sentence Transformers on Hugging Face
Full Model Architecture
SentenceTransformer(
(0): Transformer({'max_seq_length': 256, 'do_lower_case': True, 'architecture': 'BertModel'})
(1): Pooling({'word_embedding_dimension': 768, '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 = [
"Represent this sentence for searching relevant passages: user: I've been using those nail stamping plates I bought and want something to add some bling.\nassistant: Sure, are you looking for something like stickers or maybe small decorations?\nuser: I want small gems or studs to put on my nails, around 2mm size.\nassistant: Got it. I can find something that comes in a handy case with lots of pieces.\nuser: Sounds good, I'd like a big mix of colors and shapes to play with.",
'SODIAL(R) 3000 Nail Art Gems Mixed Colours Shapes in Case (Size 2mm)\nCategory: Beauty Description: * Beautiful decoration for your nails. Quantity are approximately.* They are reusable if you are careful when taking them off.* You can use it for nail art or decoration of mobile phone, ipod etc.* You can also use them to decorate home or made cards.* Colours shown may vary from photo.* Contents: 3000 Nail Art Gems Round diamonds',
'144 Pcs 3d Flower Slice Nail Art Decoration Fimo Box Packaged\nCategory: Beauty Description: Features: 1. 12 Different Patterns. 2. Charms that Makes You Wonderful Nail Art. 3. Different Patterns in separate chamber of the wheel box provided. 4. Box packaged, easy to carry and store. 5. Allows you to create your own designs on the nail. 6. Suitable for professional use or home use. Specifications: 1. FIMO shaped: Flower. 2. Color: Multi-color. 3. Quantity: More than 144 pcs. . Box dimensions: 2.36 x 0.31 inch / 6 x 0.8 cm(Dia x H). 5. Weight:0.42oz/12g. Package includes: 1 x 144 pcs 3D Flower Slice Nail Art Decoration FIMO Box Packaged.',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 768]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities)
# tensor([[1.0000, 0.6466, 0.4385],
# [0.6466, 1.0000, 0.5245],
# [0.4385, 0.5245, 1.0000]])
Training Details
Training Dataset
Unnamed Dataset
- Size: 4,830 training samples
- Columns: anchor, positive, and negative
- Approximate statistics based on the first 1000 samples:
anchor positive negative type string string string details min: 56 tokensmean: 99.6 tokensmax: 177 tokens min: 10 tokensmean: 105.0 tokensmax: 256 tokens min: 11 tokensmean: 127.39 tokensmax: 256 tokens - Samples:
anchor positive negative Represent this sentence for searching relevant passages: user: hey, just browsing for something new for my skin but not really sure what i need. i did love that self-tanning mousse i grabbed last time thoughassistant: happy to help! are you wanting more of a hydrating lotion or something to firm and tone your skin?user: probably firming, i've been noticing my skin feels less tight than before Jergens Skin Firming Daily Toning Moisturizer, 16.8 OunceCategory: Beauty Description: Jergens skin firming moisturizing lotion restores elasticity for a silky and smooth look. Daily toner moisturizer with natural extracts reduces the appearance of cellulite. Jergens skin firming daily toner moisturizer rules with a firm hand to tone and tighten the look of cellulite-prone skin. This body lotion instantly hydrates skin leaving it smooth, healthier-looking and supple. L'Oreal Paris Age Perfect Hydra-Nutrition Moisturizer, 1.7-Fluid OunceCategory: Beauty Description: Mature, very dry skin needs extra care and attention. Treat it to deep hydration with Age Perfect Hydra-Nutrition Anti-Sagging Ultra-Nourishing Day/Night Cream. Skin is nourished with a nutrient complex enriched with calcium that builds resilience, leaving the skin feeling fortified while alleviating uncomfortable dryness. This creamy and silky texture melts away leaving skin feeling soft and nourished. Skin is instantly more hydrated, and in 2 weeks comfort is restored to the skin. After 4 weeks skin is firmer and more supple. Represent this sentence for searching relevant passages: user: I've been using that dead sea hair conditioner and the vitamin c serum I got earlier, but I'm not sure what to try next.assistant: Got it! Are you leaning more toward skin or hair care right now?user: Maybe hair? My curls still feel dry even with that sea salt conditioner.assistant: Do you think you need something lighter for shine or a heavier repair treatment?user: Probably something lighter, I don't want anything too heavy. Argan Oil for Hair ★SALE!★ ORGANIC Argan Oil | Highest Quality Moisturizing Moroccan Oil - Cold Pressed Virgin Argan Oil for Face, Hair, Skin and Nails | Pure and acclaimed as "Nature's Liquid Gold" | Certified Organic and EcoCert Certified Argania Spinosa | WORKS or YOUR MONEY BACK!Category: Beauty Description: PERFECTLY Radiant Skin and Silky-Salon Hair - What Could Be BETTER?Foxbrim's 100% Pure Organic Argan Oil is the pure and absolutely NATURAL solution to your skin and hair problems!• Unbelievably Lightweight and Easily absorbs into face, hair, skin and nails.• You've seen theHollywoodGLOW. Get it. With a few drops!• ExtremelyFreshand Long-Lasting.• EcoCert & Organic Certified - no preservatives, chemicals or artificial fragrances used.The #1 Choice for a REASON! Foxbrim's Argan Oil is the "secret" solution to the most common skin and hair issues you face every single day.• Sensitive Skin? Don't Stress! Foxbrim's Argan Oil is non-irritating andisn't'oily' like those other produc... Dermorganic Leave-in Treatment with Argan Oil, 4 OunceCategory: Beauty Description: Leave-In Treatment, based on Morrocan Argan Fruit Oil, has the unique quality of instant absorption into hair. It restores shine and softness while strengthening brittle hair. Replenishes nourishment to dry, damaged, colored hair. Protects hair from styling heat and UV damage. Represent this sentence for searching relevant passages: user: I've been using that dead sea mud mask and my vitamin C serum, but my hair is still frizzy.assistant: Got it. Those are great for skin, but hair might need something different.user: I also tried that argan oil I bought, but it didn't do much for my dry scalp.assistant: Argan can be hit or miss. Maybe you need something closer to your natural oils.user: Probably. But I'm wary of another oil just being greasy. Jojoba Oil, Organic, 100% Pure Cold Pressed Unrefined, Made in the USA Revitalizes Hair and Gives Skin a Radiant and Youthful Look, Great for Lips, Cuticles, Stretch Marks, Beard, Leaving You Vibrant. Similar to Argan Oil, but Without the Smell, in a 4 oz Dark Amber Bottle, and Glass Eye Dropper for Easy ApplicationCategory: Beauty Description: Finally a solution to unmanageable hair,and dry, cracked, and irritated skinGive your hair more Shine, Body and StrengthWith the ongoing torture your hair and skin gets from hairdryers, weather, and treatments,you need something natural, without chemicals to replenish your natural shine and luster.Leven Rose's 100% Pure Natural Jojoba Oil does just that. Jojoba oil is one of the closestthings to the natural oils the body produces. Because it's similar to what the body produces,it is absorbed into the skin and hair very easily, and replenishes what is stripped away by soaps,shampoos, the elements, and everything else.If you are looking for Healt... Garnier Sleek and Shine Moroccan Sleek Oil Treatment for Frizzy Dry Unmanageable Hair, 3.75 Fluid OunceCategory: Beauty Description: Want the sleek, smooth, deep conditioning of argan oil from morocco without any oily residue. Try the new sleek and shine moroccan sleek daily treatment oil. The precious formula with argan oil from morocco is instantly absorbed, delivering concentrated conditioning for strand-by-strand softness, shine, easy smooth styling and frizz control without any oily residue. - Loss: CachedMultipleNegativesRankingLoss with these parameters:
{ "scale": 20.0, "similarity_fct": "cos_sim", "mini_batch_size": 32, "gather_across_devices": false }
Training Hyperparameters
Non-Default Hyperparameters
per_device_train_batch_size: 64learning_rate: 2e-05warmup_ratio: 0.1bf16: Truedataloader_pin_memory: Falsebatch_sampler: no_duplicates
All Hyperparameters
overwrite_output_dir: Falsedo_predict: Falseeval_strategy: noprediction_loss_only: Trueper_device_train_batch_size: 64per_device_eval_batch_size: 8per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 1eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 2e-05weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1.0num_train_epochs: 3.0max_steps: -1lr_scheduler_type: linearlr_scheduler_kwargs: {}warmup_ratio: 0.1warmup_steps: 0log_level: passivelog_level_replica: warninglog_on_each_node: Truelogging_nan_inf_filter: Truesave_safetensors: Truesave_on_each_node: Falsesave_only_model: Falserestore_callback_states_from_checkpoint: Falseno_cuda: Falseuse_cpu: Falseuse_mps_device: Falseseed: 42data_seed: Nonejit_mode_eval: Falseuse_ipex: Falsebf16: Truefp16: Falsefp16_opt_level: O1half_precision_backend: autobf16_full_eval: Falsefp16_full_eval: Falsetf32: Nonelocal_rank: 0ddp_backend: Nonetpu_num_cores: Nonetpu_metrics_debug: Falsedebug: []dataloader_drop_last: Falsedataloader_num_workers: 0dataloader_prefetch_factor: Nonepast_index: -1disable_tqdm: Falseremove_unused_columns: Truelabel_names: Noneload_best_model_at_end: Falseignore_data_skip: Falsefsdp: []fsdp_min_num_params: 0fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}fsdp_transformer_layer_cls_to_wrap: Noneaccelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}parallelism_config: Nonedeepspeed: Nonelabel_smoothing_factor: 0.0optim: adamw_torch_fusedoptim_args: Noneadafactor: Falsegroup_by_length: Falselength_column_name: lengthddp_find_unused_parameters: Noneddp_bucket_cap_mb: Noneddp_broadcast_buffers: Falsedataloader_pin_memory: Falsedataloader_persistent_workers: Falseskip_memory_metrics: Trueuse_legacy_prediction_loop: Falsepush_to_hub: Falseresume_from_checkpoint: Nonehub_model_id: Nonehub_strategy: every_savehub_private_repo: Nonehub_always_push: Falsehub_revision: Nonegradient_checkpointing: Falsegradient_checkpointing_kwargs: Noneinclude_inputs_for_metrics: Falseinclude_for_metrics: []eval_do_concat_batches: Truefp16_backend: autopush_to_hub_model_id: Nonepush_to_hub_organization: Nonemp_parameters:auto_find_batch_size: Falsefull_determinism: Falsetorchdynamo: Noneray_scope: lastddp_timeout: 1800torch_compile: Falsetorch_compile_backend: Nonetorch_compile_mode: Noneinclude_tokens_per_second: Falseinclude_num_input_tokens_seen: Falseneftune_noise_alpha: Noneoptim_target_modules: Nonebatch_eval_metrics: Falseeval_on_start: Falseuse_liger_kernel: Falseliger_kernel_config: Noneeval_use_gather_object: Falseaverage_tokens_across_devices: Falseprompts: Nonebatch_sampler: no_duplicatesmulti_dataset_batch_sampler: proportionalrouter_mapping: {}learning_rate_mapping: {}
Training Logs
| Epoch | Step | Training Loss |
|---|---|---|
| 0.1316 | 10 | 1.7665 |
| 0.2632 | 20 | 1.1796 |
| 0.3947 | 30 | 0.9256 |
| 0.5263 | 40 | 0.8466 |
| 0.6579 | 50 | 0.706 |
| 0.7895 | 60 | 0.6482 |
| 0.9211 | 70 | 0.6338 |
| 1.0526 | 80 | 0.5702 |
| 1.1842 | 90 | 0.5655 |
| 1.3158 | 100 | 0.5009 |
| 1.4474 | 110 | 0.4652 |
| 1.5789 | 120 | 0.4528 |
| 1.7105 | 130 | 0.4874 |
| 1.8421 | 140 | 0.5356 |
| 1.9737 | 150 | 0.4633 |
| 2.1053 | 160 | 0.4334 |
| 2.2368 | 170 | 0.4005 |
| 2.3684 | 180 | 0.4046 |
| 2.5 | 190 | 0.4064 |
| 2.6316 | 200 | 0.4358 |
| 2.7632 | 210 | 0.4097 |
| 2.8947 | 220 | 0.3739 |
Framework Versions
- Python: 3.12.9
- Sentence Transformers: 5.1.0
- Transformers: 4.56.1
- PyTorch: 2.8.0+cu128
- Accelerate: 1.15.0
- Datasets: 5.0.1
- Tokenizers: 0.22.2
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",
}
CachedMultipleNegativesRankingLoss
@misc{gao2021scaling,
title={Scaling Deep Contrastive Learning Batch Size under Memory Limited Setup},
author={Luyu Gao and Yunyi Zhang and Jiawei Han and Jamie Callan},
year={2021},
eprint={2101.06983},
archivePrefix={arXiv},
primaryClass={cs.LG}
}