098alzoro0 commited on
Commit
441050e
·
verified ·
1 Parent(s): 9872ce3

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +457 -54
README.md CHANGED
@@ -1,64 +1,467 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
- library_name: transformers
3
- pipeline_tag: sentence-similarity
4
- tags: [sentence-embeddings, sentence-similarity, feature-extraction]
5
- license: other
6
- language: [en]
 
 
 
 
 
 
 
 
7
  ---
8
 
9
- # mine-embed-v2 (experimental, private)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
- Text embedding model, 53.7M parameters, 512-dim, mean pooling + L2 normalisation.
12
- **Initialised from `google/bert_uncased_L-12_H-512_A-8`** (BERT miniature, Apache-2.0), then trained by MineAI Technology with
13
- contrastive learning on public datasets only. Not trained from scratch.
 
 
14
 
15
- ## Usage
16
  ```python
17
  from sentence_transformers import SentenceTransformer
18
- m = SentenceTransformer("MineAITechnology/mine-embed-v2") # mean pooling is applied automatically
19
- e = m.encode(["hello world"], normalize_embeddings=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  ```
21
- Plain transformers: mean-pool `last_hidden_state` with the attention mask, then L2-normalise.
22
- No query/passage prefixes are used. Max length used in training and evaluation: 128 tokens.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
  ## Training
