Sentence Similarity
Transformers
Safetensors
English
Arabic
Urdu
mentee_embed
feature-extraction
embeddings
retrieval
contrastive-learning
multilingual
from-scratch
custom_code
Instructions to use MenteEAI/mentee-embed-v3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MenteEAI/mentee-embed-v3 with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("MenteEAI/mentee-embed-v3", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Fix: correct Protocol A avgs, usage code, DOI, remove val column
Browse files
README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
|
|
|
|
|
|
| 3 |
language:
|
| 4 |
- en
|
| 5 |
- ar
|
|
@@ -66,14 +68,16 @@ All baselines evaluated under identical conditions on the same hardware.
|
|
| 66 |
### Protocol A — In-batch Retrieval (pool ≈ 97 candidates)
|
| 67 |
*Format: acc@1 / R@5 / MRR@10*
|
| 68 |
|
| 69 |
-
|
| 70 |
-
|-------|-----|-----------|-----------|-----------|-------------|----------|----------------|
|
| 71 |
-
| **mentee-embed-v3 (ours)** | 0.766/0.988/0.870 | 0.636/0.920/0.766 | 0.326/0.604/0.475 | 0.290/0.568/0.443 | 0.781/0.925/0.848 | 0.517/0.981/0.742 | **0.691** |
|
| 72 |
-
| paraphrase-multilingual-mpnet-base-v2 | 0.823/0.972/0.895 | 0.864/1.000/0.931 | 0.722/0.975/0.839 | 0.686/0.950/0.806 | 0.831/0.937/0.880 | 0.665/0.998/0.830 | **0.864** |
|
| 73 |
-
| paraphrase-multilingual-MiniLM-L12-v2 | 0.802/0.973/0.883 | 0.854/0.997/0.924 | 0.696/0.964/0.819 | 0.621/0.908/0.753 | 0.782/0.907/0.841 | 0.600/0.998/0.796 | **0.836** |
|
| 74 |
-
| all-MiniLM-L6-v2 | 0.524/0.688/0.627 | 0.856/0.999/0.927 | 0.025/0.109/0.144 | 0.028/0.088/0.140 | 0.065/0.172/0.186 | 0.696/1.000/0.848 | **0.479** |
|
| 75 |
|
| 76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
|
| 78 |
---
|
| 79 |
|
|
@@ -146,9 +150,11 @@ Stage 4 — Distillation Round 2 (with hard negatives)
|
|
| 146 |
## Usage
|
| 147 |
|
| 148 |
```python
|
| 149 |
-
|
|
|
|
| 150 |
|
| 151 |
-
|
|
|
|
| 152 |
|
| 153 |
sentences = [
|
| 154 |
"Hello, how are you?",
|
|
@@ -156,27 +162,28 @@ sentences = [
|
|
| 156 |
"ہیلو، آپ کیسے ہیں؟"
|
| 157 |
]
|
| 158 |
|
| 159 |
-
embeddings = model.encode(sentences)
|
| 160 |
-
print(embeddings.shape) # (3, 384)
|
| 161 |
```
|
| 162 |
|
|
|
|
|
|
|
| 163 |
### Similarity search
|
| 164 |
```python
|
| 165 |
-
from
|
| 166 |
|
| 167 |
-
|
|
|
|
| 168 |
|
| 169 |
-
query
|
| 170 |
-
passages = [
|
| 171 |
"Machine learning is a subset of artificial intelligence.",
|
| 172 |
"The weather today is sunny.",
|
| 173 |
"تعلم الآلة هو فرع من فروع الذكاء الاصطناعي.",
|
| 174 |
-
]
|
| 175 |
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
scores = util.cos_sim(q_emb, p_emb)
|
| 179 |
-
print(scores)
|
| 180 |
```
|
| 181 |
|
| 182 |
---
|
|
@@ -194,11 +201,13 @@ print(scores)
|
|
| 194 |
|
| 195 |
```bibtex
|
| 196 |
@misc{mentee-embed-v3-2026,
|
| 197 |
-
title = {
|
| 198 |
-
|
|
|
|
| 199 |
year = {2026},
|
| 200 |
-
|
| 201 |
-
|
|
|
|
| 202 |
}
|
| 203 |
```
|
| 204 |
|
|
@@ -206,6 +215,6 @@ print(scores)
|
|
| 206 |
|
| 207 |
## About MenteE AI
|
| 208 |
|
| 209 |
-
Built by **Syed Syab Ahmad Shah** and Team MenteE AI.
|
| 210 |
-
🌐 [menteeai.org](https://menteeai.org) · 📧 syab@menteeai.org
|
| 211 |
-
Research paper: [10.5281/zenodo.
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
+
pipeline_tag: sentence-similarity
|
| 4 |
+
library_name: transformers
|
| 5 |
language:
|
| 6 |
- en
|
| 7 |
- ar
|
|
|
|
| 68 |
### Protocol A — In-batch Retrieval (pool ≈ 97 candidates)
|
| 69 |
*Format: acc@1 / R@5 / MRR@10*
|
| 70 |
|
| 71 |
+
*Avg MRR@10 computed over 5 datasets: MIRACL-EN, MIRACL-AR, MIRACL-UR, xling EN-UR, MS-MARCO (val excluded from avg).*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
+
| Model | MIRACL-EN | MIRACL-AR | MIRACL-UR | xling EN↔UR | MS-MARCO | **Avg MRR@10** |
|
| 74 |
+
|-------|-----------|-----------|-----------|-------------|----------|----------------|
|
| 75 |
+
| **mentee-embed-v3 (ours)** | 0.636/0.920/0.766 | 0.326/0.604/0.475 | 0.290/0.568/0.443 | 0.781/0.925/0.848 | 0.517/0.981/0.742 | **0.655** |
|
| 76 |
+
| paraphrase-multilingual-mpnet-base-v2 | 0.864/1.000/0.931 | 0.722/0.975/0.839 | 0.686/0.950/0.806 | 0.831/0.937/0.880 | 0.665/0.998/0.830 | **0.857** |
|
| 77 |
+
| paraphrase-multilingual-MiniLM-L12-v2 | 0.854/0.997/0.924 | 0.696/0.964/0.819 | 0.621/0.908/0.753 | 0.782/0.907/0.841 | 0.600/0.998/0.796 | **0.827** |
|
| 78 |
+
| all-MiniLM-L6-v2 | 0.856/0.999/0.927 | 0.025/0.109/0.144 | 0.028/0.088/0.140 | 0.065/0.172/0.186 | 0.696/1.000/0.848 | **0.449** |
|
| 79 |
+
|
| 80 |
+
> ✅ **mentee-embed-v3 beats all-MiniLM-L6-v2** (0.655 vs 0.449) on Protocol A avg MRR@10 — despite all-MiniLM being a pretrained model.
|
| 81 |
|
| 82 |
---
|
| 83 |
|
|
|
|
| 150 |
## Usage
|
| 151 |
|
| 152 |
```python
|
| 153 |
+
# pip install torch transformers tokenizers huggingface_hub
|
| 154 |
+
from transformers import AutoModel, AutoTokenizer
|
| 155 |
|
| 156 |
+
tok = AutoTokenizer.from_pretrained("MenteEAI/mentee-embed-v3", trust_remote_code=True)
|
| 157 |
+
model = AutoModel.from_pretrained("MenteEAI/mentee-embed-v3", trust_remote_code=True)
|
| 158 |
|
| 159 |
sentences = [
|
| 160 |
"Hello, how are you?",
|
|
|
|
| 162 |
"ہیلو، آپ کیسے ہیں؟"
|
| 163 |
]
|
| 164 |
|
| 165 |
+
embeddings = model.encode(sentences, tokenizer=tok)
|
| 166 |
+
print(embeddings.shape) # torch.Size([3, 384])
|
| 167 |
```
|
| 168 |
|
| 169 |
+
> `trust_remote_code=True` is required — standard for custom-architecture models on HuggingFace. The code runs entirely on your machine.
|
| 170 |
+
|
| 171 |
### Similarity search
|
| 172 |
```python
|
| 173 |
+
from transformers import AutoModel, AutoTokenizer
|
| 174 |
|
| 175 |
+
tok = AutoTokenizer.from_pretrained("MenteEAI/mentee-embed-v3", trust_remote_code=True)
|
| 176 |
+
model = AutoModel.from_pretrained("MenteEAI/mentee-embed-v3", trust_remote_code=True)
|
| 177 |
|
| 178 |
+
query = model.encode(["What is machine learning?"], tokenizer=tok)
|
| 179 |
+
passages = model.encode([
|
| 180 |
"Machine learning is a subset of artificial intelligence.",
|
| 181 |
"The weather today is sunny.",
|
| 182 |
"تعلم الآلة هو فرع من فروع الذكاء الاصطناعي.",
|
| 183 |
+
], tokenizer=tok)
|
| 184 |
|
| 185 |
+
scores = query @ passages.T
|
| 186 |
+
print(scores) # tensor([[0.81, 0.60, 0.79]])
|
|
|
|
|
|
|
| 187 |
```
|
| 188 |
|
| 189 |
---
|
|
|
|
| 201 |
|
| 202 |
```bibtex
|
| 203 |
@misc{mentee-embed-v3-2026,
|
| 204 |
+
title = {How Far Can Multilingual Text Embeddings Be Trained From Scratch?
|
| 205 |
+
A Compute-Efficient Study of Arabic, English, and Urdu},
|
| 206 |
+
author = {Shah, Syed Syab Ahmad and Sania, Shakeel and Hamza, Rustam and Mahboob, Iqbal},
|
| 207 |
year = {2026},
|
| 208 |
+
doi = {10.5281/zenodo.22117673},
|
| 209 |
+
url = {https://doi.org/10.5281/zenodo.22117673},
|
| 210 |
+
note = {MenteE AI. Apache-2.0 License}
|
| 211 |
}
|
| 212 |
```
|
| 213 |
|
|
|
|
| 215 |
|
| 216 |
## About MenteE AI
|
| 217 |
|
| 218 |
+
Built by **Syed Syab Ahmad Shah** and Team MenteE AI.
|
| 219 |
+
🌐 [menteeai.org](https://menteeai.org) · 📧 syab@menteeai.org
|
| 220 |
+
Research paper: [10.5281/zenodo.22117673](https://doi.org/10.5281/zenodo.22117673)
|