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-v4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MenteEAI/mentee-embed-v4 with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("MenteEAI/mentee-embed-v4", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,3 +1,40 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
- ar
|
| 6 |
+
- ur
|
| 7 |
+
tags:
|
| 8 |
+
- embeddings
|
| 9 |
+
- sentence-similarity
|
| 10 |
+
- retrieval
|
| 11 |
+
- contrastive-learning
|
| 12 |
+
- multilingual
|
| 13 |
---
|
| 14 |
+
|
| 15 |
+
# mentee-embed-v4 (41M) — trilingual embeddings trained from scratch
|
| 16 |
+
|
| 17 |
+
A compact **41M-parameter, 384-dim** text embedding model for **Arabic, English and Urdu**, trained entirely from scratch (no pretrained base) in two stages on a single consumer GPU.
|
| 18 |
+
|
| 19 |
+
## Recipe
|
| 20 |
+
1. **Stage A — Masked language modeling** on ~31M tokens across the three languages
|
| 21 |
+
2. **Stage B — Contrastive fine-tuning** (symmetric InfoNCE, in-batch negatives + hard-negative column, temperature 0.05) on 2589852 triplets incl. **300K English↔Urdu parallel pairs (OPUS-100)**
|
| 22 |
+
|
| 23 |
+
## Results (Protocol B — 15K-doc corpus-pool retrieval, higher is better)
|
| 24 |
+
| 1 | paraphrase-multilingual-mpnet-base-v2 | MRR 0.829 · R@5 0.950 · R@100 0.997 | MRR 0.622 · R@5 0.757 · R@100 0.947 | MRR 0.534 · R@5 0.680 · R@100 0.903 | **0.662** |
|
| 25 |
+
| 2 | paraphrase-multilingual-MiniLM-L12-v2 | MRR 0.817 · R@5 0.920 · R@100 0.993 | MRR 0.591 · R@5 0.710 · R@100 0.943 | MRR 0.469 · R@5 0.557 · R@100 0.847 | **0.626** |
|
| 26 |
+
| 3 | mentee-embed-v4 (ours) ⭐ **ours** | MRR 0.695 · R@5 0.823 · R@100 0.970 | MRR 0.623 · R@5 0.727 · R@100 0.927 | MRR 0.336 · R@5 0.373 · R@100 0.643 | **0.551** |
|
| 27 |
+
| 4 | all-MiniLM-L6-v2 | MRR 0.844 · R@5 0.967 · R@100 1.000 | MRR 0.100 · R@5 0.000 · R@100 0.010 | MRR 0.106 · R@5 0.007 · R@100 0.013 | **0.350** |
|
| 28 |
+
|
| 29 |
+
Our model reaches **0.551** vs leader paraphrase-multilingual-mpnet-base-v2 at **0.662** on this suite.
|
| 30 |
+
*Protocol details: queries ranked against the full pool; baselines run with their recommended usage (E5 query/passage prefixes applied).*
|
| 31 |
+
|
| 32 |
+
## Usage
|
| 33 |
+
```python
|
| 34 |
+
from sentence_transformers import SentenceTransformer
|
| 35 |
+
model = SentenceTransformer("<your-hf-user>/mentee-embed-v1")
|
| 36 |
+
emb = model.encode(["مرحبا بالعالم", "hello world", "دنیا میں خوش آمدید"])
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
## Limitations
|
| 40 |
+
NLI+parallel derived training data; small-pool protocol is easier than full MIRACL; expect open-domain gaps versus web-scale models.
|