SentenceTransformer based on BAAI/bge-m3
This is a sentence-transformers model finetuned from BAAI/bge-m3. It maps sentences & paragraphs to a 1024-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, classification, clustering, and more.
License & Attribution
- This model: MIT
- Base model BAAI/bge-m3: MIT
- Training data OpenAssistant/oasst1: Apache-2.0
- Training data BelleGroup/multiturn_chat_0.8M: ODC-By (Open Data Commons Attribution License)
Contains information from BelleGroup/multiturn_chat_0.8M which is made available under the ODC Attribution License (https://opendatacommons.org/licenses/by/1-0/).
Model Details
Model Description
- Model Type: Sentence Transformer
- Base model: BAAI/bge-m3
- Maximum Sequence Length: 2048 tokens
- Output Dimensionality: 1024 dimensions
- Similarity Function: Cosine Similarity
- Supported Modality: Text
- Training Dataset: OASST1 (OpenAssistant) + BELLE multiturn_chat_0.8M
- Language: en, zh
- License: MIT
Model Sources
- Documentation: Sentence Transformers Documentation
- Repository: Sentence Transformers on GitHub
- Hugging Face: Sentence Transformers on Hugging Face
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': 'XLMRobertaModel'})
(1): Pooling({'embedding_dimension': 1024, 'pooling_mode': 'cls', '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 = [
"yeah that's pretty stupid, i honestly doubt that stuff is even real. im not putting in all that effort.",
"It's important to acknowledge that people have different opinions and beliefs, and it's okay to disagree on certain issues. However, it's important to have an open mind and consider different perspectives, especially when it comes to issues that have a significant impact on our planet and future generations.\n\nClimate change is a complex issue that is supported by a vast body of scientific evidence. The overwhelming majority of climate scientists agree that the Earth's climate is changing due to human activities, such as the burning of fossil fuels and deforestation, and that this is causing a range of environmental and social impacts, from more frequent and intense heatwaves, floods and storms, to sea-level rise and food insecurity.\n\nWhile it may seem insignificant to reduce one's own carbon footprint, it's important to remember that individual actions can collectively make a difference. Every small change that we make, whether it's reducing our energy consumption, using public transport, eating less meat or recycling, can contribute to a more sustainable future.\n\nMoreover, reducing our carbon footprint can also have personal benefits, such as saving money on energy bills, improving our health and well-being, and connecting us to our local community and environment.\n\nIn summary, while it's understandable that people may have different views on climate change, it's important to keep an open mind and consider the scientific evidence and the potential benefits of taking action. By working together and taking small steps towards reducing our carbon footprint, we can all contribute to a more sustainable future for ourselves and for future generations.",
'你好,我是Open Assistant,有什么可以帮您的吗?',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 1024]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities)
# tensor([[ 1.0000, 0.4900, -0.0125],
# [ 0.4900, 1.0000, -0.0482],
# [-0.0125, -0.0482, 1.0000]])
Training Details
Training Dataset
Unnamed Dataset
- Size: 64,052 training samples
- Columns: anchor and positive
- Approximate statistics based on the first 100 samples:
anchor positive type string string modality text text details min: 3 tokensmean: 73.52 tokensmax: 763 tokens min: 4 tokensmean: 108.58 tokensmax: 916 tokens - Samples:
anchor positive I am looking for a place to stay. The hotel should be in the east and should have a star of 4 I am sorry, but there are no 4 star hotels in that area, would you like me to look up another type of hotel for you? I'm going to leicester train station and need to arrive there by 03:30 Just want to confirm before booking you are departing from saffron brasserie and want to arrive at leicester by 3:30, is that correct? I actually wanted you to create a campaign for a new type of energy drink targeting young adults aged 18-30 Sure, I can help you create a campaign for a new type of energy drink targeting young adults aged 18-30. To do this, I suggest you define the target audience first. For this product, the key demographic is 18-30 year olds. More specifically, I would target active lifestyle young adults who value an energetic, fast-paced life. They likely listen to popular music, watch action/adventure movies, follow extreme sports, and spend a lot of time socializing.Once you have defined the target audience, you can determine the key brand messages and slogans. The messages I would focus on include: "Unleash your inner energy and passion for life", "For those who live life at full speed", and "Engineered for an active lifestyle". Potential slogans could be "Full Throttle Energy" and "Ignite Your Lifestyle".Next, you need to select the media channels for the campaign. The best media options to reach the target audience would be social media like Instagram, Facebook, and Snapchat, sponsorship of ext... - Loss: MultipleNegativesRankingLoss with these parameters:
{ "scale": 20.0, "similarity_fct": "cos_sim", "gather_across_devices": false, "directions": [ "query_to_doc" ], "partition_mode": "joint", "hardness_mode": null, "hardness_strength": 0.0 }
Training Time
- Training: 1.2 hours
Framework Versions
- Python: 3.13.15
- Sentence Transformers: 5.7.0
- Transformers: 4.57.6
- PyTorch: 2.11.0+cu130
- Accelerate: 1.15.0
- Datasets: 4.8.5
- Tokenizers: 0.22.2
Additional Resources
- Training and Finetuning Embedding Models with Sentence Transformers: the end-to-end guide for training or finetuning Sentence Transformer models.
- Introduction to Matryoshka Embedding Models: variable-size embeddings that can be truncated with minimal quality loss.
- Binary and Scalar Embedding Quantization for Significantly Faster & Cheaper Retrieval: post-training compression of embedding vectors.
- Multimodal Embedding & Reranker Models with Sentence Transformers: use text, image, audio, and video models through the same API.
- Training and Finetuning Multimodal Embedding & Reranker Models with Sentence Transformers: train multimodal embedding models, with a Visual Document Retrieval walkthrough.
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{oord2019representationlearningcontrastivepredictive,
title={Representation Learning with Contrastive Predictive Coding},
author={Aaron van den Oord and Yazhe Li and Oriol Vinyals},
year={2019},
eprint={1807.03748},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/1807.03748},
}