SentenceTransformer
This is a sentence-transformers model trained. It maps sentences & paragraphs to a 1536-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, classification, clustering, and more.
Model Details
Model Description
- Model Type: Sentence Transformer
- Maximum Sequence Length: 1000000000000000019884624838656 tokens
- Output Dimensionality: 1536 dimensions
- Similarity Function: Cosine Similarity
- Supported Modalities: Text, Image, Audio, Video, Message
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'}, 'image': {'method': 'forward', 'method_output_name': 'last_hidden_state'}, 'audio': {'method': 'forward', 'method_output_name': 'last_hidden_state'}, 'video': {'method': 'forward', 'method_output_name': 'last_hidden_state'}, 'message': {'method': 'forward', 'method_output_name': 'last_hidden_state', 'format': 'structured'}}, 'module_output_name': 'token_embeddings', 'architecture': 'Gemma4Model'})
(1): MultiheadAttentionPooling({'hidden_size': 1536, 'num_attention_heads': 16, 'intermediate_size': 6144, 'layer_norm_eps': 1e-06})
(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("shadowlilac/omniembed-merged")
# Run inference
queries = [
'Which planet is known as the Red Planet?',
]
documents = [
"Venus is often called Earth's twin because of its similar size and proximity.",
'Mars, known for its reddish appearance, is often referred to as the Red Planet.',
'Saturn, famous for its rings, is sometimes mistaken for the Red Planet.',
]
query_embeddings = model.encode_query(queries)
document_embeddings = model.encode_document(documents)
print(query_embeddings.shape, document_embeddings.shape)
# [1, 1536] [3, 1536]
# Get the similarity scores for the embeddings
similarities = model.similarity(query_embeddings, document_embeddings)
print(similarities)
# tensor([[0.3457, 0.8750, 0.6484]], dtype=torch.bfloat16)
Evaluation
Metrics
Information Retrieval
- Evaluated with InformationRetrievalEvaluator
| Metric | Value |
|---|---|
| cosine_accuracy@1 | 0.7602 |
| cosine_accuracy@3 | 0.8358 |
| cosine_accuracy@5 | 0.8486 |
| cosine_accuracy@10 | 0.8591 |
| cosine_precision@1 | 0.7602 |
| cosine_precision@3 | 0.2786 |
| cosine_precision@5 | 0.1697 |
| cosine_precision@10 | 0.0859 |
| cosine_recall@1 | 0.7602 |
| cosine_recall@3 | 0.8358 |
| cosine_recall@5 | 0.8486 |
| cosine_recall@10 | 0.8591 |
| cosine_ndcg@10 | 0.8143 |
| cosine_mrr@10 | 0.7995 |
| cosine_map@100 | 0.8019 |
Training Details
Training Logs
| Epoch | Step | cosine_ndcg@10 |
|---|---|---|
| -1 | -1 | 0.8143 |
Framework Versions
- Python: 3.12.13
- Sentence Transformers: 5.7.0
- Transformers: 5.14.1
- PyTorch: 2.13.0+cu130
- Accelerate: 1.14.0
- Datasets: 5.0.1
- 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.