An embedding model is a transformer plus a pooling step that maps any text to one vector of fixed length, trained with a contrastive loss so that a query and the passage that answers it point the same way; which model works for you is decided on your own labelled queries with paired statistics, not by a leaderboard.
Fig. 1 follows one real pair through bge-small: the shortest SciFact test claim and its labelled abstract. The section that owns each part is named in its step.
You need: InfoNCE as a softmax over a line-up of candidates (Contrastive and self-supervised learning, section "InfoNCE, the workhorse loss"), nDCG@10 and bootstrap intervals (Evaluation metrics), and the parent Topic: rag-and-retrieval for where retrieval sits in a pipeline. The running example: SciFact (5,183 scientific abstracts and 300 test claims) and NFCorpus (3,633 medical documents and 323 test queries).
src/scripts; relevance numbers (nDCG@10, recall) are deterministic and do not depend on the machine. published: a paper, model card or results repository, with its date. derived: computed from numbers shown, with the formula. nDCG@10 scores how high the relevant documents sit in the top 10 (1 is perfect); recall@100 is the share of relevant documents anywhere in the top 100.Why one vector. Relevance belongs to a pair, but a corpus has millions of documents and a query arrives in real time. A bi-encoder computes every document vector once, at indexing; a query then costs one model pass plus dot products. A cross-encoder reads query and document together (more accurate, nothing precomputable), so it can only reorder a short list; it is owned by Rerankers and late interaction, as is late interaction (ColBERT: one small vector per token). The gap, from the topic's own timings (MPS, batch 1) measured here:
| step, per query | bi-encoder | cross-encoder |
|---|---|---|
| encode the query (bge-small / Qwen3-Embedding-0.6B) | 10.0 / 51.3 ms | none |
| score all 5,183 abstracts | 0.5 ms (exact dot products) | 21.9 s (MiniLM cross-encoder, 236.8 pairs/s) |
| rerank only the top 30 | not needed | 155 ms (MiniLM) to 6.6 s (Qwen3-Reranker-0.6B) |
The all-documents cell is derived: 5,183 / 236.8 pairs per second. The others: the setup's timings and the root's latency run (its src/pipe) (p50 over 40 claims, 2026-10-14). So every pipeline uses both: the bi-encoder (with BM25) narrows millions to tens, the cross-encoder orders the tens.
The two steps after the transformer. The transformer returns one vector per token. Pooling keeps one: CLS (the first token; bge-small, gte-modernbert), mean (average of the real tokens, padding ignored; all-MiniLM-L6, e5-small-v2) or last token (Qwen3-Embedding: in a decoder only the last token has seen the whole text). Normalisation divides by the length, so a dot product is a cosine (section 2; gte-modernbert ships without this step). The pooling is fixed by training, written in the model's 1_Pooling/config.json and modules.json: read them before writing your own inference.
Fig. 2: the claim "" through each model's real weights (CPU, float32). The second switch runs the same hidden states through a different pooling. measured here
How much the wrong pooling costs in retrieval depends on the model, measured over whole corpora with queries pooled the same wrong way (512 tokens): bge-small read with mean pooling loses almost nothing (SciFact nDCG@10 0.708 instead of 0.713; NFCorpus 0.347 instead of 0.343), while MiniLM-L6 read with CLS pooling drops from 0.654 to 0.597 on SciFact and from 0.310 to 0.289 on NFCorpus. Nothing in the code warns you either way. measured here Each model also lives at its own scale before normalising (on the six texts of the table below, MiniLM's pooled vectors have length about 2 to 5, Qwen3's about 100), so cosines from different models are never comparable.
sentence_transformers/sentence_transformer/modules/pooling.py, lines 185 to 195 (CLS), 200 to 214 (mean) and 232 to 242 (last token), read in the installed package
sentence_transformers/base/modules/normalize.py, lines 39 to 43
Two details that bite people who write their own inference: the CLS branch takes the first real token (argmax on the mask), so left padding is handled; the last-token branch finds the last real token from the mask, so a decoder embedder works with either padding side. Rebuilt by hand with plain transformers (scripts/e_pooling.py), the five models give vectors identical to SentenceTransformer.encode (largest difference 0.0). Tokenisation differs per model (WordPiece pieces such as cc ##l ##19 with [CLS] and [SEP] for BERT-style models, byte-level pieces and an end-of-text token for Qwen3; see Tokenizers). measured here
"Length before normalising" is the pooled vector's L2 length on 6 texts.
A small case first. Query q = (0.6, 0.8), length 1. Documents d1 = (1, 0), d2 = (0, 1) and d3 = (2, 0), which points the same way as d1 but is twice as long.
The dot product Σ qidi grows with both lengths; the cosine divides it by both lengths, so only the angle counts; the L2 distance |q − d| is smaller when closer. For vectors of length 1 the three rank documents identically, because |q − d|2 = 2 − 2 cos(q, d). On real vectors: gte-modernbert has no Normalize step, and ranking its raw vectors by dot product drops SciFact nDCG@10 from 0.767 to 0.740, while L2 and cosine agree (the parent's shared runs, src/vec) measured here (parent page).
Rule. For a model trained with cosine (all five here), normalise once at indexing and use the inner product, which every vector index (Vector indexes from the inside) does fastest; never mix normalised documents with an unnormalised query. Hosted APIs usually return normalised vectors: OpenAI's embeddings are "normalized to length 1" (its embeddings guide, read 2026-10-14) published, vendor.
Dot products 0.6, 0.8, 1.2: d3 first. Cosines 0.6, 0.8, 0.6: d2 first, d1 and d3 tied. L2 distances 0.894, 0.632, 1.612: d2 first. Check: 2 − 2 × 0.8 = 0.4 = 0.6322. derived
The problem. A pretrained transformer's hidden states are not a retrieval space: masked-token or next-token training never asked a claim and its evidence to point the same way. The geometry is taught with (query, positive) pairs: a question and its answer passage, a title and its body, a claim and its evidence, a search and the page clicked. SciFact's train split gives 919 pairs from 809 claims; production models use hundreds of millions (Qwen3-Embedding: about 150 million synthetic pairs for a weakly supervised first stage, then about 12 million selected synthetic pairs plus labelled data, then model merging; arXiv 2506.05176, sections 3.2 and 3.3) published, vendor.
Fig. 3 is a real batch: 8 SciFact train claims the parent drew at random (seed 0), each with its labelled abstract and its own mined hard negative, scored by bge-small (the parent's src/vec/out/contrastive.json). Probabilities and losses are derived from those cosines with the formula below at τ = 0.05.
This is InfoNCE (van den Oord et al. 2018, arXiv 1807.03748) with in-batch negatives as Dense Passage Retrieval used them (Karpukhin et al. 2020, arXiv 2004.04906): free, because the batch's documents are embedded anyway. How its gradient splits among the negatives and what τ does is taught on Contrastive and self-supervised learning (48 real sentence pairs with a τ slider); its reading as a bound on mutual information on Information theory for ML; the same loss on image-text pairs (CLIP, SigLIP) on Vision encoders. The short version: nearly all the push lands on the one or two negatives closest to the query, which is why section 4 is about choosing them.
Batch size. A bigger batch is a bigger line-up. The parent's measurement on real vectors: with 8 candidates the labelled abstract already beats all in-batch negatives for 97.9% of train claims under bge-small; with 512, for 82.8% measured here (parent page). Small batches give a nearly solved task and little gradient, which is why BGE's general-purpose stage trained with batches up to 19,200 and in-batch negatives only (C-Pack, arXiv 2309.07597, section 3.4) published. Section 5 shows that at a fixed number of epochs on a small set this advice can reverse.
Duplicates. In SciFact train, 248 abstracts are the positive of more than one claim (602 of the 919 pairs), so a random batch of 32 holds such a clash about 46% of the time (derived, assuming independent draws). This page's loss masks any column labelled relevant to the row; sentence-transformers offers a no-duplicates batch sampler instead.
sentence-transformers 6.1.0, sentence_transformers/sentence_transformer/losses/multiple_negatives_ranking.py, lines 322 to 338 (the end of compute_loss_from_embeddings; sim_matrices["query_to_doc"] is the B × (B + B·negatives) cosine matrix already multiplied by the scale)
scripts/e_train.py, verified by e_losscheck.py) gives 0.8568 and sentence-transformers' MultipleNegativesRankingLoss 0.8568 (difference 2e-07). measured hereCachedMultipleNegativesRankingLoss) embeds the batch without gradients, takes the loss's gradient with respect to the embeddings, then re-encodes chunk by chunk with gradients. Ours, at chunk 4 against one plain backward pass, gives parameter gradients equal to a relative difference of 1e-06. measured hereHard negatives teach fine distinctions: a random cardiology abstract is trivially wrong for a claim about a chemokine; an abstract about the same chemokine that does not support the claim is what the model must learn to rank second. They are mined by running a retriever over the corpus and taking high-ranked documents not labelled relevant. Two miners on the 919 SciFact train pairs (scripts/e_mine.py), BM25 and bge-small, have top-10 pools that overlap by only 33% on average: they find different negatives. measured here
False negatives are the catch: "not labelled relevant" is not "irrelevant". SciFact's annotators labelled the abstracts cited for each claim, not every abstract that bears on it.
Two models agreeing is a strong hint that a label is missing. For 154 pairs both put the same unlabelled abstract first; they read like this:
Per (claim, positive) pair: does the top unlabelled abstract of the whole corpus score above the labelled one? Both bge-small and Qwen3-Embedding say yes for 33.8% of pairs. Counted per claim with its first labelled abstract (the parent's way), the rates are 38.8% for bge-small and 38.4% for Qwen3-Embedding, equal to the parent's 38.8% and 38.4%. measured here
Filtering. NV-Retriever (Moreira et al. 2024, arXiv 2407.15831) proposed positive-aware mining: drop candidates scoring above 95% of the positive's own score ("TopK-PercPos"), their best setting published; sentence-transformers' mine_hard_negatives(relative_margin=0.05) is the same rule. Qwen3-Embedding's loss instead masks any negative scoring more than 0.1 above the positive (report, section 3.1). On SciFact train with bge-small scores, the 95% filter removes 42.1% of the top-10 dense candidates; the first surviving candidate sits at rank 3 (median), and 65 pairs have none left in the top 200, so they fall back to a random abstract. measured here Other remedies: skip the very top ranks when sampling, let a guide model mask candidates it scores above the positive (GISTEmbed, section 12), or relabel the candidates with a cross-encoder. Whether filtering helps is an empirical question: the sibling Rerankers and late interaction found random negatives beat BM25-mined ones for a cross-encoder on the same 809 train claims (rerank nDCG@10 0.734 against 0.726, 2 seeds each) and named false negatives as the likely cause; section 5 tests it on a bi-encoder.
The question. Does in-domain contrastive training help a small general model on SciFact, and does the choice of negatives matter once false negatives are counted? bge-small-en-v1.5 (33 M parameters) trained on the 919 SciFact train pairs for 2 epochs, InfoNCE at τ = 0.05, four arms at batch 32: in-batch negatives only; +BM25 one BM25-mined negative per pair; +dense one bge-small-mined negative; +dense, filtered the same after the 95% filter. Plus in-batch only at batch 8 and 128. Three seeds each; the spread across seeds is the noise floor. Deliberately tiny: it shows the mechanics and their size on one corpus, not a production recipe.
How to read a small difference: one model's nDCG@10 on 300 claims carries a 95% interval about ±0.05 wide (section 11), but two runs on the same claims are compared with a paired bootstrap, which is much tighter; seeds add their own spread, which only repeats reveal. A difference smaller than the spread across seeds is not a finding.
| setting | value |
|---|---|
| model | bge-small-en-v1.5 (33 M parameters, CLS pooling, normalised), its query prefix on claims, 512 tokens, float32 on MPS |
| data | SciFact train: 919 (claim, labelled abstract) pairs from 809 claims; nothing from the test claims |
| loss | InfoNCE, τ = 0.05, labelled-relevant columns masked; gradient caching in chunks of 16 |
| optimiser | AdamW, learning rate 2e-5, weight decay 0.01, 10% warm-up then linear decay, 2 epochs |
| mined negatives | each drawn per epoch from the top 10 of its pool |
| batch-size arm | in-batch only at batch 8, 32 and 128 (same epochs, so a larger batch also means fewer steps: the two effects are not separated) |
| repeats | 3 seeds per arm |
| evaluation | re-embed the SciFact and NFCorpus corpora with the trained weights; nDCG@10 on the test queries; paired bootstrap against the starting model |
| arm | SciFact nDCG@10 (seed mean) | seed range | gain over the starting model (paired 95%) | against in-batch only (paired 95%) | NFCorpus nDCG@10 | NFCorpus change (paired 95%) |
|---|---|---|---|---|---|---|
| starting model | 0.713 | 0.343 | ||||
| in-batch only | 0.746 | 0.005 | +0.016 to +0.051 | reference | 0.354 | +0.004 to +0.019 |
| +BM25 negatives | 0.756 | 0.004 | +0.026 to +0.061 | +0.004 to +0.016 | 0.354 | +0.004 to +0.019 |
| +dense negatives | 0.757 | 0.003 | +0.028 to +0.062 | +0.005 to +0.018 | 0.357 | +0.006 to +0.021 |
| +dense negatives, filtered | 0.748 | 0.004 | +0.018 to +0.053 | -0.002 to +0.007 | 0.357 | +0.006 to +0.022 |
| in-batch, batch 8 | 0.760 | 0.001 | +0.026 to +0.068 | +0.005 to +0.023 | 0.352 | +0.001 to +0.016 |
| in-batch, batch 128 | 0.732 | 0.002 | +0.006 to +0.032 | -0.026 to -0.003 | 0.352 | +0.003 to +0.015 |
Measured on Apple M1 Pro (MPS), 2026-10-15 09:04; per-query nDCG@10 averaged over seeds before the paired bootstrap (10,000 resamples of the test queries). measured here
What training does to the vectors. Twelve SciFact test claims (never trained on), each with its labelled abstract, its three highest-scoring unlabelled abstracts under the starting model, and twelve random abstracts, re-encoded every 4 training steps. Fig. 4 is exact, not a projection: each abstract sits at distance 1 − cosine from the claim at the centre, at a fixed angle (the angle only groups the kinds), so moving in means "more similar". Predict before it plays: does the labelled abstract move closer to the claim?
What to watch. Training spreads the whole space: with filtered dense negatives the mean cosine of a claim to the random abstracts falls from 0.564 to 0.246, and to its own labelled abstract from 0.741 to 0.619. Absolute cosines fall; what retrieval needs is the gap between the labelled abstract and everything else. On these 12 claims the labelled abstract wins before training for 7 and after for 6: a sample this small does not show the gain that the 300-claim nDCG@10 measures (the chart above), which is why this view is for seeing the mechanism and the chart for judging it. measured here
All twelve claims at the current step. Margin = cosine to the labelled abstract minus the highest cosine to any other abstract in the set; positive means the labelled abstract wins.
The problem. Queries are short questions or claims; documents are long statements. Many models are trained with a marker for the side, some with a task description:
| model | query side | document side | what the card says |
|---|---|---|---|
| e5-small-v2 | query: | passage: | "Yes, this is how the model is trained, otherwise you will see a performance degradation" (FAQ, card at revision ffb93f3b, read 2026-10-14) published, vendor |
| bge-small | Represent this sentence for searching relevant passages: | nothing | |
| Qwen3-Embedding | Instruct: <task>\nQuery: | nothing | instructions "typically" improve results by 1% to 5% published, vendor |
| all-MiniLM-L6, gte-modernbert | nothing | nothing |
bge-small without its prefix: SciFact 0.713 to 0.720 (paired interval -0.006 to +0.021), NFCorpus 0.343 to 0.337 (-0.013 to +0.002): opposite directions, both inside their intervals, so on these sets the prefix is a coin toss, not the rule its card implies. Qwen3-Embedding: no instruction costs 2.1 points on SciFact and 6.6 on NFCorpus, clear of the noise; the wording barely matters (the card's generic web-search instruction 0.702 against the task instruction's 0.700 on SciFact, interval -0.011 to +0.014; 0.356 against 0.363 on NFCorpus, -0.013 to -0.000; the other set's instruction 0.368 on NFCorpus, -0.001 to +0.011). A decoder embedder trained with instructions needs to be told "this is a query"; which task it is told matters much less.
Queries re-encoded with each setting (CPU, float32), stored document vectors searched (scripts/e_prefix.py). Dot: difference to the model's documented setting; bar: its paired 95% interval; red when the whole interval is below zero. measured here
e5-small-v2 (each corpus re-embedded with and without "passage: ", on MPS): with both prefixes 0.688 on SciFact (the MTEB results repository has 0.689) and 0.325 on NFCorpus; with neither, 0.680 and 0.318 (paired 95% interval of the difference: -0.028 to +0.013 and -0.014 to +0.001); with only the query prefix, 0.687 and 0.320. Its card's warning is right in direction but small here: under one nDCG@10 point, and both intervals include zero. measured here
Qwen3-Embedding stores 1,024 float32 numbers per text: 4,096 bytes, 4 GB for a million chunks (derived: 106 × 1,024 × 4 bytes). Two knobs shrink it: keep the first m numbers, or store fewer bits per number. Whether cutting works depends on training:
Matryoshka Representation Learning (Kusupati et al. 2022, arXiv 2205.13147) adds the loss on every prefix, so the front of the vector carries the most; sentence-transformers wraps any loss this way (MatryoshkaLoss). Qwen3-Embedding was trained like this (its card: "user-defined output dimensions ranging from 32 to 1024"); bge-small was not.
The defaults reproduce the parent's figures from its own output: Qwen3-Embedding keeps 98% of its nDCG@10 at half its dimensions and 95% at a quarter; bge-small keeps 94% and 81%; gte-modernbert cut to 384 dimensions (0.726) still beats Qwen3-Embedding at 1,024 (0.700). In bits: int8 (1 byte per number) is free (Qwen3 at 1,024: 0.996 of the exact top 10); binary codes of all 1,024 dimensions keep 0.674 of the exact top 10, and with the top 100 rescored in float32 keep all of the quality (0.700). Re-normalise after cutting. Hosted models expose the same idea as a parameter: OpenAI's text-embedding-3 models take a dimensions argument (1,536 by default for -small, 3,072 for -large), and OpenAI states that "a text-embedding-3-large embedding can be shortened to a size of 256 while still outperforming an unshortened text-embedding-ada-002 embedding with a size of 1536" (OpenAI embeddings guide) published, vendor. Index-side compression (product quantisation, RaBitQ) is on Vector indexes from the inside; indexing a Matryoshka prefix in pgvector on Search and vector databases.
The old page's figure "up to 14x smaller embeddings at the same ImageNet accuracy" is the MRL paper's ImageNet-1K classification result; it says nothing about retrieval on your corpus.
SciFact test, exact search; y is the share of each model's own full nDCG@10. Precision applies to Qwen3-Embedding (the parent's runs quantised only it); bge-small and gte-modernbert are float32 truncations. int8: per-dimension ranges calibrated on the corpus, float query against decoded codes; binary: one sign bit per number, Hamming order; rescoring: the top 100 by the compressed score rescored with full float32 vectors. Data: the parent's src/vec/out/mrl_quant.json (2026-10-14). measured here (parent page)
Every model reads at most a fixed number of tokens and silently drops the rest: all-MiniLM-L6 256 by default, bge-small and e5-small-v2 512 (the e5 card: "Long texts will be truncated to at most 512 tokens"), gte-modernbert 8,192 (run here at 1,024), Qwen3-Embedding 32K (run here at 1,024). The vector of a truncated text is still a vector.
52.8% of evidence sentences end after BERT token 256, and for 38.7% of (claim, abstract) pairs even the first evidence sentence does, so all-MiniLM-L6 at its default never reads the sentence that makes the abstract relevant; it still retrieves many of them from the topic words in the title and opening. At 512 tokens, 12.1% of evidence sentences are cut. Re-embedding SciFact at four limits, bge-small scores 0.680 at 128 tokens and 0.713 at 512; on NFCorpus the limit barely matters past 128.
What the cut costs, measured by re-embedding each corpus at four limits with the stored queries measured here:
| model, set | 64 tokens | 128 | 256 | 512 |
|---|---|---|---|---|
| bge-small, scifact | 0.590 | 0.680 | 0.701 | 0.713 |
| bge-small, nfcorpus | 0.320 | 0.330 | 0.343 | 0.343 |
| minilm-l6, scifact | 0.572 | 0.624 | 0.645 | 0.654 |
| minilm-l6, nfcorpus | 0.317 | 0.315 | 0.316 | 0.310 |
On SciFact the curve climbs to 512 for both models: bge-small gains 3.2 points from 128 to 512, and MiniLM-L6, whose default is 256, scores 0.654 at 512 against 0.645 at 256 (its card: "The sequence length was limited to 128 tokens" in training, and input "longer than 256 word pieces is truncated" by default; it still uses text beyond both). On NFCorpus the limit barely matters past 128 (MiniLM is even slightly lower at 512): likely because the opening of these documents already carries their topic. Measure on your own documents before raising or lowering a limit.
In chunked pipelines the same problem is measured by The retrieval pipeline on QASPER papers: LangChain's default 4,000-character chunks are 782 BERT tokens at the median, so all-MiniLM-L6 reads 33.3% of their tokens and bge-small 65.1%; even 256-Qwen3-token chunks exceed MiniLM's 256 BERT tokens 16.9% of the time measured here (sibling page). Size chunks in the embedding model's tokens. Long-context embedders (gte-modernbert, Qwen3-Embedding, modernbert-embed at 8K to 32K) can embed a whole paper, but one vector for 8,000 tokens averages many topics; the usual design still chunks, and late chunking (embed the long text once, pool per chunk) is measured on the pipeline page.
The running example has three labelled sets in different domains: SciFact (scientific claims against abstracts), NFCorpus (consumer health questions against medical documents, many relevant documents per query) and the multi-hop set (200 HotpotQA questions against Wikipedia paragraphs).
gte-modernbert leads SciFact by a clear margin (paired difference against bge-small +0.054, interval +0.029 to +0.081); on NFCorpus it is exactly tied with bge-small (+0.000, interval -0.016 to +0.017) and both trail Qwen3-Embedding; on the multi-hop set bge-small and gte lead and Qwen3 is third, although Qwen3-Embedding declares HotpotQA among its training data. The 22 M MiniLM is last or close to last everywhere: the one stable conclusion. Fine-tuning moves a model towards its training domain; section 5's NFCorpus panel shows it did not hurt the other set here.
On the 809 train claims, bge-small and gte-modernbert are tied (bge ahead by 0.004, interval -0.011 to +0.020); on the 300 test claims gte is ahead by 0.054. Neither model declares SciFact training data in MTEB's metadata. The test set (the original release's dev claims) scores much higher on claims with annotated evidence (gte 0.895) than the train set does (0.739), so the two splits are not samples of one population, and a model chosen on one did not carry to the other. Choose on labelled queries that look like your production traffic, and keep a separate set to confirm. measured here
Multilingual retrieval is not measured here: both BEIR sets are English and two of the models (bge-small-en, MiniLM) are English-only. A multilingual model maps a query in one language near a passage in another, but quality per language follows its training data, so check on your own languages. Two open examples published, vendor: Qwen3-Embedding ("Supported Languages: 100+ Languages", its card; it also advises writing the instructions in English) and BGE-M3 ("more than 100 working languages", inputs "up to 8,192 tokens", and dense, sparse and multi-vector retrieval from one model; Chen et al. 2024, arXiv 2402.03216). For a multilingual shortlist, MMTEB extends MTEB to "over 500 quality-controlled evaluation tasks across 250+ languages" (arXiv 2502.13595).
MTEB scores a model on many tasks with one fixed protocol and ranks models by the mean. The current English benchmark, MTEB(eng, v2) (introduced with MMTEB, Enevoldsen et al. 2025, arXiv 2502.13595), has 41 tasks: 10 retrieval, 9 semantic similarity (STS), 8 classification, 8 clustering, 3 pair classification, 2 reranking, 1 summarization. SciFact and NFCorpus are not among its 10 retrieval tasks, so they are a fair test of transfer.
Why rank does not transfer, in order of size here: the task mix (the mean blends classification, clustering and similarity with retrieval: a model can climb on 31 non-retrieval tasks); your domain (the retrieval tasks are arguments, questions, fact-checking, finance, COVID literature; your corpus is none of them); contamination (13 of these 149 models declare SciFact training data and 14 NFCorpus, while 28 declare nothing at all, so their zero-shot status is unknown); noise (a few hundred queries per task; section 11); and setup (a model run without its query instruction or at a shorter maximum length scores below its leaderboard number; sections 6 and 8). The leaderboard is a shortlist generator: read the retrieval tasks nearest your domain, not the mean.
scripts/e_mteb.py, repository commit 34a44096, 2026-10-14) published (results repository), analysis measured here.Retrieval and reranking: nDCG@10 or MAP; classification: accuracy of a logistic regression on the vectors; clustering: V-measure; semantic similarity: Spearman correlation of cosines with human scores; pair classification: average precision. MTEB(eng, v2)'s description in mteb 2.24.13: "prioritizing tasks not commonly used for fine-tuning to give a more realistic estimate of generalization performance". The parent's Tool map tab has the leaderboard view, version caveats and the zero-shot table.
Pick the labelled set that looks most like your queries, then your limits. "Against the best" is the paired difference to the best system on the same queries; if its interval covers zero, the model is tied and cost decides. Costs are this machine's (Apple M1 Pro, MPS, batch 1 for queries): the ratios transfer, the milliseconds do not. measured here
ColBERT (late interaction, about 45 KB per abstract) and BM25 are listed for reference; their storage is not one vector per document. Query cost: single-query encode p50 on MPS for the four models (setup records); 62 ms for ColBERT is the setup's exhaustive MaxSim over all 5,183 abstracts per query; 0.25 ms for BM25 is the root's latency run.
How many labelled queries? Subsampling the test sets (2,000 random subsets per size, scripts/e_choose.py) measured here:
On SciFact, where the best model leads by 0.054, 100 queries pick the same winner 99.95% of the time and 50 queries 96%. On NFCorpus, whose top two are 0.020 apart, 100 queries agree only 90%. Per-model 95% intervals are about ±0.05 wide at 300 SciFact claims, but the paired half-width is far tighter and shrinks like 1/√n, about 0.044 at 100 SciFact queries. The order of all four models is much less stable than the winner: 50% at 200 NFCorpus queries.
| model | params | dims | pooling | query prompt | max tokens | Matryoshka | licence | MTEB(eng, v2) rank by mean | rank on SciFact | SciFact nDCG@10 here |
|---|---|---|---|---|---|---|---|---|---|---|
| all-MiniLM-L6-v2 | 22 M | 384 | mean | none | 256 | no | Apache 2.0 | 98 | 93 | 0.645 |
| bge-small-en-v1.5 | 33 M | 384 | CLS | query prefix | 512 | no | MIT | 47 | 60 | 0.713 |
| gte-modernbert-base | 149 M | 768 | CLS | none | 8,192 (run at 1,024) | not stated | Apache 2.0 | not in results | not in results | 0.767 |
| Qwen3-Embedding-0.6B | 0.6 B | 1024 | last token | task instruction | 32K (run at 1,024) | yes, 32 to 1,024 | Apache 2.0 | 13 | 73 | 0.700 |
Parameters, dims, pooling, prompt and licence from the parent's model records (2026-10-14); ranks from the MTEB results repository at commit 34a44096 (2026-10-14) among the 149 models with full results (gte-modernbert has none there); SciFact nDCG@10 measured here. Matryoshka: Qwen3-Embedding's card; bge-small and MiniLM were not trained for it.
The current hosted and open models (OpenAI text-embedding-3, Gemini embedding, Voyage 4, Cohere embed v5, Jina v5, Qwen3-Embedding, bge, gte, e5, MiniLM), with status, licences and context lengths as read in October 2026, are on the parent's Tool map tab. When images, audio or video must share the index with text, EmbeddingGemma 2 (Google, 6 October 2026, Apache 2.0) is a small open candidate: 740M parameters, of which a text-only deployment loads 270M; text, code, images, audio and video in one 768-dimensional space, trained to truncate to 512, 256 or 128 dimensions; 8K-token context; Google reports MTEB Code rising from 68.76 for EmbeddingGemma 1 to 78.68 published (Google). vLLM 0.32.0 and SGLang 0.5.22 serve it.
When. After the protocol above says the best off-the-shelf model is not good enough, and when you have a domain the general models have not seen (internal jargon, product codes, queries that are error messages), at least a few thousand (query, positive) pairs or a way to make them (a language model writing questions for your passages is the common route; Qwen3-Embedding's report describes synthetic pairs at scale), and a labelled evaluation set never used for training.
How, with sentence-transformers 6.1.0 (the tools this page's run mirrors): mine_hard_negatives(..., relative_margin=0.05) for positive-aware mining; MultipleNegativesRankingLoss, or CachedMultipleNegativesRankingLoss for large batches on a small GPU; GISTEmbedLoss, which uses a second "guide" model to mask in-batch negatives the guide scores above the positive; MatryoshkaLoss around any of them if you will truncate; a no-duplicates batch sampler; evaluation on held-out queries every epoch; three seeds.
The costs people forget. A new model means re-embedding the whole corpus (bge-small: 36 s for SciFact here; Qwen3-Embedding-0.6B: 816 s), and vectors from the old and new model cannot share an index: a running system needs a second index and a switch-over (RAG in production measures what mixing them does: nDCG@10 0.379 at 50% re-embedded against 0.713 clean). Check the other domains for forgetting (section 5's NFCorpus panel).
These runs are recorded in the root page's src/vec (the same vectors this page uses).
The overview. Its shared runs (src/vec) behind section 7's truncation and quantisation data; its Tool map tab: hosted and open models, MTEB versions and the zero-shot table. 19 min
What happens after the vectors exist: flat, IVF, PQ, HNSW, DiskANN, filtered search; the index material of the old "Embeddings and vector search" page lives there now. 34 min
Cross-encoders and ColBERT; its tiny cross-encoder fine-tune is this page's counterpart. 34 min
Chunk sizes in tokens, hybrid fusion, query rewriting, late chunking. 47 min
Embedding page images (ColPali) against parsing them to text. 28 min
Model upgrades with dual indexes, mixed-model indexes measured, cost per query. 37 min
When an agent searches several times instead of trusting one embedding. 35 min
Questions one vector cannot answer. 40 min
Contrastive losses in general: InfoNCE as an N-way classification, its gradient and temperature on 48 real sentence pairs, SimCLR, CLIP. 31 min
Cross-entropy and mutual information: why InfoNCE lower-bounds mutual information and wants many negatives. 38 min
The encoder recipe bge-small, MiniLM and e5 descend from, and where [CLS] comes from. 23 min
CLIP and SigLIP as encoders: the same contrastive idea on images and text, temperature and batch size at scale.
The same in-batch contrastive loss on image-text pairs, with a learned temperature. 27 min
Why the same text is a different number of tokens to each model. 46 min
Dot products, norms, projections. 45 min
The database-engine view: pgvector operators and distance functions. 33 min
Golden sets and retrieval metrics beyond nDCG. 27 min
nDCG, recall and bootstrap intervals defined. 27 min
Reimers and Gurevych 2019: siamese BERT with pooling, the start of sentence-transformers. 30 min
van den Oord et al. 2018: the loss and its mutual-information reading. 40 min
Karpukhin et al. 2020: in-batch negatives plus one BM25 hard negative. 40 min
Wang et al. 2022: weakly supervised contrastive pre-training, query and passage prefixes. 40 min
The BGE recipe: batches up to 19,200, then mined hard negatives. 40 min
A decoder turned embedder: synthetic pairs, the +0.1 false-negative mask, model merging. 45 min
Positive-aware hard-negative mining (TopK-PercPos 95%). 35 min
Gao et al. 2021: large contrastive batches at small memory. 25 min
Nested embeddings you can truncate. 35 min
The benchmark paper behind MTEB(eng, v2). 45 min
Which loss for which data, including GISTEmbed and the cached losses. 20 min
Use it to shortlist; read the retrieval tasks nearest your domain. 10 min