Views
No views yet


mmbert-base-arabic-nli is a high-quality Sentence Transformer model fine-tuned from jhu-clsp/mmBERT-base with GISTEmbedLoss guided by Arabic-Triplet-Matryoshka-V2.It maps Arabic sentences and paragraphs into a 768-dimensional semantic space, optimized for semantic textual similarity, semantic search, paraphrase mining, text classification, and clustering tasks.The model achieves Spearman correlation of 0.8311 on STS benchmarks and supports sequences up to 8192 tokens, making it ideal for long-form Arabic understanding and retrieval-augmented generation (RAG) applications.
SentenceTransformer(
(0): Transformer({'max_seq_length': 8192, 'do_lower_case': False, 'architecture': '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})
)
The fine-tuned mmbert-base-arabic-nli demonstrates a significant improvement in semantic understanding across both MTEB benchmarks, achieving up to +30 points over the base mmBERT in cross-domain Arabic sentence similarity.
sts-devEmbeddingSimilarityEvaluator| Metric | Value |
|---|---|
| pearson_cosine | 0.8259 |
| spearman_cosine | 0.8311 |
pip install -U sentence-transformers1from sentence_transformers import SentenceTransformer
2
3# 🔹 Load the model from Hugging Face Hub
4model = SentenceTransformer("Omartificial-Intelligence-Space/mmbert-base-arabic-nli")
5
6# 🔹 Example Arabic sentences
7sentences = [
8 "متوسط درجة الحرارة في أورلاندو، فلوريدا.",
9 "تقع أورلاندو في وسط فلوريدا، ويبلغ متوسط درجة الحرارة الإجمالية فيها 83 درجة فهرنهايت، ومتوسط منخفض يبلغ 62 درجة.",
10 "تتمتع جنوب فلوريدا بمناخ دافئ ورطب على مدار العام، مما يجعلها وجهة مثالية للعطلات."
11]
12
13# 🔹 Generate embeddings
14embeddings = model.encode(sentences)
15print("Shape of embeddings:", embeddings.shape)
16# Output: (3, 768)
17
18# 🔹 Compute pairwise cosine similarities
19similarities = model.similarity(embeddings, embeddings)
20print(similarities)
21# tensor([
22# [1.0000, 0.8495, 0.7115],
23# [0.8495, 1.0000, 0.7436],
24# [0.7115, 0.7436, 1.0000]
25# ])1@inproceedings{reimers-2019-sentence-bert,
2 title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
3 author = "Reimers, Nils and Gurevych, Iryna",
4 booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
5 month = "11",
6 year = "2019",
7 publisher = "Association for Computational Linguistics",
8 url = "https://arxiv.org/abs/1908.10084",
9}1@misc{solatorio2024gistembed,
2 title={GISTEmbed: Guided In-sample Selection of Training Negatives for Text Embedding Fine-tuning},
3 author={Aivin V. Solatorio},
4 year={2024},
5 eprint={2402.16829},
6 archivePrefix={arXiv},
7 primaryClass={cs.LG}
8}