Views
No views yet

💡 Think of a sentence as a queue of people. The last person (EOS) has "heard" everyone before them through causal attention, so they alone can summarize the whole sentence.

💡 Contrastive learning is like a "find your friend" game: push the correct match closer, push strangers further away. But what if a "stranger" is actually your friend (false negative)? We detect and mask them!


💡 Like Russian nesting dolls — the big doll (768-dim) contains smaller dolls (512/256/128/64-dim), each fully functional at its size.

| Item | Value |
|---|---|
| Architecture | MiniMind-3 (causal decoder-only Transformer) |
| Parameters | 64M |
| Hidden size | 768 |
| Layers | 8 |
| Attention heads | 8 (query) / 4 (KV, GQA) |
| Vocab size | 6400 |
| Embedding output dim | 768 (MRL: truncatable to 512/256/128/64) |
| Max sequence length | 8192 (backbone supports 32768) |
| Pooling | last-token |
| Features | L2-normalized; MRL multi-dim |
| Stage | Data | Loss | Steps | Final Loss | Status |
|---|---|---|---|---|---|
| 1. Weakly-supervised | T2Ranking triplets (90k) | Standard InfoNCE | 1,413 | 0.43 | ✅ Done |
| 2. Supervised | T2Ranking-15 (340k, 15 hard negs) | InfoNCE + false-neg mask + MRL | 63,768 (3 epochs) | 0.72 | ✅ Done |
| 3. Model merging | Last 5 Stage-2 checkpoints | SLERP | — | — | ✅ Done |

| Hyperparameter | Value |
|---|---|
| Temperature τ | 0.02 |
| False-neg margin | 0.1 |
| Hard negatives | 7 per query |
| Batch size | 16 |
| Learning rate | 1e-5 (Stage 2), 2e-4 (Stage 1) |
| MRL dims | [768, 512, 256, 128, 64] |

| Task | Samples | Score |
|---|---|---|
| ATEC | 20,000 | 0.265 |
| BQ | 10,000 | 0.379 |
| LCQMC | 12,500 | 0.631 |
| STSB | 1,361 | 0.637 |
| Average | 0.478 |

| Model | Params | C-MTEB STS |
|---|---|---|
| This model | 64M | 0.478 |
| BGE-small-zh | 24M | ~0.60 |
| BGE-large-zh | 326M | ~0.66 |
| Qwen3-Embedding-0.6B | 600M | ~0.66 |
Honest note: scores are bounded by the small vocab (6400) and limited Stage-1 data (90k vs Qwen3's 150M). The value is the complete, reproducible Qwen3-Embedding pipeline.
1from sentence_transformers import SentenceTransformer
2from sentence_transformers.util import cos_sim
3
4model = SentenceTransformer("Muzian/minimind-embedding-dense")
5
6documents = ["天空呈蓝色是因为阳光散射。", "红烧肉的做法是..."]
7doc_embs = model.encode(documents, normalize_embeddings=True)
8
9queries = ["天空为什么是蓝色的"]
10query_embs = model.encode(queries, prompt_name="query", normalize_embeddings=True)
11
12scores = cos_sim(query_embs, doc_embs)1# Use only first 256 dims (smaller index, faster search)
2emb_256 = embedding[:, :256]
3emb_256 = F.normalize(emb_256, p=2, dim=1)