đ SentenceTransformer based on answerdotai/ModernBERT-base
This model is a sentence-transformers model fine - tuned from answerdotai/ModernBERT-base on the gooaq dataset. It maps sentences and paragraphs to a 768 - dimensional dense vector space. This can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.
⨠Features
- Maps sentences and paragraphs to a 768 - dimensional dense vector space.
- Can be applied in multiple natural language processing tasks such as semantic textual similarity, semantic search, etc.
- Fine - tuned on the gooaq dataset.
đĻ Installation
First install the Sentence Transformers library:
pip install -U sentence-transformers
đģ Usage Examples
Basic Usage
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("tomaarsen/ModernBERT-base-gooaq")
sentences = [
'are you human korean novela?',
"Are You Human? (Korean: ëë ė¸ę°ė´ë; RR: Neodo Inganini; lit. Are You Human Too?) is a 2018 South Korean television series starring Seo Kang - jun and Gong Seung - yeon. It aired on KBS2's Mondays and Tuesdays at 22:00 (KST) time slot, from June 4 to August 7, 2018.",
'A relative of European pear varieties like Bartlett and Anjou, the Asian pear is great used in recipes or simply eaten out of hand. It retains a crispness that works well in slaws and salads, and it holds its shape better than European pears when baked and cooked.',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
đ Documentation
Model Details
Model Description
Property |
Details |
Model Type |
Sentence Transformer |
Base model |
answerdotai/ModernBERT-base |
Maximum Sequence Length |
512 tokens |
Output Dimensionality |
768 dimensions |
Similarity Function |
Cosine Similarity |
Training Dataset |
gooaq |
Language |
en |
Model Sources
Full Model Architecture
SentenceTransformer(
(0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: ModernBertModel
(1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
)
đ§ Technical Details
This model has been finetuned using train_st_gooaq.py using an RTX 3090, although only 10GB of VRAM was used.
đ Evaluation
Metrics
Information Retrieval
The model has the following performance metrics on different datasets:
NanoNQ
Metric |
Value |
Cosine Accuracy@1 |
0.38 |
Cosine Accuracy@3 |
0.64 |
Cosine Accuracy@5 |
0.7 |
Cosine Accuracy@10 |
0.8 |
Cosine Precision@1 |
0.38 |
Cosine Precision@3 |
0.22 |
Cosine Precision@5 |
0.14400000000000002 |
Cosine Precision@10 |
0.08199999999999999 |
Cosine Recall@1 |
0.36 |
Cosine Recall@3 |
0.62 |
Cosine Recall@5 |
0.67 |
Cosine Recall@10 |
0.74 |
Cosine Ndcg@10 |
0.5673854489333459 |
Cosine Mrr@10 |
0.5237460317460316 |
Cosine Map@100 |
0.5116785860647901 |
NanoMSMARCO
Metric |
Value |
Cosine Accuracy@1 |
0.32 |
Cosine Accuracy@3 |
0.56 |
Cosine Accuracy@5 |
0.66 |
Cosine Accuracy@10 |
0.82 |
Cosine Precision@1 |
0.32 |
Cosine Precision@3 |
0.18666666666666665 |
Cosine Precision@5 |
0.132 |
Cosine Precision@10 |
0.08199999999999999 |
Cosine Recall@1 |
0.32 |
Cosine Recall@3 |
0.56 |
Cosine Recall@5 |
0.66 |
Cosine Recall@10 |
0.82 |
Cosine Ndcg@10 |
0.555381357077638 |
Cosine Mrr@10 |
0.47249206349206346 |
Cosine Map@100 |
0.4797949229011178 |
NanoBEIR mean
Metric |
Value |
Cosine Accuracy@1 |
0.35 |
Cosine Accuracy@3 |
0.6000000000000001 |
Cosine Accuracy@5 |
0.6799999999999999 |
Cosine Accuracy@10 |
0.81 |
Cosine Precision@1 |
0.35 |
Cosine Precision@3 |
0.2033333333333333 |
Cosine Precision@5 |
0.138 |
Cosine Precision@10 |
0.08199999999999999 |
Cosine Recall@1 |
0.33999999999999997 |
Cosine Recall@3 |
0.5900000000000001 |
Cosine Recall@5 |
0.665 |
Cosine Recall@10 |
0.78 |
Cosine Ndcg@10 |
0.5613834030054919 |
Cosine Mrr@10 |
0.4981190476190476 |
Cosine Map@100 |
0.49573675448295396 |