25
- 1. Stage 1: symmetric InfoNCE, global in-batch negatives (GradCache), fp16, about 9.0 h on 2x T4.
26
- 2. Stage 2: hard-negative fine-tuning (MS MARCO BM25 triplets + AllNLI triplets), about 1.5 h.
27
- Temperature 0.02, AdamW, cosine schedule, no dropout.
28
-
29
- ## Data (public; verify each license before redistribution or commercial use)
30
- - `sentence-transformers/gooaq` (gooaq): GooAQ: verify
31
- - `sentence-transformers/paq` (paq): PAQ: may be non-commercial, verify
32
- - `sentence-transformers/wikianswers-duplicates` (wikianswers): verify
33
- - `sentence-transformers/npr` (npr): verify
34
- - `sentence-transformers/ccnews` (ccnews): verify
35
- - `sentence-transformers/xsum` (xsum): verify
36
- - `sentence-transformers/eli5` (eli5): verify
37
- - `sentence-transformers/natural-questions` (natural_questions): CC BY-SA 3.0 (verify)
38
- - `sentence-transformers/squad` (squad): CC BY-SA 4.0 (verify)
39
- - `sentence-transformers/trivia-qa` (trivia_qa): verify
40
- - `sentence-transformers/wikihow` (wikihow): verify
41
- - `sentence-transformers/agnews` (agnews): verify
42
- - `sentence-transformers/sentence-compression` (sentence_compression): verify
43
- - `sentence-transformers/simple-wiki` (simple_wiki): verify
44
- - `sentence-transformers/altlex` (altlex): verify
45
- - `sentence-transformers/coco-captions` (coco_captions): verify
46
- - `sentence-transformers/flickr30k-captions` (flickr30k): verify
47
- - `sentence-transformers/msmarco-bm25` (msmarco_pairs): MS MARCO terms (verify)
48
- - `sentence-transformers/msmarco-bm25` (msmarco_triplets): MS MARCO terms (verify)
49
- - `sentence-transformers/all-nli` (all_nli_triplets): SNLI CC BY-SA 4.0 / MultiNLI per-genre (verify)
50
-
51
- Deliberately excluded to keep MTEB-style evaluation clean:
52
- - quora-duplicates: QuoraRetrieval / Quora tasks would be in-domain
53
- - stackexchange-duplicates: overlaps AskUbuntu / StackOverflow duplicate-question tasks
54
- - s2orc, specter: overlaps SCIDOCS / SciDocsRR (scientific papers)
55
- - BEIR/MTEB task train splits (FiQA, NFCorpus, SciFact, ...): evaluation data
56
-
57
- ## Evaluation
58
- TODO: paste the MTEB benchmark table here (run the benchmark notebook with this model).
59
- Quick check, not a benchmark: STS-B dev Spearman 0.8265, test 0.8133.
60
-
61
- ## License
62
- Mixed. The backbone is Apache-2.0; the training datasets carry their own terms (see above), including
63
- share-alike and non-commercial sources. Treat as private/research until a license review is finished.
64
- Generated 2026-10-17.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # mine-embed-v2
2
+
3
+ A 54M-parameter English text-embedding model from **MineAI Technology**, with a full, reproducible MTEB benchmark against eight established models.
4
+
5
+ > **Status: early research release.** On the 28-task English MTEB subset below, mine-embed-v2 averages **59.77** and ranks **8 of 9** (ahead of the GloVe baseline only). It is closest to the leaders on short-text similarity and duplicate detection, and weakest on retrieval and reranking. This page publishes every number, including the unflattering ones.
6
+
7
+ | | |
8
+ |---|---|
9
+ | Parameters | 54.0M |
10
+ | Embedding dimension | 512 |
11
+ | Max sequence length (trained and evaluated) | 128 tokens |
12
+ | Pooling | mean pooling, L2-normalized |
13
+ | Language | English |
14
+ | Backbone | `google/bert_uncased_L-12_H-512_A-8` (BERT miniature, Apache-2.0), then contrastive training |
15
+ | Prefixes / instructions | none needed |
16
+ | Weights size | 204.9 MB (fp32) |
17
+ | License | **not yet decided**: depends on the training-data license review (see [License and data](#license-and-data)) |
18
+
19
  ---
20
+
21
+ ## Contents
22
+
23
+ 1. [Install](#install)
24
+ 2. [Quick start](#quick-start)
25
+ 3. [More usage examples](#more-usage-examples)
26
+ 4. [Benchmark](#benchmark)
27
+ 5. [Where v2 is useful, and where it is not](#where-v2-is-useful-and-where-it-is-not)
28
+ 6. [Training](#training)
29
+ 7. [Limitations](#limitations)
30
+ 8. [Reproduce the benchmark](#reproduce-the-benchmark)
31
+ 9. [License and data](#license-and-data)
32
+
33
  ---
34
 
35
+ ## Install
36
+
37
+ Requires Python 3.9+ and PyTorch.
38
+
39
+ ```bash
40
+ pip install -U sentence-transformers
41
+ ```
42
+
43
+ Optional, for the RAG example below:
44
+
45
+ ```bash
46
+ pip install -U faiss-cpu
47
+ ```
48
+
49
+ If the model repository is private, authenticate first:
50
+
51
+ ```bash
52
+ export HF_TOKEN=hf_xxx # a token with read access to MineAITechnology/mine-embed-v2
53
+ ```
54
 
55
+ Tested with: Python 3.13.15, torch 2.11.0+cu128, transformers 4.57.6, sentence-transformers 5.7.0.
56
+
57
+ ---
58
+
59
+ ## Quick start
60
 
 
61
  ```python
62
  from sentence_transformers import SentenceTransformer
63
+
64
+ model = SentenceTransformer("MineAITechnology/mine-embed-v2") # mean pooling is applied automatically
65
+ model.max_seq_length = 128 # the length used in training and in the benchmark
66
+
67
+ sentences = [
68
+ "How do I reset my password?",
69
+ "I forgot my login credentials, what should I do?",
70
+ "The stock market fell sharply today.",
71
+ ]
72
+ emb = model.encode(sentences, normalize_embeddings=True) # shape (3, 512)
73
+
74
+ sim = emb @ emb.T # cosine similarity (vectors are unit length)
75
+ print(sim.round(3))
76
+ ```
77
+
78
+ Notes:
79
+
80
+ - **No query/passage prefixes.** Embed questions and documents the same way. Do not add `query:` or `passage:`.
81
+ - Always embed documents and queries with the **same** model. Vectors from different embedding models are not comparable.
82
+ - Use `normalize_embeddings=True` (or normalize yourself) so dot product equals cosine similarity.
83
+
84
+ ### Plain `transformers` (no sentence-transformers)
85
+
86
+ ```python
87
+ import torch
88
+ import torch.nn.functional as F
89
+ from transformers import AutoTokenizer, AutoModel
90
+
91
+ repo = "MineAITechnology/mine-embed-v2"
92
+ tok = AutoTokenizer.from_pretrained(repo)
93
+ net = AutoModel.from_pretrained(repo).eval()
94
+
95
+ def embed(texts, max_length=128):
96
+ batch = tok(texts, padding=True, truncation=True, max_length=max_length, return_tensors="pt")
97
+ with torch.no_grad():
98
+ hidden = net(**batch).last_hidden_state # (batch, seq, 512)
99
+ mask = batch["attention_mask"].unsqueeze(-1).float()
100
+ pooled = (hidden * mask).sum(1) / mask.sum(1).clamp(min=1) # mean pooling over real tokens
101
+ return F.normalize(pooled, dim=-1) # L2 normalization
102
+
103
+ e = embed(["A man is playing a guitar.", "Someone strums an instrument."])
104
+ print((e[0] @ e[1]).item())
105
  ```
106
+
107
+ ---
108
+
109
+ ## More usage examples
110
+
111
+ ### Semantic search
112
+
113
+ ```python
114
+ from sentence_transformers import SentenceTransformer, util
115
+
116
+ model = SentenceTransformer("MineAITechnology/mine-embed-v2")
117
+ model.max_seq_length = 128
118
+
119
+ corpus = [
120
+ "Reset your password from the account settings page.",
121
+ "Our office is open Monday to Friday, 9am to 5pm.",
122
+ "You can pay by bank transfer, EasyPaisa or JazzCash.",
123
+ ]
124
+ corpus_emb = model.encode(corpus, normalize_embeddings=True, convert_to_tensor=True)
125
+
126
+ query = "which payment methods do you accept?"
127
+ q_emb = model.encode(query, normalize_embeddings=True, convert_to_tensor=True)
128
+
129
+ for hit in util.semantic_search(q_emb, corpus_emb, top_k=2)[0]:
130
+ print(f"{hit['score']:.3f} {corpus[hit['corpus_id']]}")
131
+ ```
132
+
133
+ ### Duplicate / paraphrase detection (v2's strongest use)
134
+
135
+ ```python
136
+ a = "How can I change my email address?"
137
+ b = "What is the way to update the email on my account?"
138
+ ea, eb = model.encode([a, b], normalize_embeddings=True)
139
+ print("similarity:", float(ea @ eb)) # pick a threshold on your own labelled data; 0.8 is a starting point only
140
+ ```
141
+
142
+ ### RAG retrieval step (embeddings + FAISS)
143
+
144
+ ```python
145
+ import faiss, numpy as np
146
+ from sentence_transformers import SentenceTransformer
147
+
148
+ model = SentenceTransformer("MineAITechnology/mine-embed-v2")
149
+ model.max_seq_length = 128
150
+
151
+ # 1) split documents into short chunks: about 80-100 words, because the model reads at most 128 tokens
152
+ chunks = ["...chunk 1...", "...chunk 2...", "...chunk 3..."]
153
+
154
+ # 2) embed once and build the index (inner product == cosine for normalized vectors)
155
+ X = model.encode(chunks, normalize_embeddings=True, batch_size=64).astype("float32")
156
+ index = faiss.IndexFlatIP(X.shape[1])
157
+ index.add(X)
158
+
159
+ # 3) at question time: embed the question, fetch the top chunks, pass them to your LLM
160
+ q = model.encode(["your question here"], normalize_embeddings=True).astype("float32")
161
+ scores, ids = index.search(q, 3)
162
+ context = "\n\n".join(chunks[i] for i in ids[0])
163
+ # prompt = f"Answer using only this context:\n{context}\n\nQuestion: ..."
164
+ ```
165
+
166
+ Keep expectations realistic for retrieval-heavy RAG: v2 scores 36.4 on the retrieval average vs 49.9 for the best model here (see benchmark). For document question answering where answer quality matters, a stronger retriever such as `BAAI/bge-small-en-v1.5` is currently the safer choice.
167
+
168
+ ### Speed tips
169
+
170
+ - Batch your inputs (`batch_size=64` is what the benchmark used).
171
+ - On a Tesla T4 (fp32) v2 encodes about 279 sentences/s; on 2 CPU threads about 17 sentences/s (128-token inputs). Both are slower than the 22-33M-parameter models in the table. Half-precision and quantized inference were not benchmarked.
172
+
173
+ ---
174
+
175
+ ## Benchmark
176
+
177
+ ### Methodology
178
+
179
+ - **Suite:** 28 English tasks from MTEB v1.36.15: 9 STS, 4 classification, 3 clustering, 3 pair classification, 3 reranking, 6 retrieval. Scores are each task's MTEB main score x 100 (higher is better): Spearman for STS, accuracy for classification, V-measure for clustering, average precision for pair classification, MAP for reranking, nDCG@10 for retrieval.
180
+ - **Same settings for every model:** max length 128, batch size 64, fp32, one run. The 128-token cap is applied to the baselines too, which slightly understates models that normally read 512 tokens.
181
+ - **Baselines** load through `mteb.get_model`, which applies each model's own prompts or prefixes (for example E5 and BGE).
182
+ - **STS17** is scored on the `en-en` subset only. Averaging all subsets includes cross-lingual pairs, which are meaningless for an English model.
183
+ - **Averages:** *Avg (all tasks)* is the mean of the 28 task scores. *Avg (categories)* is the mean of the six category means (each category counts equally).
184
+ - **QuoraRetrieval** is reported separately, below.
185
+ - **Hardware and versions:** 2x Tesla T4, Python 3.13.15, torch 2.11.0+cu128, transformers 4.57.6, sentence-transformers 5.7.0, mteb 1.36.15. Run date 2026-10-17.
186
+ - **Model under test:** `MineAITechnology/mine-embed-v2`, commit `9872ce36`, weights SHA-256 (first 12 hex) `c08611eafb96`.
187
+
188
+ ### Overall leaderboard
189
+
190
+ ![Overall average](benchmark_assets/overall_bar.png)
191
+
192
+ | Model | Rank | Params (M) | Avg (all tasks) | Δ vs v2 | Avg (categories) | STS | Classification | Clustering | PairClassification | Reranking | Retrieval |
193
+ |---|---:|---:|---:|---:|---:|---:|---:|---:|---:|---:|---:|
194
+ | bge-base-en-v1.5 | 1 | 109.5 | **68.09** | +8.32 | **65.81** | **84.22** | **66.69** | **39.68** | **86.56** | 67.77 | **49.94** |
195
+ | bge-small-en-v1.5 | 2 | 33.4 | 66.33 | +6.56 | 64.05 | 83.40 | 64.89 | 37.88 | 84.92 | 66.84 | 46.35 |
196
+ | gte-small | 3 | 33.4 | 66.19 | +6.42 | 63.74 | 83.64 | 62.72 | 39.15 | 83.55 | 66.21 | 47.17 |
197
+ | all-mpnet-base-v2 | 4 | 109.5 | 64.73 | +4.97 | 62.82 | 81.65 | 60.06 | 39.43 | 83.04 | **68.84** | 43.92 |
198
+ | all-MiniLM-L12-v2 | 5 | 33.4 | 63.79 | +4.03 | 61.79 | 81.37 | 59.79 | 37.56 | 82.46 | 67.58 | 41.99 |
199
+ | e5-small-v2 | 6 | 33.4 | 63.78 | +4.02 | 61.23 | 82.17 | 61.74 | 33.16 | 85.43 | 61.94 | 42.97 |
200
+ | all-MiniLM-L6-v2 | 7 | 22.7 | 63.24 | +3.48 | 61.35 | 80.20 | 59.28 | 37.08 | 82.37 | 67.12 | 42.04 |
201
+ | **mine-embed-v2** | 8 | 54.0 | 59.77 | – | 57.21 | 79.33 | 58.52 | 30.25 | 81.23 | 57.49 | 36.42 |
202
+ | average_word_embeddings_glove.6B.300d | 9 | 120.0 | 48.02 | -11.75 | 47.09 | 62.46 | 55.11 | 21.39 | 72.48 | 48.76 | 22.35 |
203
+
204
+ ### v2 against its closest small models (difference, points)
205
+
206
+ | v2 minus | STS | Classification | Clustering | PairClassification | Reranking | Retrieval | Avg (28) |
207
+ |---|---:|---:|---:|---:|---:|---:|---:|
208
+ | all-MiniLM-L6-v2 | -0.87 | -0.76 | -6.83 | -1.14 | -9.63 | -5.62 | -3.48 |
209
+ | e5-small-v2 | -2.84 | -3.22 | -2.91 | -4.20 | -4.45 | -6.55 | -4.02 |
210
+ | bge-small-en-v1.5 | -4.07 | -6.37 | -7.63 | -3.69 | -9.35 | -9.93 | -6.56 |
211
+
212
+ ### How v2 compares by category
213
+
214
+ | Category | v2 | Best | Best model | v2 as % of best | v2 rank (of 9) |
215
+ |---|---:|---:|---|---:|---:|
216
+ | STS | 79.33 | 84.22 | bge-base-en-v1.5 | 94% | 8 |
217
+ | Classification | 58.52 | 66.69 | bge-base-en-v1.5 | 88% | 8 |
218
+ | Clustering | 30.25 | 39.68 | bge-base-en-v1.5 | 76% | 8 |
219
+ | PairClassification | 81.23 | 86.56 | bge-base-en-v1.5 | 94% | 8 |
220
+ | Reranking | 57.49 | 68.84 | all-mpnet-base-v2 | 84% | 8 |
221
+ | Retrieval | 36.42 | 49.94 | bge-base-en-v1.5 | 73% | 8 |
222
+
223
+ ### Head to head (28 tasks)
224
+
225
+ | Model | Tasks v2 wins | Tasks v2 loses |
226
+ |---|---:|---:|
227
+ | bge-base-en-v1.5 | 1 | 27 |
228
+ | bge-small-en-v1.5 | 2 | 26 |
229
+ | gte-small | 2 | 26 |
230
+ | all-mpnet-base-v2 | 5 | 23 |
231
+ | all-MiniLM-L12-v2 | 5 | 23 |
232
+ | e5-small-v2 | 3 | 25 |
233
+ | all-MiniLM-L6-v2 | 4 | 24 |
234
+ | average_word_embeddings_glove.6B.300d | 27 | 1 |
235
+
236
+ ### Per-task scores
237
+
238
+ #### STS (9 tasks)
239
+
240
+ | Model | STSBenchmark | STS12 | STS13 | STS14 | STS15 | STS16 | STS17 | SICK-R | BIOSSES | Avg |
241
+ |---|---:|---:|---:|---:|---:|---:|---:|---:|---:|---:|
242
+ | bge-base-en-v1.5 | **86.42** | **78.03** | 84.18 | **82.27** | 87.96 | **85.47** | 86.41 | 80.30 | 86.94 | **84.22** |
243
+ | bge-small-en-v1.5 | 85.86 | 77.44 | 82.98 | 81.84 | 87.27 | 84.93 | 87.14 | 79.41 | 83.75 | 83.40 |
244
+ | gte-small | 85.57 | 75.12 | **85.09** | 81.03 | **88.32** | 83.91 | 87.59 | 77.93 | **88.17** | 83.64 |
245
+ | all-mpnet-base-v2 | 83.42 | 72.63 | 83.48 | 78.00 | 85.66 | 80.03 | **90.60** | **80.59** | 80.43 | 81.65 |
246
+ | all-MiniLM-L12-v2 | 83.09 | 73.08 | 82.13 | 76.73 | 85.58 | 80.23 | 88.63 | 79.32 | 83.57 | 81.37 |
247
+ | e5-small-v2 | 84.92 | 73.71 | 82.32 | 80.07 | 87.21 | 82.33 | 87.58 | 79.25 | 82.19 | 82.17 |
248
+ | all-MiniLM-L6-v2 | 82.03 | 72.37 | 80.60 | 75.59 | 85.39 | 78.99 | 87.59 | 77.58 | 81.64 | 80.20 |
249
+ | **mine-embed-v2** | 81.33 | 70.99 | 77.54 | 72.65 | 82.24 | 81.63 | 86.85 | 75.99 | 84.79 | 79.33 |
250
+ | average_word_embeddings_glove.6B.300d | 61.54 | 54.64 | 69.16 | 60.81 | 72.31 | 65.34 | 77.95 | 55.43 | 44.93 | 62.46 |
251
+ #### Classification (4 tasks)
252
+
253
+ | Model | Banking77Classification | EmotionClassification | TweetSentimentExtractionClassification | ToxicConversationsClassification | Avg |
254
+ |---|---:|---:|---:|---:|---:|
255
+ | bge-base-en-v1.5 | **83.99** | **54.60** | 61.94 | **66.22** | **66.69** |
256
+ | bge-small-en-v1.5 | 81.75 | 50.39 | **62.47** | 64.93 | 64.89 |
257
+ | gte-small | 77.22 | 48.05 | 59.67 | 65.95 | 62.72 |
258
+ | all-mpnet-base-v2 | 81.70 | 42.23 | 55.05 | 61.26 | 60.06 |
259
+ | all-MiniLM-L12-v2 | 80.41 | 41.16 | 54.24 | 63.34 | 59.79 |
260
+ | e5-small-v2 | 73.74 | 47.44 | 61.77 | 64.00 | 61.74 |
261
+ | all-MiniLM-L6-v2 | 80.04 | 40.83 | 54.04 | 62.20 | 59.28 |
262
+ | **mine-embed-v2** | 79.91 | 40.44 | 53.16 | 60.57 | 58.52 |
263
+ | average_word_embeddings_glove.6B.300d | 67.80 | 37.55 | 48.96 | 66.13 | 55.11 |
264
+ #### Clustering (3 tasks)
265
+
266
+ | Model | TwentyNewsgroupsClustering | BiorxivClusteringS2S | MedrxivClusteringS2S | Avg |
267
+ |---|---:|---:|---:|---:|
268
+ | bge-base-en-v1.5 | **50.75** | **36.62** | 31.68 | **39.68** |
269
+ | bge-small-en-v1.5 | 48.13 | 34.42 | 31.08 | 37.88 |
270
+ | gte-small | 50.62 | 34.77 | 32.04 | 39.15 |
271
+ | all-mpnet-base-v2 | 50.07 | 34.82 | **33.42** | 39.43 |
272
+ | all-MiniLM-L12-v2 | 47.28 | 32.96 | 32.42 | 37.56 |
273
+ | e5-small-v2 | 40.70 | 31.02 | 27.76 | 33.16 |
274
+ | all-MiniLM-L6-v2 | 46.49 | 32.88 | 31.86 | 37.08 |
275
+ | **mine-embed-v2** | 40.51 | 24.31 | 25.93 | 30.25 |
276
+ | average_word_embeddings_glove.6B.300d | 24.93 | 18.74 | 20.49 | 21.39 |
277
+ #### PairClassification (3 tasks)
278
+
279
+ | Model | SprintDuplicateQuestions | TwitterSemEval2015 | TwitterURLCorpus | Avg |
280
+ |---|---:|---:|---:|---:|
281
+ | bge-base-en-v1.5 | 96.37 | **77.68** | 85.64 | **86.56** |
282
+ | bge-small-en-v1.5 | **96.67** | 73.24 | 84.84 | 84.92 |
283
+ | gte-small | 95.61 | 70.12 | 84.92 | 83.55 |
284
+ | all-mpnet-base-v2 | 90.15 | 73.87 | 85.11 | 83.04 |
285
+ | all-MiniLM-L12-v2 | 92.58 | 70.02 | 84.77 | 82.46 |
286
+ | e5-small-v2 | 95.08 | 75.24 | **85.96** | 85.43 |
287
+ | all-MiniLM-L6-v2 | 94.55 | 67.86 | 84.70 | 82.37 |
288
+ | **mine-embed-v2** | 93.99 | 64.12 | 85.57 | 81.23 |
289
+ | average_word_embeddings_glove.6B.300d | 86.96 | 53.12 | 77.35 | 72.48 |
290
+ #### Reranking (3 tasks)
291
+
292
+ | Model | AskUbuntuDupQuestions | StackOverflowDupQuestions | SciDocsRR | Avg |
293
+ |---|---:|---:|---:|---:|
294
+ | bge-base-en-v1.5 | 62.18 | **54.51** | 86.62 | 67.77 |
295
+ | bge-small-en-v1.5 | 61.82 | 53.44 | 85.26 | 66.84 |
296
+ | gte-small | 61.74 | 52.05 | 84.83 | 66.21 |
297
+ | all-mpnet-base-v2 | **65.85** | 52.00 | **88.65** | **68.84** |
298
+ | all-MiniLM-L12-v2 | 64.06 | 51.48 | 87.20 | 67.58 |
299
+ | e5-small-v2 | 57.48 | 46.87 | 81.46 | 61.94 |
300
+ | all-MiniLM-L6-v2 | 63.48 | 50.76 | 87.12 | 67.12 |
301
+ | **mine-embed-v2** | 55.92 | 43.97 | 72.58 | 57.49 |
302
+ | average_word_embeddings_glove.6B.300d | 49.57 | 34.14 | 62.56 | 48.76 |
303
+ #### Retrieval (6 tasks)
304
+
305
+ | Model | SciFact | NFCorpus | FiQA2018 | ArguAna | SCIDOCS | TRECCOVID | Avg |
306
+ |---|---:|---:|---:|---:|---:|---:|---:|
307
+ | bge-base-en-v1.5 | **72.22** | **37.18** | 37.12 | **58.10** | 21.86 | **73.15** | **49.94** |
308
+ | bge-small-en-v1.5 | 68.03 | 32.98 | 35.33 | 52.81 | 19.10 | 69.85 | 46.35 |
309
+ | gte-small | 71.07 | 34.45 | 35.08 | 53.99 | 21.40 | 67.04 | 47.17 |
310
+ | all-mpnet-base-v2 | 62.82 | 33.17 | **45.22** | 43.98 | **23.39** | 54.92 | 43.92 |
311
+ | all-MiniLM-L12-v2 | 62.64 | 32.25 | 37.27 | 47.13 | 21.82 | 50.81 | 41.99 |
312
+ | e5-small-v2 | 61.97 | 31.93 | 33.64 | 42.92 | 16.99 | 70.35 | 42.97 |
313
+ | all-MiniLM-L6-v2 | 62.39 | 31.45 | 36.63 | 48.76 | 21.72 | 51.28 | 42.04 |
314
+ | **mine-embed-v2** | 53.31 | 28.17 | 25.08 | 49.05 | 13.93 | 48.98 | 36.42 |
315
+ | average_word_embeddings_glove.6B.300d | 29.58 | 13.87 | 10.09 | 36.30 | 8.04 | 36.22 | 22.35 |
316
+
317
+ ### v2 position on every task
318
+
319
+ | Task | Category | v2 | Rank (of 9) | Best | Best model | % of best |
320
+ |---|---|---:|---:|---:|---|---:|
321
+ | STSBenchmark | STS | 81.33 | 8 | 86.42 | bge-base-en-v1.5 | 94% |
322
+ | STS12 | STS | 70.99 | 8 | 78.03 | bge-base-en-v1.5 | 91% |
323
+ | STS13 | STS | 77.54 | 8 | 85.09 | gte-small | 91% |
324
+ | STS14 | STS | 72.65 | 8 | 82.27 | bge-base-en-v1.5 | 88% |
325
+ | STS15 | STS | 82.24 | 8 | 88.32 | gte-small | 93% |
326
+ | STS16 | STS | 81.63 | 5 | 85.47 | bge-base-en-v1.5 | 96% |
327
+ | STS17 | STS | 86.85 | 7 | 90.60 | all-mpnet-base-v2 | 96% |
328
+ | SICK-R | STS | 75.99 | 8 | 80.59 | all-mpnet-base-v2 | 94% |
329
+ | BIOSSES | STS | 84.79 | 3 | 88.17 | gte-small | 96% |
330
+ | Banking77Classification | Classification | 79.91 | 6 | 83.99 | bge-base-en-v1.5 | 95% |
331
+ | EmotionClassification | Classification | 40.44 | 8 | 54.60 | bge-base-en-v1.5 | 74% |
332
+ | TweetSentimentExtractionClassification | Classification | 53.16 | 8 | 62.47 | bge-small-en-v1.5 | 85% |
333
+ | ToxicConversationsClassification | Classification | 60.57 | 9 | 66.22 | bge-base-en-v1.5 | 91% |
334
+ | TwentyNewsgroupsClustering | Clustering | 40.51 | 8 | 50.75 | bge-base-en-v1.5 | 80% |
335
+ | BiorxivClusteringS2S | Clustering | 24.31 | 8 | 36.62 | bge-base-en-v1.5 | 66% |
336
+ | MedrxivClusteringS2S | Clustering | 25.93 | 8 | 33.42 | all-mpnet-base-v2 | 78% |
337
+ | SprintDuplicateQuestions | PairClassification | 93.99 | 6 | 96.67 | bge-small-en-v1.5 | 97% |
338
+ | TwitterSemEval2015 | PairClassification | 64.12 | 8 | 77.68 | bge-base-en-v1.5 | 83% |
339
+ | TwitterURLCorpus | PairClassification | 85.57 | 3 | 85.96 | e5-small-v2 | 100% |
340
+ | AskUbuntuDupQuestions | Reranking | 55.92 | 8 | 65.85 | all-mpnet-base-v2 | 85% |
341
+ | StackOverflowDupQuestions | Reranking | 43.97 | 8 | 54.51 | bge-base-en-v1.5 | 81% |
342
+ | SciDocsRR | Reranking | 72.58 | 8 | 88.65 | all-mpnet-base-v2 | 82% |
343
+ | SciFact | Retrieval | 53.31 | 8 | 72.22 | bge-base-en-v1.5 | 74% |
344
+ | NFCorpus | Retrieval | 28.17 | 8 | 37.18 | bge-base-en-v1.5 | 76% |
345
+ | FiQA2018 | Retrieval | 25.08 | 8 | 45.22 | all-mpnet-base-v2 | 55% |
346
+ | ArguAna | Retrieval | 49.05 | 4 | 58.10 | bge-base-en-v1.5 | 84% |
347
+ | SCIDOCS | Retrieval | 13.93 | 8 | 23.39 | all-mpnet-base-v2 | 60% |
348
+ | TRECCOVID | Retrieval | 48.98 | 8 | 73.15 | bge-base-en-v1.5 | 67% |
349
+
350
+ ### QuoraRetrieval
351
+
352
+ v2's training script excludes Quora duplicate-question data, so this task is a clean test for v2. Several baselines (for example the `all-*` sentence-transformers models) include Quora duplicates in training, so for them it is partly in-domain. It is therefore shown separately and left out of the 28-task averages. Including it as a 29th task gives:
353
+
354
+ | Model | QuoraRetrieval | Avg (29, incl. Quora) | Rank (29) |
355
+ |---|---:|---:|---:|
356
+ | bge-base-en-v1.5 | **88.74** | **68.80** | 1 |
357
+ | bge-small-en-v1.5 | 88.64 | 67.10 | 2 |
358
+ | gte-small | 88.02 | 66.94 | 3 |
359
+ | all-mpnet-base-v2 | 87.46 | 65.52 | 4 |
360
+ | all-MiniLM-L12-v2 | 87.75 | 64.62 | 5 |
361
+ | e5-small-v2 | 84.94 | 64.51 | 6 |
362
+ | all-MiniLM-L6-v2 | 87.56 | 64.08 | 7 |
363
+ | **mine-embed-v2** | 84.07 | 60.61 | 8 |
364
+ | average_word_embeddings_glove.6B.300d | 71.33 | 48.82 | 9 |
365
+
366
+ ### v1 to v2
367
+
368
+ v1 (`mine-embed-57M`) was only run on a 6-task smoke test, so this is the only like-for-like comparison:
369
+
370
+ | Task | v1 (mine-embed-57M) | v2 | Δ |
371
+ |---|---:|---:|---:|
372
+ | AskUbuntuDupQuestions | 45.57 | 55.92 | +10.36 |
373
+ | Banking77Classification | 47.51 | 79.91 | +32.39 |
374
+ | STSBenchmark | 68.60 | 81.33 | +12.72 |
375
+ | SciFact | 8.08 | 53.31 | +45.23 |
376
+ | SprintDuplicateQuestions | 49.84 | 93.99 | +44.14 |
377
+ | TwentyNewsgroupsClustering | 13.51 | 40.51 | +26.99 |
378
+ | **Average (6 tasks)** | 38.85 | 67.49 | +28.64 |
379
+
380
+ ### Efficiency
381
+
382
+ Tesla T4 (GPU) and 2 CPU threads, 128-token synthetic inputs, batch 64, fp32, every model loaded through the same sentence-transformers path in the same session.
383
+
384
+ | Model | Params (M) | Dim | fp32 size (MB) | GPU sent/s | CPU sent/s | Peak GPU MB | Avg (28) |
385
+ |---|---:|---:|---:|---:|---:|---:|---:|
386
+ | all-MiniLM-L6-v2 | 22.7 | 384 | 86.6 | 734.1 | 50.6 | 240.2 | 63.2 |
387
+ | all-MiniLM-L12-v2 | 33.4 | 384 | 127.3 | 413.4 | 26.9 | 280.9 | 63.8 |
388
+ | bge-small-en-v1.5 | 33.4 | 384 | 127.3 | 422.2 | 26.6 | 280.9 | 66.3 |
389
+ | e5-small-v2 | 33.4 | 384 | 127.3 | 418.9 | 26.1 | 280.9 | 63.8 |
390
+ | gte-small | 33.4 | 384 | 127.3 | 419.3 | 26.4 | 280.9 | 66.2 |
391
+ | **mine-embed-v2** | 54.0 | 512 | 205.9 | 278.6 | 16.7 | 407.9 | 59.8 |
392
+ | bge-base-en-v1.5 | 109.5 | 768 | 417.6 | 131.5 | 8.5 | 715.9 | **68.1** |
393
+ | all-mpnet-base-v2 | 109.5 | 768 | 417.7 | 120.3 | 7.3 | 763.8 | 64.7 |
394
+ | average_word_embeddings_glove.6B.300d | 120.0 | 300 | 457.8 | 8649.1 | 3919.3 | 531.8 | 48.0 |
395
+
396
+ GloVe is a non-transformer lookup baseline, so its speed is not meaningful for comparison. Peak GPU memory includes the weights.
397
+
398
+ ![Quality vs size](benchmark_assets/quality_vs_size.png)
399
+
400
+ ---
401
+
402
+ ## Where v2 is useful, and where it is not
403
+
404
+ **Closest to the leaders (about 94% of the best score):** sentence similarity (STS) and duplicate or paraphrase detection (pair classification). On TwitterURLCorpus it is within 0.4 points of the best model, and on BIOSSES and ArguAna it ranks 3rd and 4th among the eight transformer models.
405
+
406
+ **Reasonable:** intent and short-text classification (category average 58.5, within about 1 point of MiniLM-L6 at 59.3; Banking77 alone is 79.9).
407
+
408
+ **Weak:** retrieval (36.4 vs 49.9 best), reranking (57.5 vs 68.8) and clustering (30.3 vs 39.7). The weakest single tasks are FiQA2018 (financial questions), SCIDOCS and SciDocsRR (scientific papers).
409
+
410
+ **Practical reading:** good for matching short sentences, finding duplicate questions or tickets, and classifying short messages. Not yet a good choice for searching long documents or domain-heavy corpora. It is also larger and slower than MiniLM, bge-small, gte-small and e5-small, so there is no efficiency advantage today.
411
+
412
+ ---
413
 
414
  ## Training
415
+
416
+ The full script is `train_mine_embed_v2.ipynb`. Summary:
417
+
418
+ 1. **Backbone:** `google/bert_uncased_L-12_H-512_A-8` (BERT miniature, 12 layers, hidden size 512), pretrained and then trained further. It is not trained from scratch.
419
+ 2. **Stage 1, pair contrastive:** symmetric InfoNCE with global in-batch negatives, global batch 4096 (GradCache, fp16), temperature 0.02, AdamW, cosine schedule, no dropout. Budget in the script: about 9 hours on 2x Tesla T4.
420
+ 3. **Stage 2, hard negatives:** MS MARCO BM25 triplets and AllNLI triplets, global batch 2048, lower learning rate, about 1.5 hours.
421
+ 4. **Data:** public datasets only, from sources such as GooAQ, PAQ, WikiAnswers duplicates, NPR, CC-News, XSum, ELI5, Natural Questions, SQuAD, TriviaQA, WikiHow, AG News, MS MARCO and AllNLI (full list with license notes in the training notebook).
422
+ 5. **Deliberately not used in training:** Quora duplicates, StackExchange duplicates, S2ORC/SPECTER, and any BEIR or MTEB task training split, to keep evaluation clean. The leading baselines use some of these sources, so the comparison is not perfectly equal: v2's scores are cleaner, theirs are partly in-domain.
423
+ 6. Training data volume is on the order of 10 million pairs per epoch, far less than the hundreds of millions used by the best small models. This is the main reason for the retrieval gap, and the first thing the next version addresses.
424
+
425
+ ---
426
+
427
+ ## Limitations
428
+
429
+ - English only. Other languages, including Urdu and Roman Urdu, are not supported.
430
+ - Inputs longer than 128 tokens are truncated (about 80-100 words). The model was not trained or tested on longer text.
431
+ - Weaker retrieval, reranking and clustering than every transformer baseline in the table.
432
+ - Larger and slower than the 22-33M-parameter baselines.
433
+ - Single benchmark run per model; no confidence intervals. Differences under about 0.5 points on one task should not be over-read.
434
+ - The benchmark covers English MTEB tasks only. It says nothing about domain-specific data, code, or other languages.
435
+ - Embeddings can reflect biases in the training data. Evaluate on your own data before relying on it for decisions that affect people.
436
+
437
+ ---
438
+
439
+ ## Reproduce the benchmark
440
+
441
+ The benchmark notebook (`benchmark_mine_embed_v2.ipynb`) writes `run_benchmark.py`. On Kaggle (2x T4, internet on, `HF_TOKEN` secret set):
442
+
443
+ ```bash
444
+ python run_benchmark.py --sanity # load the model, check similarities and STS-B
445
+ BENCH_QUICK=1 python run_benchmark.py # 6-task smoke test
446
+ python run_benchmark.py # full 28 tasks: v2 + all baselines (resumable)
447
+ python run_benchmark.py --phase report # rebuild report.md and the zip from existing results
448
+ ```
449
+
450
+ The output zip contains the raw MTEB result JSON for every model and task, `per_task.csv`, `summary_by_category.csv`, `efficiency.csv` and `environment.json` with the exact weights hash.
451
+
452
+ ---
453
+
454
+ ## License and data
455
+
456
+ The training code and benchmark scripts can be released under Apache-2.0. The model weights are **not yet licensed**: the training data comes from public datasets whose terms differ (several are share-alike, and at least one, PAQ, may be non-commercial). Until a dataset-by-dataset review is finished, treat the weights as research use only and check this section again before commercial use. The backbone (`google/bert_uncased_L-12_H-512_A-8`) is Apache-2.0.
457
+
458
+ ## Citation
459
+
460
+ ```
461
+ @misc{mineembedv2,
462
+ title = {mine-embed-v2: a 54M-parameter English text-embedding model},
463
+ author = {MineAI Technology},
464
+ year = {2026},
465
+ url = {https://huggingface.co/MineAITechnology/mine-embed-v2}
466
+ }
467
+ ```